[thelist] auto-increment with mysql

Paul Cowan evolt at funkwit.com
Fri Jul 18 00:36:56 CDT 2003


Frank wrote:
> Why an unsigned int, instead of simply int?

One virtually never has negative values in an identity column. By using
an unsigned int instead of an int, you're effectively doubling the
number of values a column can have.

I have no idea what size data types MySQL uses, but if it's (say) 16-bit,
an unsigned int can hold 0-65535; a signed int, -32,768-32,767. Why
restrict your upper value to 32,000-odd if you're not going to use any
negative numbers, and you can have up to 65,000 without using any further
storage?

Paul.


More information about the thelist mailing list