Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id E14B9632FFB for ; Tue, 3 Mar 2009 13:31:12 -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 43122-01-3 for ; Tue, 3 Mar 2009 13:31:09 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.29]) by mail.postgresql.org (Postfix) with ESMTP id 1330E635A4D for ; Tue, 3 Mar 2009 13:31:08 -0400 (AST) Received: by yw-out-2324.google.com with SMTP id 5so1650513ywh.73 for ; Tue, 03 Mar 2009 09:31:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=z+swk8Cbu9Q98zdIbGD2KA+tTxfY8OpDBauuNZEaM5Y=; b=YafquqRE+9m2E7Ooh7g5gY2xxJiTr3iMYKQTzNeuucfdZqYTbeIzBOZ0EQ0sFx623E PbWM4PNUd4T7sCkMWkTk/JmRoK466NMWsIfG7RF7C2i+581DvKEG5nPmQ4FPLbh6isU4 WSZCCHc5PyxYp2f67DSyHq4FB6qRcQxGPmY9s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=wuNceVZTIBX4kSt+R9e1d2t9c+GpZMlAPqUyWGlNGloYg91sgvjcViCsqP7Z+nQqIn pzt2oapr2WCSirqD9bxBuXYUduNCSdRxxpBKrk+ycaBPr2aavGlvylwVvPtHj5EQiHJr vkaytJajtolRrgXxWmtjiInNXw5zLZ0pRoPmE= MIME-Version: 1.0 Received: by 10.100.255.9 with SMTP id c9mr2999787ani.66.1236101464124; Tue, 03 Mar 2009 09:31:04 -0800 (PST) In-Reply-To: <2870.1236050632@sss.pgh.pa.us> References: <2870.1236050632@sss.pgh.pa.us> Date: Tue, 3 Mar 2009 12:31:04 -0500 Message-ID: Subject: Re: Postgres 8.3, four times slower queries? From: Aaron Guyon To: pgsql-performance@postgresql.org Content-Type: multipart/alternative; boundary=0016368e1e5cacee2104643a4c34 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200903/27 X-Sequence-Number: 32949 --0016368e1e5cacee2104643a4c34 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On Mon, Mar 2, 2009 at 10:23 PM, Tom Lane wrote: > Are you sure you are comparing apples to apples here? Same configure > options for the builds, same parameter values in postgresql.conf, both > databases ANALYZEd, etc? And are they running on the same hardware? > Thank you for looking at this Tom. Yes, we have made sure we are comparing apples to apples here. The postgresql.confs are identical, as are the configure flags: --disable-debug --enable-shared --enable-thread-safety --with-perl --with-pam --without-docdir --without-tcl --without-python --without-krb5 --without-ldap --without-bonjour --enable-integer-datetimes --prefix=/opt/postgresql However, the db was not analyzed. I'll attached the new explain analyze of the queries with the db analyzed, but 8.2 still beats 8.3. The tests are both being run on the same machine, a Quad-core AMD Opteron Processor 2212 (each with 1024 KB cache) and 4GB of RAM. I find it telling that the query plan differs so much between postgres 8.2. and 8.3. For example, why does the 8.3. planner choose to perform so many seq scans? I know seq scans are faster than index scans for small tables, but these tables have 60K+ rows... surely an index scan would have been a better choice here? If you look at the 8.2. query plan, it is very clean in comparison, index scans all the way through. I can't help but think the 8.3 planner is simply failing to make the right choices in our case. Another question would be, why are there so many hash joins in the 8.3 plan now? All our indexes are btrees... Any light that can be shed on what going on with the 8.3. planner would be much appreciated. Thanks in advance. --0016368e1e5cacee2104643a4c34 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Mon, Mar 2, 2009 at 10:23 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Are you sure you are comparing apples to apples here? =A0Same configure
options for the builds, same parameter values in postgresql.conf, both
databases ANALYZEd, etc? =A0And are they running on the same hardware?

Thank you for looking at this Tom.=A0 Yes, we have m= ade sure we are comparing
apples to apples here.=A0 The postgresql.confs= are identical, as are the configure flags:

--disable-= debug --enable-shared --enable-thread-safety --with-perl --with-pam --without-docdir --without-tcl --without-python --without-krb5 --without-ldap --without-bonjour --enable-integer-datetimes --prefix=3D/opt/postgresql

However, the db was not analyzed.=A0 I'll attached the new ex= plain analyze of the queries with the db analyzed, but 8.2 still beats 8.3.=

The tests are both being run on the same machine, a Quad-core AMD O= pteron Processor 2212
(each with 1024 KB cache) and 4GB of RAM.

I find it telling that the= query plan differs so much between postgres 8.2. and
8.3.=A0 For example, why does the 8.3. planner choose to perform so many se= q
scans?=A0 I know seq scans are faster than index scans for small table= s, but
these tables have 60K+ rows... surely an index scan would have be= en a better
choice here?=A0 If you look at the 8.2. query plan, it is very clean in
= comparison, index scans all the way through.=A0 I can't help but think = the 8.3
planner is simply failing to make the right choices in our case.= Another
question would be, why are there so many hash joins in the 8.3 plan now?=A0= All
our indexes are btrees...

Any light that can be shed on what= going on with the 8.3. planner would be much
appreciated.=A0 Thanks in = advance.
--0016368e1e5cacee2104643a4c34--