postgresql/src
Andres Freund 2742c45080 expression eval: Reduce number of steps for agg transition invocations.
Do so by combining the various steps that are part of aggregate
transition function invocation into one larger step. As some of the
current steps are only necessary for some aggregates, have one variant
of the aggregate transition step for each possible combination.

To avoid further manual copies of code in the different transition
step implementations, move most of the code into helper functions
marked as "always inline".

The benefit of this change is an increase in performance when
aggregating lots of rows. This comes in part due to the reduced number
of indirect jumps due to the reduced number of steps, and in part by
reducing redundant setup code across steps. This mainly benefits
interpreted execution, but the code generated by JIT is also improved
a bit.

As a nice side-effect it also ends up making the code a bit simpler.

A small additional optimization is removing the need to set
aggstate->curaggcontext before calling ExecAggInitGroup, choosing to
instead passign curaggcontext as an argument. It was, in contrast to
other aggregate related functions, only needed to fetch a memory
context to copy the transition value into.

Author: Andres Freund
Discussion:
   https://postgr.es/m/20191023163849.sosqbfs5yenocez3@alap3.anarazel.de
   https://postgr.es/m/5c371df7cee903e8cd4c685f90c6c72086d3a2dc.camel@j-davis.com
2020-02-24 15:09:09 -08:00
..
backend expression eval: Reduce number of steps for agg transition invocations. 2020-02-24 15:09:09 -08:00
bin Add prefix checks in exclude lists for pg_rewind, pg_checksums and base backups 2020-02-24 18:13:25 +09:00
common Change client-side fsync_fname() to report errors fatally 2020-02-24 16:51:26 +01:00
fe_utils Fix bug in pg_basebackup -F plain -R. 2020-02-12 09:08:22 +09:00
include expression eval: Reduce number of steps for agg transition invocations. 2020-02-24 15:09:09 -08:00
interfaces Fix compiler warnings on 64-bit Windows 2020-02-21 19:58:39 +01:00
makefiles Remove libpq.rc, use win32ver.rc for libpq 2020-01-15 15:06:12 +01:00
pl Remove support for upgrading extensions from "unpackaged" state. 2020-02-19 16:59:14 -05:00
port Assume that we have rint(). 2020-02-21 14:30:47 -05:00
template Fix compiler warning for ppoll() on Cygwin 2019-12-22 23:20:00 +01:00
test Simplify FK-to-partitioned regression test query 2020-02-20 14:14:20 -03:00
timezone Require stdint.h 2020-02-21 09:20:32 +01:00
tools Adjust Solution.pm to set HAVE_STDINT_H. 2020-02-21 16:14:09 -05:00
tutorial Update copyrights for 2020 2020-01-01 12:21:45 -05:00
.gitignore
DEVELOPERS
Makefile Fix partial-build problems introduced by having more generated headers. 2018-04-09 16:42:10 -04:00
Makefile.global.in Simplify passing of configure arguments to pg_config 2020-02-10 19:23:41 +01:00
Makefile.shlib Clean up MinGW def file generation 2019-10-20 10:19:13 +02:00
nls-global.mk NLS: Fix backend gettext triggers 2019-09-23 09:04:20 +02:00