function returning setof performance question

From: Mark Bronnimann <meb(at)speakeasy(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: function returning setof performance question
Date: 2003-07-30 02:08:59
Message-ID: 20030730020859.GA1795@spiff.astoria.bogus
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance pgsql-sql


I have a question regarding the performance of a function returning a
set of a view as opposed to just selecting the view with the same
where clause. Please, if this should go to the performance list instead,
let me know. I'm just wondering about this from the sql end of things.

Here's the environment:

I'm working from PHP, calling on the query.

I have a view that joins 12 tables and orders the results.

From PHP, I do a select on that view with a where clause.

I created a function that queries the view with the where clause
included in the function. The function is returning a setof that
view taking one variable for the where clause (there are several
other static wheres in there).

I have found that querying the view with the where clause is
giving me quicker results than if I call the function.

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.

Any ideas?

Thanks folks... I'm new to the list.

--

Mark Bronnimann
meb(at)speakeasy(dot)net

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

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Rod Taylor 2003-07-30 02:28:19 Re: function returning setof performance question
Previous Message Tom Lane 2003-07-29 21:32:14 Re: Why performance improvement on converting subselect to a function ?

Browse pgsql-sql by date

  From Date Subject
Next Message Bruce Momjian 2003-07-30 02:20:16 Re: Very strange 'now' behaviour in nested triggers.
Previous Message Vishal Charan (IT Fiji) 2003-07-29 23:06:16 Unsubscribe