I have a table of 10M rows productwith fields like color (int), price (float), weight (float), unitprice (int),etc. Now users from the Web dynamically generate search data requests from this table with random conditions (the color should be here), for example,
select * from product where color=1 and price >5 and price <220 and .... order by unitprice limit 75, 25;
select count(*) from product where color=3 and weight <500 and price <30 ... ;
How to index a table (InnoDB or NDB) with about 10 filter fields (with range, sort ...) like this in MySQL?
EDIT: In my opinion, MySQL will most likely select only one index for the query, and only the left side of the composite index will work. Obviously, indexing all possible combinations is not a possible option, for example (color, price, weight, create_date, unitprice, ....), ( color, weight, price, create_date, unitprice, ....), (color, unitprice, weight, ....).... Not all conditions are necessarily present in all queries.
What would you do to index this table?