skip to content

PostgreSQL DBA Tooling

The tools DBAs run around a PostgreSQL server rather than inside it: the psql client, PgBouncer pooling, Patroni failover, backup managers and log or plan analysers. Interviewers probe tool choice.

on this pageshow

explore

questions

page 2 of 2

In Barman, what is the difference between collecting WAL with archiver = on and with streaming_archiver = on, and when would you enable both?

level: seniorimportance: should knowfreq 40%

basics

~20 s

archiver = on takes completed WAL segments pushed by archive_command, ideally barman-wal-archive, into the incoming directory. streaming_archiver = on runs pg_receivewal through a replication slot, receiving WAL as it is written for a lower RPO. Enabling both adds a fallback; Barman stores each segment once.

open as a page

Using Barman's barman-cloud-* scripts without a Barman server, how do you back up a PostgreSQL server to object storage, and what do you give up?

level: seniorimportance: should knowfreq 30%

basics

~20 s

Install barman-cli-cloud on the PostgreSQL host, set archive_command to barman-cloud-wal-archive, and schedule barman-cloud-backup plus barman-cloud-backup-delete -r for retention. You give up the Barman server: no cron, no barman check, no incrementals, and barman-cloud-restore leaves recovery configuration to you.

open as a page

In a Patroni cluster, what happens when the primary loses its connection to etcd, and how do failsafe_mode and the watchdog change the split-brain risk?

level: seniorimportance: should knowfreq 38%

basics

~20 s

When Patroni's primary cannot reach etcd it assumes a partition and demotes PostgreSQL, so an etcd outage costs write availability. failsafe_mode lets it stay primary only if every known member confirms via POST /failsafe; the watchdog resets a node whose Patroni stalls.

open as a page

In Patroni 4, how do maximum_lag_on_failover, synchronous_mode (on or quorum) and synchronous_mode_strict change what an automatic failover can lose and when writes stall?

level: seniorimportance: should knowfreq 42%

basics

~20 s

Asynchronously, a replica over maximum_lag_on_failover bytes (default 1 MiB) behind cannot promote, bounding loss without removing it. synchronous_mode on or quorum lets only replicas holding every acknowledged commit promote; synchronous_mode_strict blocks writes rather than run unreplicated.

open as a page

In PEV2, why can the PostgreSQL plan node with the largest actual time in raw EXPLAIN ANALYZE text differ from the node PEV2 marks as slowest?

level: seniorimportance: should knowfreq 27%

basics

~10 s

EXPLAIN ANALYZE prints each node's time per loop, including its children. PEV2 multiplies by loops, divides by the parallel processes sharing the work, subtracts the children, and ranks nodes by that exclusive time instead.

open as a page

How does PEV2 flag a row-estimate miss in a PostgreSQL plan, and how do you decide which flagged node actually matters?

level: seniorimportance: should knowfreq 25%

basics

~20 s

PEV2 divides actual by planned rows (or the reverse for overestimates) and badges nodes off by over 10x, 100x and 1000x. The miss that matters is the lowest one that drove a join or aggregation choice above it.

open as a page

For sharing a slow PostgreSQL reporting-query plan with a colleague in code review, how do you choose between explain.dalibo.com, the offline pev2.html and an embedded PEV2 component?

level: seniorimportance: should knowfreq 14%

basics

~20 s

Use explain.dalibo.com only when the plan and query may leave your control, because sharing stores them on a third-party service. Otherwise open the offline pev2.html, where plans stay in the browser, or embed the pev2 component in an internal tool.

open as a page

With pgBackRest backing up a 5 TB PostgreSQL cluster to an object-store repository, which options shorten backups and keep WAL archiving ahead, and what does each cost?

level: seniorimportance: should knowfreq 40%

basics

~20 s

Raise process-max, switch compress-type to zst, enable repo-bundle and then repo-block, turn on archive-async with a spool path, and back up from a standby. Each one costs CPU, compatibility with older pgBackRest, or extra configuration.

open as a page

On a busy PostgreSQL primary where logging every statement for pgBadger is too costly, how do you set the logging and what do the reports lose?

level: seniorimportance: should knowfreq 40%

basics

~20 s

Raise log_min_duration_statement to a threshold, sample below it with log_min_duration_sample and log_statement_sample_rate, or log everything only for a window or one role; each loses part of the most-frequent and total-time picture, which pg_stat_statements can cover.

open as a page

During a planned PostgreSQL switchover behind PgBouncer 1.26, how do PAUSE, RELOAD and RESUME keep clients connected, and how do you restart PgBouncer itself without -R?

level: seniorimportance: should knowfreq 40%

basics

~20 s

PAUSE waits for every server connection to be released, then disconnects them while clients stay connected and queue; RELOAD repoints the database; RESUME continues. PgBouncer itself restarts by rolling several so_reuseport processes, since 1.26 removed -R.

open as a page

With PgBouncer in transaction mode, why do driver prepared statements work while SQL PREPARE and EXECUTE fail, and what does max_prepared_statements control?

level: seniorimportance: should knowfreq 50%

basics

~10 s

PgBouncer 1.21+ tracks protocol-level named prepared statements, renames them and re-prepares them on whichever server a client gets; SQL PREPARE is passed through untracked. max_prepared_statements, default 200 since 1.24, sizes the per-server cache.

open as a page

With PgBouncer 1.26 in transaction mode in front of PostgreSQL 18, which session state survives between transactions and which leaks or silently disappears?

level: seniorimportance: should knowfreq 57%

basics

~20 s

Only parameters PostgreSQL reports to the client are tracked and re-applied; with PgBouncer 1.26 on PostgreSQL 18 that includes search_path. Other SET values, SQL PREPARE, LISTEN, session advisory locks and temporary tables stay behind on one backend.

open as a page

In a psql deployment script, how do you pass parameters safely with -v and :'var', and generate DDL from a catalog query with \gexec?

level: seniorimportance: should knowfreq 30%

basics

~20 s

psql substitutes variables set with -v or \set before sending: :'name' as an escaped literal, :"name" as a quoted identifier. \gexec executes each cell of a query's result as its own statement, so build those statements with format() and %I.

open as a page

When a DBA changes a PostgreSQL setting on temBoard's configuration page, what does the agent execute, and when does that clash with how the fleet is configured?

level: seniorimportance: should knowfreq 16%

basics

~10 s

The agent runs ALTER SYSTEM SET for each changed setting, then pg_reload_conf(); the value lands in postgresql.auto.conf, overriding postgresql.conf, which clashes with configuration management and fails outright when allow_alter_system is off.

open as a page

With WAL-G delta backups on PostgreSQL, what does WALG_DELTA_MAX_STEPS control, and what does a longer delta chain cost you at restore time?

level: seniorimportance: should knowfreq 30%

basics

~20 s

WALG_DELTA_MAX_STEPS (default 0, disabled) is how many delta backups may follow a full before backup-push takes a full again. Longer chains upload less but make restores fetch and apply every link, and one missing link breaks them.

open as a page

What does wal-g wal-verify check on a PostgreSQL WAL archive, and how do you act on an integrity FAILURE or a timeline FAILURE?

level: seniorimportance: should knowfreq 26%

basics

~20 s

wal-g wal-verify integrity checks that every WAL segment from the oldest backup's start to the current segment is in storage; timeline checks that no higher timeline exists there. An integrity FAILURE needs a fresh backup; a timeline FAILURE means another cluster writes there.

open as a page

For a payment gateway's PostgreSQL on Patroni across two data centres, would you stretch one Patroni cluster with a third-site etcd member or run a standby cluster, and why?

level: principalimportance: should knowfreq 26%

basics

~20 s

With a third site for one etcd member, stretch one Patroni cluster and replicate synchronously across sites for automatic, loss-free failover. With only two sites, run a standby cluster in the second and promote it manually, accepting slower recovery.

open as a page

With pgBackRest protecting a 5 TB SaaS analytics PostgreSQL cluster, how would you design two repositories, one in object storage, to meet its RPO and RTO?

level: principalimportance: should knowfreq 27%

basics

~20 s

Make repo1 a nearby repository for fast restores with short retention, and repo2 an encrypted object-store repository for off-site, longer retention. archive-push feeds both, ideally asynchronously; schedule backups, retention and verify per repository; restore from the nearest one.

open as a page

What does PEV2 show when you paste a PostgreSQL EXPLAIN ANALYZE plan into it, and why is that faster to read than the raw text?

level: juniorimportance: nice to knowfreq 18%

basics

~20 s

PEV2 draws a PostgreSQL plan as a node tree, computes each node's own time, rows, cost and buffers, and badges the outliers, so the slow node, a large row misestimate or a wasteful filter stands out at a glance.

open as a page

In PgBouncer, how do auth_user and auth_query let clients log in without listing every user in auth_file, and how do you set them up safely?

level: middleimportance: nice to knowfreq 30%

basics

~10 s

For users missing from auth_file, PgBouncer connects as auth_user and runs auth_query to fetch the user's password hash from PostgreSQL. Safely: a non-superuser calling a SECURITY DEFINER lookup function with a pinned search_path.

open as a page

When parsing a 40 GB PostgreSQL log with pgBadger, how do the -j and -J options differ, and when does each fail to help?

level: seniorimportance: nice to knowfreq 15%

basics

~20 s

-j N splits one log file into N byte ranges parsed by forked processes, which needs a seekable, uncompressed, non-CSV local file; -J N parses N whole files at once, which helps only when there are many files.

open as a page

In psql 18, what do \parse, \bind_named and the \startpipeline ... \endpipeline commands add, and when would you reach for them?

level: seniorimportance: nice to knowfreq 14%

basics

~20 s

psql normally uses the simple query protocol. psql 18's \parse creates a named protocol-level prepared statement, \bind_named executes it with parameters and \close_prepared closes it; \startpipeline ... \endpipeline queue queries without waiting for each result, as drivers do.

open as a page

Before scheduling a REINDEX or VACUUM from temBoard's maintenance page on a busy PostgreSQL table, what SQL will the agent run and what should you check?

level: seniorimportance: nice to knowfreq 12%

basics

~20 s

The agent builds plain statements such as VACUUM (FULL) schema.table, ANALYZE schema.table and REINDEX TABLE schema.table, never CONCURRENTLY, and runs them at the scheduled UTC time; check the lock cost and the estimated bloat first.

open as a page

showing 31–53 of 53