Re: "Group By " index usage - Mailing list pgsql-performance

From Tom Lane
Subject Re: "Group By " index usage
Date
Msg-id 10877.1101318923@sss.pgh.pa.us
Whole thread Raw
In response to "Group By " index usage  (sdfasdfas sdfasdfs <descuarinjado@yahoo.es>)
List pgsql-performance
sdfasdfas sdfasdfs <descuarinjado@yahoo.es> writes:
> I have a table with this index:
>  create index ARTISTS_NAME on ARTISTS (
>  lower(AR_NAME)
>  );

> Te index is over a colum with this definition:

>  AR_NAME              VARCHAR(256)         null,

> I want to optimize this query:

>  select * from artists where lower(ar_name) like
> lower('a%') order by lower(ar_name) limit 20;

> I think the planner should use the index i have.

Update to 7.4, or declare the column as TEXT instead of VARCHAR.
Older versions aren't very bright about situations involving
implicit coercions.

            regards, tom lane

pgsql-performance by date:

Previous
From: sdfasdfas sdfasdfs
Date:
Subject: "Group By " index usage
Next
From: "gnari"
Date:
Subject: Re: FW: Index usage