I have a table with 10 columns that should be searchable (the table itself contains about 20 columns). Thus, the user will enter query criteria for at least one of the columns, but possibly all ten. All non-empty criteria are then placed in the AND condition.
Suppose the user is provided with non-empty criteria for columns1 and column4 and column8, the query will look like this:
select * from the_table where column1 like '%column1_query%' and column4 like '%column4_query%' and column8 like '%column8_query%'
So my question is: should I create 1 index with 10 columns? 10 indexes with 1 column each? Or I need to find out which groups of columns are often set together and create indexes for them (index in columns 1,4 and 8 in the above case).
If my understanding is correct, one index of 10 columns will work only if all 10 columns are in state.
Open all the sentences here, in addition, the number of rows in the table should be about 20-30K rows, but I want all and all queries in the table to be fast.
Thanks!
Corey source share