More than five years ago Tom Lane wrote
"It's not easy to tell whether a client has disconnected (particularly if
the network stack is unhelpful, which is depressingly often true).
Postgres will cancel a query if it gets told that the connection's been
dropped, but it will only discover this when an attempt to output to the
client fails. It does not spend cycles looking aside to see if the
connection has dropped when it is doing something that doesn't involve
output to the client."
Is this still true on the 9.x versions? Thanks!