I'm going to use a very large MySQL database which I have to optimize as good as possible. I read that using fixed width's of the columns is a good way to optimize the MySQL performance, logically. For instance, a CHAR is better than a VARCHAR or BLOB. However, does MySQL perform better when the values within these static width columns are all the same width, e.g. filling the whole column width?
For example, let's say I have a table structure like
|ID(BIGINT) |Integer (CHAR[5])|Integer2(CHAR[5])|etc...
|1 |45896 |47736 |etc...
|2 |577 |77 |etc... <-- is such a row bad practice looking at performance?
|3 |47732 |85773 |etc...
E.g. woud it be better to pad the short values like shown below? (I have indexes on my tables to optimize. I am looking for further optimization, since it am getting in the segment of large MySQL tables?)
|ID(BIGINT) |Integer (CHAR[5])|Integer2(CHAR[5])|etc...
|1 |45896 |47736 |etc...
|2 |00577 |00077 |etc...
|3 |47732 |85773 |etc...
The tables I'm going to use will consist of 250+ million
rows with multiple Integer columns
like shown above. I defined the field as a CHAR, since I will store the integers in bytes myself. I will save you the reason for this, but this approach is needed for my application to work properly. So, is it good, looking at MySQL performance, to pad a value which doesn't match the column width, so all the values within a fixed width column have the same width?
Width can also be read as length?
I hope my question is clear. When it isn't, please let me know and I will try to explain my question further.
Summary: How do the value width's within the fixed column width's affect MySQL performance looking at tables with over 250 million rows? E.g. is it smart to pad smaller integers to the column width to optimize the performance?