Re: [SQL] optimizer woes ? - Mailing list pgsql-sql

From Tom Lane
Subject Re: [SQL] optimizer woes ?
Date
Msg-id 23416.929476558@sss.pgh.pa.us
Whole thread Raw
In response to Re: [SQL] optimizer woes ?  (Bruce Momjian <maillist@candle.pha.pa.us>)
Responses Re: [SQL] optimizer woes ?
List 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@candle.pha.pa.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


pgsql-sql by date:

Previous
From: Fabio Silvestri
Date:
Subject: replication
Next
From: Bruce Momjian
Date:
Subject: Re: [SQL] optimizer woes ?