pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: arnaulist@andromeiberica.com
Cc: pgsql-admin@postgresql.org
Subject: Re: Problems restoring big tables
Date: Fri, 05 Jan 2007 22:02:45 -0500
Message-ID: <25554.1168052565@sss.pgh.pa.us> (raw)
In-Reply-To: <459E7D83.3030307@andromeiberica.com>
References: <459E7D83.3030307@andromeiberica.com>

Arnau <arnaulist@andromeiberica.com> writes:
>    I have to restore a database that its dump using custom format (-Fc) 
> takes about 2.3GB. To speed the restore first I have restored everything 
> except (played with pg_restore -l) the contents of some tables that's 
> where most of the data is stored.

I think you've outsmarted yourself by creating indexes and foreign keys
before loading the data.  That's *not* the way to make it faster.

> pg_restore: ERROR:  out of memory
> DETAIL:  Failed on request of size 32.
> CONTEXT:  COPY statistics_operators, line 25663678: "137320348  58618027 

I'm betting you ran out of memory for deferred-trigger event records.
It's best to load the data and then establish foreign keys ... indexes
too.  See
http://www.postgresql.org/docs/8.2/static/populate.html
for some of the underlying theory.  (Note that pg_dump/pg_restore
gets most of this stuff right already; it's unlikely that you will
improve matters by manually fiddling with the load order.  Instead,
think about increasing maintenance_work_mem and checkpoint_segments,
which pg_restore doesn't risk fooling with.)

			regards, tom lane



view thread (3+ messages)  latest in thread

Message-ID: <25554.1168052565@sss.pgh.pa.us>
Permalink:  ../25554.1168052565@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/25554.1168052565@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, arnaulist@andromeiberica.com
  Subject: Re: Problems restoring big tables
  In-Reply-To: <25554.1168052565@sss.pgh.pa.us>
  References: <459E7D83.3030307@andromeiberica.com> <25554.1168052565@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox