feature request: index supported REINDEX for partial indexes on needle/haystack tables

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: feature request: index supported REINDEX for partial indexes on needle/haystack tables
Date: 2026-04-21 17:22:45
Message-ID: CAHyXU0yedXJ9EwXRyKMw2ddfSf1cGWJNAnTZn_SDz73SLvK4sw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Suppose you have an index:

CREATE INDEX ON huge_table WHERE something_transient;

...where something_transient represents a small amount records (the needle)
at any point in time, but touches many records up to the next REINDEX.
This is a common pattern in queue type processing tables.

The basic issue here is index bloat, which is a well understood problem.
However, there's an opportunity to have the index support its own rebuild,
since it can limit the number of records that need to be scanned.
If "something_transient" represents zero or near zero records relative to
the table's size, the REINDEX ought to be quite fast...almost a "TRUNCATE
INDEX" if the something_transient set is empty.

merlin

Browse pgsql-performance by date

  From Date Subject
Next Message Dirschel, Steve-CW 2026-04-27 15:52:06 Query performance
Previous Message Kristjan Mustkivi 2026-04-21 08:33:53 Re: table bloat very fast and free space can not be reused