Support functions

Support functions are user-defined functions that the HCL Informix® database server uses to construct and maintain an R-tree index. They are never explicitly executed by end users.

The R-tree access method uses support functions to determine the leaf page on which an index key belongs and to create the special bounding-box-only keys used internally by the R-tree index. For more information on bounding boxes, refer to Bounding boxes.

The R-tree access method requires that you create the following three support functions:
  • Union
  • Size
  • Inter
If you plan to support bounding-box-only R-tree indexes (described in Bounding-box-only R-tree indexes), which are the default R-tree indexes created by Version 9.21.UC1 or later of the database server, or you plan to support nearest-neighbor searches, you must also implement the RtreeInfo support function with the operation strat_func_substitutions.
Important: To support bounding-box-only indexes or nearest-neighbor searches, you might also need to redesign your strategy functions that occupy slots 5 and up, if you want them to behave differently at nonleaf pages. This is because you cannot distinguish between leaf and nonleaf items in a bounding-box-only index. For more information, see The RtreeInfo function.

You must list the Union, Size, and Inter support functions in the order shown when you execute the CREATE OPCLASS statement to register the operator class with the database server. In other words, you must list the Union, Size, and Inter support functions as the first, second, and third support functions, respectively, in the CREATE OPCLASS statement. This SQL statement is described in Syntax for creating a new operator class.

In addition to the required support functions, the R-tree access method also recognizes the following four optional support functions that it uses to enhance the performance of the statement that creates the R-tree index:
  • SFCbits
  • ObjectLength
  • SFCvalue
  • SetUnion

You are not required to include these support functions in your operator class. However, since these functions are specifically designed to improve the performance of the creation of R-tree indexes, it is highly recommended that you include them in your operator class.

If you decide to include these optional support functions in your operator class, you must list them after the required support functions, in the order shown, when you execute the CREATE OPCLASS statement to register the operator class with the database server. In other words, you must list the SFCbits, ObjectLength, SFCvalue, and SetUnion support functions as the fourth, fifth, sixth, and seventh support functions, respectively, in the CREATE OPCLASS statement. This SQL statement is described in Syntax for creating a new operator class.

You must list the RtreeInfo support function in the eighth position, after Union, Size, and Inter, and the four optional bulk-loading support functions. If you do not provide the four optional bulk-loading support functions in your DataBlade® module, specify NULL in the fourth, fifth, sixth, and seventh positions in the CREATE OPCLASS statement.

The following topics describe how the R-tree access method uses the support functions and how you should write each function, and provide an example of an SQL statement used to create the Union function. Examples of the SQL statements to create the Size, Inter, SFCbits, ObjectLength, SFCvalue, and SetUnion functions are not provided because they are similar to the Union example.
Tip: It is useful to name support functions in a way that describes what they do. For example, it makes sense to name a function that calculates the size of a bounding box Size. For convenience, this guide uses the names Union, Size, and Inter when it describes the three required support functions. These are also the names that the default operator class rtree_ops uses for its support functions.