In the software I'm writing one has the ability to search a given table for information. The search form has 5 fields, all which of course correspond to different columns in a table, but all of the fields are optional.
My question is in regard to whether or not multi-column indexing will work and the proper way to build a query for it.
If I have a single index across 5 columns, and I build a query to search them, when it comes to fields in this index I'm not searching, do I do something like:
field1 = 10 AND field2 > 0 AND ...
Or should I not include the unused columns at all?
I've searched around for information about multiple column indices, but I can't seem to find what to do when you need to skip one of the columns in a given index or if you simply don't care about that one in that specific instance.