From e8e2c12b6541ce86adeefde87af995d4681ae19a Mon Sep 17 00:00:00 2001 From: David Rowley Date: Wed, 16 Mar 2016 23:19:40 +1300 Subject: [PATCH 5/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 000489d..b25235c 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -12577,12 +12577,13 @@ NULL baz(3 rows) General-Purpose Aggregate Functions - + Function Argument Type(s) Return Type + Partial Mode Description @@ -12601,6 +12602,7 @@ NULL baz(3 rows) array of the argument type + Noinput values, including nulls, concatenated into an array @@ -12614,6 +12616,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) @@ -12639,6 +12642,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 @@ -12656,6 +12660,7 @@ NULL baz(3 rows) same as argument data type + Yesthe bitwise AND of all non-null input values, or null if none @@ -12673,6 +12678,7 @@ NULL baz(3 rows) same as argument data type + Yesthe bitwise OR of all non-null input values, or null if none @@ -12689,6 +12695,7 @@ NULL baz(3 rows) bool + Yestrue if all input values are true, otherwise false @@ -12705,6 +12712,7 @@ NULL baz(3 rows) bool + Yestrue if at least one input value is true, otherwise false @@ -12717,6 +12725,7 @@ NULL baz(3 rows)bigint + Yesnumber of input rows @@ -12724,6 +12733,7 @@ NULL baz(3 rows)count(expression)anybigint + Yes number of input rows for which the value of expression is not null @@ -12743,6 +12753,7 @@ NULL baz(3 rows) bool + Yesequivalent to bool_and @@ -12759,6 +12770,7 @@ NULL baz(3 rows) json + Noaggregates values as a JSON array @@ -12775,6 +12787,7 @@ NULL baz(3 rows) jsonb + Noaggregates values as a JSON array @@ -12791,6 +12804,7 @@ NULL baz(3 rows) json + Noaggregates name/value pairs as a JSON object @@ -12807,6 +12821,7 @@ NULL baz(3 rows) jsonb + Noaggregates name/value pairs as a JSON object @@ -12820,6 +12835,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 @@ -12837,6 +12853,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 @@ -12860,6 +12877,7 @@ NULL baz(3 rows) same as argument types + Noinput values concatenated into a string, separated by delimiter @@ -12882,6 +12900,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 @@ -12898,6 +12917,7 @@ NULL baz(3 rows) xml + Noconcatenation of XML values (see also ) @@ -12914,6 +12934,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 @@ -12997,12 +13023,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 @@ -13025,6 +13052,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; double precision + Nocorrelation coefficient @@ -13045,6 +13073,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; double precision + Nopopulation covariance @@ -13065,6 +13094,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; double precision + Nosample covariance @@ -13081,6 +13111,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) @@ -13098,6 +13129,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) @@ -13115,6 +13147,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 @@ -13134,6 +13167,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 @@ -13172,6 +13207,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 @@ -13190,6 +13226,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 @@ -13282,6 +13322,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 @@ -13305,6 +13346,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 @@ -13324,6 +13366,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 @@ -13347,6 +13390,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) @@ -13370,6 +13414,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) @@ -13394,13 +13439,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 @@ -13423,6 +13469,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) @@ -13449,6 +13496,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 @@ -13469,6 +13517,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 @@ -13493,6 +13542,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 @@ -13512,6 +13562,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 @@ -13550,13 +13601,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 @@ -13580,6 +13632,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 @@ -13602,6 +13655,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; bigint + No rank of the hypothetical row, without gaps @@ -13624,6 +13678,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 @@ -13646,6 +13701,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