Int(11) is 4 bytes, correct?
Decimal(5,0) – 5 before decimal and 0 after decimal… I’m not sure about the number of bytes it takes… (0..99999… 65536 will take two bytes)… So does Decimal(5,0) take 3 bytes then?
What’s better to use if we are talking about performance?
The table is changed manually (once in a while), so there are only SELECTs FROM that table.
From some preliminary testing, it seems like the storage requirements are actually the same whether you use INT(11) or DECIMAL(5,0). I created 2 tables with the following queries.
After inserting a single value into each table, and running the following for both tables, I saw that the DATA_LENGTH for each row was 7. Inserting additional rows increased the size of either table by 7 bytes.
As with all stuff like this, the easiest way to figure it out is to create some tables and verify it. In this case I would just go with INT(11) since it doesn’t seem to require any extra space, and probably requires less processing since Integers are a more primitive data type that the processor can deal with directly. When using DECIMAL, MySQL has to convert the numbers to format that the processor can actually use, probably integer anyway in this case, and there is probably some kind of overhead associated with going back and forth between formats.