diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c
index 3bfdd23..4dc7b37 100644
--- a/src/backend/storage/lmgr/proc.c
+++ b/src/backend/storage/lmgr/proc.c
@@ -49,6 +49,7 @@
 #include "storage/procsignal.h"
 #include "storage/spin.h"
 #include "utils/timestamp.h"
+#include "pgstat.h"
 
 
 /* GUC variables */
@@ -1198,9 +1199,66 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable)
 			}
 
 			if (myWaitStatus == STATUS_WAITING)
-				ereport(LOG,
-						(errmsg("process %d still waiting for %s on %s after %ld.%03d ms",
-							  MyProcPid, modename, buf.data, msecs, usecs)));
+			{
+				PROCLOCK   *proclock2;
+				PGPROC *proc2;
+				PgBackendStatus *be;
+				bool found = false;
+
+				/* find lock holder */
+				proclock2 = (PROCLOCK *) SHMQueueNext(&(lock->procLocks), &(lock->procLocks),
+						offsetof(PROCLOCK, lockLink));
+				while (proclock2)
+				{
+					if (lockMethodTable->conflictTab[lockmode] & proclock2->holdMask)
+						break;
+
+					proclock2 = (PROCLOCK *) SHMQueueNext(&(lock->procLocks), &proclock2->lockLink,
+							offsetof(PROCLOCK, lockLink));
+				}
+
+				if (proclock2)
+				{
+					proc2 = proclock2->tag.myProc;
+
+					/* get lock holder's beentry */
+					int numbackends = pgstat_fetch_stat_numbackends();
+					for (i = 1; i <= numbackends; i++)
+					{
+						be = pgstat_fetch_stat_beentry(i);
+						if (be)
+						{
+							if (be->st_procpid == proc2->pid)
+							{
+								found = true;
+								break;
+							}
+						}
+					}
+				}
+
+				if (found)
+				{
+					long secs2;
+					int usecs2;
+					long msecs2;
+
+					/* calculate lock holder's tx duration */
+					TimestampDifference(be->st_xact_start_timestamp, GetCurrentTimestamp(), &secs2, &usecs2);
+					msecs2 = secs2 * 1000 + usecs2 / 1000;
+					usecs2 = usecs2 % 1000;
+
+					ereport(LOG,
+							(errmsg("process %d still waiting for %s on %s after %ld.%03d ms",
+									MyProcPid, modename, buf.data, msecs, usecs),
+							 errdetail_log("process %d is holding lock for %ld.%03d ms, activity: %s",
+									proc2->pid, msecs2, usecs2, be->st_activity)));
+				}
+				else
+					ereport(LOG,
+							(errmsg("process %d still waiting for %s on %s after %ld.%03d ms",
+									MyProcPid, modename, buf.data, msecs, usecs)));
+			}
 			else if (myWaitStatus == STATUS_OK)
 				ereport(LOG,
 					(errmsg("process %d acquired %s on %s after %ld.%03d ms",
