| From: | Dmitrii Bondar <d(dot)bondar(at)postgrespro(dot)ru> |
|---|---|
| To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Pgbench: remove synchronous prepare |
| Date: | 2026-01-27 03:34:51 |
| Message-ID: | 2da56b59-acb6-4ee3-af6b-6e800115dc7f@postgrespro.ru |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi, Hackers!
I was testing a connection pooler with pgbench and pgbench froze. I
checked the traffic and noticed that pgbench just blocks the execution
while it is waiting the response to the prepare command.
To reproduce the problem, it is enough to run pgbouncer with the session
pooling mode and use more clients than the pool size. With the pool size
of 20:
pgbench -h localhost -p 6432 --client=21 --jobs=1 -S -T 1000 -P 1
postgres --protocol=prepared
Pgbench with the extended protocol flag does not have this issue because
pgbench sends the whole parse/bind/execute/sync packet sequence at once
and waits for the result asynchronously. I suggest implementing this
behavior for the prepared protocol too.
I attached the pgbouncer configuration to reproduce the issue and the
proposed fix. I prefer to add a new function to libpqfe instead of
changing the existing behavior or adding a new state to pgbench.
Although it is largely duplicated code, it looks to be as non-invasive
as possible. Implementation and naming need to be discussed.
Tests for pgbench passed. I made small changes to the expected output.
Regards,
Dmitrii Bondar.
| Attachment | Content-Type | Size |
|---|---|---|
| pgbouncer.ini | text/plain | 235 bytes |
| userlist.txt | text/plain | 56 bytes |
| 0001-Remove-synchronous-prepare-from-pgbench.patch | text/x-patch | 5.0 KB |
| From | Date | Subject | |
|---|---|---|---|
| Previous Message | cca5507 | 2026-01-27 03:13:11 | Re: Fix logical decoding not track transaction during SNAPBUILD_BUILDING_SNAPSHOT |