From: | Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Howie <caffeine(at)toodarkpark(dot)org> |
Cc: | pgsql-sql(at)postgreSQL(dot)org |
Subject: | Re: [SQL] optimizer woes ? |
Date: | 1999-06-15 17:13:18 |
Message-ID: | 199906151714.NAA11734@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
> 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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
From | Date | Subject | |
---|---|---|---|
Next Message | Jackson, DeJuan | 1999-06-15 17:34:56 | RE: [SQL] Function security? |
Previous Message | Howie | 1999-06-15 17:11:22 | optimizer woes ? |