Everything on database.
5 articles tagged database, sorted newest first.
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.
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.
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.
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.
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.