"Gurjeet Singh" <singh(dot)gurjeet(at)gmail(dot)com> writes:> The situation seems pretty bad!!
I think at least part of your problem is not understanding that a singletransaction sees a frozen snapshot of pg_stat_activity.
regards, tom lane