[SERVER-1576] $or does not use indexes when combined with sort() Created: 05/Aug/10 Updated: 07/Mar/14 Resolved: 06/Aug/10 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Index Maintenance, Performance, Querying |
| Affects Version/s: | 1.6.0 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Niall O'Higgins | Assignee: | Aaron Staple |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Debian Lenny 4.0, amd64 |
||
| Operating System: | Linux |
| Participants: |
| Description |
|
// First of all, my indexes: db.notes.getIndexes() [ { }, }, }, }, } // No sorting - $or is fast > db.notes.find({$or : [ {owner_account_id : ObjectId("0000000000000000000c7e98")}, {shared_to : ObjectId("0000000000000000000c7e98")}] }).explain() , } , } // Sort + limit, $or is slow: > db.notes.find({$or : [ {owner_account_id : ObjectId("0000000000000000000c7e98")}, {shared_to : ObjectId("0000000000000000000c7e98")}] }).limit(20).sort( {created_at:1}).explain() } |
| Comments |
| Comment by Aaron Staple [ 06/Aug/10 ] |
|
duplicate of |