Reasons for extending btree_ops

The strategy functions of btree_ops are the relational operations that end users can use in expressions. (For a list of the relational operators, see B-tree strategy functions.) The generic B-tree index handles only the built-in data types. When you write relational-operator functions that handle a new UDT, you extend the generic B-tree so that it can handle the UDT in a column or a user-defined function. To create B-tree indexes on columns or functions of the new data type, you must write new relational-operator functions that can handle the new data type.

In the relational-operator functions, you determine the following behavior of a B-tree index:
  • What single value does the B-tree secondary-access method use to order the index?

    For a particular UDT, the relational-operator functions must compare two values of this data type for the data type to be stored in the B-tree index.

  • In what order does the B-tree index sort the values?

    For a particular UDT, the relational-operator functions must determine what constitutes an ordered sequence of the values.