I have to store in MySQL some kind of data catalog with mixed arrays, e.g.
ITEM_TYPE1 | A | 7 | long_text | 1000-80 | N | 0 |
ITEM_TYPE1 | X | 8 | long_text | 9999-80 | B | 1 |
ITEM_TYPE2 | 7.50 | X1 | 1 | long_text | 8 | |
ITEM_TYPE2 | 1000.85 | 4F | 8 | long_text | 0 | |
ITEM_TYPE3 | long_text | 9 | 9 | | | |
ITEM_TYPE3 | long_text | 1 | 1 | | | |
As you can see, all ITEM_TYPEs have different number of array values with different type (char, int, bool, text, decimal), so I can't predefine right column types in a single table. Besides, I can't use serialize or json functions, as all data must be sorted and in future selected by filters using MySQL engine.
What is the best (best - I mean less data size on HDD and more productive with SELECT queries) way to store such data arrays? I see two options:
Create predefined columns for data, such as
int1, int2, int3, int4, int5, chr5_1, chr5_2, chr5_3, text1, text2, text3 <...>
but it is less size-effective ...
or create separate tables for each ITEM_TYPE with predefined columns, according to ITEM_TYPE values?