> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vortexiq.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Top 10 Slowest Queries, PostgreSQL

> Top 10 Slowest Queries for PostgreSQL instances. Tracked live in Vortex IQ Nerve Centre. How to read it, why it matters, and how to act on it.

**Card class:** [Non-Hero](/nerve-centre/overview#card-classes-explained)  •  **Category:** [Performance](/nerve-centre/connectors#connectors-by-type)

## At a glance

> A ranked table of the statement shapes consuming the most total execution time over the last 24 hours, drawn from `pg_stat_statements`. This is the "where is my database time actually going?" leaderboard. The ranking is by total time, not per-call time, so it surfaces the queries that matter most in aggregate: a 20ms query run two million times outranks a 5-second query run twice, because the first is where your instance is genuinely spending its capacity.

## What it tracks

The card lists the top queries by `total_exec_time` from `pg_stat_statements` over a rolling 24-hour window (`24h`), with each row showing the normalised statement text (literals replaced by `$1`, `$2`), call count, mean execution time, and total accumulated time. Ranking by total time is the key design choice: it directs optimisation effort at the statements that consume the most database capacity overall, which is usually a high-frequency query at moderate latency rather than a rare slow one. This is the natural drill-down whenever a percentile or rate card moves: when [Query Latency p99 (ms)](/nerve-centre/kpi-cards/postgresql/query-latency-p99-ms) spikes or [Slow-Query Rate %](/nerve-centre/kpi-cards/postgresql/slow-query-rate) climbs, this table names the statement shapes responsible. Pair it with [Buffer Cache Hit Rate %](/nerve-centre/kpi-cards/postgresql/buffer-cache-hit-rate) (a leader with heavy disk reads points at an indexing or cache gap) and [Queries per Second (live)](/nerve-centre/kpi-cards/postgresql/queries-per-second-live) for traffic context. The first query to optimise is almost always the one at the top of this list, because shaving 30% off the statement that owns the most total time frees more capacity than fixing ten rare slow ones.

## Reconciling against the source

Reproduce the ranking natively with `SELECT queryid, calls, mean_exec_time, total_exec_time, query FROM pg_stat_statements ORDER BY total_exec_time DESC LIMIT 10;` on the monitored database. The raw view holds lifetime cumulative totals since the last `pg_stat_statements_reset()`, so it will differ from the card's 24-hour window; reset the view or compare deltas to align. On managed services cross-check with Performance Insights top SQL (RDS / Aurora), Query Insights (Cloud SQL), or Query Store (Azure). Run `EXPLAIN (ANALYZE, BUFFERS)` on any leader to confirm the plan before optimising.

***

### Tracked live in Vortex IQ Nerve Centre

*Top 10 Slowest Queries* is one of hundreds of KPI pulses Vortex IQ tracks across PostgreSQL and 70+ other ecommerce connectors. Nerve Centre runs the detection layer; Vortex Mind investigates the cause when something moves; Ask Viq lets you interrogate any number in plain English.

[Start for free](https://app.vortexiq.ai/login) or [book a demo](https://www.vortexiq.ai/contact-us) to see this metric running on your own data.
