Re: Index optimization ?

From: Bo Lorentsen <bl(at)netgroup(dot)dk>
To: Ragnar Hafstað <gnari(at)simnet(dot)is>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Index optimization ?
Date: 2005-01-16 16:45:52
Message-ID: 41EA9A40.2060106@netgroup.dk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2005-01-16 16:48:08 Re: Index optimization ?
Previous Message Ragnar Hafstað 2005-01-16 16:34:42 Re: Index optimization ?