Re: Indexing varchar fields with lower() - Mailing list pgsql-hackers

From Mitch Vincent
Subject Re: Indexing varchar fields with lower()
Date
Msg-id 01b901bfb6a7$150b02a0$4100000a@venux.net
Whole thread Raw
In response to Re: Why Not MySQL?  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: Indexing varchar fields with lower()
List pgsql-hackers
Excellent, Tom. Thanks!

It went from

ipa=# explain select * from applicants as a where a.firstname ~* '^mitch'
limit 10 offset 0;
NOTICE:  QUERY PLAN:

Seq Scan on applicants a  (cost=0.00..1355.54 rows=98 width=599)

EXPLAIN
ipa=#

To....

ipa=# explain select * from applicants as a where lower(a.firstname) ~
lower('^mitch') limit 10 offset 0;
NOTICE:  QUERY PLAN:

Index Scan using applicants_firstname on applicants a  (cost=0.00..228.47
rows=98 width=599)

EXPLAIN

On 7.0 RC5.

Could putting that function in there even though it's not 'built-in' cause
any problems that you can think of? (Mainly worried about any kind of index
corruption like I've seen before)

Thanks again!

- Mitch





pgsql-hackers by date:

Previous
From: "Hiroshi Inoue"
Date:
Subject: RE: pg_group_name_index corrupt?
Next
From: Thomas Lockhart
Date:
Subject: Re: pg_group_name_index corrupt?