| From: | Michael Paquier <michael(at)paquier(dot)xyz> |
|---|---|
| To: | Sami Imseih <samimseih(dot)pg(at)gmail(dot)com> |
| Cc: | Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, 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-12-01 07:19:36 |
| Message-ID: | aw51CE88HfKLyL08@paquier.xyz |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Mon, Nov 30, 2026 at 04:59:21PM -0600, Sami Imseih wrote:
> oops. I attached the wrong one. Thanks for letting me know!
> v22 is correct.
- * Some of the stats are copied to the corresponding pending database stats
- * entry when successfully flushing.
Under pgstat_relation_flush_cb(), I think that this is still valid.
Why is that removed?
- * Ignore entries that didn't accumulate any actual counts. If the table
- * was truncated, we still need to flush the entry to reset the live/dead
- * counters and ins_since_vacuum even when no other counts were
- * accumulated.
+ * Skip entries with nothing new since the last flush, unless a truncate
+ * must reset the live/dead counters.
ins_since_vacuum is still covered by the reset.
A bit further down, the original "Using tuples_inserted to update
ins_since_vacuum does mean.." comment is losing a bit of information,
it seems..
There are a few more of these within pgstat_index_flush_cb(), which
come partially from pgstat_relation.c.
I was reading your patch, and it sounds to me that the main patch
could be split into some independent pieces. The following things are
standing out, at least:
- The DROP queries in stats.sql.
- Addition of tuples_hot_updated and tuples_newpage_updated to
PgStat_TableXactStatus, which is something that you require for the
in-transaction flushes.
- Introduction of xact_boundary, which reflects most of the mechanical
changes in the patch across all the stats kinds. At least that should
remove some churn from the main patch.
I'm wondering whether the CFI in the flush loop should be a patch of
its own, as well.. Or perhaps not.
--
Michael
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2026-12-01 07:26:46 | Re: Reapply graceful socket shutdown on Windows (revert 29992a6a509) |
| Previous Message | Ajin Cherian | 2026-12-01 07:15:36 | Re: Wrong relation in apply worker "not updatable" errors PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>for partitions; relcache leak in check_and_init_gencol() |