From: Christopher Kings-Lynne <chriskl@familyhealth.com.au>
To: Bojidar Mihajlov <bmihajlov@yahoo.com>
Cc: pgsql-hackers@postgresql.org
Cc: pgsql-odbc@postgresql.org
Subject: Re: [HACKERS] RQ: Prepared statements used by multiple connections
Date: Tue, 25 Jan 2005 09:37:43 +0000
Message-ID: <41F61367.5060807@familyhealth.com.au> (raw)
In-Reply-To: <20050125092707.32541.qmail@web50502.mail.yahoo.com>
References: <20050125092707.32541.qmail@web50502.mail.yahoo.com>
> I need a mechanism to keep my queries in optimized
> state so that multiple processes can use them.
You should use stored procedures then.
For instance, say you want to keep 'SELECT * FROM table WHERE id=x'
prepared. You would go:
CREATE OR REPLACE FUNCTION get_table_id(integer) RETURNS SETOF table AS
'SELECT * FROM table WHERE id=$1' LANGUAGE SQL;
PostgreSQL will store a prepared version of that statement after its
first use.
You use it like this:
SELECT * FROM get_table_id(3);
Chris
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: chriskl@familyhealth.com.au, bmihajlov@yahoo.com, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RQ: Prepared statements used by multiple connections
In-Reply-To: <41F61367.5060807@familyhealth.com.au>
References: <20050125092707.32541.qmail@web50502.mail.yahoo.com> <41F61367.5060807@familyhealth.com.au>
* 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