ExportXMLWordPrintableJSON

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

      SERVER-134637 introduced support for costing index scans on hashed/wildcard/collated indices.

      Currently samplingCE extracts all the keystrings (up to a limit set by a knob) and then matches each keystring to the IndexBounds in the ixscan node. For wildcard indices, this usually means extracting keystrings for all the fields in the wildcard root just to get one of them. This is slow for documents with many fields.

      The following have come up as possible improvements:

      • Project-away unrelated fields before extracting keystrings: eg. for estimating ` {"$_path": [["a.b", "a.b"]], "a.b": [[0, 0]]}

        ` on an index with `

        {"a.$**": 1}

        `, we can project away all of a except a.b (assuming they are not used elsewhere in the index shape). This lets us keep using the same keystring extractor used by the index, avoiding a re-implementation.

      • Enforcing the limit on the number of keystrings per document before fully extracting them. This is obviously desirable, but currently difficult to implement. One way would be to add support for an optional max-number-of-keystrings parameter to the keystring generator interface.
      • The countNDV on the keystring codepath currently essentially does BSONObjBuilder::asTempObj().getOwned(), which does an extra copy compared to BSONObjBuilder::obj() (which transfer ownership of the underlying buffer to a BSONObj). In this case forEachKey would need to keep track of whether the callee did indeed call obj() (as it cannot use the builder beyond that call). An alternative is to introduce a forEachKeyOwned.

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

              Created:
              Updated: