Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 0388D133729E for ; Fri, 29 Oct 2010 18:17:40 -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 21049-01 for ; Fri, 29 Oct 2010 21:17:32 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 5953E1336971 for ; Fri, 29 Oct 2010 18:17:32 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id o9TLHUi5009344; Fri, 29 Oct 2010 17:17:30 -0400 (EDT) To: "Ozer, Pam" cc: pgsql-performance@postgresql.org Subject: Re: Slow Query- Bad Row Estimate In-reply-to: <216FFB77CBFAEE4B8EE4DF0A939FF1D1018354@mail-001.corp.automotive.com> References: <216FFB77CBFAEE4B8EE4DF0A939FF1D1018354@mail-001.corp.automotive.com> Comments: In-reply-to "Ozer, Pam" message dated "Fri, 29 Oct 2010 13:54:04 -0700" Date: Fri, 29 Oct 2010 17:17:30 -0400 Message-ID: <9343.1288387050@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201010/594 X-Sequence-Number: 41012 "Ozer, Pam" writes: > Unfortunately I have not received a response on this question. Is more > information needed? Does anyone have any ideas why the estimates may be > bad? Or what I might be able to do to speed this up? The most likely explanation for the bad rowcount estimates is that there is correlation between the regionid/countyid/cityid columns, only the planner doesn't know it. Can you reformulate that data representation at all, or at least avoid depending on it as a join key? regards, tom lane