Skip to content

Build1 publisher2 min readPublished

DocumentDB 0.117 ships index pushdown for scalar $group switched off by default

Microsoft-led DocumentDB 0.117 adds scalar $group index pushdown, so Postgres can sum an indexed field for a MongoDB query that carries no hint. Because the feature ships off, MongoDB users weighing DocumentDB swap a query hint for a server setting.

The Engineer · Build desk

Illustration accompanying DocumentDB 0.117 ships index pushdown for scalar $group switched off by default

What happened

  • DocumentDB is an open-source PostgreSQL extension that exposes the MongoDB API and translates MongoDB operators into PostgreSQL access paths.
  • With an index on a in place, MongoDB Atlas 8.0 answered the unhinted $sum by examining all 50,000 documents and zero index keys.
  • The same documents, indexes and unhinted pipelines ran on MongoDB, DocumentDB 0.116 and DocumentDB 0.117, so 0.116 is the baseline for the new release.
  • The 0.117 run enabled only documentdb.enable_scalar_aggregate_index_pushdown and left every other setting unchanged.

Compiled by The EngineerSomething wrong?How this is made

Why it matters

  • cost On MongoDB 8.0 an unhinted scalar sum is paid for with a read of every full document, so collections with wide payloads pay most for a value a narrow index already holds.
  • decision A DocumentDB evaluation on default settings will not exercise the pushdown, so a head-to-head against MongoDB has to set the flag before it tests this feature at all.
  • constraint The evidence covers one pipeline shape, a scalar $group with _id null over one indexed field; grouped accumulators and filtered pipelines sit outside it.

MongoDB Atlas 8.0's planner produced a single plan: a GROUP stage over a COLLSCAN, with an empty `rejectedPlans` list [6]. The run took 12 milliseconds [7]. Every value the sum needed was in the `a_1` index [4].

The total can be checked by hand. The loader sets `a` to `(index + 1) % 100` [13], so each of the 100 values appears 500 times, and 500 times the sum of 0 through 99 (4,950) is 2,475,000 [1]. MongoDB returned exactly that [8]. To get there, the collection scan read past about 10 MB of 200-byte payloads that the sum never uses [2].

DocumentDB's answer comes from PostgreSQL. Version 0.117-0, released September 10, 2026, adds a path that serves the scalar accumulator from the index [1]. Microsoft leads development and builds on feedback from enterprise customers on Azure DocumentDB [3]. The post's author wrote that "the PostgreSQL query planner ensures optimal performance without requiring additional hints in the query" [10].

The claim holds for the query text, while the opt-in moves to the server as a setting the release ships switched off [5]. I think off is the right default for a first release. A change to the access path of a common aggregation belongs behind an opt-in until operators have read the explain plans on their own collections.

The test design is careful. Each DocumentDB gateway run split into setup, VACUUM (ANALYZE) and query phases [11]. Timings across separate containers would mostly measure the containers, so the author compared rows, heap fetches and buffers instead [9].

The excerpt of the post ends inside MongoDB's explain output, before the DocumentDB counters appear. In this record, the case for 0.117 is the author's statement set against a MongoDB plan shown in full [6][10]. For MongoDB's side of the result to carry over to a production collection, that collection needs what this one has: an index on the summed field, and documents much wider than that field [4].

What to watch

  • Whether a later DocumentDB release enables scalar $group index pushdown by default.
  • The heap-fetch and buffer counts for DocumentDB 0.116 and 0.117 from the same test, set against MongoDB's 50,000 examined documents.
  • Whether Azure DocumentDB, whose enterprise customers' feedback shapes the extension, exposes the pushdown setting to them.
Loading claim ledger
Loading source directory links
Loading share composer
Loading topic controls
Loading related stories