Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 87B7B2E0039 for ; Mon, 14 Apr 2008 14:54:29 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 80860-09 for ; Mon, 14 Apr 2008 14:54:22 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from fhw-relay07.plus.net (fhw-relay07.plus.net [212.159.14.215]) by developer.postgresql.org (Postfix) with ESMTP id 55EA12E0082 for ; Mon, 14 Apr 2008 14:54:22 -0300 (ADT) Received: from [84.51.143.99] (helo=server3.office.archonet.com) by fhw-relay07.plus.net with esmtp (Exim) id 1JlSsl-0007N2-RG; Mon, 14 Apr 2008 18:54:20 +0100 Received: from [192.168.1.36] (dell36.office.archonet.com [192.168.1.36]) by server3.office.archonet.com (Postfix) with ESMTP id 91B2A27405A; Mon, 14 Apr 2008 18:54:19 +0100 (BST) Message-ID: <48039A4C.2000304@archonet.com> Date: Mon, 14 Apr 2008 18:54:20 +0100 From: Richard Huxton User-Agent: Thunderbird 2.0.0.12 (X11/20080213) MIME-Version: 1.0 To: Adam Gundy CC: pgsql-performance@postgresql.org Subject: Re: varchar index joins not working? References: <6f55f1270804092013n73ee1f81t2c6d72cee49655a3@mail.gmail.com> <47FDD3D1.9070208@archonet.com> <47FE29AF.6010906@starsilk.net> <6f55f1270804101154t3d4a01eco2b7bff7a0053af38@mail.gmail.com> <48030439.9040309@archonet.com> <48038E21.50606@starsilk.net> In-Reply-To: <48038E21.50606@starsilk.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Plusnet-Relay: a9cbd179086d3298a11fb5b097abdb0f X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200804/181 X-Sequence-Number: 29674 Adam Gundy wrote: > I doubt we could get stats stable enough for this. the number of groups > will hopefully be much larger at some point. The pg_stats table should be recording the n most-common values, so if you have 1 million groups you track details of the 1000 most-common. That gives you a maximum for how common any value not in the stats can be. >> No, but let's see what's in pg_stats. > > no real help there. either it hits the group being read, and does a good > plan, or it doesn't, and tries to seqscan (unless I disable it). even > forcing stats to 1000 only bandaids the situation, given the number of > groups will eventually exceed that.. Like I say, that's not the point of gathering the stats. If one group represents 95% of your rows, then its group-id should be almost certain to occur in the stats. Are you saying that's not happening with your data? -- Richard Huxton Archonet Ltd