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

Unify spilling metrics across different plan stage stats

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • Fully Compatible
    • QE 2025-01-20, QE 2025-02-03

      For example, SortStats don't track spilled records and bytes (uncompressed):

      https://github.com/mongodb/mongo/blob/839e7db4cce8e94e3d3d9bd3d445c091e7b695f7/src/mongo/db/exec/plan_stats.h#L841

      And some stats structures can have the same metric with different names:

      GroupStats::numBytesSpilledEstimate and SpoolStats::spilledUncompressedDataSize are the same metric.

      After this change, each stage that spills to disk will have 4 metrics with the same type, name and meaning:

      https://github.com/mongodb/mongo/blob/master/src/mongo/db/pipeline/spilling/spilling_stats.h#L36

          // The number of times the tracked entity spilled.
          uint64_t spills = 0;
          // The size, in bytes, of the memory released with spilling.
          uint64_t spilledBytes = 0;
          // The size, in bytes, of disk space used for spilling.
          uint64_t spilledDataStorageSize = 0;
          // The number of records, written to record store.
          uint64_t spilledRecords = 0; 

            Assignee:
            ivan.fefer@mongodb.com Ivan Fefer
            Reporter:
            ivan.fefer@mongodb.com Ivan Fefer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: