Re: SQL query latency when using pgPool (v4.6.2)

From: Bo Peng <pengbo(at)sraoss(dot)co(dot)jp>
To: Bob Ross <bob(dot)ross(dot)19821(at)gmail(dot)com>, "pgpool-general(at)lists(dot)postgresql(dot)org" <pgpool-general(at)lists(dot)postgresql(dot)org>
Subject: Re: SQL query latency when using pgPool (v4.6.2)
Date: 2025-10-17 07:42:04
Message-ID: TYWP286MB263346EDD0F451CE5C8067BAF2F6A@TYWP286MB2633.JPNP286.PROD.OUTLOOK.COM
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgpool-general

Hi,

Thank you for your question.

Could you please share the cluster configuration?
(For example, the number of nodes, Pgpool-II/PostgreSQL versions, and whether pgpool and PostgreSQL are running on the same host.)

Also, could you please share your pgpool.conf file and the pgpool logs?

---
Bo Peng <pengbo(at)sraoss(dot)co(dot)jp>
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
Mobile: 080-7752-0749
URL: https://www.sraoss.co.jp/

________________________________________
差出人: Bob Ross <bob(dot)ross(dot)19821(at)gmail(dot)com>
送信: 2025 年 10 月 8 日 (水曜日) 15:30
宛先: pgpool-general(at)lists(dot)postgresql(dot)org <pgpool-general(at)lists(dot)postgresql(dot)org>
件名: SQL query latency when using pgPool (v4.6.2)

Hello,
I am currently testing SQL query performance using PgPool (v4.6.2) as a load balancer, and I am observing approximately 18–20 ms latency between SQL statements within the same transaction. Execution time on the PostgreSQL backend servers is less than 0.5 ms.
It’s important to note that both the application and database servers are located in the same cloud region, with network latency below 1 ms. PgPool is colocated with the PostgreSQL backend servers.
For example, when executing a transaction containing 10 SQL statements, the total execution time through pgPool is about 200 ms, as confirmed by both application and pgPool logs. The delay consistently occurs between the “Execute” and “Parse” phases. When connecting directly to the PostgreSQL backends, the same transaction completes in about 10 ms, with roughly 1 ms between SQL statements.
We have tested the following configurations:
- Switched from the extended query protocol to the simple query protocol — for some queries this reduced inter-query latency to 2–3 ms, but for others it increased to 30–40 ms due to additional parsing overhead.
- Adjusted various PgPool parameters related to load balancing and connection pooling (e.g., load_balance_mode, statement_level_load_balance, serialize_accept, disable_load_balance_on_write) and enabled debug logging, but none of these changes brought a significant improvement.
Could you please advise whether there are additional pgPool parameters or tuning approaches that could help improve throughput and reduce latency in extended query protocol? 
Thank you,
Bob

In response to

Browse pgpool-general by date

  From Date Subject
Next Message Bo Peng 2025-10-17 07:55:26 Re: Automating Failover Resync & Re-Attach in pgpool2
Previous Message chongin119 2025-10-15 01:24:33 About PG-Pool Load balance configuration