Slow query monitoring

PostgreSQL Slow Query Monitoring Without Guesswork

Slow query monitoring is most useful when it tells you what changed. A static list of slow SQL is a start, but production teams need baselines, deploy comparisons, plans, and enough context to fix the right thing.

Search Topics This Page Covers

postgresql slow query monitoringpostgres slow query logpostgresql query performance monitoringpostgresql slow query alertfind slow queries postgres

Signals Worth Watching

A query is called often enough that small regressions matter

Mean execution time looks fine but p95 is getting worse

Rows returned stay flat while blocks read increase

A release changes a query's filter or join behavior

The same normalized query behaves differently for different tenants

Practical PostgreSQL Checks

Rank by total impact, not only one slow execution

A query that is moderately slow and called constantly may matter more than a rare outlier.

SELECT query, calls, total_exec_time, mean_exec_time, rows
FROM pg_stat_statements
ORDER BY total_exec_time DESC
LIMIT 20;

Use logs for outliers and statements for trends

Slow query logs are useful for individual outliers. pg_stat_statements is better for normalized trends and regressions.

ALTER SYSTEM SET log_min_duration_statement = '500ms';
SELECT pg_reload_conf();

How MonPG Helps

MonPG keeps query history so slow query regressions can be compared to earlier baselines.

Query pages connect timing, calls, rows, blocks, WAL, and related index signals.

Alerts can focus on regression and impact instead of noisy one-off slow statements.

Related PostgreSQL Guides

Documentation for This Topic

Hands-on setup, integration, and troubleshooting guides from the MonPG product docs.

Browse all documentation →

PostgreSQL Tools

Related Topic Hubs

Monitor PostgreSQL before tuning turns into firefighting.

MonPG gives teams query history, alerts, index guidance, vacuum visibility, replication signals, and cloud PostgreSQL monitoring in one place.

Start free