Home | Previous Page | Next Page   Developing an Access Method > Writing Purpose Functions >

Optimizing Queries

To provide the optimum performance with an access method, perform the following actions:

Providing Optimizer Information

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:

Splitting 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:

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.

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]