Query Performance
Find and fix slow queries with query statistics and EXPLAIN plans.
The Queries page shows aggregated performance statistics for every query your database has executed, powered by pg_stat_statements (PostgreSQL) or system.query_log (ClickHouse).
Query List
Queries are grouped by their normalized fingerprint — parameterized values are replaced with placeholders so that SELECT * FROM users WHERE id = 1 and SELECT * FROM users WHERE id = 2 appear as one entry.
Sorting
Sort by any column to find different types of problems:
| Sort by | Use case |
|---|---|
| Total time (default) | Queries consuming the most cumulative database time |
| Calls | Most frequently executed queries |
| Mean time | Slowest average execution time per call |
| Rows | Queries returning or affecting the most rows |
Metrics
| Field | Description |
|---|---|
| Total time | Cumulative wall-clock time across all executions |
| Calls | Number of times the query was executed |
| Mean time | Average time per execution (total time / calls) |
| Rows | Total rows returned or affected |
| Cache hit ratio | Percentage of block reads served from shared buffers (PostgreSQL) |
Query Detail
Click a query to see its detail page, which includes:
- Timeseries — calls, total time, mean time, and rows over time. Use this to spot regressions or correlate with deployments.
- EXPLAIN plans — captured execution plans showing how the database executes the query.
EXPLAIN Plans
EXPLAIN plans show the query planner's chosen strategy: sequential scans, index scans, join types, sort methods, and estimated vs. actual row counts.
Key fields in each plan:
| Field | Description |
|---|---|
| Total cost | Planner's estimated total cost |
| Actual time | Real execution time in milliseconds |
| Seq scans | Number of sequential (full table) scans |
| Index scans | Number of index scans |
| Rows estimated | Planner's row estimate |
| Rows actual | Actual rows processed |
A large gap between estimated and actual rows indicates stale statistics — run ANALYZE on the affected tables.
Common Patterns
High total time, low mean time, high calls — a lightweight query called too often. Consider caching or batching.
High mean time, low calls — an expensive query. Check the EXPLAIN plan for sequential scans on large tables, missing indexes, or suboptimal joins.
Declining cache hit ratio — working set exceeds available memory. Consider increasing shared_buffers or optimizing queries to read fewer blocks.
Filtering by Time Range
Use the time picker to narrow the window. Query statistics are aggregated within the selected range. Unverified accounts are limited to the most recent 24 hours.