Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id BC203633112 for ; Wed, 25 Aug 2010 15:37:55 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 10539-06 for ; Wed, 25 Aug 2010 18:37:43 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 23F1B632B89 for ; Wed, 25 Aug 2010 15:37:43 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id o7PIbTkH023106; Wed, 25 Aug 2010 14:37:29 -0400 (EDT) To: Kasia Tuszynska cc: "pgsql-admin@postgresql.org" Subject: Re: loading a lot of data on windows is very slow In-reply-to: <232B5217AD58584C87019E8933556D11021426D18F@redmx2.esri.com> References: <232B5217AD58584C87019E8933556D11021426D18F@redmx2.esri.com> Comments: In-reply-to Kasia Tuszynska message dated "Wed, 25 Aug 2010 11:18:33 -0700" Date: Wed, 25 Aug 2010 14:37:29 -0400 Message-ID: <23105.1282761449@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201008/223 X-Sequence-Number: 35472 Kasia Tuszynska writes: > PG: 8.3.8 > 2010-08-18 20:29:42 PDT ERROR: out of memory > 2010-08-18 20:29:42 PDT DETAIL: Failed on request of size 134217728. What command is this failure occurring in? There aren't that many that would try to inhale your full work_mem in one gulp like that. The short answer here is probably that 32-bit Windows is not the platform to be trying to do memory-intensive work on, and you ought to get yourself a real operating system and/or a 64-bit machine. You could make it run within Windows' restrictions by cutting work_mem, maintenance_work_mem, and/or shared_buffers, but given that it's already taking a ridiculously long time, that doesn't seem like a path to a solution. Alternatively, you might be able to optimize the data load process a bit. Have you read http://www.postgresql.org/docs/8.3/static/populate.html ? I'm suspicious in particular that you might be trying to enforce foreign keys incrementally, which is usually a bad approach for large data loads. Also, I'd advise rethinking the choice of PG 8.3.x if possible. There are relevant performance improvements in 8.4.x. > Client: In house application, I checked to see if it is not doing anything silly, it seems to be doing everything as expected, indexes are created after a table has loaded, we commit every 1000 inserts... Committing after every few inserts is *not* an optimization for Postgres. Try kicking that number up a few orders of magnitude. regards, tom lane