B-tree support function
- A value of 0 when the first argument is equal to the second argument
- A value less than 0 when the first argument is less than the second argument
- A value greater than 0 when the first argument is greater than the second argument
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.
- Sort the keys before building the index
- Determine the linear ordering of keys in a generic B-tree index
- Evaluate the relational operators
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.