Microsoft Azure Database for PostgreSQL Blog· richyen·· 20h agoFeatured
PostgreSQL 19 GIN VACUUM Tested Beyond Shared Buffer Capacity
PostgreSQL 19 GIN VACUUM: When the Index Outgrows the Cache
Brief · Based on the source excerpt
PostgreSQL 19 adds streaming reads for GIN VACUUM cleanup. On Azure Database for PostgreSQL with 16 GiB of shared_buffers, median cleanup speedups over 18.6 were 1.27x for a 21.30 GiB GIN index and 2.20x for a 26.62 GiB index. Smaller indexes finished in under a second.
Why It Matters
When assessing PostgreSQL 19’s GIN cleanup gains, whether the index fits in shared buffers is more informative than table row count alone.
Technical Breakdown · Distilled from the original source
Why GIN cleanup can read so many pages
- GIN indexes can cover words in a document, elements in an array, or keys and values in JSONB. Unlike a simple index entry for a single scalar key, one heap row can contribute multiple GIN entries. A table can therefore have a substantial GIN index even when its row count looks ordinary.
VACUUMmay need to walk a large portion of the index, and the amount of heap cleanup is not necessarily proportional to the amount of index reading. PostgreSQL19lets this read path use streaming reads. Changing how pages are read may save little time when those pages are already in shared buffers.
Testing on both sides of shared buffer capacity
- The author compared PostgreSQL
18.6and19across three independent pairs of matched Azure Database for PostgreSQL Flexible Server deployments, with a dedicated runner for each database. Index sizes ranged from 0.50 GiB to 26.62 GiB, withshared_buffersset to 16 GiB, so the comparison covered indexes both smaller and larger than shared buffer capacity. - Smaller indexes finished cleanup in under a second. Compared with PostgreSQL
18.6, PostgreSQL19achieved median GIN cleanup speedups of 1.27x at 21.30 GiB and 2.20x at 26.62 GiB. The size of the benefit depends on the workload and environment.
Source: Microsoft Azure Database for PostgreSQL Blog· techcommunity.microsoft.com
PG Radar summarizes verified changes and impact. Read the original post for full technical details and code samples.