Wildcard indices do not produce skip scans

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Optimization
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Tested with 8.2 & on master.

      db.a.drop()
      db.a.createIndex({a:1, "b.$**":1, c: 1})
      db.a.insertOne({})
      db.a.explain().find({a:1, c: 1})

      This produces the (sole) plan:

              indexBounds: {
                a: [ '[1, 1]' ],
                '$_path': [ '[MinKey, MaxKey]' ],
                c: [ '[MinKey, MaxKey]' ]
              }
      

      ie. c is unconstrained.

      Similarly

      db.a.drop()
      db.a.createIndex({a:1, 'b.$**':1, c: 1})
      db.a.insertOne({})
      db.a.explain().find({a:3, "b.x": {$ne: null}, c: 5})
      

      gives a single plan with an index scan with the following bounds:

      {
        a: [ '[3, 3]' ],
        '$_path': [ '[MinKey, MaxKey]' ],
        c: [ '[MinKey, MaxKey]' ]
      }
      

      where, c and $_path could both be constrained.

            Assignee:
            Unassigned
            Reporter:
            Kartal Kaan Bozdogan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: