[SERVER-3327] use indexes for nested $or clauses Created: 24/Jun/11 Updated: 12/Jul/16 Resolved: 23/Jan/14 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | None |
| Fix Version/s: | 2.5.5 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Aaron Staple | Assignee: | hari.khalsa@10gen.com |
| Resolution: | Done | Votes: | 16 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||||||
| Comments |
| Comment by hari.khalsa@10gen.com [ 23/Jan/14 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This falls out of index intersection. For example, for the query
with indices over each of : a, b, c, d we generate the plan
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Grant Hall [ 22/Jan/14 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Ian, It has been a long time since this has been updated. Any news on this issue? We are experiencing this issue and would like to know what the status is. Thanks! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Ian Whalen (Inactive) [ 21/Sep/12 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
drapeko we are still intending on doing this, although we have not yet planned it for a specific upcoming release. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by drapeko [ 21/Sep/12 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Are you guys still going to implement this? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Aaron Staple [ 25/Dec/11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Folks - We do plan to implement this, though I don't have any info on when that will happen other than what appears in the summary at the top of this ticket. I would like to note a couple of short term workarounds here in case they are useful for people. Let's say A, B, C, and D are sub-queries. If you have a query like: One workaround is to rewrite the query as follows: Another workaround, which will allow you to utilize indexes for one of your $or's, is this: ,{$and:[{$or:[C,D]}]}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Nader Akhnoukh [ 15/Nov/11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi everyone, is there a planned release for this? Support for nested ors within and is great and was needed by many people (#1089 && #3192), but is of little use in any real environment without indexes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Thomas DeMille [ 14/Nov/11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi, In my opinion this is a huge miss, Consider an RDBMS if you couldn't write this fairly common query without inducing a full table scan: Select * from foo where (A = 1 or B=2 ) and (C=1 or D=2) It's a really common scenario. |