Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 20CA49FB1DE for ; Fri, 5 Jan 2007 23:02:58 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 36562-09 for ; Fri, 5 Jan 2007 23:02:48 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 592519FB1DD for ; Fri, 5 Jan 2007 23:02:48 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id l0632j61025555; Fri, 5 Jan 2007 22:02:45 -0500 (EST) To: arnaulist@andromeiberica.com cc: pgsql-admin@postgresql.org Subject: Re: Problems restoring big tables In-reply-to: <459E7D83.3030307@andromeiberica.com> References: <459E7D83.3030307@andromeiberica.com> Comments: In-reply-to Arnau message dated "Fri, 05 Jan 2007 17:32:03 +0100" Date: Fri, 05 Jan 2007 22:02:45 -0500 Message-ID: <25554.1168052565@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/52 X-Sequence-Number: 24208 Arnau 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