"Eric B. Ridge" <e...@tcdi.com> writes:
> I loaded a copy of a production database into PG 8.4b1 and immediately  
> saw that all of our queries were significantly slower compared to v8.1.

> Some investigation showed that the use of non-IMMUTABLE PL/PGSQL  
> functions as view columns, when these views are joined with other  
> views, cause the query to be planned poorly.

I think this is due to a change that was made in 8.2:

    * Do not flatten subqueries that contain volatile functions in their
      target lists (Jaime Casanova)

        This prevents surprising behavior due to multiple evaluation of a
        volatile function (such as random() or nextval()). It might cause
        performance degradation in the presence of functions that are
        unnecessarily marked as volatile.

The pre-8.2 behavior was unduly optimistic about the safety of
rearranging calls to volatile functions.

                        regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to