Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 189E49FA183 for ; Mon, 25 Jun 2007 20:39:37 -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 89827-04 for ; Mon, 25 Jun 2007 20:39:23 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from mexforwardwc.lss.emc.com (unknown [137.69.117.200]) by postgresql.org (Postfix) with ESMTP id E11659FBA3C for ; Mon, 25 Jun 2007 20:39:29 -0300 (ADT) Received: from mailhubwc.lss.emc.com (buto.lss.emc.com [137.69.224.85]) by mexforwardwc.lss.emc.com (Switch-3.2.5/Switch-3.1.7) with ESMTP id l5PNd3QB027603; Mon, 25 Jun 2007 16:39:04 -0700 (PDT) Received: from avaexch01.avamar.com (avaexch01.avamar.com [128.222.199.14]) by mailhubwc.lss.emc.com (Switch-3.2.5/Switch-3.1.7) with ESMTP id l5PNd2ud016166; Mon, 25 Jun 2007 16:39:02 -0700 (PDT) Received: from 128.222.235.22 ([128.222.235.22]) by avaexch01.avamar.com ([128.222.199.14]) with Microsoft Exchange Server HTTP-DAV ; Mon, 25 Jun 2007 23:39:01 +0000 Received: from nickel.avamar.com by avaexch01; 25 Jun 2007 16:39:02 -0700 Subject: Re: From: Ed Tyrrill To: Stephen Frost Cc: pgsql-performance@postgresql.org In-Reply-To: <20070625215654.GF7531@tamriel.snowman.net> References: <20070625215654.GF7531@tamriel.snowman.net> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Mon, 25 Jun 2007 16:39:02 -0700 Message-Id: <1182814742.6477.5.camel@nickel.avamar.com> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-27.rhel4.6) X-PMX-Version: 4.7.1.128075, Antispam-Engine: 2.5.1.298604, Antispam-Data: 2007.6.25.160433 X-PerlMx-Spam: Gauge=, SPAM=1%, Reasons='EMC_FROM_0+ -3, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __SANE_MSGID 0' X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/591 X-Sequence-Number: 25624 On Mon, 2007-06-25 at 17:56 -0400, Stephen Frost wrote: > Was the 'work_mem' set to the same thing on all these runs? Also, you > might try increasing the 'work_mem' under 8.2.4, at least for this query > (you can set it by just doing: set work_mem = '2GB'; or similar in psql, > or you can change the default in postgresql.conf). > > The big thing of note, it seems, is that you've got enough memory and > it's coming out faster when doing a hash-join vs. a sort + merge-join. > Could likely be because it doesn't think there's enough work memory > available for the hash, which might change based on the values it gets > from the statistics on how frequently something shows up, etc. > > Enjoy, > > Stephen Yes, work_mem was set to 128MB for all runs. All settings were the same except for the change to default_statistics_target. I'm certainly memory constrained, but giving 2GB to one one session doesn't allow other sessions to do anything. Possibly when we upgrade to 16GB. :-)