OFFSET pagination gets slower the deeper you go. Keyset pagination is constant time. Here is how to switch over and the cases where you cannot.
Database Topic Archive
Slow Queries Articles
Query plans, EXPLAIN ANALYZE, planner regressions, pagination, joins, and statistics.
A practical slow-query incident workflow: find the fingerprint, prove the bottleneck, avoid the tempting wrong fix, and ship the smallest change that actually holds.
Cloud SQL maintenance windows are mostly fine and occasionally not. Here is what happens during them, what gets restarted, and how to make sure your application survives.
N+1 is the most common ORM-induced performance bug. The query count tells the story; the application code makes it impossible to spot at review time.
Prepared statements skip the planning step on repeated execution. Sometimes that is a 5x speedup. Sometimes it is a 50x slowdown. Knowing the difference matters.
Bad plans usually start with bad row estimates. Fix the first wrong estimate and the rest of the plan often stops looking mysterious.
Plan regressions are painful because the SQL did not change. The work is proving the plan changed, finding the estimate or stats shift, and restoring the safe path.
auto_explain is for the slow plan you cannot reproduce later. It captures the execution plan when the bad thing actually happens.