Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id F03F664FCF2 for ; Wed, 10 Dec 2008 15:34:43 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 01704-04 for ; Wed, 10 Dec 2008 15:34:35 -0400 (AST) 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 4A59764FC4F for ; Wed, 10 Dec 2008 15:34:34 -0400 (AST) 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 mBAJYXNQ006021; Wed, 10 Dec 2008 14:34:33 -0500 (EST) To: Richard Yen cc: pgsql-performance@postgresql.org Subject: Re: query plan with index having a btrim is different for strings of different length In-reply-to: References: <751F49DC-1142-4E9C-95C8-BC3C229B3F0B@richyen.com> <22937.1228865243@sss.pgh.pa.us> Comments: In-reply-to Richard Yen message dated "Wed, 10 Dec 2008 11:28:43 -0800" Date: Wed, 10 Dec 2008 14:34:33 -0500 Message-ID: <6020.1228937673@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200812/124 X-Sequence-Number: 32160 Richard Yen writes: > You guys are right. I tried "Miller" and gave me the same result. Is > there any way to tune this so that for the common last names, the > query run time doesn't jump from <1s to >300s? If the planner's estimation is that far off then there must be something very weird about the table statistics, but you haven't given us any clue what. regards, tom lane