From: Camilo Sperberg on 25 Jan 2010 16:31 On Mon, Jan 25, 2010 at 17:15, Parham Doustdar <parham90(a)gmail.com> wrote: > Hello there, > A friend called me today and was wondering what happens if the ID colomn of > an MYSQL database, set to autoinc reaches the int limit. Will it return and > begin choosing the ID's that have been deleted, or... what? > Thanks! > > > from what I know, MySQL will convert that number into a negative number, which would be invalid for an auto-increment field (auto-increment == unsigned). That would raise an error ;) Greetings :) -- Mailed by: UnReAl4U - unreal4u ICQ #: 54472056 www1: http://www.chw.net/ www2: http://unreal4u.com/
From: Ryan Sun on 25 Jan 2010 16:49 For such a large data set, they would split into several sub tables, otherwise the performance will be horrible On Mon, Jan 25, 2010 at 3:39 PM, Robert Cummings <robert(a)interjinn.com>wrote: > Parham Doustdar wrote: > >> Hello there, >> A friend called me today and was wondering what happens if the ID colomn >> of an MYSQL database, set to autoinc reaches the int limit. Will it return >> and begin choosing the ID's that have been deleted, or... what? >> Thanks! >> > > Ask Slashdot... I believe they hit the limit one day (several actually) for > comments :) > > Cheers, > Rob. > -- > http://www.interjinn.com > Application and Templating Framework for PHP > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
From: Joseph Thayne on 25 Jan 2010 16:51 That is incorrect. What will happen is as follows: 1. The value will be incremented by 1 causing the value to be greater than the maximum integer allowed. 2. MySQL will see this as a problem and "truncate" it to the closest value. 3. MySQL will then try and insert the new row with the updated id. 4. MySQL will find that the id already exists, and will return a duplicate ID error. If you want to verify what occurs, create a table with a tinyint value for the id and autoincrement it. It is correct also, that you cannot use negative numbers for the autoincrement field. Camilo Sperberg wrote: > On Mon, Jan 25, 2010 at 17:15, Parham Doustdar <parham90(a)gmail.com> wrote: > > >> Hello there, >> A friend called me today and was wondering what happens if the ID colomn of >> an MYSQL database, set to autoinc reaches the int limit. Will it return and >> begin choosing the ID's that have been deleted, or... what? >> Thanks! >> >> >> >> > from what I know, MySQL will convert that number into a negative number, > which would be invalid for an auto-increment field (auto-increment == > unsigned). That would raise an error ;) > > Greetings :) > >
From: Camilo Sperberg on 25 Jan 2010 17:11 On Mon, Jan 25, 2010 at 18:51, Joseph Thayne <webadmin(a)thaynefam.org> wrote: > That is incorrect. What will happen is as follows: > > 1. The value will be incremented by 1 causing the value to be greater than > the maximum integer allowed. > 2. MySQL will see this as a problem and "truncate" it to the closest > value. > 3. MySQL will then try and insert the new row with the updated id. > 4. MySQL will find that the id already exists, and will return a duplicate > ID error. > > If you want to verify what occurs, create a table with a tinyint value for > the id and autoincrement it. > > you're absolutely right ! sorry, my bad xD MySQL does indeed truncate the value to the closest one... I had that problem once xD (field was tinyint, but signed, which means max value for that row was 127 instead of 255 which was what I needed, when I tried to insert any value above 127 it was automaticly truncated to 127). > It is correct also, that you cannot use negative numbers for the > autoincrement field. > > > Camilo Sperberg wrote: > > On Mon, Jan 25, 2010 at 17:15, Parham Doustdar <parham90(a)gmail.com> <parham90(a)gmail.com> wrote: > > > > Hello there, > A friend called me today and was wondering what happens if the ID colomn of > an MYSQL database, set to autoinc reaches the int limit. Will it return and > begin choosing the ID's that have been deleted, or... what? > Thanks! > > > > > > from what I know, MySQL will convert that number into a negative number, > which would be invalid for an auto-increment field (auto-increment == > unsigned). That would raise an error ;) > > Greetings :) > > > > -- Mailed by: UnReAl4U - unreal4u ICQ #: 54472056 www1: http://www.chw.net/ www2: http://unreal4u.com/
From: Shawn McKenzie on 25 Jan 2010 21:21 Joseph Thayne wrote: > That is incorrect. What will happen is as follows: > > 1. The value will be incremented by 1 causing the value to be greater > than the maximum integer allowed. > 2. MySQL will see this as a problem and "truncate" it to the closest > value. > 3. MySQL will then try and insert the new row with the updated id. > 4. MySQL will find that the id already exists, and will return a > duplicate ID error. 5. A tear is rendered in the space time continuum! -- Thanks! -Shawn http://www.spidean.com
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: How to change a filename for download (e.g. jpeg, pdfetc.) Next: XAMPP PHP 4/5 |