mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Simplify pg_am representation of ordering-capable access methods:
provide just a boolean 'amcanorder', instead of fields that specify the sort operator strategy numbers. We have decided to require ordering-capable AMs to use btree-compatible strategy numbers, so the old fields are overkill (and indeed misleading about what's allowed).
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/catalogs.sgml,v 2.141 2007/01/09 02:14:09 tgl Exp $ -->
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/catalogs.sgml,v 2.142 2007/01/20 23:13:01 tgl Exp $ -->
|
||||
<!--
|
||||
Documentation of the system catalogs, directed toward PostgreSQL developers
|
||||
-->
|
||||
@ -365,21 +365,10 @@
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><structfield>amorderstrategy</structfield></entry>
|
||||
<entry><type>int2</type></entry>
|
||||
<entry><structfield>amcanorder</structfield></entry>
|
||||
<entry><type>bool</type></entry>
|
||||
<entry></entry>
|
||||
<entry>Zero if the index offers no sort order, otherwise the strategy
|
||||
number of the strategy operator that describes the default
|
||||
(<literal>ASC</>) sort order</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><structfield>amdescorder</structfield></entry>
|
||||
<entry><type>int2</type></entry>
|
||||
<entry></entry>
|
||||
<entry>Zero if the index offers no sort order, otherwise the strategy
|
||||
number of the strategy operator that describes the <literal>DESC</>
|
||||
sort order</entry>
|
||||
<entry>Does the access method support ordered scans?</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/indexam.sgml,v 2.19 2006/12/23 00:43:08 tgl Exp $ -->
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/indexam.sgml,v 2.20 2007/01/20 23:13:01 tgl Exp $ -->
|
||||
|
||||
<chapter id="indexam">
|
||||
<title>Index Access Method Interface Definition</title>
|
||||
@ -442,6 +442,15 @@ amrestrpos (IndexScanDesc scan);
|
||||
the scan keys to a <quote>normalized</> form.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Some access methods return index entries in a well-defined order, others
|
||||
do not. If entries are returned in sorted order, the access method should
|
||||
set <structname>pg_am</>.<structfield>amcanorder</> true to indicate that
|
||||
it supports ordered scans.
|
||||
All such access methods must use btree-compatible strategy numbers for
|
||||
their equality and ordering operators.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The <function>amgettuple</> function has a <literal>direction</> argument,
|
||||
which can be either <literal>ForwardScanDirection</> (the normal case)
|
||||
@ -451,8 +460,7 @@ amrestrpos (IndexScanDesc scan);
|
||||
the normal front-to-back direction, so <function>amgettuple</> must return
|
||||
the last matching tuple in the index, rather than the first one as it
|
||||
normally would. (This will only occur for access
|
||||
methods that advertise they support ordered scans by setting
|
||||
<structname>pg_am</>.<structfield>amorderstrategy</> nonzero.) After the
|
||||
methods that advertise they support ordered scans.) After the
|
||||
first call, <function>amgettuple</> must be prepared to advance the scan in
|
||||
either direction from the most recently returned entry.
|
||||
</para>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/xindex.sgml,v 1.54 2007/01/09 02:14:10 tgl Exp $ -->
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/xindex.sgml,v 1.55 2007/01/20 23:13:01 tgl Exp $ -->
|
||||
|
||||
<sect1 id="xindex">
|
||||
<title>Interfacing Extensions To Indexes</title>
|
||||
@ -287,20 +287,6 @@
|
||||
return type <type>boolean</type>, since they must appear at the top
|
||||
level of a <literal>WHERE</> clause to be used with an index.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
By the way, the <structfield>amorderstrategy</structfield> and
|
||||
<structfield>amdescorder</structfield> columns in <classname>pg_am</> tell
|
||||
whether the index method supports ordered scans. Zeroes mean it doesn't;
|
||||
if it does, <structfield>amorderstrategy</structfield> is the strategy
|
||||
number that corresponds to the default ordering operator, and
|
||||
<structfield>amdescorder</structfield> is the strategy number for the
|
||||
ordering operator of an index column that has the <literal>DESC</> option.
|
||||
For example, B-tree has <structfield>amorderstrategy</structfield> = 1,
|
||||
which is its <quote>less than</quote> strategy number, and
|
||||
<structfield>amdescorder</structfield> = 5, which is its
|
||||
<quote>greater than</quote> strategy number.
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="xindex-support">
|
||||
|
Reference in New Issue
Block a user