jiaqizho commented on PR #1167:
URL: https://github.com/apache/cloudberry/pull/1167#issuecomment-2987116279
> Just tried. Should ORCA reuse same transno here?
>
> ```
> CREATE FUNCTION my_sum_trans(state int, val int) RETURNS int AS $$
> BEGIN
> RETURN state + val;
> END;
> $$ LANGUAGE plpgsql;
>
> CREATE AGGREGATE my_sum1(int) (
> SFUNC = my_sum_trans,
> STYPE = int,
> INITCOND = '0'
> );
>
> CREATE AGGREGATE my_sum2(int) (
> SFUNC = my_sum_trans,
> STYPE = int,
> INITCOND = '0'
> );
>
> postgres=# set debug_print_aggref_in_explain to on;
> SET
> postgres=# explain select my_sum1(v1), my_sum2(v2) from tgb1;
> QUERY PLAN
>
------------------------------------------------------------------------------------
> Aggregate (cost=0.00..431.00 rows=1 width=8)
> AggRefs(TargetList): [(0, 0), (1, 1)]
> -> Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..431.00 rows=1
width=8)
> -> Seq Scan on tgb1 (cost=0.00..431.00 rows=1 width=8)
> Optimizer: GPORCA
> (5 rows)
> ```
nope, same as PG
```
postgres=# explain select my_sum1(v1), my_sum2(v2) from tgb1;
QUERY PLAN
-----------------------------------------------------------------------------------------
Aggregate (cost=44519.00..44519.01 rows=1 width=8)
AggRefs(TargetList): [(0, 0), (1, 1)]
-> Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..1469.00
rows=86100 width=8)
-> Seq Scan on tgb1 (cost=0.00..321.00 rows=28700 width=8)
Optimizer: Postgres query optimizer
(5 rows)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]