Text indexes... - Mailing list pgsql-hackers

From Vince Vielhaber
Subject Text indexes...
Date
Msg-id XFMail.980803151051.vev@michvhf.com
Whole thread Raw
List pgsql-hackers
It's me and them indexes again.  This time back to text.

What is the difference (as far as an index is concerned) between:

select city from locations where lower(city) = lower('st. ignace');

and

select city from locations where lower(city) = 'st. ignace';

The index was created like this:

create index locations_city on locations(lower(city) text_ops);


The first gives me the Seq Scan and the second gives me the much needed
Index Scan (there are almost 170K rows in the table).  I can probably
do the lower case conversion in advance in C (since this is called from
a C program) but what am I missing with the difference between these two
statements?   As long as it's receiving lower case, why should the
optomizer care what's on the right side of the equal sign?

Very confused,
Vince.
--
==========================================================================
Vince Vielhaber -- KA8CSH   email: vev@michvhf.com   flame-mail: /dev/null
       # include <std/disclaimers.h>                   TEAM-OS2
   Online Searchable Campground Listings    http://www.camping-usa.com
       "There is no outfit less entitled to lecture me about bloat
               than the federal government"  -- Tony Snow
==========================================================================



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Bug in gram.y?
Next
From: Peter T Mount
Date:
Subject: Re: [HACKERS] initdb problems