I have 3 different fields a
, b
, c
in my collection X
, where:
a
-> short string/keyword, b
-> url, c
-> date
I have 2 queries which need a, b
and a, c
respectively.
My question is,
How to index properly to optimize both queries.
I have considered:
1) Two compound index of a+b
and a+c
2) create 3 single key indexes for a
, b
, c
and rely on index intersection.
3) create a compound index for a+b
and a single index for c
, and hope that c
and prefix a
will optimize the second query.
4) create a compound index for a+b+c
(not sure about this)
What is the best solution and why?