I have a simple users table, I guess the maximum users I am going to have is 300,000.
Currently I am using:
CREATE TABLE users
(
id INT UNSIGNED AUTOINCREMENT PRIMARY KEY,
....
Of course I have many other tables for which users(id) is a FOREIGN KEY.
I read that since the id is not going to use the full maximum of INT it is better to use:
MEDIUMINT and it will give better performance.
Is it true?
(I am using mysql on Windows Server 2008)
I would consider using MEDIUMINT sometimes.. on 300K rows.. MEDIUMINT gives u enough room up to 16M rows (unsigned).
It is not only about “smaller table size” when u use indexes.. the difference can be huge
on a 27M rows tables.. changing 2 columns from INT to MEDIUMINT saved me 1GB (indexes + table data) so it went from 2.5GB to 1.5 GB.