Re: Temporarily very slow planning time after a big delete

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: walter(at)carezone(dot)com
Cc: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: Temporarily very slow planning time after a big delete
Date: 2019-05-21 18:36:30
Message-ID: CAH2-Wz=cVFP2XUuJvMJJNPc0VdCOGWqrz-oiWqjqoaEntSYbGQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Tue, May 21, 2019 at 11:27 AM Walter Smith <walter(at)carezone(dot)com> wrote:
> Very low. Probably less than ten over all time. I suspect the only use of the index is to rapidly find the processed=false rows, so the notifiable_type value isn’t important, really. It would probably work just as well on any other column.

This problem has been fixed in Postgres 12, which treats heap TID as a
tiebreaker column within B-Tree indexes. It sounds like you have the
right idea about how to work around the problem.

VACUUM will need to kill tuples in random locations in the low
cardinality index, since the order of tuples is unspecified between
duplicate tuples -- it is more or less random. VACUUM will tend to
dirty far more pages than is truly necessary in this scenario, because
there is no natural temporal locality that concentrates dead tuples in
one or two particular places in the index. This has a far more
noticeable impact on VACUUM duration than you might expect, since
autovacuum is throttled by delays that vary according to how many
pages were dirtied (and other such factors).

--
Peter Geoghegan

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Lev Kokotov 2019-05-22 04:28:07 Use Postgres as a column store by creating one table per column
Previous Message didier 2019-05-21 18:32:06 Re: Temporarily very slow planning time after a big delete