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: "Verena Ruff" <lists(at)triosolutions(dot)at>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: case-insensitive Index
Date: 2006-07-19 14:53:58
Message-ID: 26019.1153320838@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-novice
"Verena Ruff" <lists(at)triosolutions(dot)at> writes:
> EXPLAIN SELECT * FROM kundepersonhc WHERE UPPER(pers_nachname) LIKE
> UPPER('me%');
> says that a seq scan is done.

> I used this statement to define the index:
> CREATE INDEX kundepersonhc_upper_pers_nachname ON kundepersonhc
> (UPPER(pers_nachname));

If your locale is not C then you'd need to specify a special index
opclass while creating the index in order to let it support LIKE
queries, eg

CREATE INDEX kundepersonhc_upper_pers_nachname ON kundepersonhc
(UPPER(pers_nachname) text_pattern_ops);

http://www.postgresql.org/docs/8.1/static/indexes-opclass.html

			regards, tom lane

In response to

Responses

pgsql-novice by date

Next:From: Verena RuffDate: 2006-07-19 15:43:41
Subject: Re: case-insensitive Index
Previous:From: Tom LaneDate: 2006-07-19 14:49:24
Subject: Re: Query optimization / automatic re-ordering of tables

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