Re: proposed TODO: non-locking CREATE INDEX / REINDEX

From: Hannu Krosing <hannu(at)skype(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: proposed TODO: non-locking CREATE INDEX / REINDEX
Date: 2005-06-10 14:54:11
Message-ID: 1118415252.4972.27.camel@fuji.krosing.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On R, 2005-06-10 at 09:47 -0400, Tom Lane wrote:
> Hannu Krosing <hannu(at)skype(dot)net> writes:
> > There are many ways this could be made to work, so it needs some
> > discussion.
>
> (1) when do you ever catch up?
>
> (2) if your answer to (1) involves increasing the strength of a lock,
> how do you avoid risk of deadlock?

No. I don't plan on locking the table at all.

The only thing that is changed during the initial fast-build-index is
that new tuples are inserted after CTID_INDEX_MIN, and after the initial
fastbuild index is done, the only restriction is that the index can't be
used in queries before the tuples between CTID_INDEX_MIN and
CTID_INDEX_MAX are added to the index.

As the number of tuples between CTID_INDEX_MIN and CTID_INDEX_MAX is
finite, they must be added in finite time, by which time the index will
be up-to-date and usable for querie planner. (i.e. (1) is done)

All tuples inserted after the initial fast-build-index has finished and
CTID_INDEX_MAX is fixed, are inserted into the index at the time of
inserting the tuple, like for any other index.

--
Hannu Krosing <hannu(at)skype(dot)net>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2005-06-10 14:59:05 Re: proposed TODO: non-locking CREATE INDEX / REINDEX
Previous Message Yann Michel 2005-06-10 14:51:21 Re: User Quota Implementation