Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 48B799F9F18 for ; Mon, 3 Sep 2007 15:08:12 -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 70624-02 for ; Mon, 3 Sep 2007 15:08:03 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by postgresql.org (Postfix) with ESMTP id 129A59F9D03 for ; Mon, 3 Sep 2007 15:08:05 -0300 (ADT) Received: from Courts-MTA by gwmta.wicourts.gov with Novell_GroupWise; Mon, 03 Sep 2007 13:08:03 -0500 Message-Id: <46DC071D.EE98.0025.0@wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 7.0.2 Date: Mon, 03 Sep 2007 13:07:41 -0500 From: "Kevin Grittner" To: , "Shawn" Subject: Re: Slow Query References: <20070901102947.0c0a50a3@boffin.xmtservices.net> <46DA9522.EE98.0025.0@wicourts.gov> <20070903091558.0780b963@boffin.xmtservices.net> In-Reply-To: <20070903091558.0780b963@boffin.xmtservices.net> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/13 X-Sequence-Number: 26558 >>> On Mon, Sep 3, 2007 at 11:15 AM, in message <20070903091558.0780b963@boffin.xmtservices.net>, Shawn wrote:=20 > On Sun, 02 Sep 2007 10:49:09 -0500 "Kevin Grittner" > wrote: >=20 >> >>> On Sat, Sep 1, 2007 at 12:29 PM, in message >> <20070901102947.0c0a50a3@boffin.xmtservices.net>, Shawn >> wrote:=20 >> > update shawns_data set alias =3D null; >> > Even after VACUUM this simple line takes 35 sec to complete. >> =20 >> Would any rows already have a null alias when you run this? >> If so, try adding 'where alias is not null' to the query. >=20 > This one initially added about 10sec to the run but I added a HASH > index on the alias field and its now about 5 sec average runtime, a net > improvement. =20 Testing for null on 15,700 rows took five seconds more than the time saved from not updating some portion of the rows????? I've never seen anything remotely like that. =20 Did you ever capture the output of VACUUM VERBOSE against this table (as Tom requested)? =20 What happens if you run CLUSTER against this table before running one of these updates? (Be sure to do that VACUUM VERBOSE first, to see what the "old" state of the table was, and run it again after.) =20 What is the row count from the second update of the table in your script? (An overly loose join there could bloat the table.) =20 -Kevin =20