- My items table: code int -- can take one of 100 values property varchar(250) -- can take one of 5000 values param01 char(10) -- can take one of 10 values param02 char(10) -- can take one of 10 values ... [ 20 similar columns } ... parama20 char(10) -- can take one of 10 values
Instead of 20 columns, you could instead use a "param" field containing an array of 20 TEXT fields. Then create a simple index on (code, param) and SELECT WHERE code BETWEEN ... AND param = '{P,G,....,C}'
If you don't want to modify your structure, you can create a functional index on an array {param1...param20}, but your queries will be a bit uglier.