diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 9b0778baa9978eb20b2d5fbe638871a756e7464d..396eaa5d550035163a98d776c043d4b6d278a449 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -12678,12 +12678,13 @@ NULL baz</literallayout>(3 rows)</entry> <table id="functions-aggregate-table"> <title>General-Purpose Aggregate Functions</title> - <tgroup cols="4"> + <tgroup cols="5"> <thead> <row> <entry>Function</entry> <entry>Argument Type(s)</entry> <entry>Return Type</entry> + <entry>Partial Mode</entry> <entry>Description</entry> </row> </thead> @@ -12702,6 +12703,7 @@ NULL baz</literallayout>(3 rows)</entry> <entry> array of the argument type </entry> + <entry>No</entry> <entry>input values, including nulls, concatenated into an array</entry> </row> @@ -12715,6 +12717,7 @@ NULL baz</literallayout>(3 rows)</entry> <entry> same as argument data type </entry> + <entry>No</entry> <entry>input arrays concatenated into array of one higher dimension (inputs must all have same dimensionality, and cannot be empty or NULL)</entry> @@ -12740,6 +12743,7 @@ NULL baz</literallayout>(3 rows)</entry> <type>double precision</type> for a floating-point argument, otherwise the same as the argument data type </entry> + <entry>All types apart from floating-point types</entry> <entry>the average (arithmetic mean) of all input values</entry> </row> @@ -12757,6 +12761,7 @@ NULL baz</literallayout>(3 rows)</entry> <entry> same as argument data type </entry> + <entry>Yes</entry> <entry>the bitwise AND of all non-null input values, or null if none</entry> </row> @@ -12774,6 +12779,7 @@ NULL baz</literallayout>(3 rows)</entry> <entry> same as argument data type </entry> + <entry>Yes</entry> <entry>the bitwise OR of all non-null input values, or null if none</entry> </row> @@ -12790,6 +12796,7 @@ NULL baz</literallayout>(3 rows)</entry> <entry> <type>bool</type> </entry> + <entry>Yes</entry> <entry>true if all input values are true, otherwise false</entry> </row> @@ -12806,6 +12813,7 @@ NULL baz</literallayout>(3 rows)</entry> <entry> <type>bool</type> </entry> + <entry>Yes</entry> <entry>true if at least one input value is true, otherwise false</entry> </row> @@ -12818,6 +12826,7 @@ NULL baz</literallayout>(3 rows)</entry> </entry> <entry></entry> <entry><type>bigint</type></entry> + <entry>Yes</entry> <entry>number of input rows</entry> </row> @@ -12825,6 +12834,7 @@ NULL baz</literallayout>(3 rows)</entry> <entry><function>count(<replaceable class="parameter">expression</replaceable>)</function></entry> <entry>any</entry> <entry><type>bigint</type></entry> + <entry>Yes</entry> <entry> number of input rows for which the value of <replaceable class="parameter">expression</replaceable> is not null @@ -12844,6 +12854,7 @@ NULL baz</literallayout>(3 rows)</entry> <entry> <type>bool</type> </entry> + <entry>Yes</entry> <entry>equivalent to <function>bool_and</function></entry> </row> @@ -12860,6 +12871,7 @@ NULL baz</literallayout>(3 rows)</entry> <entry> <type>json</type> </entry> + <entry>No</entry> <entry>aggregates values as a JSON array</entry> </row> @@ -12876,6 +12888,7 @@ NULL baz</literallayout>(3 rows)</entry> <entry> <type>jsonb</type> </entry> + <entry>No</entry> <entry>aggregates values as a JSON array</entry> </row> @@ -12892,6 +12905,7 @@ NULL baz</literallayout>(3 rows)</entry> <entry> <type>json</type> </entry> + <entry>No</entry> <entry>aggregates name/value pairs as a JSON object</entry> </row> @@ -12908,6 +12922,7 @@ NULL baz</literallayout>(3 rows)</entry> <entry> <type>jsonb</type> </entry> + <entry>No</entry> <entry>aggregates name/value pairs as a JSON object</entry> </row> @@ -12921,6 +12936,7 @@ NULL baz</literallayout>(3 rows)</entry> <entry>any numeric, string, date/time, network, or enum type, or arrays of these types</entry> <entry>same as argument type</entry> + <entry>Yes</entry> <entry> maximum value of <replaceable class="parameter">expression</replaceable> across all input @@ -12938,6 +12954,7 @@ NULL baz</literallayout>(3 rows)</entry> <entry>any numeric, string, date/time, network, or enum type, or arrays of these types</entry> <entry>same as argument type</entry> + <entry>Yes</entry> <entry> minimum value of <replaceable class="parameter">expression</replaceable> across all input @@ -12961,6 +12978,7 @@ NULL baz</literallayout>(3 rows)</entry> <entry> same as argument types </entry> + <entry>No</entry> <entry>input values concatenated into a string, separated by delimiter</entry> </row> @@ -12983,6 +13001,7 @@ NULL baz</literallayout>(3 rows)</entry> <type>bigint</type> arguments, otherwise the same as the argument data type </entry> + <entry>All types apart from floating-point types</entry> <entry>sum of <replaceable class="parameter">expression</replaceable> across all input values</entry> </row> @@ -12999,6 +13018,7 @@ NULL baz</literallayout>(3 rows)</entry> <entry> <type>xml</type> </entry> + <entry>No</entry> <entry>concatenation of XML values (see also <xref linkend="functions-xml-xmlagg">)</entry> </row> </tbody> @@ -13015,6 +13035,12 @@ NULL baz</literallayout>(3 rows)</entry> substitute zero or an empty array for null when necessary. </para> + <para> + Aggregate functions which support <firstterm>Partial Mode</firstterm> + are eligible to participate in various optimizations, such as parallel + aggregation. + </para> + <note> <indexterm> <primary>ANY</primary> @@ -13098,12 +13124,13 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <table id="functions-aggregate-statistics-table"> <title>Aggregate Functions for Statistics</title> - <tgroup cols="4"> + <tgroup cols="5"> <thead> <row> <entry>Function</entry> <entry>Argument Type</entry> <entry>Return Type</entry> + <entry>Partial Mode</entry> <entry>Description</entry> </row> </thead> @@ -13126,6 +13153,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <entry> <type>double precision</type> </entry> + <entry>No</entry> <entry>correlation coefficient</entry> </row> @@ -13146,6 +13174,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <entry> <type>double precision</type> </entry> + <entry>No</entry> <entry>population covariance</entry> </row> @@ -13166,6 +13195,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <entry> <type>double precision</type> </entry> + <entry>No</entry> <entry>sample covariance</entry> </row> @@ -13182,6 +13212,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <entry> <type>double precision</type> </entry> + <entry>No</entry> <entry>average of the independent variable (<literal>sum(<replaceable class="parameter">X</replaceable>)/<replaceable class="parameter">N</replaceable></literal>)</entry> </row> @@ -13199,6 +13230,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <entry> <type>double precision</type> </entry> + <entry>No</entry> <entry>average of the dependent variable (<literal>sum(<replaceable class="parameter">Y</replaceable>)/<replaceable class="parameter">N</replaceable></literal>)</entry> </row> @@ -13216,6 +13248,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <entry> <type>bigint</type> </entry> + <entry>No</entry> <entry>number of input rows in which both expressions are nonnull</entry> </row> @@ -13235,6 +13268,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <entry> <type>double precision</type> </entry> + <entry>No</entry> <entry>y-intercept of the least-squares-fit linear equation determined by the (<replaceable class="parameter">X</replaceable>, <replaceable @@ -13254,6 +13288,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <entry> <type>double precision</type> </entry> + <entry>No</entry> <entry>square of the correlation coefficient</entry> </row> @@ -13273,6 +13308,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <entry> <type>double precision</type> </entry> + <entry>No</entry> <entry>slope of the least-squares-fit linear equation determined by the (<replaceable class="parameter">X</replaceable>, <replaceable class="parameter">Y</replaceable>) pairs</entry> @@ -13291,6 +13327,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <entry> <type>double precision</type> </entry> + <entry>No</entry> <entry><literal>sum(<replaceable class="parameter">X</replaceable>^2) - sum(<replaceable class="parameter">X</replaceable>)^2/<replaceable @@ -13311,6 +13348,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <entry> <type>double precision</type> </entry> + <entry>No</entry> <entry><literal>sum(<replaceable class="parameter">X</replaceable>*<replaceable class="parameter">Y</replaceable>) - sum(<replaceable @@ -13334,6 +13372,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <entry> <type>double precision</type> </entry> + <entry>No</entry> <entry><literal>sum(<replaceable class="parameter">Y</replaceable>^2) - sum(<replaceable class="parameter">Y</replaceable>)^2/<replaceable @@ -13360,6 +13399,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <type>double precision</type> for floating-point arguments, otherwise <type>numeric</type> </entry> + <entry>All types apart from floating-point types</entry> <entry>historical alias for <function>stddev_samp</function></entry> </row> @@ -13383,6 +13423,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <type>double precision</type> for floating-point arguments, otherwise <type>numeric</type> </entry> + <entry>All types apart from floating-point types</entry> <entry>population standard deviation of the input values</entry> </row> @@ -13406,6 +13447,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <type>double precision</type> for floating-point arguments, otherwise <type>numeric</type> </entry> + <entry>All types apart from floating-point types</entry> <entry>sample standard deviation of the input values</entry> </row> @@ -13425,6 +13467,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <type>double precision</type> for floating-point arguments, otherwise <type>numeric</type> </entry> + <entry>All types apart from floating-point types</entry> <entry>historical alias for <function>var_samp</function></entry> </row> @@ -13448,6 +13491,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <type>double precision</type> for floating-point arguments, otherwise <type>numeric</type> </entry> + <entry>All types apart from floating-point types</entry> <entry>population variance of the input values (square of the population standard deviation)</entry> </row> @@ -13471,6 +13515,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <type>double precision</type> for floating-point arguments, otherwise <type>numeric</type> </entry> + <entry>All types apart from floating-point types</entry> <entry>sample variance of the input values (square of the sample standard deviation)</entry> </row> </tbody> @@ -13495,13 +13540,14 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <table id="functions-orderedset-table"> <title>Ordered-Set Aggregate Functions</title> - <tgroup cols="5"> + <tgroup cols="6"> <thead> <row> <entry>Function</entry> <entry>Direct Argument Type(s)</entry> <entry>Aggregated Argument Type(s)</entry> <entry>Return Type</entry> + <entry>Partial Mode</entry> <entry>Description</entry> </row> </thead> @@ -13524,6 +13570,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <entry> same as sort expression </entry> + <entry>No</entry> <entry> returns the most frequent input value (arbitrarily choosing the first one if there are multiple equally-frequent results) @@ -13550,6 +13597,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <entry> same as sort expression </entry> + <entry>No</entry> <entry> continuous percentile: returns a value corresponding to the specified fraction in the ordering, interpolating between adjacent input items if @@ -13570,6 +13618,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <entry> array of sort expression's type </entry> + <entry>No</entry> <entry> multiple continuous percentile: returns an array of results matching the shape of the <literal>fractions</literal> parameter, with each @@ -13594,6 +13643,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <entry> same as sort expression </entry> + <entry>No</entry> <entry> discrete percentile: returns the first input value whose position in the ordering equals or exceeds the specified fraction @@ -13613,6 +13663,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <entry> array of sort expression's type </entry> + <entry>No</entry> <entry> multiple discrete percentile: returns an array of results matching the shape of the <literal>fractions</literal> parameter, with each non-null @@ -13651,13 +13702,14 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <table id="functions-hypothetical-table"> <title>Hypothetical-Set Aggregate Functions</title> - <tgroup cols="5"> + <tgroup cols="6"> <thead> <row> <entry>Function</entry> <entry>Direct Argument Type(s)</entry> <entry>Aggregated Argument Type(s)</entry> <entry>Return Type</entry> + <entry>Partial Mode</entry> <entry>Description</entry> </row> </thead> @@ -13681,6 +13733,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <entry> <type>bigint</type> </entry> + <entry>No</entry> <entry> rank of the hypothetical row, with gaps for duplicate rows </entry> @@ -13703,6 +13756,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <entry> <type>bigint</type> </entry> + <entry>No</entry> <entry> rank of the hypothetical row, without gaps </entry> @@ -13725,6 +13779,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <entry> <type>double precision</type> </entry> + <entry>No</entry> <entry> relative rank of the hypothetical row, ranging from 0 to 1 </entry> @@ -13747,6 +13802,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <entry> <type>double precision</type> </entry> + <entry>No</entry> <entry> relative rank of the hypothetical row, ranging from 1/<replaceable>N</> to 1