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

Поиск
Список
Период
Сортировка
От Kenneth Marshall
Тема Re: proposed TODO: non-locking CREATE INDEX / REINDEX
Дата
Msg-id 20050610182701.GB26755@it.is.rice.edu
обсуждение исходный текст
Ответ на Re: proposed TODO: non-locking CREATE INDEX / REINDEX  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Fri, Jun 10, 2005 at 12:12:05PM -0400, Tom Lane wrote:
> Hannu Krosing <hannu@skype.net> writes:
> > 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)
> 
> ... and by which time, some more could have been added after
> CTID_INDEX_MAX.  Have you forgotten Zeno's paradox?  I don't see a
> reason to assume the indexer can *ever* catch up --- it's entirely
> likely that adding a new unindexed row is faster than adding an index
> entry for it.
> 
> > 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.
> 
> This implies that you are hoping for an asynchronous change in the
> behavior of other processes, which you are not going to get without
> taking out locks, which is what you wanted to avoid.
> 

Maybe I am misunderstanding something, but the scenario seems to be
in the ever simpler pseudo-code:

1. Issue CREATE INDEX command
2. Record CTID_INDEX_MAX
3. Mark the index as created with the "FAST" flag. This means that all  of the normal INSERT/DELETE processing with
regardsto the data tuples  and the index tuples is performed. i.e. the new tuples cannot be added  faster than the
indexbecause the insert of the data tuple does not  commit until the index entries are added.
 
4. Start generating the index entries until you reach CTID_INDEX_MAX
5. Mark the index as LIVE.

Ken Marshall


В списке pgsql-hackers по дате отправления:

Предыдущее
От: ziga@mail.ljudmila.org
Дата:
Сообщение: Re: Request for Comments: ALTER [OBJECT] SET SCHEMA
Следующее
От: Scott Marlowe
Дата:
Сообщение: Re: [GENERAL] Issue with adding ORDER BY to EXCEPT.