| From: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> |
|---|---|
| To: | Sami Imseih <samimseih(dot)pg(at)gmail(dot)com> |
| Cc: | Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, Lukas Fittl <lukas(at)fittl(dot)com> |
| Subject: | Re: pgstat: Flush some statistics within running transactions, take 2 |
| Date: | 2026-09-02 04:34:19 |
| Message-ID: | apenS46TBv/ZTFTN@bdtpg |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
On Tue, Sep 01, 2026 at 11:41:08AM -0500, Sami Imseih wrote:
> >
> > I wonder if the flags should be reset before starting the scan?
>
>
> Done,
Thanks!
> added a scan to reset the flag at the start
> of pgstat_flush_pending_entries().
+ * Reset the per-pass state before starting the scan so stale state from a
+ * prior pass is never mistaken for "already visited in this pass".
*
* So we just keep track of the next pointer in each loop iteration.
*/
+ dlist_foreach(iter, &pgStatPending)
+ {
+ PgStat_EntryRef *entry_ref =
+ dlist_container(PgStat_EntryRef, pending_node, iter.cur);
+
+ entry_ref->flushed_this_pass = false;
+ }
+
this adds an extra O(N) scan of pgStatPending to every flush.
The scan only performs one backend local bool write per pending entry, so this
is probably negligible compared to the actual flush work. A pass generation
could avoid the extra scan, but I'm not sure that would be worth the additional
complexity.
What do you think?
That said, v10 looks in a good shape to me.
Regards,
--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2026-09-02 04:55:38 | Re: LockHasWaiters() crashes on fast-path locks |
| Previous Message | Ashutosh Bapat | 2026-09-02 04:13:48 | Re: SQL/PGQ: quantified path patterns unsupported in GRAPH_TABLE (19beta2/beta3) — known gap or on the roadmap? |