DNB5brims DNB5brims - 6 months ago 46
MySQL Question

What is the MAX number if I store int(255) in MySQL?

I use int(255) in mysql as my id. Is this long enough? If I got about 1,000,000 records....Thank you.

Answer

Something is probably just converting that to int(11) for you, since you can't have 255 visible digits in an int. The maximum value will be 2147483647. If you need more than that you can set it to be unsigned, since I'm assuming you have no negative ids and then you can have up to 4294967295. If you are ever going to have more than 4 billion records (very unlikely if you're at 1 million right now), then you could use a bigint instead which allows you to store numbers up to 18446744073709551615 at a cost of more storage space of course.

Comments