From pdonlin@oaisd.org Thu Jul 15 14:48:23 2010 Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 01A6E63318A for ; Thu, 15 Jul 2010 11:48:23 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 53596-04 for ; Thu, 15 Jul 2010 14:48:14 +0000 (UTC) X-Greylist: delayed 00:06:42.754822 by SQLgrey-1.7.6 Received: from mm-mailstore02.merit.edu (mm-mailstore02.merit.edu [207.74.184.19]) by mail.postgresql.org (Postfix) with ESMTP id AA924633140 for ; Thu, 15 Jul 2010 11:48:15 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by mm-mailstore02.merit.edu (Postfix) with ESMTP id 010FB6800FF6 for ; Thu, 15 Jul 2010 10:41:28 -0400 (EDT) X-Virus-Scanned: amavisd-new at mm-mailstore02.merit.edu Received: from mm-mailstore02.merit.edu ([127.0.0.1]) by localhost (mm-mailstore02.merit.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TcUMeyKeBs04 for ; Thu, 15 Jul 2010 10:41:23 -0400 (EDT) Received: from mm-mailstore02.merit.edu (mm-mailstore02.merit.edu [10.108.2.25]) by mm-mailstore02.merit.edu (Postfix) with ESMTP id 009936800FF8 for ; Thu, 15 Jul 2010 10:41:22 -0400 (EDT) Date: Thu, 15 Jul 2010 10:41:22 -0400 (EDT) From: Patrick Donlin To: pgsql-performance@postgresql.org Message-ID: <1187615879.13268921279204882941.JavaMail.root@mm-mailstore02.merit.edu> In-Reply-To: <282748664.13267761279204611150.JavaMail.root@mm-mailstore02.merit.edu> Subject: Identical query slower on 8.4 vs 8.3 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_447276_638425413.1279204882940" X-Originating-IP: [64.9.158.13] X-Mailer: Zimbra 5.0.21_GA_3150.RHEL5_64 (ZimbraWebClient - FF3.0 (Mac)/5.0.21_GA_3150.RHEL5_64) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-4.199 tagged_above=-10 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_MED=-2.3 X-Spam-Level: X-Archive-Number: 201007/234 X-Sequence-Number: 39623 ------=_Part_447276_638425413.1279204882940 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit I have two servers with equal specs, one of them running 8.3.7 and the new server running 8.4.4. The only tweak I have made from the default install (from Ubuntu repositories) is increasing shared_buffers to 768MB. Both servers are running 64-bit, but are different releases of Ubuntu. This is the query I am running: SELECT DISTINCT test.tid, testresult.trscore, testresult.trpossiblescore, testresult.trstart, testresult.trfinish, testresult.trscorebreakdown, testresult.fk_sid, testresult.fk_tid, test.tname, qr.qrscore, qr.qrtotalscore, testresult.trid, qr.qrid FROM testresult, test, questionresult qr WHERE test.tid = testresult.fk_tid AND qr.fk_trid = testresult.trid ORDER BY test.tid; Results when running on the v8.3.7 server.... Total query runtime: 32185 ms. 700536 rows retrieved. Results when running on the v8.4.4 server.... Total query runtime: 164227 ms. 700536 rows retrieved. Results when running on a different v8.4.4 server with slightly faster hardware and shared_buffers at 1024MB.... (this one has a few more rows of data due to this being the server that is currently live, so it has more recent data) Total query runtime: 157931 ms. 700556 rows retrieved. Anyone have any ideas on where I should start looking to figure this out? I didn't perform any special steps when moving to v8.4, I just did a pg_dump from the 8.3 server and restored it on the new 8.4 servers. Maybe that is where I made a mistake. Thanks! Patrick ------=_Part_447276_638425413.1279204882940 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable <= div style=3D'font-family: Arial; font-size: 12pt; color: #000000'>I have tw= o servers with equal specs, one of them running 8.3.7 and the new server ru= nning 8.4.4. The only tweak I have made from the default install (from Ubun= tu repositories) is increasing shared_buffers to 768MB. Both servers are ru= nning 64-bit, but are different releases of Ubuntu.

This is the quer= y I am running:

SELECT DISTINCT test.tid, testresult.trscore, testre= sult.trpossiblescore, testresult.trstart,
testresult.trfinish, testresul= t.trscorebreakdown, testresult.fk_sid, testresult.fk_tid, test.tname,
qr= .qrscore, qr.qrtotalscore, testresult.trid, qr.qrid
FROM testresult, tes= t, questionresult qr
WHERE test.tid =3D testresult.fk_tid AND qr.fk_trid= =3D testresult.trid
ORDER BY test.tid;

Results when running on t= he v8.3.7 server....
Total query runtime: 32185 ms.
700536 rows retri= eved.

Results when running on the v8.4.4 server....
Total query r= untime: 164227 ms.
700536 rows retrieved.

Results when running on= a different v8.4.4 server with slightly faster hardware and shared_buffers= at 1024MB....
(this one has a few more rows of data due to this being t= he server that is currently live, so it has more recent data)
Total quer= y runtime: 157931 ms.
700556 rows retrieved.


Anyone have any = ideas on where I should start looking to figure this out? I didn't perform = any special steps when moving to v8.4, I just did a pg_dump from the 8.3 se= rver and restored it on the new 8.4 servers. Maybe that is where I made a m= istake.

Thanks!
Patrick
------=_Part_447276_638425413.1279204882940-- From thombrown@gmail.com Thu Jul 15 14:51:00 2010 Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 3EE74633140 for ; Thu, 15 Jul 2010 11:51:00 -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 31035-05 for ; Thu, 15 Jul 2010 14:50:52 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wy0-f174.google.com (mail-wy0-f174.google.com [74.125.82.174]) by mail.postgresql.org (Postfix) with ESMTP id 28DF2632AF0 for ; Thu, 15 Jul 2010 11:50:51 -0300 (ADT) Received: by wyb42 with SMTP id 42so790439wyb.19 for ; Thu, 15 Jul 2010 07:50:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type; bh=XBt8HzUwwopP9M9FBl6v0zCjLcCxU/mctxWJ9V6u92M=; b=eiLalXY35lIAKdTfIHDZ1fY70CoLgeYHiIL/shQrzUDWWJqGFLSg6XgRxOg0RKOttl ahKmJbv1xmPlpldld73zn8qGOQoAkI9xxsdPdMCH5UA0GoNXKCVQybmEBqjuC0E+Epyp z1cVcgXJobXnoKTyU33r9PMlVYX8b/BGbxtn0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=waZ/5QLxaE+Yjglquc1e1HCPJc3HGATDyxdigC8J0qadA9LZK4w4xUqq3Mh9UYQk5v okfobtXUe1q0+tAFrmWKiCNrj2j368xS3oyd+e/e7cvNbJok4OuRk3NITOQDRiqxcuRm ldWtOXWxO01TtTKZl5z/4LVUWKixYsBMNq3Vo= Received: by 10.227.152.66 with SMTP id f2mr17796790wbw.188.1279205449385; Thu, 15 Jul 2010 07:50:49 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.184.204 with HTTP; Thu, 15 Jul 2010 07:50:29 -0700 (PDT) In-Reply-To: <1187615879.13268921279204882941.JavaMail.root@mm-mailstore02.merit.edu> References: <282748664.13267761279204611150.JavaMail.root@mm-mailstore02.merit.edu> <1187615879.13268921279204882941.JavaMail.root@mm-mailstore02.merit.edu> From: Thom Brown Date: Thu, 15 Jul 2010 15:50:29 +0100 Message-ID: Subject: Re: Identical query slower on 8.4 vs 8.3 To: Patrick Donlin Cc: pgsql-performance@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 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, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201007/235 X-Sequence-Number: 39624 On 15 July 2010 15:41, Patrick Donlin wrote: > I have two servers with equal specs, one of them running 8.3.7 and the new > server running 8.4.4. The only tweak I have made from the default install > (from Ubuntu repositories) is increasing shared_buffers to 768MB. Both > servers are running 64-bit, but are different releases of Ubuntu. > > This is the query I am running: > > SELECT DISTINCT test.tid, testresult.trscore, testresult.trpossiblescore, > testresult.trstart, > testresult.trfinish, testresult.trscorebreakdown, testresult.fk_sid, > testresult.fk_tid, test.tname, > qr.qrscore, qr.qrtotalscore, testresult.trid, qr.qrid > FROM testresult, test, questionresult qr > WHERE test.tid = testresult.fk_tid AND qr.fk_trid = testresult.trid > ORDER BY test.tid; > > Results when running on the v8.3.7 server.... > Total query runtime: 32185 ms. > 700536 rows retrieved. > > Results when running on the v8.4.4 server.... > Total query runtime: 164227 ms. > 700536 rows retrieved. > > Results when running on a different v8.4.4 server with slightly faster > hardware and shared_buffers at 1024MB.... > (this one has a few more rows of data due to this being the server that is > currently live, so it has more recent data) > Total query runtime: 157931 ms. > 700556 rows retrieved. > > > Anyone have any ideas on where I should start looking to figure this out? I > didn't perform any special steps when moving to v8.4, I just did a pg_dump > from the 8.3 server and restored it on the new 8.4 servers. Maybe that is > where I made a mistake. > > Thanks! > Patrick > First thing to check is did you do a VACUUM ANALYZE on the database? Thom From Kevin.Grittner@wicourts.gov Thu Jul 15 14:55:34 2010 Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id ED13E632AF0 for ; Thu, 15 Jul 2010 11:55:34 -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 32806-03 for ; Thu, 15 Jul 2010 14:55:27 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from gw.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by mail.postgresql.org (Postfix) with ESMTP id 2F190632A86 for ; Thu, 15 Jul 2010 11:55:26 -0300 (ADT) Received: from Courts-MTA by gw.wicourts.gov with Novell_GroupWise; Thu, 15 Jul 2010 09:55:24 -0500 Message-Id: <4C3EDB070200002500033621@gw.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 8.0.1 Date: Thu, 15 Jul 2010 09:55:19 -0500 From: "Kevin Grittner" To: "Patrick Donlin" , Subject: Re: Identical query slower on 8.4 vs 8.3 References: <282748664.13267761279204611150.JavaMail.root@mm-mailstore02.merit.edu> <1187615879.13268921279204882941.JavaMail.root@mm-mailstore02.merit.edu> In-Reply-To: <1187615879.13268921279204882941.JavaMail.root@mm-mailstore02.merit.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-4.21 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201007/236 X-Sequence-Number: 39625 Patrick Donlin wrote: > Anyone have any ideas on where I should start looking to figure > this out? You're going to want to run EXPLAIN ANALYZE for the slow query on both servers. If you want the rest of us to be able to contribute ideas, we'll need a little more information -- please read this page: http://wiki.postgresql.org/wiki/SlowQueryQuestions > I didn't perform any special steps when moving to v8.4, I just did > a pg_dump from the 8.3 server and restored it on the new 8.4 > servers. A database VACUUM ANALYZE by a superuser is a good idea; otherwise that's fine technique. -Kevin From pdonlin@oaisd.org Thu Jul 15 15:13:07 2010 Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 6A42F632C31 for ; Thu, 15 Jul 2010 12:13:07 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 47876-03 for ; Thu, 15 Jul 2010 15:13:00 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mm-mailstore02.merit.edu (mm-mailstore02.merit.edu [207.74.184.19]) by mail.postgresql.org (Postfix) with ESMTP id BE58363270E for ; Thu, 15 Jul 2010 12:12:59 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by mm-mailstore02.merit.edu (Postfix) with ESMTP id 32F236800FE4; Thu, 15 Jul 2010 11:12:59 -0400 (EDT) X-Virus-Scanned: amavisd-new at mm-mailstore02.merit.edu Received: from mm-mailstore02.merit.edu ([127.0.0.1]) by localhost (mm-mailstore02.merit.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id q3cQ3t3YJNzN; Thu, 15 Jul 2010 11:12:53 -0400 (EDT) Received: from mm-mailstore02.merit.edu (mm-mailstore02.merit.edu [10.108.2.25]) by mm-mailstore02.merit.edu (Postfix) with ESMTP id B20AE6800FF5; Thu, 15 Jul 2010 11:12:53 -0400 (EDT) Date: Thu, 15 Jul 2010 11:12:53 -0400 (EDT) From: Patrick Donlin To: Kevin Grittner , pgsql-performance@postgresql.org Message-ID: <1123546138.13276371279206773000.JavaMail.root@mm-mailstore02.merit.edu> In-Reply-To: <4C3EDB070200002500033621@gw.wicourts.gov> Subject: Re: Identical query slower on 8.4 vs 8.3 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_447531_499915486.1279206772998" X-Originating-IP: [64.9.158.13] X-Mailer: Zimbra 5.0.21_GA_3150.RHEL5_64 (ZimbraWebClient - FF3.0 (Mac)/5.0.21_GA_3150.RHEL5_64) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-4.199 tagged_above=-10 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_MED=-2.3 X-Spam-Level: X-Archive-Number: 201007/237 X-Sequence-Number: 39626 ------=_Part_447531_499915486.1279206772998 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit I'll read over that wiki entry, but for now here is the EXPLAIN ANALYZE output assuming I did it correctly. I have run vacuumdb --full --analyze, it actually runs as a nightly cron job. 8.4.4 Sever: "Unique (cost=202950.82..227521.59 rows=702022 width=86) (actual time=21273.371..22429.511 rows=700536 loops=1)" " -> Sort (cost=202950.82..204705.87 rows=702022 width=86) (actual time=21273.368..22015.948 rows=700536 loops=1)" " Sort Key: test.tid, testresult.trscore, testresult.trpossiblescore, testresult.trstart, testresult.trfinish, testresult.trscorebreakdown, testresult.fk_sid, test.tname, qr.qrscore, qr.qrtotalscore, testresult.trid, qr.qrid" " Sort Method: external merge Disk: 71768kB" " -> Hash Join (cost=2300.82..34001.42 rows=702022 width=86) (actual time=64.388..1177.468 rows=700536 loops=1)" " Hash Cond: (qr.fk_trid = testresult.trid)" " -> Seq Scan on questionresult qr (cost=0.00..12182.22 rows=702022 width=16) (actual time=0.090..275.518 rows=702022 loops=1)" " -> Hash (cost=1552.97..1552.97 rows=29668 width=74) (actual time=63.042..63.042 rows=29515 loops=1)" " -> Hash Join (cost=3.35..1552.97 rows=29668 width=74) (actual time=0.227..39.111 rows=29515 loops=1)" " Hash Cond: (testresult.fk_tid = test.tid)" " -> Seq Scan on testresult (cost=0.00..1141.68 rows=29668 width=53) (actual time=0.019..15.622 rows=29668 loops=1)" " -> Hash (cost=2.60..2.60 rows=60 width=21) (actual time=0.088..0.088 rows=60 loops=1)" " -> Seq Scan on test (cost=0.00..2.60 rows=60 width=21) (actual time=0.015..0.044 rows=60 loops=1)" "Total runtime: 22528.820 ms" 8.3.7 Server: "Unique (cost=202950.82..227521.59 rows=702022 width=86) (actual time=22157.714..23343.461 rows=700536 loops=1)" " -> Sort (cost=202950.82..204705.87 rows=702022 width=86) (actual time=22157.706..22942.018 rows=700536 loops=1)" " Sort Key: test.tid, testresult.trscore, testresult.trpossiblescore, testresult.trstart, testresult.trfinish, testresult.trscorebreakdown, testresult.fk_sid, test.tname, qr.qrscore, qr.qrtotalscore, testresult.trid, qr.qrid" " Sort Method: external merge Disk: 75864kB" " -> Hash Join (cost=2300.82..34001.42 rows=702022 width=86) (actual time=72.842..1276.634 rows=700536 loops=1)" " Hash Cond: (qr.fk_trid = testresult.trid)" " -> Seq Scan on questionresult qr (cost=0.00..12182.22 rows=702022 width=16) (actual time=0.112..229.987 rows=702022 loops=1)" " -> Hash (cost=1552.97..1552.97 rows=29668 width=74) (actual time=71.421..71.421 rows=29515 loops=1)" " -> Hash Join (cost=3.35..1552.97 rows=29668 width=74) (actual time=0.398..44.524 rows=29515 loops=1)" " Hash Cond: (testresult.fk_tid = test.tid)" " -> Seq Scan on testresult (cost=0.00..1141.68 rows=29668 width=53) (actual time=0.117..20.890 rows=29668 loops=1)" " -> Hash (cost=2.60..2.60 rows=60 width=21) (actual time=0.112..0.112 rows=60 loops=1)" " -> Seq Scan on test (cost=0.00..2.60 rows=60 width=21) (actual time=0.035..0.069 rows=60 loops=1)" "Total runtime: 23462.639 ms" Thanks for the quick responses and being patient with me not providing enough information. -Patrick ----- Original Message ----- From: "Kevin Grittner" To: "Patrick Donlin" , pgsql-performance@postgresql.org Sent: Thursday, July 15, 2010 10:55:19 AM GMT -05:00 US/Canada Eastern Subject: Re: [PERFORM] Identical query slower on 8.4 vs 8.3 Patrick Donlin wrote: > Anyone have any ideas on where I should start looking to figure > this out? You're going to want to run EXPLAIN ANALYZE for the slow query on both servers. If you want the rest of us to be able to contribute ideas, we'll need a little more information -- please read this page: http://wiki.postgresql.org/wiki/SlowQueryQuestions > I didn't perform any special steps when moving to v8.4, I just did > a pg_dump from the 8.3 server and restored it on the new 8.4 > servers. A database VACUUM ANALYZE by a superuser is a good idea; otherwise that's fine technique. -Kevin ------=_Part_447531_499915486.1279206772998 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable <= div style=3D'font-family: Arial; font-size: 12pt; color: #000000'>I'll read= over that wiki entry, but for now here is the EXPLAIN ANALYZE=20 output assuming I did it correctly. I have run vacuumdb --full=20 --analyze,  it actually runs as a nightly cron job.

8.4.4 Sever:
"Unique  (cost=3D202950.82..227521.59 rows=3D702022 width=3D86) (actua= l=20 time=3D21273.371..22429.511 rows=3D700536 loops=3D1)"
"  ->  Sort  (cost=3D202950.82..204705.87 rows=3D702022 w= idth=3D86) (actual time=3D21273.368..22015.948 rows=3D700536 loops=3D1)"
"        Sort Key: test.tid, testresult.= trscore,=20 testresult.trpossiblescore, testresult.trstart, testresult.trfinish,=20 testresult.trscorebreakdown, testresult.fk_sid, test.tname, qr.qrscore,=20 qr.qrtotalscore, testresult.trid, qr.qrid"
"        Sort Method:  external mer= ge  Disk: 71768kB"
"        ->  Hash Join  (co= st=3D2300.82..34001.42 rows=3D702022 width=3D86) (actual time=3D64.388..1177.468 rows=3D700536 loops=3D1)"
"            &n= bsp; Hash Cond: (qr.fk_trid =3D testresult.trid)"
"            &n= bsp; ->  Seq Scan on questionresult qr =20 (cost=3D0.00..12182.22 rows=3D702022 width=3D16) (actual time=3D0.090..275.= 518=20 rows=3D702022 loops=3D1)"
"            &n= bsp; ->  Hash  (cost=3D1552.97..1552.97 rows=3D29668 width=3D7= 4)=20 (actual time=3D63.042..63.042 rows=3D29515 loops=3D1)"
"            &n= bsp;       ->  Hash Join  (cost= =3D3.35..1552.97 rows=3D29668=20 width=3D74) (actual time=3D0.227..39.111 rows=3D29515 loops=3D1)"
"            &n= bsp;            = ; Hash Cond: (testresult.fk_tid =3D test.tid)"
"            &n= bsp;            = ; ->  Seq Scan on testresult =20 (cost=3D0.00..1141.68 rows=3D29668 width=3D53) (actual time=3D0.019..15.622= =20 rows=3D29668 loops=3D1)"
"            &n= bsp;            = ; ->  Hash  (cost=3D2.60..2.60 rows=3D60=20 width=3D21) (actual time=3D0.088..0.088 rows=3D60 loops=3D1)"
"            &n= bsp;            = ;       ->  Seq Scan on test =20 (cost=3D0.00..2.60 rows=3D60 width=3D21) (actual time=3D0.015..0.044 rows= =3D60=20 loops=3D1)"
"Total runtime: 22528.820 ms"

8.3.7 Server:
"Unique  (cost=3D202950.82..227521.59 rows=3D702022 width=3D86) (actua= l=20 time=3D22157.714..23343.461 rows=3D700536 loops=3D1)"
"  ->  Sort  (cost=3D202950.82..204705.87 rows=3D702022 w= idth=3D86) (actual time=3D22157.706..22942.018 rows=3D700536 loops=3D1)"
"        Sort Key: test.tid, testresult.= trscore,=20 testresult.trpossiblescore, testresult.trstart, testresult.trfinish,=20 testresult.trscorebreakdown, testresult.fk_sid, test.tname, qr.qrscore,=20 qr.qrtotalscore, testresult.trid, qr.qrid"
"        Sort Method:  external mer= ge  Disk: 75864kB"
"        ->  Hash Join  (co= st=3D2300.82..34001.42 rows=3D702022 width=3D86) (actual time=3D72.842..1276.634 rows=3D700536 loops=3D1)"
"            &n= bsp; Hash Cond: (qr.fk_trid =3D testresult.trid)"
"            &n= bsp; ->  Seq Scan on questionresult qr =20 (cost=3D0.00..12182.22 rows=3D702022 width=3D16) (actual time=3D0.112..229.= 987=20 rows=3D702022 loops=3D1)"
"            &n= bsp; ->  Hash  (cost=3D1552.97..1552.97 rows=3D29668 width=3D7= 4)=20 (actual time=3D71.421..71.421 rows=3D29515 loops=3D1)"
"            &n= bsp;       ->  Hash Join  (cost= =3D3.35..1552.97 rows=3D29668=20 width=3D74) (actual time=3D0.398..44.524 rows=3D29515 loops=3D1)"
"            &n= bsp;            = ; Hash Cond: (testresult.fk_tid =3D test.tid)"
"            &n= bsp;            = ; ->  Seq Scan on testresult =20 (cost=3D0.00..1141.68 rows=3D29668 width=3D53) (actual time=3D0.117..20.890= =20 rows=3D29668 loops=3D1)"
"            &n= bsp;            = ; ->  Hash  (cost=3D2.60..2.60 rows=3D60=20 width=3D21) (actual time=3D0.112..0.112 rows=3D60 loops=3D1)"
"            &n= bsp;            = ;       ->  Seq Scan on test =20 (cost=3D0.00..2.60 rows=3D60 width=3D21) (actual time=3D0.035..0.069 rows= =3D60=20 loops=3D1)"
"Total runtime: 23462.639 ms"


Thanks for the quick responses and being patient with me not providing=20 enough information.
-Patrick

----- Original Message -----
From: "Kevin Grittner" <= Kevin.Grittner@wicourts.gov>
To: "Patrick Donlin" <pdonlin@oaisd.o= rg>, pgsql-performance@postgresql.org
Sent: Thursday, July 15, 2010 1= 0:55:19 AM GMT -05:00 US/Canada Eastern
Subject: Re: [PERFORM] Identical= query slower on 8.4 vs 8.3

Patrick Donlin <pdonlin@oaisd.org>= wrote:
 
> Anyone have any ideas on where I should start loo= king to figure
> this out?
 
You're going to want to run E= XPLAIN ANALYZE for the slow query on
both servers.  If you want the= rest of us to be able to contribute
ideas, we'll need a little more inf= ormation -- please read this
page:
 
http://wiki.postgresql.o= rg/wiki/SlowQueryQuestions
 
> I didn't perform any special s= teps when moving to v8.4, I just did
> a pg_dump from the 8.3 server = and restored it on the new 8.4
> servers.
 
A database VAC= UUM ANALYZE by a superuser is a good idea; otherwise
that's fine techniq= ue.
 
-Kevin
------=_Part_447531_499915486.1279206772998-- From alvherre@commandprompt.com Thu Jul 15 15:21:51 2010 Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 79CC3632A86 for ; Thu, 15 Jul 2010 12:21:51 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 64302-08 for ; Thu, 15 Jul 2010 15:21:44 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from spinlock.commandprompt.com (host-215.commandprompt.net [207.173.203.215]) by mail.postgresql.org (Postfix) with ESMTP id 71BFD632A64 for ; Thu, 15 Jul 2010 12:21:44 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by spinlock.commandprompt.com (Postfix) with ESMTP id 3B933348037; Thu, 15 Jul 2010 08:21:38 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at commandprompt.com Received: from spinlock.commandprompt.com ([127.0.0.1]) by localhost (spinlock.commandprompt.com.commandprompt.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id A8fNYFofqtAi; Thu, 15 Jul 2010 08:21:36 -0700 (PDT) Received: from alvh.no-ip.org (pc-157-80-86-200.cm.vtr.net [200.86.80.157]) by spinlock.commandprompt.com (Postfix) with ESMTPSA id C9B91348002; Thu, 15 Jul 2010 08:21:35 -0700 (PDT) Received: by alvh.no-ip.org (Postfix, from userid 1000) id E8C7F43820A; Thu, 15 Jul 2010 11:21:33 -0400 (CLT) Content-Type: text/plain; charset=utf8 Cc: Kevin Grittner , pgsql-performance Subject: Re: Identical query slower on 8.4 vs 8.3 From: Alvaro Herrera To: Patrick Donlin In-reply-to: <1123546138.13276371279206773000.JavaMail.root@mm-mailstore02.merit.edu> References: <1123546138.13276371279206773000.JavaMail.root@mm-mailstore02.merit.edu> Date: Thu, 15 Jul 2010 11:21:33 -0400 Message-Id: <1279207110-sup-2392@alvh.no-ip.org> User-Agent: Sup/0.11 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.001 tagged_above=-10 required=5 tests=BAYES_20=-0.001 X-Spam-Level: X-Archive-Number: 201007/238 X-Sequence-Number: 39627 Excerpts from Patrick Donlin's message of jue jul 15 11:12:53 -0400 2010: > I'll read over that wiki entry, but for now here is the EXPLAIN ANALYZE output assuming I did it correctly. I have run vacuumdb --full --analyze, it actually runs as a nightly cron job. These plans seem identical (though the fact that the leading whitespace was trimmed means it's untrustworthy -- please in the future send them as text attachments instead so that your mailer doesn't interfere with formatting). The 8.4 plan is even a full second faster, according to the "total runtime" line. The slowness could've been caused by caching effects ... From andy@squeakycode.net Thu Jul 15 15:31:45 2010 Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id E7137632FB5 for ; Thu, 15 Jul 2010 12:31:45 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 85956-02-3 for ; Thu, 15 Jul 2010 15:31:38 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from marajade.localdomain (vcs5.camavision.com [63.228.164.252]) by mail.postgresql.org (Postfix) with ESMTP id 41CAC63376D for ; Thu, 15 Jul 2010 12:31:33 -0300 (ADT) Received: from [192.168.10.84] (unknown [192.168.10.84]) (Authenticated sender: andy) by marajade.localdomain (Postfix) with ESMTPA id 052FD40AB1; Thu, 15 Jul 2010 10:31:32 -0500 (CDT) Message-ID: <4C3F29D1.1080100@squeakycode.net> Date: Thu, 15 Jul 2010 10:31:29 -0500 From: Andy Colson User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.4) Gecko/20100608 Lightning/1.0b2 Thunderbird/3.1 MIME-Version: 1.0 To: Patrick Donlin , pgsql-performance@postgresql.org Subject: Re: Identical query slower on 8.4 vs 8.3 References: <4C3EDB070200002500033621@gw.wicourts.gov> <1123546138.13276371279206773000.JavaMail.root@mm-mailstore02.merit.edu> In-Reply-To: <1123546138.13276371279206773000.JavaMail.root@mm-mailstore02.merit.edu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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: 201007/239 X-Sequence-Number: 39628 FULL is usually bad. Stick to "vacuum analyze" and drop the full. Do you have indexes on: test.tid, testresult.fk_tid, questionresult.fk_trid and testresult.trid -Andy On 7/15/2010 10:12 AM, Patrick Donlin wrote: > I'll read over that wiki entry, but for now here is the EXPLAIN ANALYZE > output assuming I did it correctly. I have run vacuumdb --full > --analyze, it actually runs as a nightly cron job. > > 8.4.4 Sever: > "Unique (cost=202950.82..227521.59 rows=702022 width=86) (actual > time=21273.371..22429.511 rows=700536 loops=1)" > " -> Sort (cost=202950.82..204705.87 rows=702022 width=86) (actual > time=21273.368..22015.948 rows=700536 loops=1)" > " Sort Key: test.tid, testresult.trscore, testresult.trpossiblescore, > testresult.trstart, testresult.trfinish, testresult.trscorebreakdown, > testresult.fk_sid, test.tname, qr.qrscore, qr.qrtotalscore, > testresult.trid, qr.qrid" > " Sort Method: external merge Disk: 71768kB" > " -> Hash Join (cost=2300.82..34001.42 rows=702022 width=86) (actual > time=64.388..1177.468 rows=700536 loops=1)" > " Hash Cond: (qr.fk_trid = testresult.trid)" > " -> Seq Scan on questionresult qr (cost=0.00..12182.22 rows=702022 > width=16) (actual time=0.090..275.518 rows=702022 loops=1)" > " -> Hash (cost=1552.97..1552.97 rows=29668 width=74) (actual > time=63.042..63.042 rows=29515 loops=1)" > " -> Hash Join (cost=3.35..1552.97 rows=29668 width=74) (actual > time=0.227..39.111 rows=29515 loops=1)" > " Hash Cond: (testresult.fk_tid = test.tid)" > " -> Seq Scan on testresult (cost=0.00..1141.68 rows=29668 width=53) > (actual time=0.019..15.622 rows=29668 loops=1)" > " -> Hash (cost=2.60..2.60 rows=60 width=21) (actual time=0.088..0.088 > rows=60 loops=1)" > " -> Seq Scan on test (cost=0.00..2.60 rows=60 width=21) (actual > time=0.015..0.044 rows=60 loops=1)" > "Total runtime: 22528.820 ms" > > 8.3.7 Server: > "Unique (cost=202950.82..227521.59 rows=702022 width=86) (actual > time=22157.714..23343.461 rows=700536 loops=1)" > " -> Sort (cost=202950.82..204705.87 rows=702022 width=86) (actual > time=22157.706..22942.018 rows=700536 loops=1)" > " Sort Key: test.tid, testresult.trscore, testresult.trpossiblescore, > testresult.trstart, testresult.trfinish, testresult.trscorebreakdown, > testresult.fk_sid, test.tname, qr.qrscore, qr.qrtotalscore, > testresult.trid, qr.qrid" > " Sort Method: external merge Disk: 75864kB" > " -> Hash Join (cost=2300.82..34001.42 rows=702022 width=86) (actual > time=72.842..1276.634 rows=700536 loops=1)" > " Hash Cond: (qr.fk_trid = testresult.trid)" > " -> Seq Scan on questionresult qr (cost=0.00..12182.22 rows=702022 > width=16) (actual time=0.112..229.987 rows=702022 loops=1)" > " -> Hash (cost=1552.97..1552.97 rows=29668 width=74) (actual > time=71.421..71.421 rows=29515 loops=1)" > " -> Hash Join (cost=3.35..1552.97 rows=29668 width=74) (actual > time=0.398..44.524 rows=29515 loops=1)" > " Hash Cond: (testresult.fk_tid = test.tid)" > " -> Seq Scan on testresult (cost=0.00..1141.68 rows=29668 width=53) > (actual time=0.117..20.890 rows=29668 loops=1)" > " -> Hash (cost=2.60..2.60 rows=60 width=21) (actual time=0.112..0.112 > rows=60 loops=1)" > " -> Seq Scan on test (cost=0.00..2.60 rows=60 width=21) (actual > time=0.035..0.069 rows=60 loops=1)" > "Total runtime: 23462.639 ms" > > > Thanks for the quick responses and being patient with me not providing > enough information. > -Patrick > > ----- Original Message ----- > From: "Kevin Grittner" > To: "Patrick Donlin" , pgsql-performance@postgresql.org > Sent: Thursday, July 15, 2010 10:55:19 AM GMT -05:00 US/Canada Eastern > Subject: Re: [PERFORM] Identical query slower on 8.4 vs 8.3 > > Patrick Donlin wrote: > > > Anyone have any ideas on where I should start looking to figure > > this out? > > You're going to want to run EXPLAIN ANALYZE for the slow query on > both servers. If you want the rest of us to be able to contribute > ideas, we'll need a little more information -- please read this > page: > > http://wiki.postgresql.org/wiki/SlowQueryQuestions > > > I didn't perform any special steps when moving to v8.4, I just did > > a pg_dump from the 8.3 server and restored it on the new 8.4 > > servers. > > A database VACUUM ANALYZE by a superuser is a good idea; otherwise > that's fine technique. > > -Kevin From jnelson+pgsql@jamponi.net Thu Jul 15 15:43:15 2010 Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id BEB5D632D5F for ; Thu, 15 Jul 2010 12:43:15 -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 53961-09 for ; Thu, 15 Jul 2010 15:43:08 +0000 (UTC) X-Greylist: delayed 00:07:49.788536 by SQLgrey-1.7.6 Received: from mail-wy0-f174.google.com (mail-wy0-f174.google.com [74.125.82.174]) by mail.postgresql.org (Postfix) with ESMTP id 519FC632D49 for ; Thu, 15 Jul 2010 12:43:08 -0300 (ADT) Received: by wyb42 with SMTP id 42so843580wyb.19 for ; Thu, 15 Jul 2010 08:43:06 -0700 (PDT) Received: by 10.227.148.2 with SMTP id n2mr4554051wbv.216.1279208116622; Thu, 15 Jul 2010 08:35:16 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.11.205 with HTTP; Thu, 15 Jul 2010 08:34:56 -0700 (PDT) In-Reply-To: <1187615879.13268921279204882941.JavaMail.root@mm-mailstore02.merit.edu> References: <282748664.13267761279204611150.JavaMail.root@mm-mailstore02.merit.edu> <1187615879.13268921279204882941.JavaMail.root@mm-mailstore02.merit.edu> From: Jon Nelson Date: Thu, 15 Jul 2010 10:34:56 -0500 X-Google-Sender-Auth: lMTEUd5nS7B1T7IwIyW1t-3PgD4 Message-ID: Subject: Re: Identical query slower on 8.4 vs 8.3 To: Patrick Donlin Cc: pgsql-performance@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 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, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201007/240 X-Sequence-Number: 39629 On Thu, Jul 15, 2010 at 9:41 AM, Patrick Donlin wrote: > I have two servers with equal specs, one of them running 8.3.7 and the new > server running 8.4.4. The only tweak I have made from the default install > (from Ubuntu repositories) is increasing shared_buffers to 768MB. Both > servers are running 64-bit, but are different releases of Ubuntu. ^^^ Right there. *different releases*. I've seen fairly significant differences in identical hardware with even minor O/S point releases. After you run a full vacuum and then reindex and then vacuum analyze (probably not entirely necessary) if there is still a difference I'd point at the O/S. -- Jon From Kevin.Grittner@wicourts.gov Thu Jul 15 15:53:32 2010 Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id AC862632E18 for ; Thu, 15 Jul 2010 12:53:32 -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 61264-02-4 for ; Thu, 15 Jul 2010 15:53:24 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from gw.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by mail.postgresql.org (Postfix) with ESMTP id 4844F632D2E for ; Thu, 15 Jul 2010 12:53:24 -0300 (ADT) Received: from Courts-MTA by gw.wicourts.gov with Novell_GroupWise; Thu, 15 Jul 2010 10:53:23 -0500 Message-Id: <4C3EE8A00200002500033637@gw.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 8.0.1 Date: Thu, 15 Jul 2010 10:53:20 -0500 From: "Kevin Grittner" To: "Patrick Donlin" , Subject: Re: Identical query slower on 8.4 vs 8.3 References: <4C3EDB070200002500033621@gw.wicourts.gov> <1123546138.13276371279206773000.JavaMail.root@mm-mailstore02.merit.edu> In-Reply-To: <1123546138.13276371279206773000.JavaMail.root@mm-mailstore02.merit.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-4.21 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201007/241 X-Sequence-Number: 39630 Patrick Donlin wrote: > I have run vacuumdb --full --analyze, it > actually runs as a nightly cron job. That's usually not wise -- VACUUM FULL can cause index bloat, and is not normally necessary. If you have autovacuum turned on and run a database vacuum each night, you can probably avoid ever running VACUUM FULL. A long-running transaction or mass deletes might still make aggressive cleanup necessary on occasion, but you should consider using CLUSTER instead of VACUUM FULL. So, you should probably change your crontab job to vacuum --all --analyze. Also, after a bulk load of a database like this you might consider a one-time VACUUM FREEZE of the database. Without that there will come a time when autovacuum will need to rewrite all rows from the bulk load which haven't subsequently been modified, in order to prevent transaction ID wraparound problems. -Kevin From mmoncure@gmail.com Thu Jul 15 16:04:39 2010 Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id DE509632B68 for ; Thu, 15 Jul 2010 13:04:39 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 48140-07 for ; Thu, 15 Jul 2010 16:04:32 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-gw0-f46.google.com (mail-gw0-f46.google.com [74.125.83.46]) by mail.postgresql.org (Postfix) with ESMTP id 22D8A63270E for ; Thu, 15 Jul 2010 13:04:32 -0300 (ADT) Received: by gwj18 with SMTP id 18so528057gwj.19 for ; Thu, 15 Jul 2010 09:04:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=6DgTXFlpllrznYSJx/Zb0irOZeOwzmSBtQjiDOVrHd8=; b=kjibbI9TAaBJ5sDfokmW8N95KZjX7uDlHH2CGD8Yt+e2AeQjcDyEwQe5P/siQn89ad jHl+cQWEDe9i2ZpFEftaWarF+Y1KqENRK+CL1mZ9QZMIPunqvdZEdLZyCbYSMjmENcWD oHb5hC87QoPMYqtJKv5qK74YzpXxJWXi9XVEM= 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 :cc:content-type:content-transfer-encoding; b=OCPsmkGJGUP9f4yS/t+RUdfaiX68aDEHuLeSUpq4//nIB8uQLKFTMMNW1livrQrITs WCRoLCMdlo5uZZlFU+ULJVAZqOZlr9iFtOR6nOmIkT/p6sKk/mc9wNrWIQJ2TiZumUyy y0xQNV7pf4Q0tOb1uUhlDrw0HskQBm27E6EZA= MIME-Version: 1.0 Received: by 10.90.50.14 with SMTP id x14mr5569agx.53.1279209853256; Thu, 15 Jul 2010 09:04:13 -0700 (PDT) Received: by 10.90.56.8 with HTTP; Thu, 15 Jul 2010 09:04:13 -0700 (PDT) In-Reply-To: <1123546138.13276371279206773000.JavaMail.root@mm-mailstore02.merit.edu> References: <4C3EDB070200002500033621@gw.wicourts.gov> <1123546138.13276371279206773000.JavaMail.root@mm-mailstore02.merit.edu> Date: Thu, 15 Jul 2010 12:04:13 -0400 Message-ID: Subject: Re: Identical query slower on 8.4 vs 8.3 From: Merlin Moncure To: Patrick Donlin Cc: Kevin Grittner , pgsql-performance@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201007/242 X-Sequence-Number: 39631 On Thu, Jul 15, 2010 at 11:12 AM, Patrick Donlin wrote: > I'll read over that wiki entry, but for now here is the EXPLAIN ANALYZE > output assuming I did it correctly. I have run vacuumdb --full --analyze, > it actually runs as a nightly cron job. > > 8.4.4 Sever: > "Unique=A0 (cost=3D202950.82..227521.59 rows=3D702022 width=3D86) (actual > time=3D21273.371..22429.511 rows=3D700536 loops=3D1)" > "=A0 ->=A0 Sort=A0 (cost=3D202950.82..204705.87 rows=3D702022 width=3D86)= (actual > time=3D21273.368..22015.948 rows=3D700536 loops=3D1)" > "=A0=A0=A0=A0=A0=A0=A0 Sort Key: test.tid, testresult.trscore, testresult= .trpossiblescore, > testresult.trstart, testresult.trfinish, testresult.trscorebreakdown, > testresult.fk_sid, test.tname, qr.qrscore, qr.qrtotalscore, testresult.tr= id, > qr.qrid" > "=A0=A0=A0=A0=A0=A0=A0 Sort Method:=A0 external merge=A0 Disk: 71768kB" > "=A0=A0=A0=A0=A0=A0=A0 ->=A0 Hash Join=A0 (cost=3D2300.82..34001.42 rows= =3D702022 width=3D86) > (actual time=3D64.388..1177.468 rows=3D700536 loops=3D1)" > "=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Hash Cond: (qr.fk_trid =3D testr= esult.trid)" > "=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ->=A0 Seq Scan on questionresult= qr=A0 (cost=3D0.00..12182.22 > rows=3D702022 width=3D16) (actual time=3D0.090..275.518 rows=3D702022 loo= ps=3D1)" > "=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ->=A0 Hash=A0 (cost=3D1552.97..1= 552.97 rows=3D29668 width=3D74) (actual > time=3D63.042..63.042 rows=3D29515 loops=3D1)" > "=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ->=A0 Hash Joi= n=A0 (cost=3D3.35..1552.97 rows=3D29668 width=3D74) > (actual time=3D0.227..39.111 rows=3D29515 loops=3D1)" > "=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0 Hash Cond: (testresult.fk_tid =3D test.tid)" > "=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0 ->=A0 Seq Scan on testresult=A0 (cost=3D0.00..1141.68 > rows=3D29668 width=3D53) (actual time=3D0.019..15.622 rows=3D29668 loops= =3D1)" > "=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0 ->=A0 Hash=A0 (cost=3D2.60..2.60 rows=3D60 width=3D21) > (actual time=3D0.088..0.088 rows=3D60 loops=3D1)" > "=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0 ->=A0 Seq Scan on test=A0 (cost=3D0.00..2.60 > rows=3D60 width=3D21) (actual time=3D0.015..0.044 rows=3D60 loops=3D1)" > "Total runtime: 22528.820 ms" > > 8.3.7 Server: > "Unique=A0 (cost=3D202950.82..227521.59 rows=3D702022 width=3D86) (actual > time=3D22157.714..23343.461 rows=3D700536 loops=3D1)" > "=A0 ->=A0 Sort=A0 (cost=3D202950.82..204705.87 rows=3D702022 width=3D86)= (actual > time=3D22157.706..22942.018 rows=3D700536 loops=3D1)" > "=A0=A0=A0=A0=A0=A0=A0 Sort Key: test.tid, testresult.trscore, testresult= .trpossiblescore, > testresult.trstart, testresult.trfinish, testresult.trscorebreakdown, > testresult.fk_sid, test.tname, qr.qrscore, qr.qrtotalscore, testresult.tr= id, > qr.qrid" > "=A0=A0=A0=A0=A0=A0=A0 Sort Method:=A0 external merge=A0 Disk: 75864kB" > "=A0=A0=A0=A0=A0=A0=A0 ->=A0 Hash Join=A0 (cost=3D2300.82..34001.42 rows= =3D702022 width=3D86) > (actual time=3D72.842..1276.634 rows=3D700536 loops=3D1)" > "=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Hash Cond: (qr.fk_trid =3D testr= esult.trid)" > "=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ->=A0 Seq Scan on questionresult= qr=A0 (cost=3D0.00..12182.22 > rows=3D702022 width=3D16) (actual time=3D0.112..229.987 rows=3D702022 loo= ps=3D1)" > "=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ->=A0 Hash=A0 (cost=3D1552.97..1= 552.97 rows=3D29668 width=3D74) (actual > time=3D71.421..71.421 rows=3D29515 loops=3D1)" > "=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ->=A0 Hash Joi= n=A0 (cost=3D3.35..1552.97 rows=3D29668 width=3D74) > (actual time=3D0.398..44.524 rows=3D29515 loops=3D1)" > "=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0 Hash Cond: (testresult.fk_tid =3D test.tid)" > "=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0 ->=A0 Seq Scan on testresult=A0 (cost=3D0.00..1141.68 > rows=3D29668 width=3D53) (actual time=3D0.117..20.890 rows=3D29668 loops= =3D1)" > "=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0 ->=A0 Hash=A0 (cost=3D2.60..2.60 rows=3D60 width=3D21) > (actual time=3D0.112..0.112 rows=3D60 loops=3D1)" > "=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0 ->=A0 Seq Scan on test=A0 (cost=3D0.00..2.60 > rows=3D60 width=3D21) (actual time=3D0.035..0.069 rows=3D60 loops=3D1)" > "Total runtime: 23462.639 ms" your plans are identical as is the runtime basically. this means you might want to consider the following possibilities: *) operator error :-) *) cache effects *) environmental factors on the server at the time *) network/client issues I say network issues because if your explain analyze (which actually does run the entire query) is significantly faster than the full query, then we have to consider that the formatting and transfer of the data back to the client (even if it's on the same box) becomes suspicious. If you've eliminated other possibilities, try running other big, trivially planned, mucho result returning queries (like select * from table) on both servers and comparing times. merlin From jd@commandprompt.com Thu Jul 15 17:17:39 2010 Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 62F0F632B68 for ; Thu, 15 Jul 2010 14:17:39 -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 93998-08 for ; Thu, 15 Jul 2010 17:17:32 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from spinlock.commandprompt.com (host-215.commandprompt.net [207.173.203.215]) by mail.postgresql.org (Postfix) with ESMTP id 1CFAB632A86 for ; Thu, 15 Jul 2010 14:17:32 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by spinlock.commandprompt.com (Postfix) with ESMTP id E4CD6348037; Thu, 15 Jul 2010 10:17:30 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at commandprompt.com Received: from spinlock.commandprompt.com ([127.0.0.1]) by localhost (spinlock.commandprompt.com.commandprompt.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rrW6mJA1WN4S; Thu, 15 Jul 2010 10:17:25 -0700 (PDT) Received: from [75.142.153.107] (unknown [75.142.153.107]) by spinlock.commandprompt.com (Postfix) with ESMTPSA id 25036348002; Thu, 15 Jul 2010 10:17:25 -0700 (PDT) Subject: Re: Identical query slower on 8.4 vs 8.3 From: "Joshua D. Drake" Reply-To: jd@commandprompt.com To: Patrick Donlin Cc: pgsql-performance@postgresql.org In-Reply-To: <1187615879.13268921279204882941.JavaMail.root@mm-mailstore02.merit.edu> References: <1187615879.13268921279204882941.JavaMail.root@mm-mailstore02.merit.edu> Content-Type: text/plain; charset="UTF-8" Organization: Command Prompt, Inc. Date: Thu, 15 Jul 2010 10:17:21 -0700 Message-ID: <1279214241.30528.42.camel@jd-desktop.unknown.charter.com> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Content-Transfer-Encoding: 7bit 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: 201007/243 X-Sequence-Number: 39632 On Thu, 2010-07-15 at 10:41 -0400, Patrick Donlin wrote: > Results when running on the v8.3.7 server.... > Total query runtime: 32185 ms. > 700536 rows retrieved. > > Results when running on the v8.4.4 server.... > Total query runtime: 164227 ms. > 700536 rows retrieved. > > > Anyone have any ideas on where I should start looking to figure this > out? I didn't perform any special steps when moving to v8.4, I just > did a pg_dump from the 8.3 server and restored it on the new 8.4 > servers. Maybe that is where I made a mistake. Three immediate things come to mind: 1. One had relations in file or shared buffer cache, the other didn't 2. One is running ext4 versus ext3 and when you end up spilling to disk when you over run work_mem, the ext4 machine is faster, but without knowing which machine is which it is a bit tough to diagnose. 3. You didn't run ANALYZE on one of the machines Sincerely, Joshua D. Drake > > Thanks! > Patrick > -- PostgreSQL.org Major Contributor Command Prompt, Inc: http://www.commandprompt.com/ - 509.416.6579 Consulting, Training, Support, Custom Development, Engineering From pdonlin@oaisd.org Thu Jul 15 18:48:19 2010 Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 4907163282E for ; Thu, 15 Jul 2010 15:48:19 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 42174-02 for ; Thu, 15 Jul 2010 18:48:11 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mm-mailstore02.merit.edu (mm-mailstore02.merit.edu [207.74.184.19]) by mail.postgresql.org (Postfix) with ESMTP id 85C5963267E for ; Thu, 15 Jul 2010 15:48:10 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by mm-mailstore02.merit.edu (Postfix) with ESMTP id D53386801412; Thu, 15 Jul 2010 14:48:09 -0400 (EDT) X-Virus-Scanned: amavisd-new at mm-mailstore02.merit.edu Received: from mm-mailstore02.merit.edu ([127.0.0.1]) by localhost (mm-mailstore02.merit.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id y6XQViSypHsX; Thu, 15 Jul 2010 14:48:04 -0400 (EDT) Received: from mm-mailstore02.merit.edu (mm-mailstore02.merit.edu [10.108.2.25]) by mm-mailstore02.merit.edu (Postfix) with ESMTP id E82376800BBB; Thu, 15 Jul 2010 14:48:04 -0400 (EDT) Date: Thu, 15 Jul 2010 14:48:04 -0400 (EDT) From: Patrick Donlin To: Merlin Moncure Cc: pgsql-performance@postgresql.org Message-ID: <1045407518.13317091279219684833.JavaMail.root@mm-mailstore02.merit.edu> In-Reply-To: Subject: Re: Identical query slower on 8.4 vs 8.3 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_448990_767340079.1279219684831" X-Originating-IP: [64.9.158.13] X-Mailer: Zimbra 5.0.21_GA_3150.RHEL5_64 (ZimbraWebClient - FF3.0 (Mac)/5.0.21_GA_3150.RHEL5_64) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-4.199 tagged_above=-10 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_MED=-2.3 X-Spam-Level: X-Archive-Number: 201007/245 X-Sequence-Number: 39634 ------=_Part_448990_767340079.1279219684831 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Thanks everyone for the input so far, Merlin's comment about the network gave me one of those duh moments since I have been running these queries remotely using pgadmin. I will experiment with this more tomorrow/Monday along with the other suggestions that have been posted to hopefully narrow it down. Running the query from my webserver yielded much better times, but from a quick look it seems my 8.4 server is still a bit slower. I will share more details as I dig into it more tomorrow or Monday. -Patrick ----- Original Message ----- From: "Merlin Moncure" To: "Patrick Donlin" Cc: "Kevin Grittner" , pgsql-performance@postgresql.org Sent: Thursday, July 15, 2010 12:04:13 PM GMT -05:00 US/Canada Eastern Subject: Re: [PERFORM] Identical query slower on 8.4 vs 8.3 your plans are identical as is the runtime basically. this means you might want to consider the following possibilities: *) operator error :-) *) cache effects *) environmental factors on the server at the time *) network/client issues I say network issues because if your explain analyze (which actually does run the entire query) is significantly faster than the full query, then we have to consider that the formatting and transfer of the data back to the client (even if it's on the same box) becomes suspicious. If you've eliminated other possibilities, try running other big, trivially planned, mucho result returning queries (like select * from table) on both servers and comparing times. merlin ------=_Part_448990_767340079.1279219684831 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable <= div style=3D'font-family: Arial; font-size: 12pt; color: #000000'>Thanks ev= eryone for the input so far, Merlin's comment about the network gave me one= of those duh moments since I have been running these queries remotely usin= g pgadmin. I will experiment with this more tomorrow/Monday along with the = other suggestions that have been posted to hopefully narrow it down. Runnin= g the query from my webserver yielded much better times, but from a quick l= ook it seems my 8.4 server is still a bit slower. I will share more details= as I dig into it more tomorrow or Monday.

-Patrick

----- Ori= ginal Message -----
From: "Merlin Moncure" <mmoncure@gmail.com>To: "Patrick Donlin" <pdonlin@oaisd.org>
Cc: "Kevin Grittner" <= ;Kevin.Grittner@wicourts.gov>, pgsql-performance@postgresql.org
Sent:= Thursday, July 15, 2010 12:04:13 PM GMT -05:00 US/Canada Eastern
Subjec= t: Re: [PERFORM] Identical query slower on 8.4 vs 8.3

your plans are= identical as is the runtime basically.  this means you
might want = to consider the following possibilities:
*) operator error :-)
*) cac= he effects
*) environmental factors on the server at the time
*) netw= ork/client issues

