Re: Split index and table statistics into different types of stats

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Daniel Gustafsson <daniel(at)yesql(dot)se>, "Gregory Stark (as CFM)" <stark(dot)cfm(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Melanie Plageman <melanieplageman(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Split index and table statistics into different types of stats
Date: 2026-08-13 05:20:05
Message-ID: an1UBSeMZTlYK4vG@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Aug 13, 2026 at 04:29:35AM +0000, Bertrand Drouvot wrote:
> So, 272 bytes for the current structure and 80 bytes for the index specific one,
> including allocation overhead. That's 192 bytes of additional allocated space
> per pending index entry.
>
> 1000 pending index entries would lead to about 188 KB per backend.
> Given that this is not a new cost, I agree that it is probably not worth reducing
> the code clarity for this.

I don't know. If more people want to argue in favor of that..

> So, index entries return the copy unchanged, worth to modify this comment on top
> of the function then?
>
> "
> * If an entry is found, copy it and increment the copy's counters with their
> "

Right, that's slightly incorrect. I'd probably just tweak it like
that:
+ * If an entry is found, copy it. For a PGSTAT_KIND_INDEX entry, just return
+ * the copy. For a PGSTAT_KIND_RELATION entry, increment the copy's counters
+ * with their subtransaction counterparts, then return the copy. The caller
+ * may need to pfree() the copy.

If you would like to word that differently, please let me know.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-08-13 05:22:48 Re: Fix contradictory comment for pgstat_slru_flush_cb()
Previous Message Chao Li 2026-08-13 05:16:19 Re: pgbench --continue-on-error: clarify TPS and failure reporting