Re: Indexing varchar fields with lower()

Mitch Vincent <mitch@huntsvilleal.com>

From: "Mitch Vincent" <mitch@huntsvilleal.com>
To: <pgsql-hackers@postgresql.org>
Date: 2000-05-05T15:32:11Z
Lists: 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