I have implemented custom aggregation in regular PostgreSQL, which is partially aggregates and is parallelized. It also runs on the whole table. Now, I am trying to use citus to distribute the table and run my aggregation. I was expecting I would be able to reduce the execution time by using citus. However, it seems that citus is making the execution time extensively slower because it is pulling all the rows from the worker nodes and performing aggregation on the coordinator node. Is it possible to make it partially aggregates on the worker nodes and merge the result on the coordinator node? I mean just like the special-case aggregates on the docs?
Here is the overview of aggregation:
CREATE AGGREGATE avg_speed_optimized(double precision[]) (
SFUNC = avg_speed_transfn_optimized,
STYPE = internal,
FINALFUNC = avg_speed_finalfn_optimized,
FINALFUNC_EXTRA,
COMBINEFUNC = avg_speed_combinefn_optimized,
SERIALFUNC = avg_speed_serializefn,
DESERIALFUNC = avg_speed_deserializefn,
PARALLEL = SAFE
);
Steve Davaasuren is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.