Re: [HACKERS] Index recreation in vacuum

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: [HACKERS] Index recreation in vacuum
Дата
Msg-id 200001181936.OAA16687@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] Index recreation in vacuum  (Dmitry Samersoff <dms@wplus.net>)
Список pgsql-hackers
[Charset koi8-r unsupported, filtering to ASCII...]
> Bruce Momjian wrote:
> 
> > >
> > > The problem is how to invalidate/validate indexes.
> > > Of cource natural way is to drop/create indexes but the
> > > definition of indexes would be lost in case of abort/crash.
> >
> > My idea would be to create a new index that is a random index name.
> > Then, do rename(), which is an atomic OS operation putting the new index
> > file in place of the old name.  Seems that would work well.
> 
> Yes, but it can cause disk space problem for very large indices.

Well, one would hope you have enough disk space free for that.

> Moreover,  you need firts unlink old index file than do rename(),
> it is not atomic.

    rename - change the name of a file
    int    rename(const char *from, const char *to);

...    Rename() causes the link named from to be renamed as to. If to exists, it    is first removed.  Both from and to
mustbe of the same type (that is,    both directories or both non-directories), and must reside on the same    file
system.

> 
>   May be better way is to create tmp file containing index description,
> undestandable for vacuum.

That would work too.  pg_dump call for just the index, and run it though
a pg_exec_desc() call to recreate.


--  Bruce Momjian                        |  http://www.op.net/~candle pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


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

Предыдущее
От: Dmitry Samersoff
Дата:
Сообщение: Re: [HACKERS] Index recreation in vacuum
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [PATCHES] docs done Re: [HACKERS] LIBPQ patches ...