Re: CREATE INDEX and HOT - revised design

From: "Simon Riggs" <simon(at)2ndquadrant(dot)com>
To: "Pavan Deolasee" <pavan(dot)deolasee(at)gmail(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 17:12:52
Message-ID: 1175101972.4386.408.camel@silverbirch.site
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 2007-03-28 at 22:24 +0530, Pavan Deolasee wrote:

> Just when I thought we have nailed down CREATE INDEX, I realized
> that there something more to worry. The problem is with the HOT-chains
> created by our own transaction which is creating the index. We thought
> it will be enough to index the tuple at the head-of-the-chain since
> that
> would be the visible copy once the transaction commits. We thought
> of keeping the index unavailable for queries in pre-existing
> transactions
> by setting a new "xid" attribute in pg_index. The question is what
> value
> to assign to "xid". I though we would assign ReadNewTransactionId().

> Any idea how to handle this case ?

Set it at the end, not the beginning.

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.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-03-28 17:14:24 Modifying TOAST thresholds
Previous Message Alvaro Herrera 2007-03-28 17:11:05 Re: Arrays of Complex Types