PostgreSQL monitoring · 12 and later

Know what PostgreSQL waits on, and who sends it.

WatchLog shows what your database is waiting on, which statement is responsible, which service sends it and what changed, on Kubernetes and on plain Linux servers. When a lock holds everything up, it names the service holding it.

A role with pg_monitor, read-only. Never a row of your tables. Open source.

WatchLog’s PostgreSQL page on the live demo: shop/stock-sync holds a row lock in an idle transaction and one session waits on it, with the query flow, six tiles and the moment it took the lock marked on the charts
What other dashboards leave to you

A slow database is the symptom.
WatchLog shows the cause.

  • It names the blocker

    When writes wait on a lock, WatchLog draws who blocks whom, root first, and names the service holding the lock: whether its transaction sits idle, for how long, and on which table.

  • It knows each statement’s usual

    Every costly statement is compared with its own mean of the six hours before. When one turns far slower while its calls didn’t rise, WatchLog says so, and which service sends it.

  • It tells you how long you have

    A replication slot that keeps WAL fills the disk in so many hours; a sequence is at 92 % of its type; transaction IDs head for wraparound. Each with the time left, before it is an outage.

What you see

Waits, statements, locks, replication, tables.

  • Query flow

    Clients, sessions, queries and storage in one strip, with what sits between each: the services that connect, how many sessions wait on a lock or idle in a transaction, the longest query.

    clients · sessions · queries · storage

  • Waits

    What the active sessions wait on, CPU, I/O, lock or client, every 15 seconds, by statement and by service. Drag across the chart and the lists below follow the period.

    wait_event_type · query_id · 14+

  • Statements

    The 50 that cost the most, as normalised text: calls, mean against its usual, share of time, rows, who sends it mostly, and “probably missing an index” where it reads far more than it returns.

    pg_stat_statements · sent mostly by

  • Locks

    The blocking tree, the oldest open transactions, lock waits by hour and day, deadlocks, and the tables locked most. Each session named by its workload or service.

    pg_blocking_pids · idle in transaction

  • Replication and WAL

    Replicas and their lag, slots with the WAL each keeps and when it fills the disk, archiving, checkpoints timed and requested, and pg_stat_io on 16 and later.

    slots · archiver · checkpointer

  • Tables and vacuum

    The largest and fastest-growing tables, unused and duplicate indexes, tables without a primary key, dead rows, and who holds vacuum back: a session, a slot or a prepared transaction.

    xmin horizon · bloat estimate · wraparound

Alerts that are already written

On from the first minute.

Press Monitor and these start watching. Each goes to Slack, Telegram, email or a webhook, and says which statement, which table and which service. Any statement or table can have its own.

  • A session blocked for over a minutecritical
  • A replication slot fills the disk within a daycritical
  • A query running longer than 5 minutescritical
  • A transaction open for over 30 minuteswarning
  • A statement far slower than usualwarning
  • Connections above 90 % of max_connectionswarning
Setup

One click. One role.

  1. Install the WatchLog agentOne command on a server, or one Helm chart on a cluster.
  2. WatchLog finds PostgreSQLFrom the images and ports the agent already sees. It appears under Applications.
  3. Press MonitorRun the one command it writes: a role with pg_monitor. The page and its alerts start at once.
Platform
kubectl exec -n shop statefulset/postgres -- psql -U postgres -v ON_ERROR_STOP=1 \
  -c "CREATE ROLE watchlog LOGIN PASSWORD '…'" -c "GRANT pg_monitor TO watchlog"
docker exec shop-postgres-1 psql -U postgres -v ON_ERROR_STOP=1 \
  -c "CREATE ROLE watchlog LOGIN PASSWORD '…'" -c "GRANT pg_monitor TO watchlog"

On Linux servers the install runs the integrations collector next to the agent; with docker run agents, the service page gives its command. On Kubernetes the chart already runs it.

The command creates a role with pg_monitor and nothing else. Every session is read-only with a 2-second timeout; WatchLog never runs EXPLAIN and never reads your rows.

Installed with apt or dnf on a Linux server? WatchLog finds it by its unit’s name, and the server’s own collector reads it on 127.0.0.1 once you press Monitor. Applications on Linux servers.

The grants, by version →
Compared

Against an exporter and a dashboard you build.

WhatWatchLogExporter and a dashboard you build
Time to the first chartMinutesHours: an exporter, a scrape config, dashboards
Which service sends a slow statementNamed, when one clearly doesNot available
Who holds the lockThe root blocker and its serviceA query you run by hand
A statement slower than usualAgainst its own six hours beforeThresholds you tune
Default alertsTwelve, written for youRules you write
Works on plain Linux serversYes, and KubernetesDepends on your setup
Reads your rowsNeverDepends on the exporter’s queries
Ask your AI

Ask your AI about PostgreSQL.

Claude and ChatGPT read the same facts through WatchLog's MCP server, read-only: what the database waited on, the statements that cost the most and who sends them, and who blocks whom.

Connect your assistant →

Why is checkout slow right now?

get_application · get_service_map

A session idle in a transaction from payments/worker holds a lock on payments; two queries have waited 38 s behind it.

An example on Kubernetes, written from the docs.
Questions

PostgreSQL monitoring, answered.

Which PostgreSQL versions are supported?
12 and later, on Kubernetes and on Linux servers (systemd services, process groups and containers). Waits by statement need 14; pg_stat_io needs 16.
What access does WatchLog need?
A role with pg_monitor. WatchLog writes the one command that creates it. Every session is read-only, with a 2-second statement timeout. It never reads a row of your tables and never runs EXPLAIN, ANALYZE or VACUUM.
Does it need pg_stat_statements?
For the statements, yes; everything else works without it, and the page says how to turn it on. Statement text is the normalised text PostgreSQL keeps, values replaced by $1, $2.
How does it know which service sends a statement?
Every 30 seconds it sees which client ran each top statement last, and maps the client’s address to its workload or service. It names one only when that one holds at least 70 % of the sightings.
Will it slow the database down?
No. Measured under load: about 1.4 short statements a second, under a millisecond of database time a second. Tables and indexes are read every 10 minutes, capped at the 100 largest.
Does it work on RDS, Cloud SQL or Azure?
Yes, their admin user can grant pg_monitor. Their disks aren’t visible to the agent, so capacity shows only what PostgreSQL itself reports, and the page says so.
Can I alert on one statement or one table?
Yes, from its own page, in one click: a statement far slower than usual or above a mean, a table's dead rows or its size.
Is it free?
The open-source edition is free without limits. WatchLog Cloud is free for 5 servers or nodes.

See your own database in five minutes.

Free on WatchLog Cloud for 5 servers or nodes, or run it yourself, open source.