Creating parallelizable UDRs
A parallelizable query is a query that can be executed in parallel.
About this task
The Parallel Database Query (PDQ) feature allows the database server to run a single SQL statement in parallel. When you send a query to the database server, it breaks your request into a set of discrete subqueries, each of which can be assigned to a different CPU virtual processor. PDQ is especially effective when your tables are fragmented and your server computer has more than one CPU.
A parallelizable UDR is a C UDR that can be executed in parallel when it is invoked within a parallelizable query. If you write your C UDR to be parallelizable, it can be executed in parallel when the query that invokes it is executed in parallel. That is, the C UDR can execute on subsets of table data just as the query itself can. A query that invokes a nonparallelizable UDR can still run in parallel. However, the calls to the UDR do not run in parallel. Similarly, prepared queries that invoke a parallelizable query do not run the UDR in parallel.
To create a parallelizable C UDR:
Procedure
- Write the C UDR so that it does not call any DataBlade® API functions that are non-PDQ-threadsafe.
- Register the C UDR with the PARALLELIZABLE routine modifier.
- Execute the parallelized C UDR, once in each scan thread of the parallelized query.
- Debug the parallelized C UDR.
Results
The following subsections describe these steps in detail.