pgsql: Create infrastructure for moving-aggregate optimization.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Create infrastructure for moving-aggregate optimization.
Дата
Msg-id E1WZ0Tg-0002x9-Im@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
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

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/a9d9acbf219b9e96585779cd5f99d674d4ccba74

Modified Files
--------------
doc/src/sgml/catalogs.sgml                     |   43 ++
doc/src/sgml/ref/create_aggregate.sgml         |  153 +++++-
doc/src/sgml/xaggr.sgml                        |  197 +++++++-
src/backend/catalog/pg_aggregate.c             |  241 ++++++++-
src/backend/commands/aggregatecmds.c           |  101 +++-
src/backend/executor/nodeAgg.c                 |   13 +-
src/backend/executor/nodeWindowAgg.c           |  639 ++++++++++++++++++++----
src/backend/optimizer/util/clauses.c           |    6 +-
src/backend/parser/parse_agg.c                 |   32 +-
src/bin/pg_dump/pg_dump.c                      |   68 +++
src/include/catalog/catversion.h               |    2 +-
src/include/catalog/pg_aggregate.h             |  302 +++++------
src/include/nodes/execnodes.h                  |    3 +-
src/include/parser/parse_agg.h                 |    2 +
src/test/regress/expected/create_aggregate.out |   35 ++
src/test/regress/expected/opr_sanity.out       |  122 ++++-
src/test/regress/expected/window.out           |  223 +++++++++
src/test/regress/sql/create_aggregate.sql      |   41 ++
src/test/regress/sql/opr_sanity.sql            |  103 +++-
src/test/regress/sql/window.sql                |  192 +++++++
20 files changed, 2228 insertions(+), 290 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: pgsql: docs: psql '--' comments are not passed to the server
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Provide moving-aggregate support for a bunch of numerical aggreg