pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Patrik Kudo <kudo@partitur.se>
Cc: Ross J. Reedstrom <reedstrm@rice.edu>
Cc: pgsql-sql@postgresql.org
Subject: Re: indexing and LIKE
Date: Fri, 12 Oct 2001 13:32:15 -0400
Message-ID: <27330.1002907935@sss.pgh.pa.us> (raw)
In-Reply-To: <20011012100747.I99068-100000@tb303.partitur.se>
References: <20011012100747.I99068-100000@tb303.partitur.se>

Patrik Kudo <kudo@partitur.se> writes:
> Thanks for your respons, but I'm afraid it didn't help. I've succeeded
> with indexing my table using functional indices, but the problem is that
> the index I create won't work with my query.

Works for me:

test71=# create table person (last_name text);
CREATE
test71=# create index person_lower_lname_idx on person (lower(last_name));
CREATE
test71=# explain select * from person where lower(last_name) like 'kud%';
NOTICE:  QUERY PLAN:

Index Scan using person_lower_lname_idx on person  (cost=0.00..8.16 rows=10 width=12)

EXPLAIN

The difference is probably a locale problem: if you aren't in C locale
then the index LIKE optimization is disabled because it doesn't work
reliably.  See the list archives for more info.

			regards, tom lane



view thread (7+ messages)  latest in thread

Message-ID: <27330.1002907935@sss.pgh.pa.us>
Permalink:  ../27330.1002907935@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/27330.1002907935@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, kudo@partitur.se, reedstrm@rice.edu
  Subject: Re: indexing and LIKE
  In-Reply-To: <27330.1002907935@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox