An operator class is a group of functions that allow the secondary-access method to store and search for values of a particular data type. The query optimizer uses an operator class to determine if an index can process the query with the least cost. For more information on the query optimizer, see the IBM Informix: Performance Guide.
The operator-class functions fall into the following categories:
The database server uses the strategy functions of a secondary-access method to help the query optimizer determine whether a specific index is applicable to a specific operation on a data type. The strategy functions are the operators that can appear in the filter of an SQL statement.
The database server uses the support functions of a secondary-access method to build and access the index. End users do not call these functions directly. When an operator in the filter of a query matches one of the strategy functions, the secondary-access method uses the support functions to traverse the index and obtain the results.
Each secondary-access method has a default operator class associated with it. By default, the CREATE INDEX statement associates the default operator class with an index.
The database server stores information about operator classes in the sysopclasses system catalog table.
The built-in secondary-access method, the generic B-tree, has a single operator class defined in the sysopclasses system catalog table. This operator class, called btree_ops, is the default operator class for the btree secondary-access method.
The database server uses the btree_ops operator class to specify:
The CREATE INDEX statement in Generic B-Tree Index shows how to create a B-tree index whose column uses the btree_ops operator class. This CREATE INDEX statement does not need to specify the btree_ops operator class because btree_ops is the default operator class for the btree access method.
For more information on the btree secondary-access method, see Generic B-Tree Index.
The btree_ops operator class defines the following strategy functions for the btree access method:
These strategy functions are all operator functions. That is, each function is associated with an operator symbol; in this case, with a relational-operator symbol. For more information, see Relational Operators.
The btree_ops operator class has one support function, a comparison function called compare(). The compare() function is a user-defined function that returns an integer value to indicate whether its first argument is equal to, less than, or greater than its second argument, as follows:
The B-tree secondary-access method uses the compare() function to traverse the nodes of the generic B-tree index. To search for data values in a generic B-tree index, the secondary-access method uses the compare() function to compare the key value in the query to the key value in an index node. The result of the comparison determines if the secondary-access method needs to search the next lower level of the index or if the key resides in the current node.
The generic B-tree access method also uses the compare() function to perform the following tasks for generic B-tree indexes:
The database server uses the compare() function to evaluate comparisons in the SELECT statement. To provide support for these comparisons for opaque data types, you must write the compare() function. For more information, see Conditional Operators for Opaque Data Types.
The R-tree secondary-access method has an operator class defined in the sysopclasses system catalog table. This operator class, called rtree_ops, is the default operator class for the rtree secondary-access method. The database server defines the default R-tree operator class in the system catalog tables but does not provide the operator-class functions to implement this operator class.
To use an R-tree index, install a spatial DataBlade module such as the Spatial DataBlade module, Geodetic DataBlade module, or any other third-party DataBlade module that implements an R-tree index. For more information on R-tree indexes, refer to IBM Informix: R-Tree Index User's Guide. For more information on the spatial DataBlade modules, consult the appropriate DataBlade module user guide.
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]