MySQL primary/foreign key size? -


I think many people arbitrarily override primary / foreign key areas in their MySQL schema, such as INT (11) And even uses WordPress as the Biggunt (20).

Correct me now if I am wrong, but an int (4) will support (4) more than 4 billion (unsigned) values. Convert it to INT (5) and you increase the values ​​to quadrillion, which you ever need more, unless you're storing Geodata in NASA / Google, I'm sure that among us Most are not.

Is there any reason why people use such a large size for their primary key? I feel like useless ...

The size is neither bits nor bytes. This is only the display width, the area used The ZEROFILL is used when specifying.

INT [(M)] [UNSIGNED] is a normal size integer signed border - 2147483647 with 2147483648. The unsigned range is 0 to 42 9, 4967295.


Comments