Indexes & explain plans

MongoDB® explain plans and indexes, in plain words.

A result tells you what came back. Explain helps you understand how MongoDB found it, with the winning plan, index details, and examined-document counts beside the query.

Download for MacFree on the Mac App Store

Indexes & explain plans is part of the free app. macOS 15 or later.

  • Winning plan
  • Execution statistics
  • Index management
An explain summary: an efficient plan using an index, with returned, examined and timing figures.An explain summary: an efficient plan using an index, with returned, examined and timing figures.
The real app, with sample data.

See what a query does. Understand the work behind it.

Read the query plan, inspect the work done, and manage your indexes.

Indexes & explain plans, in detail.

A verdict first

Explain opens with a verdict, such as “Efficient plan”, and up to three reasons for it. You know within a second whether a query is in good shape, before you read a single number.

The four numbers that matter

Under the verdict are the documents returned, the index keys examined, the documents examined and the time taken. Keys and documents examined are also shown per document returned, which is the quickest way to spot a query that reads far more than it gives back.

The plan, stage by stage

The winning plan is laid out as a flow of stages, such as IXSCAN, FETCH and LIMIT, each with what it read and what it passed on. The index is shown as its key fields with their directions, or as “no index” when the query scanned the collection.

Rejected plans are listed too, and the server’s complete explain output is one click away as raw JSON.

Every index, with its usage

Each collection has an Indexes section listing every index: its name and keys, whether it is unique, sparse, partial, TTL or hidden, its size, and how often MongoDB has used it and since when. An index nobody uses is easy to find.

Create, hide and drop

Create an index with a form for keys and options, or write it as JSON. Hide an index to see how queries behave without it before you remove it, and unhide it if you were wrong. Dropping an index asks for confirmation.

A TTL index deletes documents by itself, so Tallhorn treats it as destructive: it states the expiry in words and always asks before creating one.

How it goes, step by step.

Three steps from opening Tallhorn to having what you came for.

  1. Start with a real query

    Use the filter or aggregation pipeline whose behavior you want to understand.

  2. Open Explain

    Check the selected plan and compare keys and documents examined with documents returned.

  3. Inspect the collection’s indexes

    Review existing keys and options before deciding whether an index change makes sense.

At a glance.

Explain
Find queries and aggregation pipelines
Summary
Verdict, documents returned, keys and documents examined, time
Plan
Stage flow, index used, rejected plans, raw JSON
Index list
Keys, options, size and usage
Index actions
Create (form or JSON), hide, unhide, drop
Price
Free

Questions about indexes & explain plans, answered.

Can I explain an aggregation pipeline?

Yes. Explain is available for find queries and aggregation pipelines.

Does Tallhorn automatically optimize my database?

No. Explain reports MongoDB’s execution information. You decide which queries or indexes to change.

How do I see why a MongoDB query is slow?

Run the query in Tallhorn and choose Explain. If the plan shows a collection scan, or far more documents examined than returned, the query has no suitable index.

What do COLLSCAN and IXSCAN mean?

COLLSCAN means MongoDB read the whole collection to answer the query. IXSCAN means it used an index. Tallhorn names the index and shows how many keys it had to examine.

Does running Explain change my data?

No. Explain never sends $out or $merge stages, so it cannot write.

Can I test dropping an index safely?

Yes. Hide the index first. MongoDB stops using a hidden index but keeps maintaining it, so you can unhide it straight away if queries get slower.