aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2012-04-06 16:04:10 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2012-04-06 16:04:10 -0400
commitcea49fe82fedcf125eb99a780099eaf47a326b03 (patch)
tree37312e107b898d1dc4668f52bf2eb9876f18fbce /doc/src
parent263d9de66b867b7800fac82c222e004b795b724a (diff)
downloadpostgresql-cea49fe82fedcf125eb99a780099eaf47a326b03.tar.gz
postgresql-cea49fe82fedcf125eb99a780099eaf47a326b03.zip
Dept of second thoughts: improve the API for AnalyzeForeignTable.
If we make the initially-called function return the table physical-size estimate, acquire_inherited_sample_rows will be able to use that to allocate numbers of samples among child tables, when the day comes that we want to support foreign tables in inheritance trees.
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/fdwhandler.sgml28
1 files changed, 15 insertions, 13 deletions
diff --git a/doc/src/sgml/fdwhandler.sgml b/doc/src/sgml/fdwhandler.sgml
index 8e7525ab596..2c75b80b303 100644
--- a/doc/src/sgml/fdwhandler.sgml
+++ b/doc/src/sgml/fdwhandler.sgml
@@ -279,15 +279,19 @@ EndForeignScan (ForeignScanState *node);
<para>
<programlisting>
-AcquireSampleRowsFunc
-AnalyzeForeignTable (Relation relation);
+bool
+AnalyzeForeignTable (Relation relation,
+ AcquireSampleRowsFunc *func,
+ BlockNumber *totalpages);
</programlisting>
This function is called when <xref linkend="sql-analyze"> is executed on
- a foreign table. If the FDW supports collecting statistics for this
- foreign table, it should return a pointer to a function that will collect
- sample rows from the table. Otherwise, return <literal>NULL</>. If the
- FDW does not support collecting statistics for any tables, the
+ a foreign table. If the FDW can collect statistics for this
+ foreign table, it should return <literal>true</>, and provide a pointer
+ to a function that will collect sample rows from the table in
+ <parameter>func</>, plus the estimated size of the table in pages in
+ <parameter>totalpages</>. Otherwise, return <literal>false</>.
+ If the FDW does not support collecting statistics for any tables, the
<function>AnalyzeForeignTable</> pointer can be set to <literal>NULL</>.
</para>
@@ -298,18 +302,16 @@ int
AcquireSampleRowsFunc (Relation relation, int elevel,
HeapTuple *rows, int targrows,
double *totalrows,
- double *totaldeadrows,
- BlockNumber *totalpages);
+ double *totaldeadrows);
</programlisting>
A random sample of up to <parameter>targrows</> rows should be collected
from the table and stored into the caller-provided <parameter>rows</>
array. The actual number of rows collected must be returned. In
- addition, store estimates of the total numbers of live rows, dead rows,
- and pages in the table into the output parameters
- <parameter>totalrows</>, <parameter>totaldeadrows</>, and
- <parameter>totalpages</>. These numbers will be recorded in the table's
- <structname>pg_class</> entry for future use.
+ addition, store estimates of the total numbers of live and dead rows in
+ the table into the output parameters <parameter>totalrows</> and
+ <parameter>totaldeadrows</>. (Set <parameter>totaldeadrows</> to zero
+ if the FDW does not have any concept of dead rows.)
</para>
<para>