MySQL ID -- what happens when you run out of range?

MySQL ID -- what happens when you run out of range?

am 25.01.2010 21:15:07 von Parham Doustdar

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!



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: MySQL ID -- what happens when you run out of range?

am 25.01.2010 21:19:14 von Nathan Rixham

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?

you change it to bigint before that happens :)

for a more accurate answer ask on the mysql forum?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: MySQL ID -- what happens when you run out of range?

am 25.01.2010 21:22:45 von Joseph Thayne

It will continue to use the max number which of course will cause an error.

Joseph

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!
>
>
>
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Re: MySQL ID -- what happens when you run out of range?

am 25.01.2010 21:38:37 von John Meyer

On 1/25/2010 1:19 PM, Nathan Rixham 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?
>
> you change it to bigint before that happens :)
>
> for a more accurate answer ask on the mysql forum?
>

Or the e-mail list: mysql@lists.mysql.com (though I understand the
cross-pollination)


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: MySQL ID -- what happens when you run out of range?

am 25.01.2010 21:39:08 von Robert Cummings

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

Re: MySQL ID -- what happens when you run out of range?

am 25.01.2010 22:31:46 von Camilo Sperberg

--0015173fe6507bea52047e03e5af
Content-Type: text/plain; charset=ISO-8859-1

On Mon, Jan 25, 2010 at 17:15, 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!
>
>
>
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/

--0015173fe6507bea52047e03e5af--

Re: MySQL ID -- what happens when you run out of range?

am 25.01.2010 22:49:47 von Ryan Sun

--0016e6477a62e77979047e042576
Content-Type: text/plain; charset=ISO-8859-1

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 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
>
>

--0016e6477a62e77979047e042576--

Re: MySQL ID -- what happens when you run out of range?

am 25.01.2010 22:51:54 von Joseph Thayne

--------------070603040505040900040407
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

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 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 :)
>
>

--------------070603040505040900040407--

Re: MySQL ID -- what happens when you run out of range?

am 25.01.2010 23:11:20 von Camilo Sperberg

--00151747952cfd2bcc047e0472ab
Content-Type: text/plain; charset=ISO-8859-1

On Mon, Jan 25, 2010 at 18:51, 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.
>
> 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 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/

--00151747952cfd2bcc047e0472ab--

Re: MySQL ID -- what happens when you run out of range?

am 26.01.2010 03:21:47 von Shawn McKenzie

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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: MySQL ID -- what happens when you run out of range?

am 26.01.2010 04:00:38 von Michael Peters

Shawn McKenzie wrote:
> 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!
>

6. An alternate version of Dr. Rodney McKay from an alternate universe
appears, and goes by "Rod".

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: MySQL ID -- what happens when you run out of range?

am 26.01.2010 04:18:48 von APseudoUtopia

On Mon, Jan 25, 2010 at 10:00 PM, Michael A. Peters wrote=
:
> Shawn McKenzie wrote:
>>
>> 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 gre=
ater
>>> than the maximum integer allowed.
>>> 2.  MySQL will see this as a problem and "truncate" it to the clos=
est
>>> 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!
>>
>
> 6. An alternate version of Dr. Rodney McKay from an alternate universe
> appears, and goes by "Rod".
>

7. Then you realize that MySQL handles certain things, such as the
aforementioned problem, very badly and does not comply to standards
and isn't even ACID compliant, so you then switch to PostgreSQL
instead.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php