To provide the optimum performance with an access method, perform the following actions:
In response to a SELECT statement, the query optimizer compares the cost of alternative query paths. To determine the cost for the access method to scan the virtual table that it manages, the optimizer relies on two sources of information:
The am_scancost purpose function calculates and returns this cost to the optimizer. If you do not provide an am_scancost purpose function, the optimizer cannot analyze those query paths that involve a scan of data by the access method.
This purpose function takes the place of the type of distribution analysis that the database server performs for an UPDATE STATISTICS statement.
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:
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.
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.
Reuse the information from am_beginscan and possibly some data from am_getnext to perform any subsequent scans for a join or subquery.
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.
If you supply a function for am_getbyid, you must also set the am_rowids purpose flag when you register the access method.
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]