Client - ClientWrite
The ClientWrite
event occurs when PostgreSQL is waiting to write data to the client.
A client process must read all of the data received from an PostgreSQL database instance before the cluster can send more data. The time that the cluster waits before sending more data to the client is a ClientWrite
event.
Reduced network throughput between the PostgreSQL database instance and the client can cause this event. CPU pressure and network saturation on the client can also cause this event. CPU pressure is when the CPU is fully utilized and there are tasks waiting for CPU time. Network saturation is when the network between the database and client is carrying more data than it can handle.
Common causes for the ClientWrite
event to appear in top waits include the following:
-
Increased network latency
There might be increased network latency between the PostgreSQL database instance and client. Higher network latency increases the time required for the client to receive the data.
-
Increased load on the client
There might be CPU pressure or network saturation on the client. An increase in load on the client delays the reception of data from the PostgreSQL database instance.
-
Large volume of data sent to the client
The PostgreSQL database instance might be sending a large amount of data to the client. A client might not be able to receive the data as fast as the cluster is sending it. Activities such as a copy of a large table can result in an increase in
ClientWrite
events.
We recommend different actions depending on the causes of your wait event.
When possible, adjust your application to reduce the amount of data that the PostgreSQL database instance sends to the client. Making such adjustments relieves CPU and network contention on the client.