Chris Collins

Tagged “postgresql”

Exploration ·

How a database survives a crash

Pull the plug on a database halfway through a write and it comes back with every committed transaction and none of the half-finished ones. How? Follow a write through the log, the buffer pool and the disk, compare B+trees with LSM-trees, watch compaction, and then see the other half of the promise — what concurrent transactions are allowed to see — with real PostgreSQL and SQLite running between the paragraphs.

Data and event platformsSoftware engineering

Tool ·

Connection pool sizing

How big should the database connection pool be? Little's law and Erlang C from your request rate and connection hold time, the PostgreSQL wiki's cores × 2 + spindles explained, every instance's pool against max_connections (RDS defaults included), a simulation of a pool too small and too large, and HikariCP's settings with maxLifetime and keepalive worked out from the idle limits on your network path.

Software engineeringData and event platforms

Tool ·

Explain plan

Paste PostgreSQL EXPLAIN (JSON or the usual text) or MySQL EXPLAIN ANALYZE / FORMAT=JSON and see the plan as a tree with each node's own time, a flame chart and a table of hotspots, the problems found — row misestimates, sorts and hashes spilling to disk, big filtered scans, missing join indexes, JIT overhead, foreign-key triggers — with advice for each, and two plans compared side by side.

Data and event platforms

Tool ·

Isolation lab

Two or three SQL sessions side by side: step through an interleaving and watch what PostgreSQL or MySQL InnoDB does at each isolation level — results, which statement blocks on which lock, deadlocks, serialization failures (40001 / 40P01) and the final table — with the classic anomalies, their fixes and the Hermitage tests built in, or the same steps on a real Postgres server.

Data and event platforms

Tool ·

Schema diff

Paste two SQL schemas (PostgreSQL or MySQL, hand-written or from pg_dump / mysqldump) and get the migration from one to the other as SQL, Flyway versioned files or a Liquibase changelog (YAML or XML), with warnings for the changes that rewrite or lock tables — by database version — and an ER diagram of what changed.

Data and event platforms

Tool ·

Postgres playground

Real PostgreSQL 18 in your browser (PGlite) with a psql-like console, twenty runnable labs for the distributed patterns Postgres does well — SKIP LOCKED queues, advisory-lock mutexes, leases with fencing tokens, leader election, LISTEN/NOTIFY, outbox, idempotency keys, rate limits — an animated model of concurrent sessions, and a real-server mode that races sessions on your own Postgres.

Data and event platforms

Tool ·

SQL formatter

Format SQL for 18 dialects — PostgreSQL, MySQL, SQLite, T-SQL, BigQuery, Snowflake, Spark and more — with keyword case, indent style, and minify.

Developer tools