Re: function returning setof performance question

From: Joe Conway <mail(at)joeconway(dot)com>
To: Mark Bronnimann <meb(at)speakeasy(dot)net>
Cc: Rod Taylor <rbt(at)rbt(dot)ca>, pgsql-sql(at)postgresql(dot)org
Subject: Re: function returning setof performance question
Date: 2003-07-30 03:51:04
Message-ID: 3F2740A8.7020900@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance pgsql-sql

Mark Bronnimann wrote:
> 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...
>

It sounds like you're using a sql function, not a plpgsql function
(although I don't think you said either way). If you write the function
in plpgsql it will get parsed and cached on the first call in a
particular backend session, which *might* give you improved performance
on subsequent calls, if there are any; are you using persistent connections?

Alternatively, it might work to use a prepared query.

Joe

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Rajesh Kumar Mallah 2003-07-30 07:24:49 Re: Why performance improvement on converting subselect to a function ?
Previous Message Mark Bronnimann 2003-07-30 02:57:27 Re: function returning setof performance question

Browse pgsql-sql by date

  From Date Subject
Next Message Anagha Joshi 2003-07-30 07:52:03 time precision.
Previous Message Mark Bronnimann 2003-07-30 02:57:27 Re: function returning setof performance question