Re: adding wait_start column to pg_locks
torikoshia <torikoshia@oss.nttdata.com>
From: torikoshia <torikoshia@oss.nttdata.com>
To: Fujii Masao <masao.fujii@oss.nttdata.com>
Cc: Ian Lawrence Barwick <barwick@gmail.com>, Robert Haas
<robertmhaas@gmail.com>, Justin Pryzby <pryzby@telsasoft.com>, pgsql-hackers
<pgsql-hackers@postgresql.org>
Date: 2021-02-02T13:00:47Z
Lists: pgsql-hackers
Attachments
- v6-0001-To-examine-the-duration-of-locks-we-did-join-on-p.patch (text/x-diff) patch v6-0001
On 2021-01-25 23:44, Fujii Masao wrote: > Another comment is; Doesn't the change of MyProc->waitStart need the > lock table's partition lock? If yes, we can do that by moving > LWLockRelease(partitionLock) just after the change of > MyProc->waitStart, but which causes the time that lwlock is being held > to be long. So maybe we need another way to do that. Thanks for your comments! It would be ideal for the consistency of the view to record "waitstart" during holding the table partition lock. However, as you pointed out, it would give non-negligible performance impacts. I may miss something, but as far as I can see, the influence of not holding the lock is that "waitstart" can be NULL even though "granted" is false. I think people want to know the start time of the lock when locks are held for a long time. In that case, "waitstart" should have already been recorded. If this is true, I think the current implementation may be enough on the condition that users understand it can happen that "waitStart" is NULL and "granted" is false. Attached a patch describing this in the doc and comments. Any Thoughts? Regards, -- Atsushi Torikoshi
Commits
-
Initialize atomic variable waitStart in PGPROC, at postmaster startup.
- f05ed5a5cfa5 14.0 landed
-
Display the time when the process started waiting for the lock, in pg_locks, take 2
- 46d6e5f56790 14.0 landed
-
Display the time when the process started waiting for the lock, in pg_locks.
- 3b733fcd0419 14.0 landed