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

From Joe Conway
Subject Re: function returning setof performance question
Date
Msg-id 3F2740A8.7020900@joeconway.com
Whole thread Raw
In response to Re: function returning setof performance question  (Mark Bronnimann <meb@speakeasy.net>)
List 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



pgsql-sql by date:

Previous
From: Mark Bronnimann
Date:
Subject: Re: function returning setof performance question
Next
From: "Anagha Joshi"
Date:
Subject: time precision.