Simone Giusso <simonedevs@gmail.com> writes:
> I have a question regarding postgresql waiting for the client. I queried
> the pg_stat_activity because I noticed a connection that had not been
> released for days!!! I saw that the wait_event was ClientRead and the query
> was ROLLBACK. What the server is waiting for from the client?
You are misunderstanding that display. If the wait state is ClientRead
then the server has nothing to do and is awaiting a fresh SQL command
from the client. The query that's shown is the last-executed query.
(We used to show "<IDLE>" in the query column in this state, but that
was deemed less helpful than the current behavior.)
> So I ended up in a situation where both client and server were reading from
> the socket :(. I'm not sure why. Something went wrong between client and
> server, network problems?
Yeah, a dropped packet could explain this perhaps.
regards, tom lane