Re: [HACKERS] Index recreation in vacuum - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] Index recreation in vacuum
Date
Msg-id 2246.948234775@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] Index recreation in vacuum  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: [HACKERS] Index recreation in vacuum
List pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> The beauty of doing a temp index while keeping the old one is that you
> can recover right away, and maybe allow the old index to be used while
> you vacuum?

Huh?  You've got the whole table locked exclusively for the duration
of the vacuum anyway.

In fact, the instant that vacuum does its internal commit, the old index
contents are actually *wrong*, and there is no possible value in keeping
them after that.  Might as well blow them away and recover the disk
space for use in constructing the new indexes.

Also, I agree with Dmitry's concern about peak disk space usage.  If
we are rebuilding large btree indexes then we are going to see about a
2X-normal peak usage anyway, for the sort temp file and the new index.
Making it 3X instead is just asking for trouble.  Especially since,
if you fail to rebuild the index, you are left with a corrupt index;
it doesn't agree with the vacuumed table...
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Index recreation in vacuum
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Index recreation in vacuum