Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-3768

Default $orderby _id:1 on where() causing HUGE performance issues

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 5.0.0
    • Component/s: None
    • Labels:

      Description

      On Mongoid 4 / Moped 2 stable, I am seeing crazy performance issues when $orderby:

      { _id: 1 }

      is used on a where statement that is doing an $or and looking for a single record. With $orderby its 40 seconds, without it, the same query goes to 1ms.

      I checked all of my code and I am not setting a default scope to order by _id anywhere.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: