Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 0EC6264FC32 for ; Mon, 22 Dec 2008 07:06:43 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 90546-09 for ; Mon, 22 Dec 2008 07:06:40 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from viefep18-int.chello.at (viefep17-int.chello.at [62.179.121.37]) by mail.postgresql.org (Postfix) with ESMTP id DF4BD64FC2F for ; Mon, 22 Dec 2008 07:06:39 -0400 (AST) Received: from edge05.upc.biz ([192.168.13.212]) by viefep18-int.chello.at (InterMail vM.7.09.01.00 201-2219-108-20080618) with ESMTP id <20081222110603.PTOV10001.viefep18-int.chello.at@edge05.upc.biz> for ; Mon, 22 Dec 2008 12:06:03 +0100 Received: from [192.168.1.104] ([89.134.230.11]) by edge05.upc.biz with edge id uB621a0560FQLHV05B63P1; Mon, 22 Dec 2008 12:06:03 +0100 X-SourceIP: 89.134.230.11 Message-ID: <494F749A.5090603@shopzeus.com> Date: Mon, 22 Dec 2008 12:06:02 +0100 From: Laszlo Nagy User-Agent: Thunderbird 2.0.0.18 (X11/20081125) MIME-Version: 1.0 To: "pgsql-performance@postgresql.org" Subject: Slow table update Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.125 tagged_above=0 required=5 tests=DNS_FROM_RFC_BOGUSMX=2.125 X-Spam-Level: ** X-Archive-Number: 200812/185 X-Sequence-Number: 32221 SQL: update product set sz_category_id=null where am_style_kw1 is not null and sz_category_id is not null query plan: "Seq Scan on product (cost=0.00..647053.30 rows=580224 width=1609)" " Filter: ((am_style_kw1 IS NOT NULL) AND (sz_category_id IS NOT NULL))" Information on the table: row count ~ 2 million table size: 4841 MB toast table size: 277mb indexes size: 4434 MB Computer: FreeBSD 7.0 stable, Dual Xeon Quad code 5420 2.5GHZ, 8GB memory, 6 ES SATA disks in hw RAID 6 (+2GB write back cache) for the database. Autovacuum is enabled. We also perform "vacuum analyze" on the database, each day. Here are some non-default values from postgresql.conf: shared_buffers=400MB maintenance_work_mem = 256MB max_fsm_pages = 1000000 There was almost no load on the machine (CPU: mostly idle, IO: approx. 5% total) when we started this update. Maybe I'm wrong with this, but here is a quick calculation: the RAID array should do at least 100MB/sec. Reading the whole table should not take more than 1 min. I think about 20% of the rows should have been updated. Writting out all changes should not take too much time. I believe that this update should have been completed within 2-3 minutes. In reality, after 2600 seconds I have cancelled the query. We monitored disk I/O and it was near 100% all the time. What is wrong? Thank you, Laszlo