Hi! Attached patch implements a column in the server status view that shows if a transaction is blocked, and what process it's blocked by.
Since we're very close to RC, I'm sending it past here before doing anything more. What do ppl think, are we ok with something like this for this version or should I sit on it until the next one? /Magnus
Index: frm/frmStatus.cpp =================================================================== --- frm/frmStatus.cpp (revision 6586) +++ frm/frmStatus.cpp (working copy) @@ -120,6 +120,7 @@ if (connection->BackendMinimumVersion(8, 3)) statusList->AddColumn(_("TX start"), 50); + statusList->AddColumn(_("Blocked by"), 35); statusList->AddColumn(_("Query"), 500); lockList->AddColumn(wxT("PID"), 50); @@ -326,7 +327,7 @@ { // Status long row=0; - pgSet *dataSet1=connection->ExecuteSet(wxT("SELECT * FROM pg_stat_activity ORDER BY procpid")); + pgSet *dataSet1=connection->ExecuteSet(wxT("SELECT *,(SELECT min(pid) FROM pg_locks l1 WHERE GRANTED AND relation IN (SELECT relation FROM pg_locks l2 WHERE l2.pid=procpid AND NOT granted)) AS blockedby FROM pg_stat_activity ORDER BY procpid")); if (dataSet1) { statusList->Freeze(); @@ -378,6 +379,7 @@ if (connection->BackendMinimumVersion(8, 3)) statusList->SetItem(row, colpos++, dataSet1->GetVal(wxT("txn_start"))); + statusList->SetItem(row, colpos++, dataSet1->GetVal(wxT("blockedby"))); statusList->SetItem(row, colpos, qry.Left(250)); row++; }
---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings