Re: ORDER BY case insensitive? - Mailing list pgsql-sql

From Stephan Szabo
Subject Re: ORDER BY case insensitive?
Date
Msg-id Pine.BSF.4.21.0110041443380.58252-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Re: ORDER BY case insensitive?  (Jason Earl <jdearl@yahoo.com>)
List 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.




pgsql-sql by date:

Previous
From: Jason Earl
Date:
Subject: Re: ORDER BY case insensitive?
Next
From: "Ross J. Reedstrom"
Date:
Subject: Re: Need Help!!