Re: Reconcile stats in find_tabstat_entry() and get rid of PgStat_BackendFunctionEntry - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Reconcile stats in find_tabstat_entry() and get rid of PgStat_BackendFunctionEntry
Date
Msg-id 20230210201522.5cn74vserozyj6pu@awork3.anarazel.de
Whole thread Raw
In response to Reconcile stats in find_tabstat_entry() and get rid of PgStat_BackendFunctionEntry  ("Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com>)
List pgsql-hackers
: Andres Freund <andres@anarazel.de>
References: <b9e1f543-ee93-8168-d530-d961708ad9d3@gmail.com>
 <20230210.113242.699878230551547182.horikyota.ntt@gmail.com>
 <5420b28c-d33f-d25d-9f47-b06b8a2372ba@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <5420b28c-d33f-d25d-9f47-b06b8a2372ba@gmail.com>

Hi,

On 2023-02-10 16:50:32 +0100, Drouvot, Bertrand wrote:
> On 2/10/23 3:32 AM, Kyotaro Horiguchi wrote:
> > The summarization is needed only by
> > few callers but now that cost is imposed to the all callers along with
> > additional palloc()/pfree() calls. That doesn't seem reasonable.
> > 
> 
> I agree that's not the best approach.....

I think it's completely fine to do unnecessary reconciliation for the _xact_
functions. They're not that commonly used, and very rarely is there a huge
number of relations with lots of pending data across lots of subtransactions.


> Let me come back with another proposal (thinking to increment reconciled
> counters in pgstat_count_heap_insert(), pgstat_count_heap_delete() and
> pgstat_count_heap_update()).

Those are the performance crucial functions, we shouldn't do any additional
work there if we can avoid it. Shifting cost from the "looking at
transactional stats" side to the collecting stats side is the opposite of what
we should.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: possible memory leak in VACUUM ANALYZE
Next
From: Andres Freund
Date:
Subject: Re: possible memory leak in VACUUM ANALYZE