Re: CREATE INDEX and HOT - revised design - Mailing list pgsql-hackers

From Pavan Deolasee
Subject Re: CREATE INDEX and HOT - revised design
Date
Msg-id 2e78013d0703281112l5498c03ejfc6b0cb1b731214c@mail.gmail.com
Whole thread Raw
In response to Re: CREATE INDEX and HOT - revised design  ("Simon Riggs" <simon@2ndquadrant.com>)
Responses Re: CREATE INDEX and HOT - revised design  ("Simon Riggs" <simon@2ndquadrant.com>)
List pgsql-hackers


On 3/28/07, Simon Riggs <simon@2ndquadrant.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

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: CREATE INDEX and HOT - revised design
Next
From: "Pavan Deolasee"
Date:
Subject: Re: CREATE INDEX and HOT - revised design