</para>
<para>
The <function>amrestrpos</function> function need only be provided if the access
method supports ordered scans. If it doesn't,
the <structfield>amrestrpos</structfield> field in its <structname>IndexAmRoutine</structname>
struct may be set to NULL.
</para>
<para>
In addition to supporting ordinary index scans, some types of index
may wish to support <firstterm>parallel index scans</firstterm>, which allow
multiple backends to cooperate in performing an index scan. The
index access method should arrange things so that each cooperating
process returns a subset of the tuples that would be performed by
an ordinary, non-parallel index scan, but in such a way that the
union of those subsets is equal to the set of tuples that would be
returned by an ordinary, non-parallel index scan. Furthermore, while
there need not be any global ordering of tuples returned by a parallel
scan, the ordering of that subset of tuples returned within each
cooperating backend must match the requested ordering. The following
functions may be implemented to support parallel index scans:
</para>
<para>
<programlisting>
Size
amestimateparallelscan (Relation indexRelation,
int nkeys,
int norderbys);
</programlisting>
Estimate and return the number of bytes of dynamic shared memory which
the access method will be needed to perform a parallel scan. (This number
is in addition to, not in lieu of, the amount of space needed for
AM-independent data in <structname>ParallelIndexScanDescData</structname>.)
</para>
<para>
The <literal>nkeys</literal> and <literal>norderbys</literal>
parameters indicate the number of quals and ordering operators that will be
used in the scan; the same values will be passed to <function>amrescan</function>.
Note that the actual values of the scan keys aren't provided yet.
</para>
<para>
It is not necessary to implement this function for access methods which
do not support parallel scans or for which the number of additional bytes
of storage required is zero.
</para>
<para>
<programlisting>
void
aminitparallelscan (void *target);
</programlisting>
This function will be called to initialize dynamic shared memory at the
beginning of a parallel scan. <parameter>target</parameter> will point to at least
the number of bytes previously returned by
<function>amestimateparallelscan</function>, and this function may use that
amount of space to store whatever data it wishes.
</para>
<para>
It is not necessary to implement this function for access methods which
do not support parallel scans or in cases where the shared memory space
required needs no initialization.
</para>
<para>
<programlisting>
void
amparallelrescan (IndexScanDesc scan);
</programlisting>
This function, if implemented, will be called when a parallel index scan
must be restarted. It should reset any shared state set up by
<function>aminitparallelscan</function> such that the scan will be restarted from
the beginning.
</para>
<para>
<programlisting>
CompareType
amtranslatestrategy (StrategyNumber strategy, Oid opfamily, Oid opcintype);
StrategyNumber
amtranslatecmptype (CompareType cmptype, Oid opfamily, Oid opcintype);
</programlisting>
These functions, if implemented, will be called by the planner and executor
to convert between fixed <type>CompareType</type> values and the specific
strategy numbers used by the access method. These functions can be
implemented by access methods that implement functionality similar to the
built-in btree or hash access methods, and by implementing these
translations, the system can learn about the semantics of the access
method's operations and can use them in place of btree or hash indexes in
various places. If the functionality of the access method is not similar
to those built-in access methods,