Re: ORDER BY case insensitive?

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Jason Earl <jdearl(at)yahoo(dot)com>
Cc: Bob Swerdlow <swerdlow(at)maine(dot)rr(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: ORDER BY case insensitive?
Date: 2001-10-04 22:20:20
Message-ID: Pine.BSF.4.21.0110041443380.58252-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thu, 4 Oct 2001, Jason Earl wrote:

> My guess is that compared to the task of sorting
> millions of names the fact that you have to lowercase
> them first is not going to be a particular burden. No
> matter what you do you are going to get a table scan
> (unless you qualify your select with a where clause).
>
> You can, however, create an index like:
>
> create index MyTable_lower_idx on MyTable
> (lower(name));
>
> It won't help with your particular query, but it
> certainly would help for queries like:

Current sources do (and I think older sources may) consider
such an index to replace the sort step. On a test table with
100000 strings, explain shows an index scan for the lower(<col>)
ordering and a seq scan/sort for <col> ordering. At this point
there's actually a performance gain for the lower() index scan.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Ross J. Reedstrom 2001-10-04 22:33:56 Re: Need Help!!
Previous Message Jason Earl 2001-10-04 21:22:55 Re: ORDER BY case insensitive?