Re: [SQL] optimizer woes ?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: Howie <caffeine(at)toodarkpark(dot)org>, pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] optimizer woes ?
Date: 1999-06-15 19:55:58
Message-ID: 23416.929476558@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

>> shouldn't the optimizer convert lower('anick') to lowercase first, then
>> use that value in searching the logins_nick_idx index ?

The system only knows how to use qualifications like "var rel constant"
as index-scan restrictions. "var rel func(constant)" is not of that
form ... but it could be if there were a preprocessing step that
recognized "func(constant)" as a constant subexpression and replaced it
by its result.

Right now, we don't have any such step. I've been thinking about it for
6.6 though.

Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us> writes:
> We have on our TODO list:
> * Use index with constants on functions

The TODO entry is insufficiently ambitious: it should read "implement
a general-purpose constant-subexpression-reduction step". (Actually,
I think that TODO entry might refer to something completely different
... wasn't the complaint that you couldn't make an index on
"date_part('date', field)"? )

regards, tom lane

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Bruce Momjian 1999-06-15 20:09:46 Re: [SQL] optimizer woes ?
Previous Message Fabio Silvestri 1999-06-15 19:39:59 replication