[SERVER-31764] Mongo Aggregation contains $or operator Created: 30/Oct/17  Updated: 07/Jan/18  Resolved: 01/Dec/17

Status: Closed
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: stone [X] Assignee: Mark Agarunov
Resolution: Incomplete Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

have a collection

a,
b,
c

and index on a,b

found that when aggregation contains $or

$or:[{"a":xx},{"b":xx}]

is very slow,even both of a and b have index.

1. when query with "a",may need 300ms,
and the result is 3x larger than query with "b".
but when query aggregate with

$or:[{"a":xx},{"b":xx}]

it need 1.5s



 Comments   
Comment by Mark Agarunov [ 01/Dec/17 ]

Hello cnStoneFang,

We haven’t heard back from you for some time, so I’m going to mark this ticket as resolved. If this is still an issue for you, please provide additional information and we will reopen the ticket.

Thanks,
Mark

Comment by Mark Agarunov [ 10/Nov/17 ]

Hello cnStoneFang,

We still need additional information to diagnose the problem. If this is still an issue for you, would you please provide the following:

  • Which version of MongoDB is being used?
  • Please provide the exact query being used,
  • Please append .explain(true) to the query and provide the complete output.

Thanks,
Mark

Comment by Mark Agarunov [ 30/Oct/17 ]

Hello cnStoneFang,

Thank you for the report. To get a better idea of what may be causing this behavior, I'd like to request some additional information:

  • Which version of MongoDB is being used?
  • Please provide the exact query being used,
  • Please append .explain(true) to the query and provide the complete output.

This should give some insight into why the performance is slower with $or.

Thanks,
Mark

Generated at Thu Feb 08 04:28:07 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.