If I see an entry in pg_stat_activity for a client_addr:client_port combination where there is no process bound to that port on the indicated client, what does that mean? Just that the client process exited before the query completed?
PostgreSQL – Resolving pg_stat_activity Entries Without Client Process
pg-stat-activitypostgresql
Related Question
- PostgreSQL – Fixing psql Breaks with Localhost Host
- PostgreSQL Error – How to Access When “/var/run/postgresql/.s.PGSQL.5432” Error Occurs
- Postgresql – Can’t see connexion to Postgresql using php
- PostgreSQL – How to Resolve Stuck Select/Update Query in Node.js
- PostgreSQL – Understanding DEALLOCATE pdo_stmt_00000001 in pg_stats_activity
Best Answer
You are probably correct that this simply means that the client process exited. If it exits without cleaning up the connection while its back-end server process is working on a query, then the server process will not notice until it tries to send a message to the client and finds that no one is there.
If it takes a long time to return a tuple (because it has to sort or aggregate before it sends the first one, for example) then the server process can be a dead man walking for a long time.
There was discussion about fixing this, but finding a way to do it in a performant and cross-platform way is not easy.