Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 19E2F6329C1 for ; Fri, 23 Apr 2010 10:36:54 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 55450-03 for ; Fri, 23 Apr 2010 13:36:26 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-px0-f174.google.com (mail-px0-f174.google.com [209.85.212.174]) by mail.postgresql.org (Postfix) with ESMTP id 4680E632454 for ; Fri, 23 Apr 2010 10:36:43 -0300 (ADT) Received: by pxi17 with SMTP id 17so876279pxi.19 for ; Fri, 23 Apr 2010 06:36:41 -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=LTLEg/UDRjcFcDmxKpFYdsLmr9ao+zYSRzMeMmppuaA=; b=SKZp/xhNmuu4k8Dc/g9+dVk7ola2LS+r5YXUXSP3I4GP/BnCazPTZTfPXW2cHI6Vj4 lqdHvfFQFWKnAc7z0B1/Bk18+Vh9Uj38mHZwYzyKSeYfiX6Z2x+9v4u4t3fW4+ZyaVml bE4i0vz26C+WCfnhhUsLJvIK5I+gQ8kaET94k= 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=bjUf16RYenQOJKmR1850pPCdp7OhGT7Dtkh37R+8PT6BWyfFq6bHh+epxdxwtN+zL/ i7JXNFKJqoTe2y/MbFw5pjovwHdchpzc97pGPXE7RUYw1rtLzGr1jnCAZOv1dd1Q1l4Z nWFVIx5BM44vQN5aU7qau4txj9+3rnVxa57EE= MIME-Version: 1.0 Received: by 10.141.106.11 with SMTP id i11mr3592rvm.242.1272029801225; Fri, 23 Apr 2010 06:36:41 -0700 (PDT) Received: by 10.231.38.194 with HTTP; Fri, 23 Apr 2010 06:36:40 -0700 (PDT) In-Reply-To: References: <4BD0161A.4010908@dc.baikal.ru> <4BD0430C.1050308@2ndquadrant.com> <4BD10805.9060004@dc.baikal.ru> Date: Fri, 23 Apr 2010 09:36:40 -0400 Message-ID: Subject: Re: Optimization idea From: Robert Haas To: =?ISO-8859-1?Q?C=E9dric_Villemain?= Cc: Vlad Arkhipov , 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.377 tagged_above=-10 required=5 tests=AWL=-0.877, BAYES_05=-0.5 X-Spam-Level: X-Archive-Number: 201004/299 X-Sequence-Number: 38549 On Fri, Apr 23, 2010 at 9:09 AM, C=E9dric Villemain wrote: > 2010/4/23 Robert Haas : >> On Thu, Apr 22, 2010 at 10:37 PM, Vlad Arkhipov w= rote: >>> I don't think this is just an issue with statistics, because the same >>> problem arises when I try executing a query like this: >> >> I'm not sure how you think this proves that it isn't a problem with >> statistics, but I think what you should be focusing on here, looking >> back to your original email, is that the plans that are actually much >> faster have almost as much estimated cost as the slower one. =A0Since >> all your data is probably fully cached, at a first cut, I might try >> setting random_page_cost and seq_page_cost to 0.005 or so, and >> adjusting effective_cache_size to something appropriate. > > that will help worrect the situation, but the planner is loosing here I t= hink. Well, what do you think the planner should do differently? ...Robert