Text indexes...

From: Vince Vielhaber <vev(at)michvhf(dot)com>
To: [hackers](at)paprika(dot)michvhf(dot)com, hackers(at)postgreSQL(dot)org
Subject: Text indexes...
Date: 1998-08-03 19:10:51
Message-ID: XFMail.980803151051.vev@michvhf.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)michvhf(dot)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
==========================================================================

Browse pgsql-hackers by date

  From Date Subject
Next Message Roland Roberts 1998-08-03 22:54:48 PostgreSQL catalogues: finding the primary key
Previous Message Bruce Momjian 1998-08-03 18:19:44 Re: [HACKERS] Bug in gram.y?