Re: CREATE INDEX and HOT - revised design

From: "Pavan Deolasee" <pavan(dot)deolasee(at)gmail(dot)com>
To: "Simon Riggs" <simon(at)2ndquadrant(dot)com>
Cc: "Bruce Momjian" <bruce(at)momjian(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, "Pavan Deolasee" <pavan(dot)deolasee(at)enterprisedb(dot)com>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: CREATE INDEX and HOT - revised design
Date: 2007-03-28 18:12:19
Message-ID: 2e78013d0703281112l5498c03ejfc6b0cb1b731214c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 3/28/07, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:
>
>
>
> Set it at the end, not the beginning.

At the end of what ? It does not help to set it at the end of CREATE
INDEX because the transaction may not commit immediately. In
the meantime, many new transactions may start with
transaction id > xcreate. All these transactions can see the old
tuple (which we did not index) and can also see the index once
CREATE INDEX commits.

If you are indexing a table that hasn't just been created by you, set
> the xcreate field on pg_index at the *end* of the build using
> ReadNewTransactionId(). Any xid less than that sees the index as
> invalid. If you created the table in this transaction (i.e.
> createSubId != 0) then set xcreate to creating xid.

Why do we need to handle the case where table is created in
the same transaction ? Neither the table nor the index is visible
until we commit. So thats a simple case.

Thanks,
Pavan

--

EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavan Deolasee 2007-03-28 18:36:46 Re: CREATE INDEX and HOT - revised design
Previous Message Tom Lane 2007-03-28 18:11:09 Re: CREATE INDEX and HOT - revised design