Expensive routines
Expensive routines are routines that either take a long time or require a great deal of disk space to run.
Conventional relational database systems do not account for expensive routines; any predicate that appears in a query is assumed to be as expensive as any other. For example, comparing two floating-point numbers is not more difficult than comparing two integers. For relational databases, this is the right approach.
However, an object-relational database system must evaluate relative function costs. Some routines are difficult to compute or require a great deal of intermediate space. For example, it can take many thousands of machine instructions to determine whether two polygons overlap.
Because an object-relational database stops evaluating predicates as soon as it determines that a row does not satisfy the criteria, the database server chooses an optimum order to evaluate the predicates in a query. If it evaluates all the expensive predicates first, the query runs slower than if it considers the inexpensive predicates first.
The strategy for choosing the best order to evaluate predicates is complex and beyond the scope of this discussion. However, the database server must evaluate the cost of invoking user-defined routines to run queries efficiently.
Most DataBlade® module routines are at least as complex as a routine that compares floating-point numbers. For DataBlade module routines that are more expensive, you must describe the relative expense to the HCL OneDB™ server.
<lines of code> + (<number of I/Os> * 100)
For example, if a routine has 100 lines of code and performs 5 disk I/Os or SQL queries, the cost is 100 + (5 * 100), or 600. You can enter the cost in the BladeSmith Routine wizard.
- Which DataBlade module routines take a long time to run?
- Which DataBlade module routines consume large amounts of memory or disk space?
- How expensive are the DataBlade module routines relative to one another?
- How expensive are the DataBlade module routines relative to expensive routines defined by other DataBlade modules?