From: Joe Conway <mail@joeconway.com>
To: Mark Bronnimann <meb@speakeasy.net>
Cc: Rod Taylor <rbt@rbt.ca>
Cc: pgsql-sql@postgresql.org
Subject: Re: function returning setof performance question
Date: Tue, 29 Jul 2003 20:51:04 -0700
Message-ID: <3F2740A8.7020900@joeconway.com> (raw)
In-Reply-To: <20030730025727.GA2094@spiff.astoria.bogus>
References: <20030730020859.GA1795@spiff.astoria.bogus>
<1059532098.54325.23.camel@jester>
<20030730025727.GA2094@spiff.astoria.bogus>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: mail@joeconway.com, meb@speakeasy.net, rbt@rbt.ca
Subject: Re: function returning setof performance question
In-Reply-To: <3F2740A8.7020900@joeconway.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox