Re: adding wait_start column to pg_locks

From: torikoshia <torikoshia(at)oss(dot)nttdata(dot)com>
To: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
Cc: Ian Lawrence Barwick <barwick(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Justin Pryzby <pryzby(at)telsasoft(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: adding wait_start column to pg_locks
Date: 2021-01-22 05:37:50
Message-ID: a5bfd1c2f2fb21eb7ea5ddec2e094430@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2021-01-21 12:48, Fujii Masao wrote:

> Thanks for updating the patch! I think that this is really useful
> feature!!

Thanks for reviewing!

> I have two minor comments.
>
> + <entry role="catalog_table_entry"><para
> role="column_definition">
> + <structfield>wait_start</structfield> <type>timestamptz</type>
>
> The column name "wait_start" should be "waitstart" for the sake of
> consistency
> with other column names in pg_locks? pg_locks seems to avoid including
> an underscore in column names, so "locktype" is used instead of
> "lock_type",
> "virtualtransaction" is used instead of "virtual_transaction", etc.
>
> + Lock acquisition wait start time. <literal>NULL</literal> if
> + lock acquired.
>

Agreed.

I also changed the variable name "wait_start" in struct PGPROC and
LockInstanceData to "waitStart" for the same reason.

> There seems the case where the wait start time is NULL even when
> "grant"
> is false. It's better to add note about that case into the docs? For
> example,
> I found that the wait start time is NULL while the startup process is
> waiting
> for the lock. Is this only that case?

Thanks, this is because I set 'waitstart' in the following
condition.

---src/backend/storage/lmgr/proc.c
> 1250 if (!InHotStandby)

As far as considering this, I guess startup process would
be the only case.

I also think that in case of startup process, it seems possible
to set 'waitstart' in ResolveRecoveryConflictWithLock(), so I
did it in the attached patch.

Any thoughts?

Regards,

--
Atsushi Torikoshi

Attachment Content-Type Size
v5-0001-To-examine-the-duration-of-locks-we-did-join-on-p.patch text/x-diff 10.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-01-22 05:48:53 Re: Parallel INSERT (INTO ... SELECT ...)
Previous Message Amit Kapila 2021-01-22 05:23:46 Re: Deleting older versions in unique indexes to avoid page splits