summaryrefslogtreecommitdiff
path: root/doc/src/sgml/ref/create_aggregate.sgml
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2016-03-29 15:04:05 -0400
committerRobert Haas <rhaas@postgresql.org>2016-03-29 15:04:05 -0400
commit5fe5a2cee91117673e04617aeb1a38e305dcd783 (patch)
tree191e937efe0f15daf02c921935d740f429decada /doc/src/sgml/ref/create_aggregate.sgml
parent7f0a2c85fb221bae6908fb2fddad21a4c6d14438 (diff)
downloadpostgresql-5fe5a2cee91117673e04617aeb1a38e305dcd783.tar.gz
Allow aggregate transition states to be serialized and deserialized.
This is necessary infrastructure for supporting parallel aggregation for aggregates whose transition type is "internal". Such values can't be passed between cooperating processes, because they are just pointers. David Rowley, reviewed by Tomas Vondra and by me.
Diffstat (limited to 'doc/src/sgml/ref/create_aggregate.sgml')
-rw-r--r--doc/src/sgml/ref/create_aggregate.sgml50
1 files changed, 50 insertions, 0 deletions
diff --git a/doc/src/sgml/ref/create_aggregate.sgml b/doc/src/sgml/ref/create_aggregate.sgml
index 837b83c00b..7a6f8a97fd 100644
--- a/doc/src/sgml/ref/create_aggregate.sgml
+++ b/doc/src/sgml/ref/create_aggregate.sgml
@@ -28,6 +28,9 @@ CREATE AGGREGATE <replaceable class="parameter">name</replaceable> ( [ <replacea
[ , FINALFUNC = <replaceable class="PARAMETER">ffunc</replaceable> ]
[ , FINALFUNC_EXTRA ]
[ , COMBINEFUNC = <replaceable class="PARAMETER">combinefunc</replaceable> ]
+ [ , SERIALFUNC = <replaceable class="PARAMETER">serialfunc</replaceable> ]
+ [ , DESERIALFUNC = <replaceable class="PARAMETER">deserialfunc</replaceable> ]
+ [ , SERIALTYPE = <replaceable class="PARAMETER">serialtype</replaceable> ]
[ , INITCOND = <replaceable class="PARAMETER">initial_condition</replaceable> ]
[ , MSFUNC = <replaceable class="PARAMETER">msfunc</replaceable> ]
[ , MINVFUNC = <replaceable class="PARAMETER">minvfunc</replaceable> ]
@@ -47,6 +50,9 @@ CREATE AGGREGATE <replaceable class="parameter">name</replaceable> ( [ [ <replac
[ , FINALFUNC = <replaceable class="PARAMETER">ffunc</replaceable> ]
[ , FINALFUNC_EXTRA ]
[ , COMBINEFUNC = <replaceable class="PARAMETER">combinefunc</replaceable> ]
+ [ , SERIALFUNC = <replaceable class="PARAMETER">serialfunc</replaceable> ]
+ [ , DESERIALFUNC = <replaceable class="PARAMETER">deserialfunc</replaceable> ]
+ [ , SERIALTYPE = <replaceable class="PARAMETER">serialtype</replaceable> ]
[ , INITCOND = <replaceable class="PARAMETER">initial_condition</replaceable> ]
[ , HYPOTHETICAL ]
)
@@ -61,6 +67,9 @@ CREATE AGGREGATE <replaceable class="PARAMETER">name</replaceable> (
[ , FINALFUNC = <replaceable class="PARAMETER">ffunc</replaceable> ]
[ , FINALFUNC_EXTRA ]
[ , COMBINEFUNC = <replaceable class="PARAMETER">combinefunc</replaceable> ]
+ [ , SERIALFUNC = <replaceable class="PARAMETER">serialfunc</replaceable> ]
+ [ , DESERIALFUNC = <replaceable class="PARAMETER">deserialfunc</replaceable> ]
+ [ , SERIALTYPE = <replaceable class="PARAMETER">serialtype</replaceable> ]
[ , INITCOND = <replaceable class="PARAMETER">initial_condition</replaceable> ]
[ , MSFUNC = <replaceable class="PARAMETER">msfunc</replaceable> ]
[ , MINVFUNC = <replaceable class="PARAMETER">minvfunc</replaceable> ]
@@ -437,6 +446,47 @@ SELECT col FROM tab ORDER BY col USING sortop LIMIT 1;
</varlistentry>
<varlistentry>
+ <term><replaceable class="PARAMETER">serialfunc</replaceable></term>
+ <listitem>
+ <para>
+ In order to allow aggregate functions with an <literal>INTERNAL</>
+ <replaceable class="PARAMETER">state_data_type</replaceable> to
+ participate in parallel aggregation, the aggregate must have a valid
+ <replaceable class="PARAMETER">serialfunc</replaceable>, which must
+ serialize the aggregate state into <replaceable class="PARAMETER">
+ serialtype</replaceable>. This function must take a single argument of
+ <replaceable class="PARAMETER">state_data_type</replaceable> and return
+ <replaceable class="PARAMETER">serialtype</replaceable>. A
+ corresponding <replaceable class="PARAMETER">deserialfunc</replaceable>
+ is also required.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><replaceable class="PARAMETER">deserialfunc</replaceable></term>
+ <listitem>
+ <para>
+ Deserializes a previously serialized aggregate state back into
+ <replaceable class="PARAMETER">state_data_type</replaceable>. This
+ function must take a single argument of <replaceable class="PARAMETER">
+ serialtype</replaceable> and return <replaceable class="PARAMETER">
+ state_data_type</replaceable>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><replaceable class="PARAMETER">serialtype</replaceable></term>
+ <listitem>
+ <para>
+ The data type to into which an <literal>INTERNAL</literal> aggregate
+ state should be serialized.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><replaceable class="PARAMETER">initial_condition</replaceable></term>
<listitem>
<para>