Skip site navigation (1) Skip section navigation (2)

Re: Fast index build vs. PITR

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Fast index build vs. PITR
Date: 2004-06-01 17:55:38
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl> writes:

> The big problem I see with this kind of approaches is that building an
> index from scratch can take a huge amount of time, because you have to
> sort the data.  Building from WAL does not have this problem, so it can
> be much faster.  

I'm not clear that building from WAL is really going to be that much faster.
A) algorithmically it's only the factor of log(n) that you're talking about.
and B) the WAL will have records for every write, not just the final product,
so it might potentially have a lot more writes to do.

I thought part of the original problem was specifically that going through WAL
slowed down the index rebuild much more than a factor of 2, which would tend
to imply that in fact rebuilding from WAL isn't going to be as fast as you
might expect.

Another possibility is doing the complete index build without going through
WAL and then inserting a complete copy of the index into the WAL without
syncing or activating the rebuilt index until the copy do WAL is done. That
kind of sucks since it's equivalent to just taking another backup of the data
files immediately after the rebuild, but might be a more direct solution using
the existing tools.

> Of course, when you are restoring using a PITR approach you probably want it
> to be very fast, and have the DB running with as little quirks as possible,
> as soon as possible.

This is certainly true.


In response to


pgsql-hackers by date

Next:From: Mike BenoitDate: 2004-06-01 19:04:15
Subject: Re: Official Freeze Date for 7.5: July 1st, 2004
Previous:From: Bob.HenkelDate: 2004-06-01 17:50:39
Subject: Re: Official Freeze Date for 7.5: July 1st, 2004

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group