Client:ClientRead
This event occurs when a PostgreSQL backend process is waiting to receive data or a new command from the connected client application.
Essentially, the database has finished its previous task and is asking, "What should I do next?"
Big precentage of ClientRead indicates that the response from application is not fast enough. It is wasting wall-clock time and potentially holding locks.
"ClientRead" wait-event combined with "idle-in-transaction" can cause contention in the server.
Two reasons generally cause high values for this wait-event
Why it is happening (Root Causes)
1. Network Latency (The "Slow Road"):
The communication channel between the database and the application/client may have low bandwith or high latency.
For example, there could be too many network hops. Many of the Cloud, Virtualization, Containerization, Firewall, and Routing (sometimes multi-layer routing) are found to cause high network latency.
Latency has nothing to do with network bandwidth. Even a very high bandwidth connection can have high latency and affect the database performance.
Please remember that the network related waits within the trasactions are generally accounted as "ClientRead"
2. Application Logic (The "Long Pause"):
This is the most dangerous cause. It happens when an application starts a transaction (BEGIN), performs a SQL command, and then pauses to do non-database work
(like sending an email, processing a file, or calling an external API) before sending the next SQL command or COMMIT.
During this pause, the database is left waiting for the next command from the application, leading to "ClientRead" waits.
This situation is particularly problematic because it can lead to long-held locks and increased contention within the database.
3. Human Error:
A user with interactive login access may start a transaction and then get distracted or take a long time to issue the next command or COMMIT.