pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <maillist@candle.pha.pa.us>
To: Howie <caffeine@toodarkpark.org>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] optimizer woes ?
Date: Tue, 15 Jun 1999 13:13:18 -0400 (EDT)
Message-ID: <199906151714.NAA11734@candle.pha.pa.us> (raw)
In-Reply-To: <Pine.LNX.3.96.990615170128.15049T-100000@rabies.toodarkpark.org>

> ircbot=> explain select nick,hostname,dttime,logtype from logins where
> nick=lower('anick') ORDER BY dttime desc;
> NOTICE:  QUERY PLAN:
> 
> Sort  (cost=19913.31 size=0 width=0)
>   ->  Seq Scan on logins  (cost=19913.31 size=42498 width=44)
> ---[ CUT ]---
> 
> but when removing the lower(), it uses the index:
> 
> ---[ CUT ]---
> ircbot=> explain select nick,hostname,dttime,logtype from logins where
> nick='anick' ORDER BY dttime desc;
> 
> NOTICE:  QUERY PLAN:
> 
> Sort  (cost=15.68 size=0 width=0)
>   ->  Index Scan using logins_nick_idx on logins  (cost=15.68 size=214
> width=44)
> ---[ CUT ]---
> 
> shouldn't the optimizer convert lower('anick') to lowercase first, then
> use that value in searching the logins_nick_idx index ?
> 
> btw, this is using postgres 6.4.2 (system is a debian box, p2-350 with
> 256m, all uw scsi </brag> )
> 

We have on our TODO list:

	* Use index with constants on functions

Seems we have not implemented it yet.  It may be done in 6.5, but I
don't think so.

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026



view thread (4+ messages)  latest in thread

Message-ID: <199906151714.NAA11734@candle.pha.pa.us>
Permalink:  ../199906151714.NAA11734@candle.pha.pa.us/
Also on:    postgresql.org/message-id/199906151714.NAA11734@candle.pha.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: maillist@candle.pha.pa.us, caffeine@toodarkpark.org
  Subject: Re: [SQL] optimizer woes ?
  In-Reply-To: <199906151714.NAA11734@candle.pha.pa.us>
  References: <Pine.LNX.3.96.990615170128.15049T-100000@rabies.toodarkpark.org> <199906151714.NAA11734@candle.pha.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