Add better index support for placement history query

XMLWordPrintableJSON

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

      SERVER-113143 adds a query on the config.placementHistory collection on the config server with this pipeline:

      [
        {$match: {timestamp: {$gt: ts}, nss: matchExpression}},
        {$sort: {timestamp: -1}},
        {$limit: 1},
        {$project: {timestamp: 1}}
      ]
      

      ts has a dynamic value, and matchExpression is one of:

      • {$ne: ""}
      • {$regex: "^dbName(\..*")?$}
      • {$regex: "^dbName(\.collName)?$}

      The index present on config.placementHistory currently is nss_1_timestamp_-1, which likely means that it needs to scan more index than strictly necessary to find the closest placement history entry.
      This assumption should be verified, and if accurate, we should try to limit the amount of index entries this query needs to read from the placement history by adding another index or rephrasing the query.

            Assignee:
            Jan Steemann
            Reporter:
            Jan Steemann
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: