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 pageshowhide
explore
- Client, Pooling & Failover18 questions
- Backup Managers18 questions
- pgBackRest6 questions
- Barman6 questions
- WAL-G6 questions
- Log & Plan Analysis17 questions
questions
page 2 of 2In Barman, what is the difference between collecting WAL with archiver = on and with streaming_archiver = on, and when would you enable both?
basics
~20 sarchiver = 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.
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?
basics
~20 sInstall 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.
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?
basics
~20 sWhen 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.
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?
basics
~20 sAsynchronously, 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.
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?
basics
~10 sEXPLAIN 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.
How does PEV2 flag a row-estimate miss in a PostgreSQL plan, and how do you decide which flagged node actually matters?
basics
~20 sPEV2 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.
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?
basics
~20 sUse 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.
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?
basics
~20 sRaise 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.
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?
basics
~20 sRaise 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.
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?
basics
~20 sPAUSE 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.
With PgBouncer in transaction mode, why do driver prepared statements work while SQL PREPARE and EXECUTE fail, and what does max_prepared_statements control?
basics
~10 sPgBouncer 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.
With PgBouncer 1.26 in transaction mode in front of PostgreSQL 18, which session state survives between transactions and which leaks or silently disappears?
basics
~20 sOnly 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.
In a psql deployment script, how do you pass parameters safely with -v and :'var', and generate DDL from a catalog query with \gexec?
basics
~20 spsql 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.
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?
basics
~10 sThe 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.
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?
basics
~20 sWALG_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.
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?
basics
~20 swal-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.
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?
basics
~20 sWith 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.
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?
basics
~20 sMake 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.
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?
basics
~20 sPEV2 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.
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?
basics
~10 sFor 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.
When parsing a 40 GB PostgreSQL log with pgBadger, how do the -j and -J options differ, and when does each fail to help?
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.
In psql 18, what do \parse, \bind_named and the \startpipeline ... \endpipeline commands add, and when would you reach for them?
basics
~20 spsql 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.
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?
basics
~20 sThe 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.
showing 31–53 of 53