Bypass table scans
The secondary access method always returns row identifiers so that the database server can locate table rows. The access method can additionally format and return rows from the key columns that the scan descriptor specifies.
Set the am_keyscan purpose flag (with the CREATE SECONDARY
ACCESS_METHOD or ALTER ACCESS_METHOD statement) to alert the database
server that the am_getnext purpose function returns
key values. When am_keyscan is set, the database server knows
that am_getnext creates a row in shared memory
from the key values in a qualified index entry. If the query selects
only the columns in the key, the database server returns rows of index
keys to the query. It does not retrieve the physical table row or
extract the selected columns from the row.
Important: The
access method cannot determine whether an individual query projects
key columns. Before you decide to set the am_keyscan purpose
flag, determine whether key columns satisfy queries with sufficient
frequency for the access method to format rows, which requires a function
call to the database server.
Remember: Do not set am_keyscan or
format rows if users of the access method might index user-defined
types (UDTs).
For more information about am_keyscan, see Purpose options.