Page 1 of 1

Compound index vs. multiple single indexes

Posted: Mon Feb 18, 2013 8:52 pm
by barry.marcus
We have a table from which data is retrieved in only one place in our application. That query is as follows:

select document_hit
from validation_result
where patent_wku=$thisDocument
and project_id=$project
and search_field=$saveField
and filter_id=$filterId

This is a new table and does not yet have much data in it. But I expect to grow to be very large. My question is does it make more sense in the long run to have a single, compound index on (patent_wku, project_id, search_field, filter_id) or four indexes, one for each column. Or perhaps it doesn't make any difference. BTW, this are obviously standard (i.e., non-metamorph) indexes I'm talking about.

Thanks.

Compound index vs. multiple single indexes

Posted: Mon Feb 18, 2013 10:28 pm
by barry.marcus
In the case of this particular table, this will always be the query. Moreover, it makes no sense for any of the fields to ever be null.

So, thanks... a single compound index it is!