AArtery

Top 20 slowest queries from pg_stat_statements (admin)

get/v1/admin/slow-queries

Reads `pg_stat_statements` (a Postgres contrib module) and returns the 20 statements with the highest cumulative `total_exec_time` since the last reset. Each row carries `calls`, `meanExecMs`, `totalExecMs`, `maxExecMs`, and `rows`; the SQL is parameter-normalised by Postgres and additionally truncated to 500 chars. When the extension isn't loaded (it requires a `postgresql.conf` change, not a migration), responds `{ available: false, reason }` so the UI can render a friendly help block. Every call writes `admin.slow-queries.viewed` to the audit log.

Top 20 slowest queries from pg_stat_statements (admin) · Artery API Docs