- Notifications
You must be signed in to change notification settings - Fork5
Commit69c8fba
committed
Improve performance of numeric sum(), avg(), stddev(), variance(), etc.
This patch improves performance of most built-in aggregates that formerlyused a NUMERIC or NUMERIC array as their transition type; this includesnot only aggregates on numeric inputs, but some aggregates on integerinputs where overflow of an int8 value is a possibility. The code nowuses a special-purpose data structure to avoid array construction anddeconstruction overhead, as well as packing and unpacking overhead fornumeric values.These aggregates' transition type is now declared as INTERNAL, sinceit doesn't correspond to any SQL data type. To keep the planner fromthinking that that means a lot of storage will be used, we make useof the just-added pg_aggregate.aggtransspace feature. The space estimateis set to 128 bytes, which is at least in the right ballpark.Hadi Moshayedi, reviewed by Pavel Stehule and Tomas Vondra1 parent6cb8614 commit69c8fba
File tree
7 files changed
+362
-186
lines changed- src
- backend/utils/adt
- include
- catalog
- utils
- test/regress
- expected
- sql
7 files changed
+362
-186
lines changed0 commit comments
Comments
(0)