mongodb - Should I make a compound index for this query? -


say have collection 1 million documents ones below:

{    email: "test@test.com",    survey: objectid('whatever'),    taken: date(1/1/2015) }, {    email: "blah@blah.com",    survey: objectid('whatever'),    taken: date(6/1/2015) } 

if going going execute query 1 below often:

db.participants.find({survey: objectid('whatever')}).sort({taken: 1}) 

how important me include taken in index? typically record set go down 1 million 30 based on survey query , 30 records sorted.

does still make sense index column though filtered set sorted smaller?


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -