Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id B61BC476716 for ; Fri, 31 May 2002 13:02:31 -0400 (EDT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id 56A814759D0 for ; Fri, 31 May 2002 13:02:18 -0400 (EDT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id BD5DBD60D; Fri, 31 May 2002 10:02:17 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id B309E5C01; Fri, 31 May 2002 10:02:17 -0700 (PDT) Date: Fri, 31 May 2002 10:02:17 -0700 (PDT) From: Stephan Szabo To: Marc Mitchell Cc: Subject: Re: LIKE operator and indexes In-Reply-To: <01f301c208c0$a9b74ae0$7501050a@eisolution.com> Message-ID: <20020531095711.V56129-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200205/260 X-Sequence-Number: 4435 On Fri, 31 May 2002, Marc Mitchell wrote: > Can anyone provide definitive information and/or points of reference within > the documentation about the ability of the query optimizer to use indexes > when processing a "LIKE" operator on a String column? > > My assumption is that > > "SELECT * FROM customer WHERE name LIKE 'GENERAL%';" > > should benefit from the existence of a BTREE index on the "customer.name" > column. I know this is the case is most other RDBMS's I've used including > Postgres's ancestor Ingres. If you are in "C" locale, and have an anchored like or regex, indexes should be considered. If you're in a different locale, the optimization is turned off.