Currently we're using INT(21)* for all autoincrement id columns in out 30+ table database.
We are a blogging site, and have tables storing members, comments, blog posts and the like.
I'm quite sure we will never reach the limit of our INT(21) id columns, and would like to know:
*Not my design. I'm asking this because I'm considering reducing this to say, INT(10).
The value within the brackets is the display width.
[It] may be used by applications to display integer values having a width less than the width specified for the column by left-padding them with spaces. (That is, this width is present in the metadata returned with result sets. Whether it is used or not is up to the application.)
The display width does not constrain the range of values that can be stored in the column, nor the number of digits that are displayed for values having a width exceeding that specified for the column. For example, a column specified as
INT(3)
has the usualINT
range of -2147483648 to 2147483647, and values outside the range permitted by three characters are displayed using more than three characters.
INT(10)
or INT(21)
, doesn't impact the values that can be stored. If you really have a concern, the data type can easily be changed to be BIGINT with no repercussions that I'm aware of. I'd look at how many new records are being created in a given period (IE a month) & see how long it'll take to max out the INT value based on that history.