Skip to content

PostgreSQL

This page holds what is particular to PostgreSQL databases. How database monitoring works for every engine — setup, collector pools, privacy, the tabs, alarms and billing — is on Database monitoring. Set a PostgreSQL database up from the page for its provider: Self-managed PostgreSQL or Amazon RDS and Aurora PostgreSQL. The role’s grants are on Privileges and pg_stat_statements, and its connection’s TLS and authentication on TLS and authentication.

Pick where the database runs first. Each provider has its own setup page:

Provider Versions Page
Self-managed PostgreSQL — any host: on-premises, any cloud VM PostgreSQL 14 to 18 (certified) · 13 (supported) Self-managed PostgreSQL
Amazon RDS for PostgreSQL PostgreSQL 14 to 18 (certified) · 13 (supported) Amazon RDS and Aurora PostgreSQL
Amazon Aurora PostgreSQL, Serverless v2 included PostgreSQL 14 to 18 (supported) Amazon RDS and Aurora PostgreSQL

The other PostgreSQL providers the setup lists — Azure, Google Cloud SQL and AlloyDB, DigitalOcean, Aiven, Crunchy Bridge, Timescale Cloud, Supabase, Neon, Heroku and any other PostgreSQL-compatible endpoint — are listed in the setup as not yet available and cannot be set up.

The general table is on Database monitoring. For PostgreSQL, by name:

Collected Never collected
Connections against max_connections, and the backends by state: active, waiting on a lock, idle in transaction, idle Passwords or keys: WatchTower15 stores only where your collectors find them
What the waiting backends wait on, by type: Lock, LWLock, IO, IPC, BufferPin, Client, Timeout, Extension Statement text, query samples and the processlist: the activity read names no query column
Commits and rollbacks, rows returned, fetched, inserted, updated and deleted, blocks found in shared buffers and read Your data: no table of yours is read
Deadlocks, recovery conflicts, temporary files and their size, checkpoints, WAL written, sessions that ended abnormally (14 and later) Anything over a connection WatchTower15 opens: it opens none
The age of the oldest unfrozen transaction ID and multixact ID, and the age of the oldest transaction that is running, idle in a transaction, or holding a snapshot
Replication slots: the WAL the worst one keeps, and how many have no consumer; the WAL archiver’s state; a standby’s lag and whether its WAL receiver is streaming; the lag each physical standby reports on a primary
The server’s version, whether it is a standby, a fixed set of its settings, the grant tiers the monitoring role holds

Rates are worked out on the collector, per second, from the server’s own counters. A counter reset (a restart, or a statistics reset) is detected and never shows as a spike.

The collector opens a read-only session and runs a fixed list of statements per PostgreSQL version. The grant script grants nothing more. Storage and growth, schema-change history, query analytics, the advisor, the slow and error logs and cloud metrics do not apply to PostgreSQL yet: their tabs and cards are not shown for it.

Now shows Connections, as a share of max_connections with N of the maximum beside it; Active backends, the backends running a statement (warning at 32, critical at 64); Commits per second; Cache hit ratio, the share of block reads found in shared buffers (warning at 95 %, critical at 90 %); and Monitoring coverage. Connections warns at 80 % and is critical at 95 %, as it does for every engine.

The Overview’s graphs card shows seventeen charts: Backends by state, Waits by type, Commits and rollbacks, Rows, Blocks hit and read, Deadlocks and conflicts, Temporary files, Temporary file data, Checkpoints, WAL written (on a primary), Sessions ended abnormally (on 14 and later: PostgreSQL 13 does not count them), Transaction-ID age, Oldest transactions, Slot WAL retained, Inactive replication slots, Replication lag (on a standby) and Standby lag (on a primary with a physical standby streaming from it). Each chart’s ⓘ names the series it draws.

A PostgreSQL database gets eighteen alarms: the ten that every engine’s database gets and eight of PostgreSQL’s own. They are routed through your policies and channels. The eight, by their names:

Alarm Fires when Default
Database transaction-ID wraparound The oldest unfrozen transaction ID or multixact ID in any database of the instance is that many millions old. The instance stops accepting writes shortly before an age of about 2,147 million; a vacuum that freezes old rows brings the age down warning 500 million, critical 1,000 million, each for 3 minutes
Database replication slot WAL high The replication slot holding back the most WAL keeps that many GiB of it on disk. A slot keeps WAL until its consumer has read it. A database with no slot reports 0 and never fires warning 10 GiB, critical 50 GiB, each for 3 minutes
Database replication slot inactive A replication slot has had no consumer connected for the configured number of consecutive minutes. It keeps WAL on disk until it is read again or the slot is dropped warning after 60 minutes
Database WAL archiving failing The WAL archiver’s latest attempt has failed, with no success since. Until it archives again, the database keeps the unarchived WAL on its disk. A database with archiving off never fires warning after 2 minutes, critical after 15
Database long transaction The oldest transaction that is running a statement has been open that many minutes. A long transaction holds back vacuum warning 60 minutes, critical 360, each for 3 minutes
Database idle in transaction A session left idle inside an open transaction has had it open that many minutes. It keeps its locks and holds back vacuum warning 10 minutes, critical 60, each for 3 minutes
Database blocking high A session has been waiting for a lock that many seconds warning 30 s, critical 120 s, each for 3 minutes
Database checksum failures In the last five minutes the database read a data page whose checksum did not match, a sign of storage corruption critical

On the database’s Alarms tab the eight sit under Queries (long transaction, idle in transaction, blocking high), Replication (slot WAL high, slot inactive, WAL archiving failing) and Storage (transaction-ID wraparound, checksum failures); WAL archiving failing reads No failures or Failing. How each value reads is on A database’s alarms.

The ten shared alarms are Database unreachable, No collector reporting, Database restarted, Database connections high, Database replication stopped, Database replication lag high, Database deadlocks, Database storage filling up, Database schema changed and Database error-log errors. The last three stay quiet on PostgreSQL until the layers they read apply to it. Database unreachable counts a database that AWS has paused as answering.

A series that a version or a setting leaves out never alarms:

  • Database blocking high on PostgreSQL 13: it does not record when a lock wait started, so there is no series. The tile reads No data: reported only where the database records when a lock wait started.
  • Database checksum failures on a database with data checksums off: it cannot detect a corrupt page. The tile reads No data: reported only for a database with data checksums on.

A standby fed only by restore_command (WAL archive shipping, with no streaming) has no WAL receiver, so it reads as not receiving: its Database replication stopped fires two minutes after its first report and stays open. WatchTower15 cannot tell it from a stopped receiver. Switch the alarm off on such a database with Disable on its Alarms tab (see the Alarms tab).

While an Aurora Serverless v2 instance is paused by AWS, the collector does not connect, so those alarms have no new values for that time, and Database unreachable counts the instance as answering: see Paused Serverless v2 instances.