Re: function returning setof performance question - Mailing list pgsql-sql

From Rod Taylor
Subject Re: function returning setof performance question
Date
Msg-id 1059532098.54325.23.camel@jester
Whole thread Raw
In response to function returning setof performance question  (Mark Bronnimann <meb@speakeasy.net>)
Responses Re: function returning setof performance question  (Mark Bronnimann <meb@speakeasy.net>)
List pgsql-sql
> The performance hit is tiny, we're talking less than 1/2 a second,
> but when I've done this sort of thing in Oracle I've seen a performance
> increase, not a decrease.

Thats just plain strange (never tried on Oracle).  Why in the world
would adding the overhead of a function call (with no other changes)
increase performance?

The function has additional overhead in the form of the plpgsql
interpreter.  You may find a c function will give close to identical
performance as with the standard view so long as the query is the same.


One thing to keep in mind is that the view can be rearranged to give a
better query overall. The exact work completed for the view may be
different when called from within a different SQL statement.  Most
functions -- some SQL language based functions are strange this way --
cannot do this


pgsql-sql by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Very strange 'now' behaviour in nested triggers.
Next
From: Mark Bronnimann
Date:
Subject: Re: function returning setof performance question