Re: Free list same_input_transnos in preprocess_aggref

From: Zhang Mingli <zmlpostgres(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Free list same_input_transnos in preprocess_aggref
Date: 2022-11-07 04:51:33
Message-ID: be568c58-f491-47a9-86d6-a8403408a436@Spark
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

HI,

On Nov 7, 2022, 04:12 +0800, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, wrote:
>
> The NIL lists are of course occupying no storage. The two one-element
> lists are absolutely, completely negligible in the context of planning
> any nontrivial statement. Even the aggtransinfos list that is the
> primary output of preprocess_aggref will dwarf that; and we leak
> similarly small data structures in probably many hundred places in
> the planner.
>
> I went a bit further and ran the core regression tests, then aggregated
> the results:
>
> $ grep 'leaking list' postmaster.log | sed 's/.*] //' | sort | uniq -c
> 4516 LOG: leaking list of length 0
> 95 LOG: leaking list of length 1
> 15 LOG: leaking list of length 2
>
> You can quibble of course about how representative the regression tests
> are, but there's sure no evidence at all here that we'd be saving
> anything measurable.
>
> If anything, I'd be inclined to get rid of the
>
> list_free(*same_input_transnos);
>
> in find_compatible_agg, because it seems like a waste of code on
> the same grounds. Instrumenting that in the same way, I find
> that it's not reached at all in your example, while the
> regression tests give
>
> 49 LOG: freeing list of length 0
> 2 LOG: freeing list of length 1
>
Thanks for the investigation.
Yeah, this patch is negligible. I’ll withdraw it in CF.

Regards,
Zhang Mingli

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2022-11-07 05:02:26 Re: Perform streaming logical transactions by background workers and parallel apply
Previous Message Masahiko Sawada 2022-11-07 04:32:17 Re: Perform streaming logical transactions by background workers and parallel apply