I\'m currently having a discussion in my class about the datatypes char
and int
in MySQL.
We have a phone number of 8 individual numbers. However, we c
If you have a fixed size then you can use char(8)
-> 8B , mysql works much faster with fixed size fields, but if you chose int
-> 4B you will save space and also if you will have a index on that field it will work faster then the char.
You can do a simple benchmark to test the speed of writes and reads using char(8) and int
There is no point in using variable length type like varchar or varbinary if you have a fixed size because performance will decrease