Re: [PATCH v4] pg_stat_statements: Add last_execution_start column

From: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH v4] pg_stat_statements: Add last_execution_start column
Date: 2026-06-04 20:54:58
Message-ID: CAN4CZFOVims3k9v9V6LMb1W10Evc=nym09yPO7e0DWiLzTUy9w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello!

The write happens inside the spinlock and shared pgss->lock:

+ /* Record the start time of this execution */
+ entry->last_execution_start = exec_start;
+
SpinLockRelease(&entry->mutex);

And then at the read, we see:

/*
- * The spinlock is not required when reading these two as they are
+ * The spinlock is not required when reading these three as they are
* always updated when holding pgss->lock exclusively.
*/
stats_since = entry->stats_since;
minmax_stats_since = entry->minmax_stats_since;
+ last_execution_start = entry->last_execution_start;

But that comment doesn't seem true, it is updated with a shared lock,
not exclusive. Shouldn't it be read together with the counters above
this?

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message Jacob Champion 2026-06-04 20:48:17 Re: PSA: Planning to grease protocol connections during 19beta