diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2011-12-18 15:49:00 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2011-12-18 15:50:37 -0500 |
commit | 3695a555136a6d179cac8ae48d5f90171d5b30e9 (patch) | |
tree | efb7fb5afb3dea1292c9a50635b53215cc548e64 /doc/src | |
parent | 19d223171801dda36f84e24dc89c9fbab1ababad (diff) | |
download | postgresql-3695a555136a6d179cac8ae48d5f90171d5b30e9.tar.gz postgresql-3695a555136a6d179cac8ae48d5f90171d5b30e9.zip |
Replace simple constant pg_am.amcanreturn with an AM support function.
The need for this was debated when we put in the index-only-scan feature,
but at the time we had no near-term expectation of having AMs that could
support such scans for only some indexes; so we kept it simple. However,
the SP-GiST AM forces the issue, so let's fix it.
This patch only installs the new API; no behavior actually changes.
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/catalogs.sgml | 15 | ||||
-rw-r--r-- | doc/src/sgml/indexam.sgml | 24 |
2 files changed, 24 insertions, 15 deletions
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml index b8cc16f72a9..d948ed487c6 100644 --- a/doc/src/sgml/catalogs.sgml +++ b/doc/src/sgml/catalogs.sgml @@ -482,13 +482,6 @@ </row> <row> - <entry><structfield>amcanreturn</structfield></entry> - <entry><type>bool</type></entry> - <entry></entry> - <entry>Can the access method return the contents of index entries?</entry> - </row> - - <row> <entry><structfield>amoptionalkey</structfield></entry> <entry><type>bool</type></entry> <entry></entry> @@ -623,6 +616,14 @@ </row> <row> + <entry><structfield>amcanreturn</structfield></entry> + <entry><type>regproc</type></entry> + <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry> + <entry>Function to check whether index supports index-only scans, + or zero if none</entry> + </row> + + <row> <entry><structfield>amcostestimate</structfield></entry> <entry><type>regproc</type></entry> <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry> diff --git a/doc/src/sgml/indexam.sgml b/doc/src/sgml/indexam.sgml index a6e4466e8a1..ebd32cc8d97 100644 --- a/doc/src/sgml/indexam.sgml +++ b/doc/src/sgml/indexam.sgml @@ -134,11 +134,6 @@ <structfield>amsearchnulls</structfield>, indicating that it supports <literal>IS NULL</> and <literal>IS NOT NULL</> clauses as search conditions. - An index method can also set <structfield>amcanreturn</structfield>, - indicating that it can support <firstterm>index-only scans</> by returning - the indexed column values for an index entry in the form of an IndexTuple. - (An example of an index AM that cannot do this is hash, which stores only - the hash values not the original data.) </para> </sect1> @@ -278,6 +273,19 @@ amvacuumcleanup (IndexVacuumInfo *info, <para> <programlisting> +bool +amcanreturn (Relation indexRelation); +</programlisting> + Check whether the index can support <firstterm>index-only scans</> by + returning the indexed column values for an index entry in the form of an + IndexTuple. Return TRUE if so, else FALSE. If the index AM can never + support index-only scans (an example is hash, which stores only + the hash values not the original data), it is sufficient to set its + <structfield>amcanreturn</> field to zero in <structname>pg_am</>. + </para> + + <para> +<programlisting> void amcostestimate (PlannerInfo *root, IndexOptInfo *index, @@ -391,9 +399,9 @@ amgettuple (IndexScanDesc scan, </para> <para> - If the access method supports index-only scans (i.e., - <structfield>amcanreturn</structfield> is TRUE in its <structname>pg_am</> - row), then on success it must also check + If the index supports index-only scans (i.e., + <function>amcanreturn</function> returns TRUE for it), + then on success the AM must also check <literal>scan->xs_want_itup</>, and if that is true it must return the original indexed data for the index entry, in the form of an <structname>IndexTuple</> pointer stored at <literal>scan->xs_itup</>, |