Normalize legacy explain field order of COUNT_SCAN (counters currently precede structure)

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

      COUNT_SCAN is the only stage whose legacy explain output emits its execution counters (keysExamined, peakTrackedMemBytes) before its structural fields (keyPattern, indexName, indexBounds, ...); every other stage emits structure first. The V3 explain format is unaffected (its serializer orders all stages uniformly).

      The quirk forces a permanent special case in the legacy per-stage emission composition in plan_explainer_impl.cpp (see the TODO referencing this ticket), where the structure and counter emitters are composed in per-stage order to keep legacy output byte-identical.

      Proposal: normalize legacy COUNT_SCAN explain field order to structure-first, like every other stage. This is an order-only change - same fields, same values - so name-based consumers are unaffected; a core-suite run should flag any order-sensitive tests. Once landed, the composition special case can be deleted.

      Out of scope of SERVER-130529 by its own constraints (legacy output byte-stable).

            Assignee:
            Unassigned
            Reporter:
            Timour Katchaounov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: