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-09-19 16:27:30 |
Message-ID: | 7586c7bf-9dd1-4f7a-98e2-455cb03d6316@Spark |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Regards,
Zhang Mingli
On Sep 19, 2022, 23:14 +0800, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, wrote:
> Very little of the planner bothers with freeing small allocations
> like that.
I think so too, as said, not sure if it worths.
> Can you demonstrate a case where this would actually
> make a meaningful difference?
Offhand, an example may help a little:
create table t1(id int);
explain select max(id), min(id), sum(id), count(id), avg(id) from t1;
Modify codes to test:
@@ -139,6 +139,7 @@ preprocess_aggref(Aggref *aggref, PlannerInfo *root)
int16 transtypeLen;
Oid inputTypes[FUNC_MAX_ARGS];
int numArguments;
+ static size_t accumulate_list_size = 0;
Assert(aggref->agglevelsup == 0);
@@ -265,7 +266,7 @@ preprocess_aggref(Aggref *aggref, PlannerInfo *root)
aggserialfn, aggdeserialfn,
initValue, initValueIsNull,
same_input_transnos);
- list_free(same_input_transnos);
+ accumulate_list_size += sizeof(int) * list_length(same_input_transnos);
Gdb and print accumulate_list_size for each iteration:
SaveBytes = Sum results of accumulate_list_size: 32(4+4+8+8), as we have 5 aggs in sql.
If there were N sets of that aggs (more columns as id, with above aggs ), the bytes will be N*SaveBytes.
Seems we don’t have so many agg functions that could share the same trans function, Does it worth?
From | Date | Subject | |
---|---|---|---|
Next Message | Jacob Champion | 2022-09-19 16:27:41 | Re: Support tls-exporter as channel binding for TLSv1.3 |
Previous Message | Himanshu Upadhyaya | 2022-09-19 16:20:40 | Re: HOT chain validation in verify_heapam() |