Postgres

Connect

psql -h $db_dns_record \
     -p 5432 \
     -U $USER \
     -d 'postgres'

Locally, this is usually:

psql -h localhost \
     -d postgres

Docker

docker run --rm \
       -e POSTGRES_USER='postgres' \
       -e POSTGRES_PASSWORD='postgres' \
       -p 5433:5432 \
       postgres:15.2-alpine

Connect

psql -h localhost -d postgres --port 5433 -U postgres

WAL

Get a list of the current WAL files:

SELECT * FROM pg_ls_waldir();

Current amount of space in MiB taken up by WAL:

SELECT
(sum(size) / 1024 / 1024)
FROM
pg_ls_waldir ();

Parameters

View postgres parameters using `SHOW`. E.g.

SHOW max_wal_size;