Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 72A2263242D for ; Wed, 18 Aug 2010 19:42:25 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 86639-01 for ; Wed, 18 Aug 2010 22:42:16 +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 54C3B6323A3 for ; Wed, 18 Aug 2010 19:42:17 -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 o7IMgFxW015119; Wed, 18 Aug 2010 18:42:15 -0400 (EDT) To: Saadat Anwar cc: pgsql-performance@postgresql.org Subject: Re: Copy performance issues In-reply-to: References: Comments: In-reply-to Saadat Anwar message dated "Wed, 18 Aug 2010 09:25:39 -0700" Date: Wed, 18 Aug 2010 18:42:14 -0400 Message-ID: <15118.1282171334@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/210 X-Sequence-Number: 40053 Saadat Anwar writes: > I am having severe COPY performance issues after adding indices. What used > to take a few minutes (without indices) now takes several hours (with > indices). I've tried to tweak the database configuration (based on Postgres > documentation and forums), but it hasn't helped as yet. Perhaps, I haven't > increased the limits sufficiently. Dropping and recreating indices may not > be an option due to a long time it takes to rebuild all indices. I suspect your problem is basically that the index updates require a working set larger than available RAM, so the machine spends all its time shuffling index pages in and out. Can you reorder the input so that there's more locality of reference in the index values? Also, my first reaction to that schema is to wonder whether the lat/lon indexes are worth anything. What sort of queries are you using them for, and have you considered an rtree/gist index instead? regards, tom lane