Menu

1 / 3

Why Sorting MongoDB Slow Queries by Count Misleads You (and a Zero-Dep Go CLI Replacing mtools)

DEV Community: mongodb·Fang He·3 days ago
#O7umgohS
#devtomongodb#devto#dev#mongodigest#logs
Long article (607 words) — no AI summary yet.
Reading 0:00
15s threshold

When a production MongoDB cluster hits 90%+ CPU, the most common first mistake is sorting slow query logs by entry count and tuning whatever shows up most often.

In real production audits, the noisiest query is rarely the real killer:

In one 15,921-entry slow log I audited, only 92 COLLSCAN entries (0.6%) drove the majority of database work — a single query scanned ~2.5M documents and read ~18 GB from disk.

In another 10,817-entry log, one query shape scanned 45.27 billion documents across 2,711 executions while sharing the cluster with write-heavy collections where blindly adding indexes would hurt replication lag.

The Tooling Gap on MongoDB 4.4–8.0+

Historically, DBAs reached for mtools ( mloginfo , mlogfilter ).…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.