12.22.5 Locking for temporary tables

A temporary table contains specific data for a particular transaction or SQL session and is not available to be accessed by other users. In general, therefore, HiRDB does not acquire locks for table operations other than when a temporary table is instantiated. This subsection explains locking for temporary tables.

Organization of this subsection
(1) Locks acquired when temporary tables are instantiated
(2) Locks acquired for operations on temporary tables
(3) Operations that might result in a lock-release wait status or an execution error

(1) Locks acquired when temporary tables are instantiated

When a temporary table is instantiated, HiRDB acquires the locks shown in the following table.

Table 12-30 Locks acquired when a temporary table is instantiated

Resource type nameDescriptionUnlock timing
Transaction-specific temporary tableSQL session-specific temporary table
RDARRDAREA (table and index#1 storage RDAREA)When the transaction is completedWhen the DISCONNECT statement is completed
TABLTable
RATMUser directory table information
RAIMUser directory index information#1
SBMBUser directory segment information
TEMPTemporary table instantiation control informationAfter the temporary table has been instantiated#2
TPIDUser-specific ID management (temporary table)When the DISCONNECT statement is completed
RDASRDAREA status managementAfter the temporary table has been instantiated#2
RRAM,
TRAL,
TRAI
RDAREA management information
PTBLTable for preprocessingWhen the DISCONNECT statement is completed
#1
Applicable only if there is a temporary table index.
#2
A lock for this resource is acquired temporarily during instantiation.

(2) Locks acquired for operations on temporary tables

When the following SQL statements are executed, a lock is acquired only for the preprocessing table (PTBL):

Note that executing the following SQL statements on a temporary table will not lock pages, rows, or key values:

(3) Operations that might result in a lock-release wait status or an execution error

If you are performing an operation on a temporary table and, at the same time, you execute any of the following operations, a lock-release wait status or an execution error might result: