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 871F33A3B5F for ; Fri, 5 Nov 2004 15:09:32 +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 41189-04 for ; Fri, 5 Nov 2004 15:09:24 +0000 (GMT) Received: from tht.net (vista.tht.net [216.126.88.2]) by svr1.postgresql.org (Postfix) with ESMTP id 09A373A3B2A for ; Fri, 5 Nov 2004 15:09:27 +0000 (GMT) Received: from [134.22.69.212] (dyn-69-212.tor.dsl.tht.net [134.22.69.212]) by tht.net (Postfix) with ESMTP id 5E50376D74; Fri, 5 Nov 2004 10:09:04 -0500 (EST) Subject: Re: Strange (?) Index behavior? From: Rod Taylor To: Allen Landsidel Cc: Postgresql Performance In-Reply-To: <88f1825a041105063955367088@mail.gmail.com> References: <88f1825a041105063955367088@mail.gmail.com> Content-Type: text/plain Message-Id: <1099667258.1647.827.camel@home> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Fri, 05 Nov 2004 10:07:38 -0500 Content-Transfer-Encoding: 7bit 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/96 X-Sequence-Number: 9050 > It seems to me that a query saying "SELECT column FROM table WHERE > column LIKE 'AA%';" should be just as fast or very close to the first > case up above. However, explain tells me that this query is not using > the index above, which is what's not making sense to me. It looks for an exact expression match, and doesn't know about values which are equal. You can provide both clauses. WHERE column LIKE 'A%' and column LIKE 'AA%';