Re: CREATE INDEX and HOT (was Question:pg_classattributes and race conditions ?)

From: "Simon Riggs" <simon(at)2ndquadrant(dot)com>
To: "Pavan Deolasee" <pavan(dot)deolasee(at)enterprisedb(dot)com>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <pgsql-hackers(at)postgresql(dot)org>, "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>
Subject: Re: CREATE INDEX and HOT (was Question:pg_classattributes and race conditions ?)
Date: 2007-03-19 11:21:43
Message-ID: 1174303304.4160.709.camel@silverbirch.site
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 2007-03-19 at 16:06 +0530, Pavan Deolasee wrote:
> Simon Riggs wrote:
> >
> > This problem is solved by moving the wait (for all transactions in
> > reference snapshot to finish) so that it is now between the first and
> > second scans, as described.
> >
> > During the second Vscan we would prune each block, so the only remaining
> > tuple in the block when the second scan sees it would be (10,30) and it
> > would no longer be a HOT tuple - the index would have a pointer to it,
> > so no new index pointer would be added. The pointer to (10,30) is the
> > same pointer that was added in the first phase for the tuple (10,20).
> >
>
> The problem is that in the first phase, the pointer was inserted
> with key=20 whereas now its changed to 30. So we need to delete the old
> index entry and add a new one.

So don't index HOT tuples in the first phase, wait until the second.
That should be just a single if() test in IndexBuildHeapScan().

--
Simon Riggs
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2007-03-19 12:05:19 Re: CREATE INDEX and HOT (was Question: pg_classattributes and race conditions ?)
Previous Message Heikki Linnakangas 2007-03-19 11:00:21 Re: modifying the tbale function