Tracked query memory across explain, currentOp and profiler
Parent: MongoDB Monitoring and Observability · Published reference · snapshot 2026-10-29
↓ Facts as markdownall context files
Source-anchored research for Tracked query memory across explain, currentOp and profiler. Run status: COMPLETED.
These notes link each claim to its source. Some citations identify archived research reports that are no longer hosted on this site. A published reference means the content is available; it does not certify independent review or accuracy.Read the editorial policy and follow the sources before relying on a claim.
How it works
- The inspected master implementation of CurOp::setMemoryTrackingStats raises its stored peak only when a larger value arrives, then updates current in-use bytes. It writes peak first to maintain peak >= in-use. This is implementation evidence, not verification of every release branch. (low confidence) (verified as of 2026-10-27) [source]
Problems, failure modes and limitations
- MongoDB 8.3 introduces inUseTrackedMemBytes and peakTrackedMemBytes in profiler output. They describe current tracked bytes and maximum tracked bytes, respectively. Release coverage also places query-memory tracking in currentOp and slow-query logs. (high confidence) (verified as of 2026-10-27) [source]
- MongoDB recommends the $currentOp aggregation stage over the deprecated currentOp command and db.currentOp() method; run the stage first in a pipeline on the admin database. On mongos, localOps:true inspects the router, while false inspects shard operations. (low confidence) (verified as of 2026-10-27) [source]
- Zero tracked bytes cannot establish zero memory consumption: SERVER-133136 describes specific internal DBDirectClient bucket-reopening reads with no blocking stages, no OperationMemoryUsageTracker and zero tracked bytes. This is a scoped implementation observation; the issue lists no affected or fix versions. (low confidence) (verified as of 2026-08-10) [source]
Comparisons and alternatives
- The profiler fields system.profile.inUseTrackedMemBytes and system.profile.peakTrackedMemBytes have the same current-versus-maximum definitions as the live $currentOp fields, enabling comparison of those measurements across the two diagnostic surfaces. (medium confidence) (verified as of 2026-10-27) [source]
Facts and statements
- MongoDB 8.3 explain.executionStats.peakTrackedMemBytes reports the whole-query tracked-memory peak and explain also reports blocking-stage peaks. With one blocking stage, the documented query and stage peaks are equal. (low confidence) (verified as of 2026-10-27) [source]
- A diagnostic workflow can compare live currentOp memory with captured profiler memory, then use executionStats explain to locate blocking-stage peaks. This is a synthesis of documented surfaces, not evidence of an automatic correlation service or identical replay. (medium confidence) [source]
- Treat explain as a separate experiment: it ignores the plan cache and does not cache its winning plan. planCacheShapeHash groups plan-cache query shapes; matching hashes do not prove two observations belong to one execution. (medium confidence) (verified as of 2026-10-27) [source]
- SERVER-104648 separately adds memory statistics to QueryStats. It is marked Fixed with fix version 9.0.0-rc0 and requests peakTrackedMemBytes aggregation across shards and mongos. The 8.3 profiler/explain feature alone does not establish QueryStats support in 8.3. (low confidence) (verified as of 2026-09-25) [source]
- MongoDB explicitly documents both memory fields in $currentOp, db.currentOp(), profiler output and log messages; it separately lists peakTrackedMemBytes for explain results, PlanCache.list() and $planCacheStats. (medium confidence) (verified as of 2026-10-27) [source]
- Percona's July 30, 2026 announcement lists query memory tracking among the observability features of its own Percona Server for MongoDB 8.3 Technical Preview. The announcement's preview status is historical, not a claim about its current production status. (low confidence) (verified as of 2026-07-30) [source]
- Alibaba's ApsaraDB for MongoDB 8.3 documentation lists per-operation memory tracking and describes inUseTrackedMemBytes as current memory and peakTrackedMemBytes as peak memory. Its broad field-placement summary should be scoped using MongoDB's more explicit surface-by-surface documentation. (medium confidence) (verified as of 2026-09-10) [source]
Children
- No children recorded.