User-defined methods
- How to register a new method?
- Write the code for the method
- Compile the code into the object code
- Inform the ORDBMS about its location, return data type, input data types
- Example
- CREATE FUNCTION overlaps (polygon, polygon) RETURNS boolean
AS EXTERNAL NAME ‘a/b/c/overlap.o’;
- Method security
- purpose: to prevent buggy or malicious code from causing problems
- interpreted methods:
- restrict the power of the interpreted language
- ensure safety of each step before executing
- compiled methods
- run methods in a different address space that the DBMS
- use interprocess communication (IPC) to invoke methods and receive data
- transparent to user
- Method caching:
- purpose: improve processing efficiency
- cache method inputs and matching outputs as a table in the database: cache table
- join cache table with input tuples
- Pointer swizzling: when an object O is paged into the memory
- maintain in memory pointers to the objects contained in O