From: | Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> |
---|---|
To: | Bojidar Mihajlov <bmihajlov(at)yahoo(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org, pgsql-odbc(at)postgresql(dot)org |
Subject: | Re: [HACKERS] RQ: Prepared statements used by multiple connections |
Date: | 2005-01-25 09:37:43 |
Message-ID: | 41F61367.5060807@familyhealth.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-odbc |
> 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
From | Date | Subject | |
---|---|---|---|
Next Message | Neil Conway | 2005-01-25 10:19:46 | Re: [HACKERS] RQ: Prepared statements used by multiple connections |
Previous Message | Michael Paesold | 2005-01-25 09:30:01 | Re: WAL: O_DIRECT and multipage-writer |
From | Date | Subject | |
---|---|---|---|
Next Message | Neil Conway | 2005-01-25 10:19:46 | Re: [HACKERS] RQ: Prepared statements used by multiple connections |
Previous Message | Bojidar Mihajlov | 2005-01-25 09:27:07 | RQ: Prepared statements used by multiple connections |