Two sequential lease symbols loop through one retained physical connection.

Connection pools amortize slow setup

A connection pool amortizes setup across several uses of a physical connection. It does not make setup disappear, and creating a pool does not necessarily open anything. Distinguish the application’s short-lived lease from the underlying database connection: closing the former normally returns the latter for reuse. ...

January 28, 2027 · 5 min · XB Field Notes
Three named migration versions advance in order from v1 to v2 to v3. Applied history must remain fixed; the local model records version and name, not a digest of executable content.

Migrations are versioned schema changes

The schema of a database is not a one-time design; it evolves with the software that uses it. Instead of editing the schema ad hoc, migrations apply a named, ordered set of changes that any environment can replay. Schema as code Treat the schema as source code: each migration is one small, named, ordered step that moves the database from one state to the next, and the sequence itself lives in the repository. A fresh environment replays the steps from an empty database to the current version, which is exactly how tests, CI, and new servers all converge on the same shape without ad-hoc ALTER TABLE edits on a live box. The schema stops being an undocumented fact of a single instance and becomes a reviewable artifact with history, blame, and a pull request. ...

January 24, 2027 · 7 min · XB Field Notes
A retry loop encloses reading again, recomputing, writing and committing. Confirmed 40001 or 40P01 requires rollback, remaining budget and jitter. An unknown commit requires reconciliation before replay.

A bounded retry gives a transaction another chance

A retry can recover a transaction rejected because of concurrent work. It cannot guarantee success, and it does not automatically make external effects idempotent. The retry unit should include every database read and application decision that determined the writes. Reusing an amount calculated from the first attempt’s snapshot can defeat the purpose of starting a fresh transaction. ...

November 9, 2026 · 6 min · XB Field Notes
Old and new schema representations overlap through migration until the contract boundary retires the old shape.

Zero-downtime migrations change schema while old code runs

A zero-downtime migration is a compatibility and availability goal, not a guarantee attached to small statements. Old and new application versions may overlap while data is changing. Plan the schema, writer behavior, backfill, reader cutover, and recovery together. Dropping information is not automatically reversible, even when the preceding steps were additive. ...

November 3, 2026 · 5 min · XB Field Notes
A checkpointed main file holds 10 while committed WAL holds the change to 20. A main-only copy remains at 10; the online backup API captures 20.

SQLite is an embedded database engine

SQLite is a database engine linked into the application rather than a separate database server. Its main database file stores schema, tables, and indexes in a portable format. That makes it useful for local application state, embedded devices, and services whose write workload fits its concurrency model. The file is still governed by transactions and locking; ordinary file-copy intuition is not enough to operate it safely. ...

October 20, 2026 · 5 min · XB Field Notes
A large retention pin holds a schematic run of old WAL segments while the write position continues forward.

A stale replication slot holds WAL back

A PostgreSQL replication slot records retention requirements for a consumer. Once the slot has reserved a WAL position, losing the consumer’s connection does not automatically release that position. The primary may keep generating log while the slot’s requirement remains unchanged. The operational risk is retained storage and an increasingly expensive catch-up or rebuild decision. Slot usability depends on retained WAL availability and the configured invalidation rules. ...

October 19, 2026 · 6 min · XB Field Notes
Sensor A keeps values 10,15,12 with predecessors NULL,10,15 and total 37 on every row. Filtering before lag changes the population.

Window functions give a row its neighbourhood

Window functions let a report retain individual readings while adding information from related rows. A sensor reading can show its predecessor, its change, and its share of the sensor’s total without reducing the sensor to one output row. Correctness depends on defining the population, the partition, and the ordering before interpreting those extra columns. ...

October 18, 2026 · 5 min · XB Field Notes
Rows 100 and 200 have state ready and enter ready_jobs; done row 101 is excluded. Query conditions must imply state equals ready.

Prepared plans must prove a partial-index predicate

A queue with a hundred ready jobs and thousands of completed jobs can benefit from an index containing only ready work. PostgreSQL calls this a partial index: its predicate determines which table rows have entries. The benefit depends on the actual query population and write pattern, not simply on making every index smaller. ...

October 17, 2026 · 4 min · XB Field Notes