On Wed, Jan 29, 2020 at 2:50 PM Peter Geoghegan <p...@bowt.ie> wrote: > It's tempting to try to reason about the state of an index over time > like this, but I don't think that it's ever going to work well. > Imagine a unique index where 50% of all values are NULLs, on an > append-only table. Actually, let's say it's a non-unique index with > unique integers, and NULL values for the remaining 50% of rows -- that > way we don't get the benefit of the incoming-item-is-duplicate > heuristic.
I mean, if you guess wrong and deduplicate less frequently, you are no worse off than today. But it depends, too, on the magnitude. If a gain is both large and probable and a loss is both unlikely and improbable, then accepting a bit of slowdown when it happens may be the right call. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company