X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A8A8911F6B46 for ; Fri, 7 Apr 2006 10:31:23 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29538-02 for ; Fri, 7 Apr 2006 10:31:17 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from ptb-relay02.plus.net (ptb-relay02.plus.net [212.159.14.213]) by postgresql.org (Postfix) with ESMTP id 42DDB11F6B18 for ; Fri, 7 Apr 2006 10:31:21 -0300 (ADT) Received: from [213.162.97.75] (helo=mail.metronet.co.uk) by ptb-relay02.plus.net with esmtp (Exim) id 1FRr3W-00011m-P1; Fri, 07 Apr 2006 14:31:18 +0100 Received: from mainbox.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 E6D8973709; Fri, 7 Apr 2006 14:32:24 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 9FCF0FF04; Fri, 7 Apr 2006 14:31:17 +0100 (BST) Message-ID: <443669A5.2000603@archonet.com> Date: Fri, 07 Apr 2006 14:31:17 +0100 From: Richard Huxton User-Agent: Thunderbird 1.5 (X11/20051201) MIME-Version: 1.0 To: Rafael Martinez Guerrero Cc: pgsql-performance@postgresql.org Subject: Re: Same SQL, 104296ms of difference between 7.4.12 and References: <1144413933.24060.253.camel@bbking.uio.no> In-Reply-To: <1144413933.24060.253.camel@bbking.uio.no> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200604/127 X-Sequence-Number: 18211 Rafael Martinez Guerrero wrote: > Hello > > I have a sql statement that takes 108489.780 ms with 8.0.7 in a > RHEL4/amd64linux server with 2xAMD Opteron(tm) Processor 275 2.00GHz / > 8GB RAM and only 4193.588 ms with 7.4.12 in a RHEL3/386linux server with > 2xIntel(R) Xeon(TM) CPU 2.40GHz / 4GB RAM. > > Some information: > > - There is no IO when I am running the sql, but it uses 99% of the cpu. > - I run VACUUM VERBOSE ANALYZE in both databases before the test. > - The databases are identical. > - No other jobs running when testing. > - Some different parameters between 7.4.12 and 8.0.7 : > > 7.4.12: > ------- > shared_buffers = 114966 #(15% of ram) > sort_mem = 16384 > vacuum_mem = 524288 > wal_buffers = 64 > checkpoint_segments = 16 > effective_cache_size = 383220 #(50% ram) > random_page_cost = 3 > default_statistics_target = 100 > > 8.0.7: > ------ > shared_buffers = 250160 #(25% ram) > work_mem = 8192 > maintenance_work_mem = 131072 > wal_buffers = 128 > checkpoint_segments = 64 > effective_cache_size = 500321 #(50% ram) > random_page_cost = 3 > default_statistics_target = 100 > > Any ideas of what I can test/configurate to find out why this happens? > Thanks in advance. I haven't looked in detail at the plans, but what stands out to me is that you've got a sort with a lot of columns and you've halved sort_mem (work_mem). Try increasing it (perhaps to 32000 even). set work_mem = 32000; Give that a quick go and see what happens. If it doesn't work, we'll look at the plans in more detail. -- Richard Huxton Archonet Ltd