Re: ILIKE

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ILIKE
Date: 2003-02-24 21:25:51
Message-ID: 5647.1046121951@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> Josh Berkus writes:
>> 4) It's just as indexible (or not indexable) as regexp comparisons, and easier
>> to understand for users from the Microsoft world than regexp.

> ILIKE is not indexible at all.

You are arguing from a false premise.

regression=# create table foo (f1 text unique);
NOTICE: CREATE TABLE / UNIQUE will create implicit index 'foo_f1_key' for table 'foo'
CREATE TABLE
regression=# explain select * from foo where f1 ilike '123%';
QUERY PLAN
------------------------------------------------------------------------
Index Scan using foo_f1_key on foo (cost=0.00..17.07 rows=5 width=32)
Index Cond: ((f1 >= '123'::text) AND (f1 < '124'::text))
Filter: (f1 ~~* '123%'::text)
(3 rows)

ILIKE is exactly as indexable as any other pattern that does the same
thing.

regards, tom lane

In response to

  • Re: ILIKE at 2003-02-24 19:19:34 from Peter Eisentraut

Browse pgsql-hackers by date

  From Date Subject
Next Message Ross J. Reedstrom 2003-02-24 21:34:57 Re: Simplifying timezone support
Previous Message Tom Lane 2003-02-24 21:23:44 Re: Possibly inconsistent type casting logic