X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 078203A3F9E for ; Sat, 6 Nov 2004 04:04:46 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 58084-02 for ; Sat, 6 Nov 2004 04:04:37 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 2817A3A3F8F for ; Sat, 6 Nov 2004 04:04:36 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iA644N4d025493; Fri, 5 Nov 2004 23:04:24 -0500 (EST) To: Matt Clark Cc: Allen Landsidel , pgsql-performance@postgresql.org Subject: Re: Strange (?) Index behavior? In-reply-to: <418C1757.70909@ymogen.net> References: <88f1825a041105095631064cb0@mail.gmail.com> <008401c4c366$127d5260$8300a8c0@solent> <88f1825a04110513028759dd3@mail.gmail.com> <418C1757.70909@ymogen.net> Comments: In-reply-to Matt Clark message dated "Sat, 06 Nov 2004 00:14:15 +0000" Date: Fri, 05 Nov 2004 23:04:23 -0500 Message-ID: <25492.1099713863@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/120 X-Sequence-Number: 9074 Matt Clark writes: > Well, 74000/76000000 ~= 0.1%, way less than 1/26, so no surprise that an > indexscan is better, and also no surprise that the planner can't know > that I is such an uncommon initial char. But it *can* know that, at least given adequate ANALYZE statistics. I'm pretty convinced that the basic answer to Allen's problem is to increase the histogram size. How large he needs to make it is not clear --- obviously his data distribution is not uniform, but I don't have a fix on how badly non-uniform. regards, tom lane