pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: sdfasdfas sdfasdfs <descuarinjado@yahoo.es>
Cc: pgsql-performance@postgresql.org
Subject: Re: "Group By " index usage
Date: Wed, 24 Nov 2004 12:55:23 -0500
Message-ID: <10877.1101318923@sss.pgh.pa.us> (raw)
In-Reply-To: <20041124173659.2441.qmail@web54301.mail.yahoo.com>
References: <20041124173659.2441.qmail@web54301.mail.yahoo.com>

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



view thread (3+ messages)  latest in thread

Message-ID: <10877.1101318923@sss.pgh.pa.us>
Permalink:  ../10877.1101318923@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/10877.1101318923@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, descuarinjado@yahoo.es
  Subject: Re: "Group By " index usage
  In-Reply-To: <10877.1101318923@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox