Re: "Group By " index usage

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: sdfasdfas sdfasdfs <descuarinjado(at)yahoo(dot)es>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: "Group By " index usage
Date: 2004-11-24 17:55:23
Message-ID: 10877.1101318923@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

sdfasdfas sdfasdfs <descuarinjado(at)yahoo(dot)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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Bo Stewart 2004-11-24 17:58:06 Hardware purchase question
Previous Message sdfasdfas sdfasdfs 2004-11-24 17:36:59 "Group By " index usage