Global Named Prepared Statements

Поиск
Список
Период
Сортировка
От Samba
Тема Global Named Prepared Statements
Дата
Msg-id CAKgWO9K5WBZJh+UD1p73Xrpf0MdZ8f=CppsSuS_BEstxswz2UA@mail.gmail.com
обсуждение исходный текст
Ответы Re: Global Named Prepared Statements
Re: Global Named Prepared Statements
Список pgsql-general
Hi,
Does postgresql support Global Prepared Statements, which are prepared only once per server and not per every connection?

I see a discussion about this in the pgsql-hacker archives but it does not have any conclusion; further, that discussion also deviates a bit from my question by proposing to cache any arbitrary statements when used too often based on statistical analyses.

here is the original thread : http://archives.postgresql.org/pgsql-hackers/2008-03/msg01228.php

I noticed that a similar feature request is made in mysql community as well; link here: http://bugs.mysql.com/bug.php?id=38732

Problem with per-connection prepared statements is that the onus of preparing those statements for each connection lies with the client which makes those connections. Ideally, the performance of an application must be decided by the Server that hosts and not by the client that uses the service.

Hence, it would be great if from a connection C1  i can prepare the statement:

PREPARE GLOBAL fooplan (int, text, bool, numeric) AS   INSERT INTO foo VALUES($1, $2, $3, $4);

And From Connections C2-Cn, I can execute the same statement with bind parameters:

EXECUTE fooplan(1, 'Hunter Valley', 't', 200.00);
This would help DBA to define the important and costly but fine-tuned queries and expose only the prepared statement names to the application developers. This will avoid scenarios like the developers forgetting to prepare all the required statements per each connection on the one hand and to make sure that they do not try to prepare it again and again which would be causing errors and if not handled properly may cause functionality to be broken at unexpected places.

Rather, if one can prepare named statements globally at once and then reuse them through the entire uptime of the server, would that not be a lot more beneficial?

If it is observed that a particular prepared statement is not behaving properly, then it can be deallocated and fixed and then prepared again.


I'm not that much sure whether such a feature is already implemented in postgres or not hence posting it to general mailing list; if folks feel that it ought to go to hackers list, then please guide me so.

Thanks and Regards,
Samba


В списке pgsql-general по дате отправления:

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: Encryption - searching and sorting
Следующее
От: Mike Christensen
Дата:
Сообщение: dblink.sql and Linux