Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id EF9AE633951 for ; Fri, 8 Jan 2010 15:55:12 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 74964-05 for ; Fri, 8 Jan 2010 19:55:02 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-fx0-f227.google.com (mail-fx0-f227.google.com [209.85.220.227]) by mail.postgresql.org (Postfix) with ESMTP id 3ACAF632E2A for ; Fri, 8 Jan 2010 15:55:01 -0400 (AST) Received: by fxm27 with SMTP id 27so5033620fxm.3 for ; Fri, 08 Jan 2010 11:55:00 -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:cc:content-type :content-transfer-encoding; bh=fGcQaI5Iw+zsIsxQKT/UApciBdCv0+uDnulVZnRqUjk=; b=TSSEyTXJg1kepevTeM60Riig1Wo4F2QI/AU5+r3GP4nn5aSzWJ0F8mwKdTs3cHtWYt CRyvn8jRYnISj7A5+B2T1U620eEu1/hY9UQ2gXmiaBJjbv7utUoFL5hfyW89BP2ZB0oO Ex3dxngjvFteqoRHoDqdgdeP+EalD2QCB2BdQ= 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=sOgsh4fSFkHpvq4T7GGAFOv3pMzroHNfMqTkQLnLfS9oZY8475tNrnKIZHoHODPe7u xLxKV+LPdLLRGs/06LOGaIVq41jyDpQEWqeTPE7ayaqD+O2WbSq2Fx9Ap/aMMHPqRt2A r+RiI1FG2owUHRa7fgaerN9QSZzM3dKN4pbys= MIME-Version: 1.0 Received: by 10.239.148.8 with SMTP id d8mr1446897hbb.109.1262980500548; Fri, 08 Jan 2010 11:55:00 -0800 (PST) In-Reply-To: <10916.1262978630@sss.pgh.pa.us> References: <4B47722A.4010502@digsys.bg> <9969.1262975223@sss.pgh.pa.us> <603c8f071001081101t5c7b26fci407edd8523a7f4a@mail.gmail.com> <10916.1262978630@sss.pgh.pa.us> Date: Fri, 8 Jan 2010 14:55:00 -0500 Message-ID: <603c8f071001081155w3b7b8042s362837542cfbc42b@mail.gmail.com> Subject: Re: Change query join order From: Robert Haas To: Tom Lane Cc: Kaloyan Iliev Iliev , 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=0.589 tagged_above=-10 required=5 tests=BAYES_00=-2.599, FH_DATE_PAST_20XX=3.188 X-Spam-Level: X-Archive-Number: 201001/155 X-Sequence-Number: 37035 On Fri, Jan 8, 2010 at 2:23 PM, Tom Lane wrote: >> If the other plan does turn out to be faster (and I agree with Tom >> that there is no guarantee of that), then one thing to check is >> whether seq_page_cost and random_page_cost are set too high. =A0If the >> data is all cached, the default values of 4 and 1 are three orders of >> magnitude too large, and they should also be set to equal rather than >> unequal values. > > Tweaking the cost parameters to suit your local situation is the > recommended cure for planner misjudgments; but I'd recommend against > changing them on the basis of only one example. =A0You could easily > find yourself making other cases worse. =A0Get a collection of common > queries for your app and look at the overall effects. No argument, and well said -- just trying to point out that the default values really are FAR too high for people with databases that fit in OS cache. ...Robert