Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id E1432B5DBC4 for ; Mon, 27 Jun 2011 12:37:50 -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 96036-05 for ; Mon, 27 Jun 2011 15:37:44 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from elizabeth.gransy.com (elizabeth.gransy.com [89.187.132.199]) by mail.postgresql.org (Postfix) with ESMTP id 983CCB5DBCB for ; Mon, 27 Jun 2011 12:37:44 -0300 (ADT) Received: from sq.gransy.com (localhost [127.0.0.1]) by elizabeth.gransy.com (Postfix) with ESMTP id E256315E410C; Mon, 27 Jun 2011 17:37:43 +0200 (CEST) Received: from 85.160.214.34 (SquirrelMail authenticated user tv@fuzzy.cz) by sq.gransy.com with HTTP; Mon, 27 Jun 2011 17:37:43 +0200 Message-ID: In-Reply-To: <4E089B6A.4000208@riskcontrollimited.com> References: <4E035649.20007@riskcontrollimited.com> <4E089B6A.4000208@riskcontrollimited.com> Date: Mon, 27 Jun 2011 17:37:43 +0200 Subject: Re: Long Running Update - My Solution From: tv@fuzzy.cz To: "Harry Mantheakis" Cc: pgsql-performance@postgresql.org User-Agent: SquirrelMail/1.4.21 MIME-Version: 1.0 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201106/247 X-Sequence-Number: 44180 > The mystery remains, for me: why updating 100,000 records could complete > in as quickly as 5 seconds, whereas an attempt to update a million > records was still running after 25 minutes before we killed it? Hi, there's a lot of possible causes. Usually this is caused by a plan change - imagine for example that you need to sort a table and the amount of data just fits into work_mem, so that it can be sorted in memory. If you need to perform the same query with 10x the data, you'll have to sort the data on disk. Which is way slower, of course. And there are other such problems ... > One thing remains crystal clear: I love Postgresql :-) regards Tomas