From e63b56e6e219bfed6c80fe6fdf6383c2df4a6f8a Mon Sep 17 00:00:00 2001 From: David Rowley Date: Sat, 26 Mar 2016 14:11:46 +1300 Subject: [PATCH 4/5] Add documents to explain which aggregates support partial mode. --- doc/src/sgml/func.sgml | 64 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 60 insertions(+), 4 deletions(-) diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index ae93e69..b783ab3 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -12603,12 +12603,13 @@ NULL baz(3 rows) General-Purpose Aggregate Functions - + Function Argument Type(s) Return Type + Partial Mode Description @@ -12627,6 +12628,7 @@ NULL baz(3 rows) array of the argument type + Noinput values, including nulls, concatenated into an array @@ -12640,6 +12642,7 @@ NULL baz(3 rows) same as argument data type + Noinput arrays concatenated into array of one higher dimension (inputs must all have same dimensionality, and cannot be empty or NULL) @@ -12665,6 +12668,7 @@ NULL baz(3 rows)double precision for a floating-point argument, otherwise the same as the argument data type + All types apart from floating-point typesthe average (arithmetic mean) of all input values @@ -12682,6 +12686,7 @@ NULL baz(3 rows) same as argument data type + Yesthe bitwise AND of all non-null input values, or null if none @@ -12699,6 +12704,7 @@ NULL baz(3 rows) same as argument data type + Yesthe bitwise OR of all non-null input values, or null if none @@ -12715,6 +12721,7 @@ NULL baz(3 rows) bool + Yestrue if all input values are true, otherwise false @@ -12731,6 +12738,7 @@ NULL baz(3 rows) bool + Yestrue if at least one input value is true, otherwise false @@ -12743,6 +12751,7 @@ NULL baz(3 rows)bigint + Yesnumber of input rows @@ -12750,6 +12759,7 @@ NULL baz(3 rows)count(expression)anybigint + Yes number of input rows for which the value of expression is not null @@ -12769,6 +12779,7 @@ NULL baz(3 rows) bool + Yesequivalent to bool_and @@ -12785,6 +12796,7 @@ NULL baz(3 rows) json + Noaggregates values as a JSON array @@ -12801,6 +12813,7 @@ NULL baz(3 rows) jsonb + Noaggregates values as a JSON array @@ -12817,6 +12830,7 @@ NULL baz(3 rows) json + Noaggregates name/value pairs as a JSON object @@ -12833,6 +12847,7 @@ NULL baz(3 rows) jsonb + Noaggregates name/value pairs as a JSON object @@ -12846,6 +12861,7 @@ NULL baz(3 rows)any numeric, string, date/time, network, or enum type, or arrays of these typessame as argument type + Yes maximum value of expression across all input @@ -12863,6 +12879,7 @@ NULL baz(3 rows)any numeric, string, date/time, network, or enum type, or arrays of these typessame as argument type + Yes minimum value of expression across all input @@ -12886,6 +12903,7 @@ NULL baz(3 rows) same as argument types + Noinput values concatenated into a string, separated by delimiter @@ -12908,6 +12926,7 @@ NULL baz(3 rows)bigint arguments, otherwise the same as the argument data type + All types apart from floating-point typessum of expression across all input values @@ -12924,6 +12943,7 @@ NULL baz(3 rows) xml + Noconcatenation of XML values (see also ) @@ -12940,6 +12960,12 @@ NULL baz(3 rows) substitute zero or an empty array for null when necessary. + + Aggregate functions which support Partial Mode + are eligible to participate in various optimizations, such as parallel + aggregation. + + ANY @@ -13023,12 +13049,13 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab;
Aggregate Functions for Statistics - + Function Argument Type Return Type + Partial Mode Description @@ -13051,6 +13078,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; double precision + Nocorrelation coefficient @@ -13071,6 +13099,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; double precision + Nopopulation covariance @@ -13091,6 +13120,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; double precision + Nosample covariance @@ -13107,6 +13137,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; double precision + Noaverage of the independent variable (sum(X)/N) @@ -13124,6 +13155,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; double precision + Noaverage of the dependent variable (sum(Y)/N) @@ -13141,6 +13173,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; bigint + Nonumber of input rows in which both expressions are nonnull @@ -13160,6 +13193,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; double precision + Noy-intercept of the least-squares-fit linear equation determined by the (X, double precision + Nosquare of the correlation coefficient @@ -13198,6 +13233,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; double precision + Noslope of the least-squares-fit linear equation determined by the (X, Y) pairs @@ -13216,6 +13252,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; double precision + Nosum(X^2) - sum(X)^2/ double precision + Nosum(X*Y) - sum( double precision + Nosum(Y^2) - sum(Y)^2/double precision for floating-point arguments, otherwise numeric + All types apart from floating-point typeshistorical alias for stddev_samp @@ -13308,6 +13348,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; double precision for floating-point arguments, otherwise numeric + All types apart from floating-point typespopulation standard deviation of the input values @@ -13331,6 +13372,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; double precision for floating-point arguments, otherwise numeric + All types apart from floating-point typessample standard deviation of the input values @@ -13350,6 +13392,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; double precision for floating-point arguments, otherwise numeric + All types apart from floating-point typeshistorical alias for var_samp @@ -13373,6 +13416,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; double precision for floating-point arguments, otherwise numeric + All types apart from floating-point typespopulation variance of the input values (square of the population standard deviation) @@ -13396,6 +13440,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; double precision for floating-point arguments, otherwise numeric + All types apart from floating-point typessample variance of the input values (square of the sample standard deviation) @@ -13420,13 +13465,14 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab;
Ordered-Set Aggregate Functions - + Function Direct Argument Type(s) Aggregated Argument Type(s) Return Type + Partial Mode Description @@ -13449,6 +13495,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; same as sort expression + No returns the most frequent input value (arbitrarily choosing the first one if there are multiple equally-frequent results) @@ -13475,6 +13522,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; same as sort expression + No continuous percentile: returns a value corresponding to the specified fraction in the ordering, interpolating between adjacent input items if @@ -13495,6 +13543,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; array of sort expression's type + No multiple continuous percentile: returns an array of results matching the shape of the fractions parameter, with each @@ -13519,6 +13568,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; same as sort expression + No discrete percentile: returns the first input value whose position in the ordering equals or exceeds the specified fraction @@ -13538,6 +13588,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; array of sort expression's type + No multiple discrete percentile: returns an array of results matching the shape of the fractions parameter, with each non-null @@ -13576,13 +13627,14 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab;
Hypothetical-Set Aggregate Functions - + Function Direct Argument Type(s) Aggregated Argument Type(s) Return Type + Partial Mode Description @@ -13606,6 +13658,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; bigint + No rank of the hypothetical row, with gaps for duplicate rows @@ -13628,6 +13681,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; bigint + No rank of the hypothetical row, without gaps @@ -13650,6 +13704,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; double precision + No relative rank of the hypothetical row, ranging from 0 to 1 @@ -13672,6 +13727,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; double precision + No relative rank of the hypothetical row, ranging from 1/N to 1 -- 1.9.5.msysgit.1