Skip to content
  1. Planet PostgreSQLGuides & Cases

    Deepak Mahto: Exploring PostgreSQL 19 – Part 2: SELECT expression INTO in PL/pgSQL

    PostgreSQL 19 closes the performance gap between SELECT expr INTO v and v := expr in PL/pgSQL, which was roughly 5x slower before. A 1,000,000-iteration benchmark on PostgreSQL 18 took 201.

    Brief · Based on the source excerpt

    Test conditionsMigrated Oracle and SQL Server PL/pgSQL code gains speed without rewrites; after upgrading to PostgreSQL 19, re-benchmark loop-heavy procedures that rely on SELECT ... INTO.

  2. Planet PostgreSQLGuides & Cases

    PostgreSQL 19 REPACK (CONCURRENTLY) in Practice: Reads and Writes Continue, but the Final Swap Still Waits on Locks

    PostgreSQL 19's REPACK (CONCURRENTLY) allowed reads and writes during the main rewrite, but the final table swap had to wait for an open read transaction to release its lock, so the operation is not fully lock-free. In the test, a regular VACUUM left the table at 70 MB while REPACK reduced it to 14 MB.

    Brief · Based on the source excerpt

    Why It MattersUse REPACK (CONCURRENTLY) to reclaim disk space from bloated tables without a full outage, but budget for the final ACCESS EXCLUSIVE swap and avoid long-running transactions; validate in a test database first.

  3. Planet PostgreSQLGuides & Cases

    PostgreSQL 19 DBA Walkthrough, Part 2: Read Your Writes with WAIT FOR LSN

    A two-session psql walkthrough shows how PostgreSQL 19 uses WAIT FOR LSN to read your writes on an asynchronous standby. It captures the WAL insert LSN on the same primary connection after commit and also covers timeouts, monitoring waiters, and a stalled standby.

    Brief · Based on the source excerpt

    Why It MattersWhen reads from an asynchronous standby must reflect a just committed write, the application can wait before reporting success without adding that wait to the primary’s synchronous commit path.

  4. Crunchy DataGuides & Cases

    Queries captured by pg_stat_statements can be re-run from psql by passing arguments with the \bind command when they are simple SELECT statements. Statements with IN lists don't work because pg_stat_statements collapses them; use EXPLAIN (GENERIC_PLAN) instead.

    Why It MattersThe approach works for parameterized replay of simple SELECTs sampled from pg_stat_statements; statements with IN lists must fall back to EXPLAIN (GENERIC_PLAN) since their parameters can't be matched.

  5. Lobste.rs DatabasesGuides & Cases

    Giving AI Agents Safe Access to PostgreSQL: Read-Only Roles, Temporary Credentials and Query Logging

    Restricting an AI agent to a read-only PostgreSQL role, read-only transactions or a read replica limits writes, but permissions are additive and PUBLIC grants can still allow updates.

    Why It MattersAdopting this requires automating credential provisioning and cleanup, and explicitly terminating existing sessions when access ends, since expired passwords do not close open connections.

  6. Lobste.rs DatabasesGuides & Cases

    ClickHouse Tests PostgreSQL 19 pg_plan_advice and Its Hazards

    ClickHouse tests PostgreSQL 19’s pg_plan_advice and pg_stash_advice on ClickHouse Managed Postgres, using scan and JOIN-order hints to address planner misestimates.

    Why It MattersUsing ClickHouse Managed Postgres tests, the article shows where PostgreSQL 19 plan advice helps and how stale or poor advice can degrade query performance.

  7. Planet PostgreSQLGuides & Cases

    Umair Shahid: Where 39% of the WAL Came From

    Umair Shahid breaks down a Supabase customer case writing 1. 8 TB of WAL per day, where about 39% was full-page-image overhead caused by the five-minute checkpoint_timeout default.

    Brief · Based on the source excerpt

    Why It MattersFor workloads that frequently modify hot tables and indexes, check whether repeated checkpoints are inflating WAL through full-page images rather than disabling the full-page writes that protect against torn pages.

  8. Planet PostgreSQLGuides & Cases

    Vibhor Kumar: Relevance Is Not Permission — Filter-First Vector Search in PostgreSQL

    Vibhor Kumar argues in a Planet PostgreSQL post that permission checks must live in PostgreSQL SQL rather than in application-side filtering after vector retrieval.

    Brief · Based on the source excerpt

    Why It MattersMaking access control a property of the data reduces the risk that autonomous agents omit permission checks, while filtering still needs to preserve enough candidates.

  9. CYBERTEC PostgreSQL BlogGuides & Cases

    How to Stabilize Query Plans in PostgreSQL 19 with pg_stash_advice

    PostgreSQL 19 uses pg_plan_advice and pg_stash_advice to constrain join order without rewriting SQL. In the example, a row estimate of 20 versus 990 led to a 405.646 ms query. Stored advice survives restarts but not pg_upgrade. cybertec-postgresql.com/en/pg…

    Why It MattersConstraining only the join order can guard against a bad choice caused by underestimated row counts while leaving the planner free to adapt join methods and scan strategies.

  10. Postgres.fmGuides & Cases

    Postgres.fm Breaks Down the Hidden Costs of CREATE TEMP TABLE

    Postgres. fm episode 193 examines the hidden costs of CREATE TEMP TABLE: dead tuples, catalog bloat, and the shared invalidation queue every session must read.

    Why It MattersWhen temporary tables are repeatedly created and dropped in the request path, distinguish baseline catalog churn from shared invalidation lock contention amplified by many idle sessions.

  11. pganalyze BlogGuides & Cases

    Postgres in Production, Part 6: Diagnosing High Cardinality Workloads in pg_stat_statements

    Part 6 of pganalyze's Postgres in Production series explains how to tell whether a workload is generating more unique normalized queries than pg_stat_statements.

    Why It MattersFor workloads that frequently generate variable-length IN lists, upgrading to PostgreSQL 18 can reduce statement entry usage through normalization, leaving room for other queries’ tuning metrics.