I have a user table structured like this:
- id MEDIUMINT(7),
- username VARCHAR(15)
Would it technically be faster if I changed it to this instead:
- id MEDIUMINT(5),
- username VARCHAR(15)
I’m confused because even though the total row length in terms of characters and digits would be shorter, I assume the number of bytes used would be the same.
You’re correct – the number of digits specified does not change the number of bytes that a MEDIUMINT column will use to hold the value. Effectively, there’s no speed performance.
Reference: