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

Use full index scan as proxy for collection scan in order to make certain queries covered

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.6.0-rc1
    • Affects Version/s: 2.5.4
    • Component/s: Querying
    • None

      The old query system would prefer full index scans to collection scans in the case of covered queries. For example, with an index on field 'foo' consider the following query:

      db.t.find({foo: {$exists: true}}, {_id: 0, foo: 1});
      

      This query would be covered by the index, hence this test which asserts that explain.indexOnly is true.

      The new query system does not try to construct full index scans for things like $exists and $nin, preferring a collection scan instead. This means that in the new system, a FETCH stage is required and the query is not covered. As a performance improvement, we could eliminate these fetches and make such queries covered.

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            david.storch@mongodb.com David Storch
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: