Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 6B1139FBBF7 for ; Wed, 13 Jun 2007 15:15:27 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 41207-05 for ; Wed, 13 Jun 2007 15:15:14 -0300 (ADT) 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 DB6209FBBBD for ; Wed, 13 Jun 2007 15:15:22 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id l5DIFLx2014902; Wed, 13 Jun 2007 14:15:21 -0400 (EDT) To: Mark Makarowsky cc: pgsql-performance@postgresql.org Subject: Re: Update table performance problem In-reply-to: <886101.35974.qm@web32203.mail.mud.yahoo.com> References: <886101.35974.qm@web32203.mail.mud.yahoo.com> Comments: In-reply-to Mark Makarowsky message dated "Wed, 13 Jun 2007 10:13:50 -0700" Date: Wed, 13 Jun 2007 14:15:20 -0400 Message-ID: <14901.1181758520@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/246 X-Sequence-Number: 25279 Mark Makarowsky writes: > "Hash Join (cost=15590.22..172167.03 rows=383654 > width=215) (actual time=1473.297..43032.178 > rows=383654 loops=1)" > " Hash Cond: (co.xno = fco.xno)" > " -> Seq Scan on co (cost=0.00..123712.64 > rows=384964 width=195) (actual time=440.196..37366.682 > rows=384964 loops=1)" > " -> Hash (cost=7422.54..7422.54 rows=383654 > width=34) (actual time=995.651..995.651 rows=383654 > loops=1)" > " -> Seq Scan on fco (cost=0.00..7422.54 > rows=383654 width=34) (actual time=4.641..509.947 > rows=383654 loops=1)" > "Total runtime: 378258.707 ms" According to the top line, the actual scanning and joining took 43 sec; so the rest of the time went somewhere else. Possibilities include the actual data insertion (wouldn't take 5 minutes), index updates (what indexes are on this table?), constraint checks, triggers, ... You failed to mention which PG version this is. 8.1 and up would show time spent in triggers separately, so we could eliminate that possibility if it's 8.1 or 8.2. My suspicion without any data is a lot of indexes on the table. regards, tom lane