Re: RQ: Prepared statements used by multiple connections
От | Neil Conway |
---|---|
Тема | Re: RQ: Prepared statements used by multiple connections |
Дата | |
Msg-id | 41F61D42.50804@samurai.com обсуждение исходный текст |
Ответ на | Re: RQ: Prepared statements used by multiple connections (Christopher Kings-Lynne <chriskl@familyhealth.com.au>) |
Ответы |
Re: RQ: Prepared statements used by multiple connections
|
Список | pgsql-hackers |
Christopher Kings-Lynne wrote: >> 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. ... a prepared version that is local to the backend that invokes the function, yes (i.e. it will be planned once per backend). So ISTM this is equivalent functionality to what you can get using PREPARE or the extended query protocol. There currently isn't support for prepared queries that span multiple connections. There has been prior discussion of the topic, so try searching the pgsql-hackers archive. There are some implementation issues that require thought (e.g. managing dependencies, storing a potentially unbounded set of prepared queries in a finite amount of shmem). -Neil
В списке pgsql-hackers по дате отправления: