Query Profiler & Performance Analyzer
Analyze MongoDB query performance, identify slow queries, view execution plans, and get optimization recommendations. The Query Profiler helps you understand how your queries execute and where to improve performance.
Quick Start
Start profiling your queries in seconds:
- Open the Query Profiler from the sidebar or menu
- Select a database and collection to profile
- View real-time query metrics and slow query logs
- Click on any query to see its execution plan
- Review index usage and optimization suggestions
Profiler Dashboard
The profiler dashboard gives you a real-time view of query performance across your MongoDB database.
Key Metrics
| Metric |
Description |
Execution Time |
Total time in milliseconds for the query to complete |
Documents Scanned |
Number of documents MongoDB examined to fulfill the query |
Documents Returned |
Number of documents returned to the client |
Index Keys Examined |
Number of index entries scanned |
Scan Efficiency |
Ratio of documents returned to documents scanned (higher is better) |
Slow Query Log
The slow query log captures queries that exceed a configurable threshold, helping you identify performance bottlenecks.
Slow Query Features
- Threshold Configuration: Set custom thresholds (e.g., queries over 100ms)
- Query Grouping: Group similar queries by shape to identify patterns
- Time Range Filter: Filter queries by time range (last hour, day, week)
- Collection Filter: Focus on specific collections
- Export Logs: Export slow query data for analysis
Execution Plans
View detailed execution plans (explain output) for any query to understand how MongoDB processes it.
Explain Modes
| Mode |
Description |
queryPlanner |
Shows the query plan without executing it |
executionStats |
Executes the query and shows actual statistics |
allPlansExecution |
Shows statistics for all considered plans |
Understanding Plans
- COLLSCAN: Full collection scan (no index used) - usually indicates a missing index
- IXSCAN: Index scan - efficient query using an index
- FETCH: Document retrieval after index scan
- SORT: In-memory sort operation (can be slow for large datasets)
- PROJECTION: Field projection stage
Index Recommendations
Get AI-powered index recommendations based on your query patterns and execution statistics.
Recommendation Types
- Missing Index: Queries that would benefit from a new index
- Compound Index: Suggestions to combine multiple fields into one index
- Covered Query: Indexes that could make queries fully covered (no FETCH needed)
- Unused Index: Indexes that are not being utilized and could be removed
Query Timeline
Visualize query performance over time with interactive charts and graphs.
Timeline Features
- Scatter Plot: Each dot represents a query, positioned by time and duration
- Color Coding: Different colors for different collections or query types
- Zoom & Pan: Interactive zoom to focus on specific time ranges
- Click to Inspect: Click any data point to view query details
- Percentile Lines: P50, P95, P99 lines to understand distribution
Live Monitoring
Monitor queries in real-time as they execute on your MongoDB server.
Live Monitoring Features
- Current Operations: See all currently running queries
- Kill Query: Terminate long-running or problematic queries
- Auto-Refresh: Configurable refresh interval
- Filter by Type: Filter by operation type (find, aggregate, update, etc.)
- Connection Info: See which client/connection issued each query
Profiler Settings
Configure profiling behavior and thresholds.
| Setting |
Description |
Default |
Slow Query Threshold |
Minimum execution time to log as slow (milliseconds) |
100ms |
Profiling Level |
0 = off, 1 = slow queries only, 2 = all queries |
1 |
Sample Rate |
Percentage of queries to sample (for high-traffic databases) |
100% |
Max Log Size |
Maximum number of queries to keep in memory |
10,000 |
Pro Tips
- Start with Slow Queries: Focus on the slowest queries first for maximum impact.
- Check Scan Efficiency: If documents scanned >> documents returned, you likely need an index.
- Monitor After Changes: After adding indexes, monitor to verify improvement.
- Use Compound Indexes: One well-designed compound index is often better than multiple single-field indexes.
- Consider Covered Queries: Design indexes that include all fields you need to avoid FETCH stages.
Ready to try VisuaLeaf?
Download and start managing your MongoDB databases with ease.
Download Free Trial