Free list same_input_transnos in preprocess_aggref

From: Zhang Mingli <zmlpostgres(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Free list same_input_transnos in preprocess_aggref
Date: 2022-09-19 10:19:07
Message-ID: c9e2b422-db98-4277-bde0-03cc9e96f77b@Spark
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
vn-0001-free-list-same_input_transnos-in-preprocess_aggref.patch application/octet-stream 932 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message a.rybakina 2022-09-19 10:42:24 Re: RFC: Logging plan of the running query
Previous Message Peter Eisentraut 2022-09-19 10:08:29 Re: remove more archiving overhead