Re: [BUGS] BUG #10123: Weird entries in pg_stat_activity

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, maxim(dot)boguk(at)gmail(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: [BUGS] BUG #10123: Weird entries in pg_stat_activity
Date: 2024-07-04 05:54:01
Message-ID: 2153c106-8979-430d-ba86-34d35e565ab4@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 2024/07/04 0:14, Fujii Masao wrote:
> I'm not sure if these are bugs. However, to prevent confusion from
> these odd pg_stat_activity entries, I suggest the following changes:
>
> 1. Modify ProcessCatchupInterrupt() and RemoveTempRelationsCallback()
> to reset stmtStartTimestamp (timestamp of the last query
> executed) to 0
> before starting the transaction. This way, during the transaction,
> records with state="idle" and xact_start=NULL would be observed.
>
> 2. Update exec_describe_statement_message() and
> exec_describe_portal_message()
> to change the state to "active," similar to exec_simple_query().
> This would result in records with state="active" and
> xact_start="current timestamp"
> during those operations.

Attached patch does these things. I will register it into the next CF.

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

Attachment Content-Type Size
v1-0001-Prevent-incorrect-entries-in-pg_stat_activity.patch text/plain 4.9 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tender Wang 2024-07-04 07:57:05 Re: BUG #18500: Detaching a partition with an index manually attached to the parent's index triggers Assert
Previous Message PG Bug reporting form 2024-07-04 04:54:09 BUG #18529: Can not install as Document