Michael Fuhr <mike(at)fuhr(dot)org> writes:
> pg_stat_activity sometimes shows old connections that have already
> terminated.
Define "old"? There's a built-in delay of up to half a second (if
memory serves) in the statistics views.
regards, tom lane