Production query plans without production data
AI-generated summary of reporting by Simon Willison’s Weblog. Read the original for the full story.
Why it matters
Developers can now reproduce production query plans in test environments by copying tiny statistics files instead of cloning gigabytes of real data.
PostgreSQL 18, released in September 2025, added two functions that copy the small internal notes the database uses to plan fast queries. Developers usually cannot recreate slow queries in test databases because test data looks different from live data. Now they can import just those notes, a text file under 1MB, instead of copying hundreds of gigabytes of production data. SQLite, a smaller database, already had the same trick.
Database teams spend time and infrastructure syncing production data into development environments just to debug slow queries, because query performance depends on data statistics that differ between environments. PostgreSQL 18's statistics-restore functions let teams replicate production query behavior with a text file under 1MB instead of a copy that may be hundreds of gigabytes. The payoff is faster debugging and lower data-transfer overhead; teams on older PostgreSQL versions gain nothing.
PostgreSQL 18 adds pg_restore_relation_stats() and pg_restore_attribute_stats(), which inject planner statistics such as null_frac, avg_width, n_distinct, and most_common_vals/freqs. An example marks a status column as 95% 'delivered', letting the planner choose an index scan for rare values and a sequential scan for common ones. Radim Marek notes statistics dumps for a database with hundreds of tables fit under 1MB. D. Richard Hipp confirmed SQLite offers the same via writable sqlite_stat1/sqlite_stat4 tables.
Read the original
This summary exists to save you time, not to replace the source.
Key terms
Was this summary useful?
One click, anonymous. It tells us which summaries to re-run.
Related reading
Code-driven AI illustrations are more useful than images from dedicated image models
Code-driven AI illustrations let designers edit assets directly in code, saving time on iteration and ensuring consistency, which is a game-changer for teams that need rapid, reusable visual content.
A hierarchical note-taking app for building large personal knowledge bases
Trilium lets users build and navigate massive personal knowledge bases without duplicating content, saving time on organization and retrieval.
Desktop apps in Go with native UI or web frontend
Go developers can now ship cross-platform desktop and mobile apps in a single small binary without cgo or heavy runtimes, cutting build complexity and deployment size.
OpenBitFun: an agent workspace with four harness modes and phone remote control
OpenBitFun lets agents run on any machine and be controlled from a phone, eliminating the need to choose between local power and remote access, saving developers time switching contexts.
Intel One Mono: a monospaced font designed with low-vision developers
Developers with low vision or eye fatigue can read code more clearly, reducing errors and improving productivity.