I say network issues because if your explain analy= ze (which actually
does run the entire query) is significantly faster th= an the full
query, then we have to consider that the formatting and tran= sfer of
the data back to the client (even if it's on the same box) becom= es
suspicious.  If you've eliminated other possibilities, try runni= ng
other big, trivially planned, mucho result returning queries (likeselect * from table) on both servers and comparing times.

merlin ------=_Part_448990_767340079.1279219684831-- From ineyman@perceptron.com Fri Jul 16 14:10:50 2010 Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id E39AA632E99 for ; Fri, 16 Jul 2010 11:10: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 02376-06 for ; Fri, 16 Jul 2010 14:10:43 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from EXCHANGE.perceptron.com (exchange.perceptron.com [68.22.13.203]) by mail.postgresql.org (Postfix) with ESMTP id 35F15632E45 for ; Fri, 16 Jul 2010 11:10:43 -0300 (ADT) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable Subject: Re: Identical query slower on 8.4 vs 8.3 Date: Fri, 16 Jul 2010 10:10:40 -0400 Message-ID: In-Reply-To: <1123546138.13276371279206773000.JavaMail.root@mm-mailstore02.merit.edu> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Identical query slower on 8.4 vs 8.3 Thread-Index: Acsk8Ku2lC1cinByTfO7hCB6ly7pvw== References: <4C3EDB070200002500033621@gw.wicourts.gov> <1123546138.13276371279206773000.JavaMail.root@mm-mailstore02.merit.edu> From: "Igor Neyman" To: "Patrick Donlin" , "Kevin Grittner" , X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.79 tagged_above=-10 required=5 tests=BAYES_50=0.8, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201007/261 X-Sequence-Number: 39650 =20 > -----Original Message----- > From: Patrick Donlin [mailto:pdonlin@oaisd.org]=20 > Sent: Thursday, July 15, 2010 11:13 AM > To: Kevin Grittner; pgsql-performance@postgresql.org > Subject: Re: Identical query slower on 8.4 vs 8.3 >=20 > I'll read over that wiki entry, but for now here is the=20 > EXPLAIN ANALYZE output assuming I did it correctly. I have=20 > run vacuumdb --full --analyze, it actually runs as a nightly=20 > cron job. >=20 > 8.4.4 Sever: > "Unique (cost=3D202950.82..227521.59 rows=3D702022 width=3D86)=20 > (actual time=3D21273.371..22429.511 rows=3D700536 loops=3D1)" > " -> Sort (cost=3D202950.82..204705.87 rows=3D702022 width=3D86)=20 > (actual time=3D21273.368..22015.948 rows=3D700536 loops=3D1)" > " Sort Key: test.tid, testresult.trscore,=20 > testresult.trpossiblescore, testresult.trstart,=20 > testresult.trfinish, testresult.trscorebreakdown,=20 > testresult.fk_sid, test.tname, qr.qrscore, qr.qrtotalscore,=20 > testresult.trid, qr.qrid" > " Sort Method: external merge Disk: 71768kB" > " -> Hash Join (cost=3D2300.82..34001.42 rows=3D702022=20 > width=3D86) (actual time=3D64.388..1177.468 rows=3D700536 loops=3D1)" > " Hash Cond: (qr.fk_trid =3D testresult.trid)" > " -> Seq Scan on questionresult qr =20 > (cost=3D0.00..12182.22 rows=3D702022 width=3D16) (actual=20 > time=3D0.090..275.518 rows=3D702022 loops=3D1)" > " -> Hash (cost=3D1552.97..1552.97 rows=3D29668=20 > width=3D74) (actual time=3D63.042..63.042 rows=3D29515 loops=3D1)" > " -> Hash Join (cost=3D3.35..1552.97=20 > rows=3D29668 width=3D74) (actual time=3D0.227..39.111 rows=3D29515 = loops=3D1)" > " Hash Cond: (testresult.fk_tid =3D = test.tid)" > " -> Seq Scan on testresult =20 > (cost=3D0.00..1141.68 rows=3D29668 width=3D53) (actual=20 > time=3D0.019..15.622 rows=3D29668 loops=3D1)" > " -> Hash (cost=3D2.60..2.60 rows=3D60=20 > width=3D21) (actual time=3D0.088..0.088 rows=3D60 loops=3D1)" > " -> Seq Scan on test =20 > (cost=3D0.00..2.60 rows=3D60 width=3D21) (actual time=3D0.015..0.044=20 > rows=3D60 loops=3D1)" > "Total runtime: 22528.820 ms" >=20 > 8.3.7 Server: > "Unique (cost=3D202950.82..227521.59 rows=3D702022 width=3D86)=20 > (actual time=3D22157.714..23343.461 rows=3D700536 loops=3D1)" > " -> Sort (cost=3D202950.82..204705.87 rows=3D702022 width=3D86)=20 > (actual time=3D22157.706..22942.018 rows=3D700536 loops=3D1)" > " Sort Key: test.tid, testresult.trscore,=20 > testresult.trpossiblescore, testresult.trstart,=20 > testresult.trfinish, testresult.trscorebreakdown,=20 > testresult.fk_sid, test.tname, qr.qrscore, qr.qrtotalscore,=20 > testresult.trid, qr.qrid" > " Sort Method: external merge Disk: 75864kB" > " -> Hash Join (cost=3D2300.82..34001.42 rows=3D702022=20 > width=3D86) (actual time=3D72.842..1276.634 rows=3D700536 loops=3D1)" > " Hash Cond: (qr.fk_trid =3D testresult.trid)" > " -> Seq Scan on questionresult qr =20 > (cost=3D0.00..12182.22 rows=3D702022 width=3D16) (actual=20 > time=3D0.112..229.987 rows=3D702022 loops=3D1)" > " -> Hash (cost=3D1552.97..1552.97 rows=3D29668=20 > width=3D74) (actual time=3D71.421..71.421 rows=3D29515 loops=3D1)" > " -> Hash Join (cost=3D3.35..1552.97=20 > rows=3D29668 width=3D74) (actual time=3D0.398..44.524 rows=3D29515 = loops=3D1)" > " Hash Cond: (testresult.fk_tid =3D = test.tid)" > " -> Seq Scan on testresult =20 > (cost=3D0.00..1141.68 rows=3D29668 width=3D53) (actual=20 > time=3D0.117..20.890 rows=3D29668 loops=3D1)" > " -> Hash (cost=3D2.60..2.60 rows=3D60=20 > width=3D21) (actual time=3D0.112..0.112 rows=3D60 loops=3D1)" > " -> Seq Scan on test =20 > (cost=3D0.00..2.60 rows=3D60 width=3D21) (actual time=3D0.035..0.069=20 > rows=3D60 loops=3D1)" > "Total runtime: 23462.639 ms" >=20 >=20 > Thanks for the quick responses and being patient with me not=20 > providing enough information. > -Patrick >=20 Well, now that you've got similar runtime on both 8.4.4 and 8.3.7, here is a suggestion to improve performance of this query based on EXPLAIN ANALYZE you proveded (should have done it in your first e-mail). EXPLAIN ANALYZE shows that most of the time (22015 ms on 8.4.4) spent on sorting you result set. And according to this: "Sort Method: external merge Disk: 71768kB" - sorting is done using disk, meaning your work_mem setting is not sufficient to do this sort in memory (I didn't go back through this thread far enough, to see if you provided info on how it is set). I'd suggest to increase the value up to ~80MB, if not for the system, may be just for the session running this query. Then see if performance improved. And, with query performance issues always start with EXPLAIN ANALYZE. Regards, Igor Neyman=20 From tv@fuzzy.cz Fri Jul 16 14:17:39 2010 Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id CD29F632822 for ; Fri, 16 Jul 2010 11:17:39 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 47018-05 for ; Fri, 16 Jul 2010 14:17:31 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from anastacia.gransy.com (anastacia.gransy.com [77.78.104.100]) by mail.postgresql.org (Postfix) with ESMTP id CD53C6327B5 for ; Fri, 16 Jul 2010 11:17:32 -0300 (ADT) Received: from sq.gransy.com (localhost [127.0.0.1]) by anastacia.gransy.com (Postfix) with ESMTP id 169F818E001; Fri, 16 Jul 2010 16:17:24 +0200 (CEST) Received: from 62.40.76.70 (proxying for unknown) (SquirrelMail authenticated user tv@fuzzy.cz) by sq.gransy.com with HTTP; Fri, 16 Jul 2010 16:17:24 +0200 (CEST) Message-ID: <59630.62.40.76.70.1279289844.squirrel@sq.gransy.com> In-Reply-To: References: <4C3EDB070200002500033621@gw.wicourts.gov> <1123546138.13276371279206773000.JavaMail.root@mm-mailstore02.merit.edu> Date: Fri, 16 Jul 2010 16:17:24 +0200 (CEST) Subject: Re: Identical query slower on 8.4 vs 8.3 From: tv@fuzzy.cz To: "Igor Neyman" Cc: "Patrick Donlin" , "Kevin Grittner" , pgsql-performance@postgresql.org User-Agent: SquirrelMail/1.4.10a MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-2 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.8 tagged_above=-10 required=5 tests=BAYES_50=0.8 X-Spam-Level: X-Archive-Number: 201007/262 X-Sequence-Number: 39651 > I'd suggest to increase the value up to ~80MB, if not for the system, > may be just for the session running this query. > Then see if performance improved. Don't forget you can do this for the given query without affecting the other queries - just do something like SET work_mem = 128M and then run the query - it should work fine. This is great for testing and to set environment for special users (batch processes etc.). regards Tomas