Ad-hoc monitoring
In some cases, we need to observe some values in Postgres or the environment it's running on (OS, FS, etc.), and:
In some cases, we need to observe some values in Postgres or the environment it's running on (OS, FS, etc.), and:
Heavyweight locks, both relation- and row-level, are acquired by a query and always held until the end of the transaction this query belongs to.
Today we have quite entertaining material, but knowing (and avoiding) these things can save you time and effort.
Sometimes this happens, when you're attempting to edit a query in psql using the \e command:
Directory $PGDATA/pg_wal contains WAL files. WAL (Write-Ahead Log) is a core mechanism used for backups, recovery, and both physical and logical replication.
Diagnose and speed up slow PostgreSQL stops and restarts caused by long-running transactions, shutdown checkpoints, or lagging archive_command.
Troubleshoot slow PostgreSQL startup and crash recovery: inspect WAL REDO progress, check max_wal_size and checkpoint_timeout, and avoid unsafe restarts.
Learn how to troubleshoot streaming replication lag
In day 60, we discussed how to add a column and that under load you need low lock_timeout and retries (also see: Zero-downtime Postgres schema migrations need…