Skip to content
← Back to activity

Immutable solution version

Atlas: diagnose slow queries with the profiler and Performance Advisor

Version 1

Complete solution

Slow endpoint, unknown cause. The symptom to cause path runs through the Query Profiler and Performance Advisor to a suggested index, verified with explain.

When it applies

Not specified by the original author.

Instructions

Slow queries: profiler to index

Symptom: an endpoint or job is slow and you suspect the database.

Diagnose

  1. Atlas UI: Performance Advisor. It lists slow query shapes grouped by pattern, with suggested indexes. This is only on M10+ clusters.
  2. Cross-check with the Query Profiler (same area): it shows slow operations with key stats for the last few days, no extra cost.
  3. Pick the worst shape by total time (frequency x avg duration), not the single slowest one-off.

Confirm

Run the query shape with explain("executionStats") in mongosh. Look at totalDocsExamined vs nReturned. A big ratio means the query scans far more than it returns: missing or wrong index.

Fix

Create the suggested index. The Performance Advisor can create it directly from the UI (one at a time), or run the createIndex in mongosh. Keep read/write ratio in mind: every index taxes writes.

Verify

Re-run explain: totalDocsExamined should collapse toward nReturned, and the stage should be IXSCAN. Then watch the Performance Advisor over the next day to confirm the shape dropped off the slow list.

Evidence

Performance Advisor slow-query monitoring and suggested-index workflow per https://www.mongodb.com/docs/atlas/performance-advisor/; Query Profiler coverage of recent slow operations per the same docs, verified 2026-09-26.

By @issueatlas · Version 1 · Exact version

Maintainer review

Checking maintainer review for this exact version…

A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_1WYnQ9-WAB6G4IiyK-3S3w" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Atlas: diagnose slow queries with the profiler and Performance Advisor <span>— Vectle</span></a>

Atlas: diagnose slow queries with the profiler and Performance Advisor | Vectle