X-Original-To: pgsql-docs-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E19AA9DC848 for ; Tue, 17 Jan 2006 16:26:41 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 89592-07 for ; Tue, 17 Jan 2006 16:26:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 1EDE49DC841 for ; Tue, 17 Jan 2006 16:26:38 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 471FE39820; Tue, 17 Jan 2006 14:26:39 -0600 (CST) Date: Tue, 17 Jan 2006 14:26:39 -0600 From: "Jim C. Nasby" To: Magnus Hagander Cc: Tom Lane , pgsql-docs@postgresql.org Subject: Re: [HACKERS] Docs off on ILIKE indexing? Message-ID: <20060117202639.GL67693@pervasive.com> References: <6BCB9D8A16AC4241919521715F4D8BCE6C7EB6@algol.sollentuna.se> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6BCB9D8A16AC4241919521715F4D8BCE6C7EB6@algol.sollentuna.se> X-Operating-System: FreeBSD 6.0-RELEASE amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.093 required=5 tests=[AWL=0.093] X-Spam-Score: 0.093 X-Spam-Level: X-Archive-Number: 200601/25 X-Sequence-Number: 3415 On Tue, Jan 17, 2006 at 03:44:30PM +0100, Magnus Hagander wrote: > > > http://www.postgresql.org/docs/8.1/static/indexes-types.html > > > says: > > > The optimizer can also use a B-tree index for queries involving the > > > pattern matching operators LIKE, ILIKE, ~, and ~*, if the > > pattern is a > > > constant and is anchored to the beginning of the string - > > for example, > > > col LIKE 'foo%' or col ~ '^foo', but not col LIKE '%bar'. > > > > > But really, does it use indexes for ILIKE? > > > > That's pretty poorly phrased. For ILIKE it'll only work if > > there's a prefix of the pattern that's not letters (and hence > > is unaffected by the case-folding issue). > > Ahh. That explains it. Perfectly logical. > And yes, that's pretty poorly phrased - at least I didn't understand it > :-) I was going to submit a patch on this, and the best way seems to be adding a note to 'ILIKE', specifying that it will only work if there's a prefix to the pattern that isn't letters. Is there a standard way to tag a word indicating that there's a note? -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461