Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id B6E9C9FC109 for ; Thu, 28 Jun 2007 04:02:51 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 75271-05-2 for ; Thu, 28 Jun 2007 04:02:42 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by postgresql.org (Postfix) with ESMTP id C4E0F9FC0FE for ; Thu, 28 Jun 2007 04:02:45 -0300 (ADT) Received: from server3.office.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id 9AFCE75028; Thu, 28 Jun 2007 08:02:44 +0100 (BST) Received: from [192.168.1.36] (dell36.office.archonet.com [192.168.1.36]) by server3.office.archonet.com (Postfix) with ESMTP id 6024C2740E6; Thu, 28 Jun 2007 08:02:51 +0100 (BST) Message-ID: <46835D14.6010507@archonet.com> Date: Thu, 28 Jun 2007 08:02:44 +0100 From: Richard Huxton User-Agent: Thunderbird 2.0.0.0 (X11/20070326) MIME-Version: 1.0 To: Chris Cc: Tom Lane , Pgsql performance Subject: Re: update query taking too long References: <46834124.5010600@gmail.com> <21072.1183009270@sss.pgh.pa.us> <46835252.5070901@gmail.com> <468357B2.1040205@archonet.com> <46835A16.3050602@gmail.com> In-Reply-To: <46835A16.3050602@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/619 X-Sequence-Number: 25652 Chris wrote: > db=# UPDATE email_upd_test SET domainname=substring(email from > position('@' in email)); > UPDATE 1000000 > Time: 43796.030 ms > > I think I'm I/O bound from my very limited understanding of vmstat. Well, 43 seconds to update 1 million rows suggests your real query should be complete in a few minutes, even if your real table has more columns. Could you check again and just make sure you don't have a foreign key referencing this table? I suspect a large table without an index on the referencing column. If you can't see anything, cancel the long-running query, run VACUUM FULL VERBOSE on the table, ANALYSE VERBOSE and then try it again. There's something very odd here. -- Richard Huxton Archonet Ltd