mirror of
https://github.com/postgres/postgres.git
synced 2025-06-23 14:01:44 +03:00
Add hooks for type-specific calculation of ANALYZE statistics. Idea and
coding by Mark Cave-Ayland, some kibitzing by Tom Lane. initdb forced due to new column in pg_type.
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
<!--
|
||||
Documentation of the system catalogs, directed toward PostgreSQL developers
|
||||
$PostgreSQL: pgsql/doc/src/sgml/catalogs.sgml,v 2.82 2004/01/06 23:55:18 tgl Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/catalogs.sgml,v 2.83 2004/02/12 23:41:00 tgl Exp $
|
||||
-->
|
||||
|
||||
<chapter id="catalogs">
|
||||
@ -3524,6 +3524,13 @@
|
||||
<entry>Output conversion function (binary format), or 0 if none</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><structfield>typanalyze</structfield></entry>
|
||||
<entry><type>regproc</type></entry>
|
||||
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
|
||||
<entry>Custom ANALYZE function, or 0 to use the standard function</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><structfield>typalign</structfield></entry>
|
||||
<entry><type>char</type></entry>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_type.sgml,v 1.48 2003/11/29 19:51:38 pgsql Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_type.sgml,v 1.49 2004/02/12 23:41:02 tgl Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@ -28,6 +28,7 @@ CREATE TYPE <replaceable class="parameter">name</replaceable> (
|
||||
OUTPUT = <replaceable class="parameter">output_function</replaceable>
|
||||
[ , RECEIVE = <replaceable class="parameter">receive_function</replaceable> ]
|
||||
[ , SEND = <replaceable class="parameter">send_function</replaceable> ]
|
||||
[ , ANALYZE = <replaceable class="parameter">analyze_function</replaceable> ]
|
||||
[ , INTERNALLENGTH = { <replaceable class="parameter">internallength</replaceable> | VARIABLE } ]
|
||||
[ , PASSEDBYVALUE ]
|
||||
[ , ALIGNMENT = <replaceable class="parameter">alignment</replaceable> ]
|
||||
@ -83,8 +84,9 @@ CREATE TYPE <replaceable class="parameter">name</replaceable> (
|
||||
<replaceable class="parameter">input_function</replaceable> and
|
||||
<replaceable class="parameter">output_function</replaceable>
|
||||
are required, while the functions
|
||||
<replaceable class="parameter">receive_function</replaceable> and
|
||||
<replaceable class="parameter">send_function</replaceable>
|
||||
<replaceable class="parameter">receive_function</replaceable>,
|
||||
<replaceable class="parameter">send_function</replaceable> and
|
||||
<replaceable class="parameter">analyze_function</replaceable>
|
||||
are optional. Generally these functions have to be coded in C
|
||||
or another low-level language.
|
||||
</para>
|
||||
@ -152,6 +154,19 @@ CREATE TYPE <replaceable class="parameter">name</replaceable> (
|
||||
shell entry with a complete type definition, and the new type can be used.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The optional <replaceable class="parameter">analyze_function</replaceable>
|
||||
performs type-specific statistics collection for columns of the data type.
|
||||
By default, <command>ANALYZE</> will attempt to gather statistics using
|
||||
the type's <quote>equals</> and <quote>less-than</> operators, if there
|
||||
is a default b-tree operator class for the type. For non-scalar types
|
||||
this behavior is likely to be unsuitable, so it can be overridden by
|
||||
specifying a custom analysis function. The analysis function must be
|
||||
declared to take a single argument of type <type>internal</>, and return
|
||||
a <type>boolean</> result. The detailed API for analysis functions appears
|
||||
in <filename>src/include/commands/vacuum.h</>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
While the details of the new type's internal representation are only
|
||||
known to the I/O functions and other functions you create to work with
|
||||
@ -341,6 +356,16 @@ CREATE TYPE <replaceable class="parameter">name</replaceable> (
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><replaceable class="parameter">analyze_function</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The name of a function that performs statistical analysis for the
|
||||
data type.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><replaceable class="parameter">internallength</replaceable></term>
|
||||
<listitem>
|
||||
|
Reference in New Issue
Block a user