HI,
On Nov 7, 2022, 04:12 +0800, Tom Lane <tgl@sss.pgh.pa.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.