I think you have no need to worry overflow if you use int type. You may have 
added assurance if you also define it as unsigned. I just listed the max. of 
different unsigned integer type for your reference 

tinyint 255
smallint 65535
mediumint 16777215
int 4294967295
bigint 18446744073709551615

Clearly int type will be sufficient for most practical use.

Regards,

> Hello.
>   
>   I'm very new to MySQL (and SQL databases at large), so please 
> apologize if I'm just missing an obvious point, or if it has already 
> been discussed before.
> 
>   As I understand, auto-incremental columns (quite useful for primary
> indexes) are always incremented. Even if rows are deleted, those counters
> always keep growing.
> 
>   But a frightening thing is this snippet of the documentation :
>   
> "The behavior of the auto-increment mechanism is not defined if a 
> user gives a negative value to the column or if the value becomes 
> bigger than the maximum integer that can be stored in the specified 
> integer type." 
>  
>   The former part is obvious, but the later is not.
>   
>   Does it mean that MySQL databases will definitely stop working at 
> a random date (when an auto-incremental column will overflow) ?
> 
>   How to cope with this ? Or to detect when an overflow will occur 
> (do we need to always "BEGIN; SELECT MAX(id) ... ;" then only INSERT 
> and COMMIT if the result is lower than the max value the type can 
> handle) ?
> 
>   Or is there a way to recompute all primary keys (and sync foreign 
> keys) by filling unused gaps ?
> 
>   Best regards,
>   
>         -Frank.
>       
> -- 
>  __  /*-      Frank DENIS (Jedi/Sector One) <[EMAIL PROTECTED]>     -
> *\  __ \ '/    <a href="http://www.PureFTPd.Org/";> Secure FTP Server 
> </a>    \' /  \/  <a href="http://www.Jedi.Claranet.Fr/";> Misc. free 
> software </a>  \/
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <mysql-unsubscribe-
[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


--
Yours,
KH Chiu
C&A Computer Consultants Ltd.
Tel: 3104 2070 Fax: 3010 0896
Email: [EMAIL PROTECTED]
Website: www.caconsultant.com


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to