Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-47330

Extend IDHACK to any unique index where all properties are given as simple "equality" values.

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: Backlog
    • Component/s: None
    • Labels:

      Description

      The IDHACK is an optimization for _id lookups. It exploits the fact that _id ~always has a unique index; if the internal find cursor yields a document, there’s no need to iterate the cursor any more, or make an additional “step” in the query planner, which improves performance. This could be generalized to apply to any unique index where all properties of the index are given as simple equality values.

      For example, given unique index {foo: 1, bar: 1}, a query {foo: 123, bar: "abc", baz: {$lt: 789}} would be able to use this enhanced IDHACK optimization.

      A much more common case for us would be $in queries on _id, which I suspect is common to many users, since it's what you'd do to emulate joins. Today, an $in would require 2x the steps/cursor iterations compared to applying the IDHACK.

        Attachments

          Activity

            People

            Assignee:
            backlog-server-query Backlog - Query Team
            Reporter:
            bartle David Bartley
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Dates

              Created:
              Updated: