Re: function returning setof performance question

From: Mark Bronnimann <meb(at)speakeasy(dot)net>
To: Rod Taylor <rbt(at)rbt(dot)ca>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: function returning setof performance question
Date: 2003-07-30 02:57:27
Message-ID: 20030730025727.GA2094@spiff.astoria.bogus
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance pgsql-sql


Thanks for the reply.

I was hoping to eliminate the parse call on the view because I was doing
the where clause on the view instead of putting the where in the view.
In all, I was hoping to keep a single view called from multiple functions
with different where clauses. Yep... I shoulda known better...

Thanks again!

And Rod Taylor (rbt(at)rbt(dot)ca) said...:

> > 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
>

--

Mark Bronnimann
meb(at)speakeasy(dot)net

-- Let's organize this thing and take all the fun out of it. --

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Joe Conway 2003-07-30 03:51:04 Re: function returning setof performance question
Previous Message Rod Taylor 2003-07-30 02:28:19 Re: function returning setof performance question

Browse pgsql-sql by date

  From Date Subject
Next Message Joe Conway 2003-07-30 03:51:04 Re: function returning setof performance question
Previous Message Rod Taylor 2003-07-30 02:28:19 Re: function returning setof performance question