Re: Fastest way to restore a database

From: William Garrison <postgres(at)mobydisk(dot)com>
To: Greg Smith <gsmith(at)gregsmith(dot)com>
Cc: Postgres General List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Fastest way to restore a database
Date: 2008-09-12 19:03:00
Message-ID: 48CABCE4.4040903@mobydisk.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks so much!

So... if I am using pg_dump and pg_restore with a compressed backup,
then it is using COPY, correct? And I think that would follow a CREATE
TABLE statement as mentioned in the first link... so no WAL files written?

Greg Smith wrote:
> On Fri, 12 Sep 2008, William Garrison wrote:
>
>> Is there a definitive list of things to do?
>
> That section of the documention is pretty good:
> http://www.postgresql.org/docs/current/static/populate.html
>
> The main thing it's missing is a discussion of how to cut down on disk
> commit overhead by either usinc async commit or turning fsync off. If
> you've got a good caching controller that may not be needed though.
>
> The other large chunk of information it doesn't really go into is what
> server tuning you could do to improve general performance, which
> obviously would then help with loading as well.
> http://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server goes
> over much of that.
>
>> * Turn off full_page_writes
>> Don’t write the WAL archives in a safe way. But we don’t need WAL
>> archives during a restore. Future versions of postgres will let you
>> turn off WAL archives entirely
>
> Ideally you'd be using COPY such that the table was just created or
> truncated before loading, which (if archive_mode is off) keeps them
> from being WAL logged, as described in 14.4.7. If you do that and
> vastly increase checkpoint_segments, full_page_writes has minimal impact.
>
>> * Increase the checkpoint_segments parameter (the default is 3 –
>> so... maybe 10?)
>
> 64-256 is the usual range you'll see people using for bulk loading.
>
>> * Increase the maintenance_work_mem setting to 512MB
>
> I haven't really seen any real improvement setting that over 256MB.
> If you've got RAM to waste it doesn't really matter if you set it too
> high though.
>
> --
> * Greg Smith gsmith(at)gregsmith(dot)com http://www.gregsmith.com Baltimore, MD

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2008-09-12 19:07:07 Re: Fastest way to restore a database
Previous Message Erik Jones 2008-09-12 18:59:11 Re: connection timeouts and "killing" users