The database server supports the following classes of virtual processors for the execution of a UDR.
Virtual-Processor Class | Description |
---|---|
CPU VP | Required VP for execution of SPL routines Default VP for execution of C UDRs. A UDR must be well behaved to run in the CPU VP. |
User-defined VP | VP for execution of C UDR that has some ill-behaved characteristics but does not contain system() functions. For information on system() functions, see Using Operating System Functions. |
JVP | VP for execution of Java UDRThis VP class contains the Java Virtual Machine (Java VM). |
The database server defines the CPU VP and the JVP classes.
The CPU virtual-processor class is the primary VP class of the database server. It runs the following kinds of threads:
Session threads process requests from the SQL client applications.
Internal threads perform services internal to the database server.
The CPU VP class is the default VP class for a UDR. You do not need to specify the CLASS routine modifier in the CREATE FUNCTION or CREATE PROCEDURE statement to have the UDR execute in the CPU VP class.
SPL routines must always run in the CPU VP. Therefore, you do not need to specify the CLASS routine modifier for an SPL routine. The following CREATE FUNCTION statement registers the getTotal() SPL routine, which runs in the CPU VP:
CREATE FUNCTION getTotal(order_num, state_code) RETURNS MONEY ... END FUNCTION
You cannot run an SPL routine in a user-defined VP.
By default, a C UDR runs in the CPU VP class. Generally, UDRs perform best in the CPU VP class because threads do not have to migrate among operating-system processes during query execution. However, to run in the CPU VP, the C UDR must be well behaved; that is, it must adhere to the following programming requirements:
You can relax some of these programming requirements if you run your C UDR in a user-defined VP class. For more information, see User-Defined Virtual-Processor Class (C).
For routines written in C, you can designate a user-defined class of virtual processors, called user-defined VPs, to run the routine.
Use of user-defined VPs can result in lower performance because queries normally execute in the CPU VP, and the query thread must migrate to the user-defined VP to evaluate external routines.
Java routines always run in a Java VP. When you register a Java, you can specify the following CLASS routine modifier for legibility, but it is not required:
CLASS = jvpHome | [ Top of Page | Previous Page | Next Page | Contents | Index ]