Executing in parallel
Parallelizable routines can execute in parallel across multiple processors.
Before you begin
- Follow the guidelines for well-behaved user-defined routines.
- Avoid any routine that involves query processing (mi_exec(), mi_exec_prepared_statement()), collections (mi_collection_*), row types, or save sets (mi_save_set_*).
- Do not create rows that contain any complex types including another row type as one of the columns. Do not use the mi_row_create() or mi_value() functions with complex types or row types.
- Avoid FastPath functions (mi_routine_*, mi_func_desc_by_typeid()) if the access method might pass them routine identifiers for nonparallelizable routines.
- Specify the PARALLELIZABLE routine modifier in the CREATE FUNCTION or CREATE PROCEDURE statement for the UDR.
- Guidelines for well-behaved user-defined routines
- A complete list of nonparallelizable functions
- FastPath function syntax, usage, and examples
For more information about the PARALLELIZABLE (and other) routine modifiers, see the routine modifier section in the HCL® Informix® Guide to SQL: Syntax. For more information about parallelizable UDRs, see Creating User-Defined Routines and User-Defined Types.
About this task
To make an access method parallelizable:
Procedure
- Create a basic set of parallelizable purpose functions.
The basic set, which enables a SELECT statement to execute in parallel, includes the following purpose functions: am_open, am_close, am_getbyid, am_beginscan, am_endscan, am_getnext, and am_rescan.
An access method might not supply all of the purpose functions that define a basic parallelizable set. As long as you make all the basic purpose functions that you provide parallelizable, a SELECT statement that uses the access method can execute in parallel.
- Add a parallelizable purpose function to the basic set
for any of the following actions that you want the database server
to execute in parallel.
Parallel SQL statement Parallelizable purpose function INSERT (in a SELECT) am_insert SELECT INTO TEMP am_insert DELETE am_delete UPDATE am_update
Results
The database server sets an am_parallel purpose value in the sysams system catalog table to indicate which access-method actions can occur in parallel. For more information, see the purpose options of the CREATE ACCESS METHOD and ALTER ACCESS METHOD SQL statements in HCL® Informix® Guide to SQL: Syntax.