Articles › database
TAG ARCHIVE

Everything on database.

6 articles tagged database, sorted newest first.

postgres

Upgrade Postgres Under a Live Laravel App with Logical Replication

pg_upgrade needs the database stopped for a window nobody can predict. Logical replication gets you a cutover measured in seconds — if you handle sequences, DDL and your queue workers correctly.

17 min read →
laravel

Sort Users by Their Last Order Without an N+1: Eloquent Subquery Selects

An admin table needs a sortable Last ordered column. Eager loading fixes the query count but not the memory, and it cannot sort at all. The subquery select does both in four lines.

12 min read →
laravel

The Job That Ran Before the Row Existed: Dispatching Inside Laravel Transactions

A queued job throws ModelNotFoundException for a row that plainly exists. It is not a bug in the job — it is a worker that got there before your transaction committed.

9 min read →
laravel

Laravel Read Replicas: Route Reads to a Follower Without Serving Stale Data

The read/write split is four lines of config. The read-after-write bugs that turn up a fortnight later are the actual work — and sticky only covers one of them.

11 min read →
laravel

Run Laravel Behind PgBouncer in Transaction Mode Without Breaking Booleans

PgBouncer's transaction mode breaks PDO prepared statements, and the classic emulated-prepares workaround then breaks your boolean columns. Laravel 13.17 fixes both properly.

11 min read →
laravel

Auto-Delete Stale Records with Laravel's Prunable Trait

Some tables only ever grow. Here's how Laravel's Prunable trait deletes stale rows on a schedule — safely, in chunks, with a hook for cleaning up related files.

6 min read →