Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 9E6939FC19C for ; Thu, 28 Jun 2007 12:30:37 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 67936-06 for ; Thu, 28 Jun 2007 12:30:30 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from ns1.officenet.no (ns1.officenet.no [193.212.174.3]) by postgresql.org (Postfix) with ESMTP id D911D9FC199 for ; Thu, 28 Jun 2007 12:30:30 -0300 (ADT) Received: from [85.112.130.182] (helo=krogh-laptop.local) by ns1.officenet.no with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.62) (envelope-from ) id 1I3vww-0005dV-3d; Thu, 28 Jun 2007 17:30:29 +0200 From: Andreas Joseph Krogh Organization: OfficeNet AS To: Tom Lane Subject: Re: Is index usage in LIKE-queries with UTF-8 implemented in PG-8.3 ? Date: Thu, 28 Jun 2007 17:30:35 +0200 User-Agent: KMail/1.9.7 Cc: pgsql-sql@postgresql.org References: <200706281630.16455.andreak@officenet.no> <5092.1183044056@sss.pgh.pa.us> In-Reply-To: <5092.1183044056@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200706281730.35560.andreak@officenet.no> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/238 X-Sequence-Number: 28728 On Thursday 28 June 2007 17:20:56 Tom Lane wrote: > Andreas Joseph Krogh writes: > > Anybody knows if the following query will use an index-scan in PG-8.3? > > SELECT name FROM person WHERE name LIKE 'and%'; > > I know this works in "C"-locale, but I need it with UTF-8, > > "C locale" and "UTF8" are entirely orthogonal things. > > regards, tom lane I had the impression that LIKE-queries of type LIKE '123%' couldn't use an= =20 index if encoding was UTF-8. I was wrong obviously. The varchar_pattern_ops= =20 suggested by Pavel did the trick for me. Tom: Can you comment on, very short, if the discussion on HACKERS with=20 title "like/ilike improvements" will improve LIKE queries like this? Anybody knows if queries of type "LIKE '%234%'" ever will be able to use=20 indexes, and if someone is working on it? I'm sure I'm not the only one who= =20 would very much appreciate it:-) =2D-=20 Andreas Joseph Krogh Senior Software Developer / Manager =2D-----------------------+---------------------------------------------+ OfficeNet AS | The most difficult thing in the world is to | Karenslyst All=C3=A9 11 | know how to do a thing and to watch | PO. Box 529 Sk=C3=B8yen | somebody else doing it wrong, without | 0214 Oslo | comment. | NORWAY | | Tlf: +47 24 15 38 90 | | =46ax: +47 24 15 38 91 | | Mobile: +47 909 56 963 | | =2D-----------------------+---------------------------------------------+