hi,
From pg_stat_activity I can find a query is at waiting state, and frompg_locks and pg_class can find which relation the query is waiting for, Buthow to find witch query is lock the relation?