MongoScope

Slow Queries

Aggregate slow-query patterns from a log file or live system.profile samples

Use the Slow Queries tab to inspect repeated slow shapes from a parsed log file or from live system.profile samples on a selected connection.

Prerequisites

  • Dashboard open with a parsed log (Static) — see Getting started
  • For Live mode: a selected connection — see Connections
  • For Live profiling enable: permission to run profile on the selected database

Choose Static or Live

ModeData sourceDefault
StaticAggregated patterns from the Welcome / --log-path parse (tail of the file)Yes
LiveNewest system.profile samples from the selected connectionNo

Press l to toggle when a connection is selected. Live polls about every 2 seconds while the tab is active and connected.

Enable profiling (Live)

Live mode only records what system.profile already contains. To turn profiling on for the selected database:

  1. Switch to Live (l).
  2. Press e.
  3. Confirm the dialog.

MongoScope sets profiler level 1 and slowms (default 100). It never sets level 2.

Sort and inspect patterns

KeyAction
c / a / p / gSort by count / average ms / plan / regression (g is meaningful on static logs only; live patterns have no history and sort as 0)
EnterOpen pattern details
[ / ]Cycle databases (Live)
Shift+TStatic: log tail size (last N lines). Live: profiler sample window. Both: presets / custom; default 100000, clamp 1–1000000

From details, press i to jump to Indexes with a suggested vs existing index comparison (read-only — create indexes outside MongoScope). See the Indexing guide.

History (Query Time Machine)

Open a pattern’s details to see History for that shape in the current static log parse.

Limits (match the parser):

LimitBehavior
FileOne path only (--log-path or the Welcome pick). Rotated siblings are not joined.
WindowLast N lines of that file (Shift+T). Default 100000; clamp 1–1000000.
SamplesOps that already crossed slowms in that tail — not a pre-slow baseline.
FieldMeaning
First / last slowFirst and last timestamps of this shape in the tailed log (ops above slowms only — not a true baseline)
Avg ms / volume sparklinesLatency and occurrence buckets over the parse window
Early / lateMidpoint split of this pattern’s own span: count, avg ms, modal plan
Regression scoreHeuristic from avg ms, examined/returned, and plan mix; needs ≥5 samples in each half or marked low confidence. Sort with g on Static only
Plan changesModal plan transitions across time buckets (e.g. IXSCAN → COLLSCAN)
Index eventsIndex build start/complete, CMD: dropIndexes, and slow createIndexes lines for the same namespace in this file

Same-period index lines are correlation, not proof of cause. MongoScope does not store history, plans, or index snapshots — analysis is in-memory for this session. Live mode shows a short notice: Time Machine is static log analysis only (system.profile has no durable history).

Export patterns

  1. Press x.
  2. Choose JSON, CSV, or Markdown and a destination path.
  3. Press Enter to write (confirms overwrite if the file exists), or Esc to cancel.

Export writes all patterns in the current sort order, not only visible rows. Each row includes pattern aggregates (namespace, op, shape, counts, timings, plan) plus the slowest-sample query detail shown in the detail dialog: filter/pipeline, stage, command, suggested index, context, and work metrics.

Sample filters and commands might contain literal query values. Credentials and connection URIs are never included. Default filename shape: mongoscope-slow-queries-YYYYMMDD-HHMMSS.<ext>. Export writes on the machine running MongoScope (relevant over SSH).

On this page