Free list same_input_transnos in preprocess_aggref - Mailing list pgsql-hackers

From Zhang Mingli
Subject Free list same_input_transnos in preprocess_aggref
Date
Msg-id c9e2b422-db98-4277-bde0-03cc9e96f77b@Spark
Whole thread Raw
Responses Re: Free list same_input_transnos in preprocess_aggref
List pgsql-hackers
Hi,


In preprocess_aggref(), list same_input_transnos is used to track compatible transnos.

Free it if we don’t need it anymore.

```

/*
 * 2. See if this aggregate can share transition state with another
 * aggregate that we've initialized already.
 */
 transno = find_compatible_trans(root, aggref, shareable,
 aggtransfn, aggtranstype,
 transtypeLen, transtypeByVal,
 aggcombinefn,
 aggserialfn, aggdeserialfn,
 initValue, initValueIsNull,
 same_input_transnos);
 list_free(same_input_transnos);

```

Not sure if it worths as it will be freed sooner or later when current context ends.

But as in find_compatible_agg(), the list is freed if we found a compatible Agg.

This patch helps a little when there are lots of incompatible aggs because we will try to find the compatible transnos again and again.

Each iteration will keep an unused list memory.

Regards,
Zhang Mingli
Attachment

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: remove more archiving overhead
Next
From: "a.rybakina"
Date:
Subject: Re: RFC: Logging plan of the running query