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.