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:
- If using INT(21) when I am sure we’ll never need it is a waste of space
- If it is a waste, what the recommended size for an autoincrement id column is
*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.
Conclusion
INT(10)orINT(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.