Received: from localhost (uranus.hub.org [200.46.204.60]) by postgresql.org (Postfix) with ESMTP id 25D979FA3D0 for ; Wed, 22 Nov 2006 15:17:49 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.60]) (amavisd-new, port 10024) with ESMTP id 86917-02 for ; Wed, 22 Nov 2006 15:17:45 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by postgresql.org (Postfix) with ESMTP id 670099F9CF9 for ; Wed, 22 Nov 2006 15:17:45 -0400 (AST) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id 533AE14D2B2; Wed, 22 Nov 2006 19:17:43 +0000 (GMT) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 62EF115EAB; Wed, 22 Nov 2006 19:17:42 +0000 (GMT) Message-ID: <4564A314.4090504@archonet.com> Date: Wed, 22 Nov 2006 19:20:52 +0000 From: Richard Huxton User-Agent: Thunderbird 1.5.0.8 (X11/20061115) MIME-Version: 1.0 To: Travis Whitton Cc: pgsql-sql@postgresql.org Subject: Re: Regular Expressions, LIKE, and indexes References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/234 X-Sequence-Number: 26886 Travis Whitton wrote: > > SELECT keyword FROM keywords WHERE keyword like 'foo%'; > > Are there any other functions that can provide equivalent results while > using an index, or am going to have drop UTF-8 and recreate my database? UTF-8 isn't your locale, it's your character set (or encoding). Your locale is something like en_GB.UTF-8 (for British sorting). You need to define your indexes in such a way that the LIKE can figure things out. That means using a special operator-class (so that you redefine how less-than and greater-than are defined). It takes longer to explain than to do, so I'll direct you to the relevant "CREATE INDEX" example in the manuals: http://www.postgresql.org/docs/8.1/static/indexes-opclass.html -- Richard Huxton Archonet Ltd