Re: Skip all-visible pages during second HeapScan of CIC

From: Andres Freund <andres(at)anarazel(dot)de>
To: Peter Geoghegan <pg(at)bowt(dot)ie>
Cc: Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Skip all-visible pages during second HeapScan of CIC
Date: 2017-03-03 23:19:32
Message-ID: 20170303231932.eabqyedt6att2xfy@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2017-03-03 15:12:04 -0800, Peter Geoghegan wrote:
> On Tue, Feb 28, 2017 at 5:42 AM, Pavan Deolasee
> <pavan(dot)deolasee(at)gmail(dot)com> wrote:
> > During the second heap scan of CREATE INDEX CONCURRENTLY, we're only
> > interested in the tuples which were inserted after the first scan was
> > started. All such tuples can only exists in pages which have their VM bit
> > unset. So I propose the attached patch which consults VM during second scan
> > and skip all-visible pages. We do the same trick of skipping pages only if
> > certain threshold of pages can be skipped to ensure OS's read-ahead is not
> > disturbed.
>
> BTW, is there any danger of VACUUM acquiring a lock on the heap
> relation (i.e. vacuuming it) after the first CIC transaction ends, but
> before the second CIC transaction begins?

We hold session level locks to prevent such danger.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-03-04 00:16:04 Re: [COMMITTERS] pgsql: Use asynchronous connect API in libpqwalreceiver
Previous Message Peter Geoghegan 2017-03-03 23:12:04 Re: Skip all-visible pages during second HeapScan of CIC