-
- Downloads
Create infrastructure for moving-aggregate optimization.
Until now, when executing an aggregate function as a window function within a window with moving frame start (that is, any frame start mode except UNBOUNDED PRECEDING), we had to recalculate the aggregate from scratch each time the frame head moved. This patch allows an aggregate definition to include an alternate "moving aggregate" implementation that includes an inverse transition function for removing rows from the aggregate's running state. As long as this can be done successfully, runtime is proportional to the total number of input rows, rather than to the number of input rows times the average frame length. This commit includes the core infrastructure, documentation, and regression tests using user-defined aggregates. Follow-on commits will update some of the built-in aggregates to use this feature. David Rowley and Florian Pflug, reviewed by Dean Rasheed; additional hacking by me
Showing
- doc/src/sgml/catalogs.sgml 43 additions, 0 deletionsdoc/src/sgml/catalogs.sgml
- doc/src/sgml/ref/create_aggregate.sgml 149 additions, 4 deletionsdoc/src/sgml/ref/create_aggregate.sgml
- doc/src/sgml/xaggr.sgml 183 additions, 14 deletionsdoc/src/sgml/xaggr.sgml
- src/backend/catalog/pg_aggregate.c 221 additions, 20 deletionssrc/backend/catalog/pg_aggregate.c
- src/backend/commands/aggregatecmds.c 100 additions, 1 deletionsrc/backend/commands/aggregatecmds.c
- src/backend/executor/nodeAgg.c 11 additions, 2 deletionssrc/backend/executor/nodeAgg.c
- src/backend/executor/nodeWindowAgg.c 538 additions, 101 deletionssrc/backend/executor/nodeWindowAgg.c
- src/backend/optimizer/util/clauses.c 5 additions, 1 deletionsrc/backend/optimizer/util/clauses.c
- src/backend/parser/parse_agg.c 28 additions, 4 deletionssrc/backend/parser/parse_agg.c
- src/bin/pg_dump/pg_dump.c 68 additions, 0 deletionssrc/bin/pg_dump/pg_dump.c
- src/include/catalog/catversion.h 1 addition, 1 deletionsrc/include/catalog/catversion.h
- src/include/catalog/pg_aggregate.h 163 additions, 139 deletionssrc/include/catalog/pg_aggregate.h
- src/include/nodes/execnodes.h 2 additions, 1 deletionsrc/include/nodes/execnodes.h
- src/include/parser/parse_agg.h 2 additions, 0 deletionssrc/include/parser/parse_agg.h
- src/test/regress/expected/create_aggregate.out 35 additions, 0 deletionssrc/test/regress/expected/create_aggregate.out
- src/test/regress/expected/opr_sanity.out 121 additions, 1 deletionsrc/test/regress/expected/opr_sanity.out
- src/test/regress/expected/window.out 223 additions, 0 deletionssrc/test/regress/expected/window.out
- src/test/regress/sql/create_aggregate.sql 41 additions, 0 deletionssrc/test/regress/sql/create_aggregate.sql
- src/test/regress/sql/opr_sanity.sql 102 additions, 1 deletionsrc/test/regress/sql/opr_sanity.sql
- src/test/regress/sql/window.sql 192 additions, 0 deletionssrc/test/regress/sql/window.sql
Loading
Please register or sign in to comment