Split a scan

The way in which you split a scan influences the ability of the access method to optimize performance during queries.

You can choose to provide separate functions for each of the following purpose-function prototypes:
  • am_beginscan

    Identify the columns to project and the function to execute for each WHERE clause qualification. The database server calls the function for am_beginscan only once per query.

  • am_getnext

    Scan through the table to find a qualifying entry and return it. The database server calls this function as often as necessary to exhaust the qualified entries in the table.

  • am_rescan

    Reuse the information from am_beginscan and possibly some data from am_getnext to perform any subsequent scans for a join or subquery.

  • am_endscan

    Deallocate any memory that am_beginscan allocates. The database server calls this function only once.

If you provide only an am_getnext purpose function, that one purpose function (and any UDRs that it calls) analyzes the query, scans, rescans, and performs end-of-query cleanup.
Tip: When the database server can scan an index to query a table, it does not need to call any of the functions in the previous list. Instead, the database server can pass the physical address (rowid) of each qualified row to an am_getbyid purpose function. The function for am_getbyid calls the appropriate DataBlade API or external routines to read or write disk data. It does not scan the table to find rows.

If you supply a function for am_getbyid, you must also set the am_rowids purpose flag when you register the access method.


Copyright© 2019 HCL Technologies Limited