Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 53ECD1337B4A for ; Tue, 21 Sep 2010 16:17:14 -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 31680-05 for ; Tue, 21 Sep 2010 19:17:07 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.8]) by mail.postgresql.org (Postfix) with ESMTP id D6F431337B2F for ; Tue, 21 Sep 2010 16:17:06 -0300 (ADT) Received: from [192.168.1.6] (static-71-179-240-8.bltmmd.fios.verizon.net [71.179.240.8]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0MDVnR-1P1DOg0bJF-00HZgF; Tue, 21 Sep 2010 21:17:00 +0200 Message-ID: <4C9904A9.5080301@2ndquadrant.com> Date: Tue, 21 Sep 2010 15:16:57 -0400 From: Greg Smith User-Agent: Thunderbird 2.0.0.24 (X11/20100317) MIME-Version: 1.0 To: jd@commandprompt.com CC: Ogden , Jesper Krogh , Kenneth Marshall , pgsql-performance@postgresql.org Subject: Re: Query much faster with enable_seqscan=0 References: <0D5B9ED0-00C3-4EEB-8336-0B2F8A884620@darkstatic.com> <20100921180618.GI17152@aart.is.rice.edu> <4C98FEA2.8030607@krogh.cc> <3062DF4E-7460-4487-818A-BF77F176E501@darkstatic.com> <1285096031.15919.68.camel@jd-desktop.unknown.charter.com> In-Reply-To: <1285096031.15919.68.camel@jd-desktop.unknown.charter.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:Bi5wy0q0uC/lQwsgLTA8//iZsyp6Lh893feTnwraX0I L2O27xVvZZacVqMOBrIMXE4ViOrx55b1Y45Cvd21m/ZzxaWaIl 1EF9fOSsOPV2wU2yQnDiONTD8bEMC9mjLFi9CRPkyYGa8rfBxO 50G0OwoJ9JuTL8vNu5DUALntDIDR6sc/WDZ7V/6gswBYoXQ32n 0zzsrUTqi97hQ2KzMLY6dgAf/M4AlpYbkN/CpaMqQE= 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: 201009/130 X-Sequence-Number: 40333 Joshua D. Drake wrote: > PostgreSQL's defaults are based on extremely small and some would say > (non production) size databases. As a matter of course I always > recommend bringing seq_page_cost and random_page_cost more in line. > Also, they presume that not all of your data is going to be in memory, and the query optimizer needs to be careful about what it does and doesn't pull from disk. If that's not the case, like here where there's 8GB of RAM and a 7GB database, dramatic reductions to both seq_page_cost and random_page_cost can make sense. Don't be afraid to think lowering below 1.0 is going too far--something more like 0.01 for sequential and 0.02 for random may actually reflect reality here. -- Greg Smith, 2ndQuadrant US greg@2ndQuadrant.com Baltimore, MD PostgreSQL Training, Services and Support www.2ndQuadrant.us Author, "PostgreSQL 9.0 High Performance" Pre-ordering at: https://www.packtpub.com/postgresql-9-0-high-performance/book