I have a query that's something like the following
find( { a : { $gt: 3 } } ).sort( { b : -1 } )
Is it advised to create an index for field a and b separately?
I have a query that's something like the following
find( { a : { $gt: 3 } } ).sort( { b : -1 } )
Is it advised to create an index for field a and b separately?
No, with compound index query will work faster:
Also you can make sure that your query use index with explain command.