Re: Flush some statistics within running transactions

From: Sami Imseih <samimseih(at)gmail(dot)com>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Subject: Re: Flush some statistics within running transactions
Date: 2026-02-16 22:42:50
Message-ID: CAA5RZ0tPsU_bCATn-Wtf8hMaKmrCwfxtLcY9Pp3NQPpLrH2G_Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks!

> > 2/
> > I don't see we have tests for other timeout based GUCs, but it would nice
> > to ensure that this woks correctly. Maybe as a custom_stats test where we
> > SET stats_flush_interval inside the transaction and make sure the stats flush
> > only after the new timeout has passed. Maybe?
>
> Not sure I follow, that's what 0002 is doing.

I was referring to "SET stats_flush_interval", which you are doing in 0005,
so disregard this comment. I wrote this comment when I read 0003 only.

> > Will this be tue at all time? Let's imagine a Kind that flushes all the fields
> > ANYTIME, would we not want to delete the pending entry?
> >
> > + /* if successfull non-partial flush, remove entry */
> > + if (did_flush && !is_partial_flush)
> > pgstat_delete_pending_entry(entry_ref);
> >
>
> Right, and that's why the MIXED flush mode was useful, i.e to be able to distinguish
> here. So, in the attached, instead of re-introducing the MIXED flush mode, I added
> a "is_partial" bool paramater to the flush_pending_cb().
>

Yeah, MIXED flush mode to deal with this is still not the right idea, IMO.

I do agree with what you did here by passing "is_partial" to the callbacks.
Now it will be up to the callbacks to determine if they performed a partial
or a complete flush ( even in the case of any anytime flush, if they so
happened to flush stats for all the fields ).

I do not have any further comments on this patchset.

--
Sami Imseih
Amazon Web Services (AWS)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexandre Felipe 2026-02-16 23:05:26 Re: index prefetching
Previous Message Sami Imseih 2026-02-16 22:06:50 Re: [PATCH] Add last_executed timestamp to pg_stat_statements