Re: When extended query protocol ends?

Michael Zhilin <m.zhilin@postgrespro.ru>

From: Michael Zhilin <m.zhilin@postgrespro.ru>
To: Jelte Fennema-Nio <postgres@jeltef.nl>, Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
Cc: Tatsuo Ishii <ishii@sraoss.co.jp>, davecramer@postgres.rocks, tgl@sss.pgh.pa.us, pgsql-hackers@postgresql.org
Date: 2024-02-22T12:01:36Z
Lists: pgsql-hackers
Hi,

On 2/22/24 14:09, Jelte Fennema-Nio wrote:
>> Apparently, sending an extra message would increase the overhead of the protocol, thus reducing the efficiency of the application.
>> What is the benefit of sending extra Sync?
>>
>> https://www.postgresql.org/docs/current/protocol-overview.html#PROTOCOL-MESSAGE-CONCEPTS
>> suggests that is is fine to mix both simple and extended messages
>> depending on the needs of the application.
> Yes, it's fine to mix and match extended and simple protocol. But the
> protocol docs quite clearly state that a sync is required before going
> back to the Simple protocol: "At completion of each series of
> extended-query messages, the frontend should issue a Sync message."
> https://www.postgresql.org/docs/current/protocol-flow.html#PROTOCOL-FLOW-EXT-QUERY
I would like to say this document states that "at completion... frontend 
should issue a Sync message... causes the backend to close the current 
transaction"
It looks like the sense of wording is "to complete transaction" at the 
eventual end of traffic, but not "to switch to single protocol".
Otherwise, we can't use both protocols under same transaction that looks 
too strict limitation.
> Terminating a sequence of extended messages with a Query message
> instead of a Sync message is definitely undefined behaviour.
>
>


-- 
Michael Zhilin
Postgres Professional
+7(925)3366270
https://www.postgrespro.ru