Indexing a SQL table for efficient queries
October 15, 2008 9:31 PM
Subscribe
I have a MySQL table with about 100,000 items in it. Question about setting up indexes for efficient querying.
I already have an index set up like this (to choose some random names):
Index type: INDEX
-> field_12
-> field_7
-> field_9
And it works well. However there is now a wrinkle...Field_20 has been added, and it is paired with field_12 in an "or" statement in all queries now. Before the query was:
IF field_12='foo' AND field_7='bar' AND ...
Now it is:
IF (field_12='foo' OR field_20='meh') AND field_7='bar' AND ...
Do I need to re-index the table to reflect that, and if so, how?
posted by maxwelton to computers & internet (8 comments total)
3 users marked this as a favorite
posted by maxwelton at 9:35 PM on October 15, 2008