Re: CREATE INDEX and HOT - revised design

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

On 3/23/07, Hannu Krosing <hannu(at)skype(dot)net> wrote:
>
>
> >
> > My argument is that its enough to index only the LIVE tuple which
> > is at the end of the chain if we don't use the new index for queries
> > in transactions which were started before CREATE INDEX.
>
> You mean, which were started before CREATE INDEX completes ?
>
> Just wait for all concurrent transactions to complete before marking the
> index as usable in plans.

I thought there will be objections to that approach since it changes
the CREATE INDEX behavior and may also lead to new deadlock
conditions.

> I am
> > proposing to do that by storing an xid in the pg_index row.
>
> I don't think it is a good idea to store xid's anywhere but in xmin/xmax
> columns, as doing so would cause nasty xid wraparound problems.

May be we can use VACUUM to cleanup the xid. If xid is less than
OldtestXmin, the index is visible to all the transactions and can be
marked as InvalidTransactionId.

> >
> >
> > Oh, thanks for pointing that out. But thats certainly not fundamental
> > to the argument as you probably already guessed. The xid still
> > controls the usage of index for query planning, somewhat similar to
> > "isindvalid" flag for CREATE INDEX CONCURRENTLY.
>
> Xids are unstable and will come back to bite you after 2G transactions.
>
> Why not just use the "isindvalid" flag ?
>
>
Who would set the flag to true ? Unless of course we are waiting in
CREATE INDEX. But that seems to be less acceptable to me.

Thanks,
Pavan

--

EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Teodor Sigaev 2007-03-23 11:58:10 tsearch_core for inclusion
Previous Message Hannu Krosing 2007-03-23 08:36:01 Re: CREATE INDEX and HOT - revised design