Re: adding wait_start column to pg_locks

Robert Haas <robertmhaas@gmail.com>

From: Robert Haas <robertmhaas@gmail.com>
To: Ian Lawrence Barwick <barwick@gmail.com>
Cc: torikoshia <torikoshia@oss.nttdata.com>, Justin Pryzby <pryzby@telsasoft.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2021-01-14T18:45:13Z
Lists: pgsql-hackers
On Wed, Jan 13, 2021 at 10:40 PM Ian Lawrence Barwick <barwick@gmail.com> wrote:
> It looks like the logical place to store the value is in the PROCLOCK
> structure; ...

That seems surprising, because there's one PROCLOCK for every
combination of a process and a lock. But, a process can't be waiting
for more than one lock at the same time, because once it starts
waiting to acquire the first one, it can't do anything else, and thus
can't begin waiting for a second one. So I would have thought that
this would be recorded in the PROC.

But I haven't looked at the patch so maybe I'm dumb.

-- 
Robert Haas
EDB: http://www.enterprisedb.com



Commits

  1. Initialize atomic variable waitStart in PGPROC, at postmaster startup.

  2. Display the time when the process started waiting for the lock, in pg_locks, take 2

  3. Display the time when the process started waiting for the lock, in pg_locks.