Thread creation
At thread creation time a number of activities occur, these activities include the plan authorization check, which must always happens.
- Sign on.
- Check the maximum number of threads.
- For an application plan, load the skeleton cursor table (SKCT) and header, if not already in the environmental description manager (EDM) pool.
- Create a copy of the SKCT header in the cursor table (CT).
- Perform the plan authorization check.
The control block for an application plan, the SKCT, is divided into sections. The header and directory of an SKCT contain control information; SQL sections contain SQL statements from the application. A copy of the SKCT, the CT, is made for each thread executing the plan. Only the header and directory are loaded when the thread is created, if they are not already in the EDM pool.
The SQL sections of the plan segments are never copied into the CT at thread creation time. They are copied in, section by section, when the corresponding SQL statements are executed. For a protected thread with RELEASE(DEALLOCATE), the CT increases in size until all segments have been copied into the CT.
If the SQL statements for the transaction are bound to a package rather than a plan, Db2® uses a skeleton package table (SKPT) rather than an SKCT, and a package table (PT) rather than a CT. The SKPT is allocated when the first SQL statement is executed; it is not allocated when the thread is created.