Skip site navigation (1) Skip section navigation (2)

Re: case-insensitive Index

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: kmh496 <kmh496(at)kornet(dot)net>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: case-insensitive Index
Date: 2006-07-26 14:49:38
Message-ID: 1791.1153925378@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-novice
kmh496 <kmh496(at)kornet(dot)net> writes:
> I tried declaring a varchar_pattern_ops and text_varchar_ops on a
> character varying (60) column but it still does a sequential scan on the
> column.

That's because the index doesn't match the query:

> mod=# create index english_english_word_idx on
> english_english(UPPER(word) text_pattern_ops)

> mod=# explain select word from english_english where word like 'here';

You'd need
	select word from english_english where upper(word) like upper('here');
to use that index (and also to get the right answer, if your goal is
case-insensitive matching).

			regards, tom lane

In response to

pgsql-novice by date

Next:From: Andrew HammondDate: 2006-07-26 17:17:24
Subject: Re: Installation "baby" steps (next steps)?
Previous:From: Michael SwierczekDate: 2006-07-26 13:27:41
Subject: Re: Novice! How to run pg_dump from within Java?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group