Re: Index optimization ? - Mailing list pgsql-general

From Bo Lorentsen
Subject Re: Index optimization ?
Date
Msg-id 41EA9A40.2060106@netgroup.dk
Whole thread Raw
In response to Re: Index optimization ?  (Ragnar Hafstað <gnari@simnet.is>)
Responses Re: Index optimization ?
List pgsql-general
Ragnar Hafstað wrote:

>this has nothing to do with the return type. a volatile function is a
>function that is not garanteed to return the same value given same
>input parameters, (such as currval()).
>
>when a volatile function is used thus:
>  SELECT * FROM mytable WHERE col=myvolatilefunc();
>the planner must call the function once per table row, and assume
>possibly different return values each time, so an indexscan will
>not improve timings.
>
>
Why not use the index scan for every row, is this a "limit" in the
planner ? I think there is something in the planner I don't understand :-)

>on the other hand, if the function is labeled STABLE, the planner
>can assume that the same value will alway be returned, so only
>one call to it can be made, and an indexscan might be found the
>most effective.
>
>
The two other function types are not interesting, but I don't understand
the planners use of index optimization.

/BL

pgsql-general by date:

Previous
From: Ragnar Hafstað
Date:
Subject: Re: Index optimization ?
Next
From: Martijn van Oosterhout
Date:
Subject: Re: Index optimization ?