Nonstop Database, HiRDB Version 9 Description

[Contents][Glossary][Index][Back][Next]

6.10.1 Units of locking

This section explains the units of locking and their inclusion relationships.

Organization of this subsection
(1) Locked resources and their inclusion relationships
(2) Setting the lowest-order locked resource unit

(1) Locked resources and their inclusion relationships

HiRDB prevents illegal referencing and updating by applying locks based on a unit called the locked resource. Locking is applied sequentially from top to bottom of the locked resources. If when locking is applied there is a transaction that cannot execute because it is in contention with other transactions for a resource, that transaction goes onto wait status.

Locked resources have inclusion relationships. Therefore, once a lock is applied to a higher-order resource, there is no need to apply locks to the resources that are below it hierarchically. The figure below shows locked resources and their inclusion relationships. For example, a table is a higher-order resource and a page is a lower-order resource.

Figure 6-25 Locked resources and their inclusion relationships

[Figure]

#1
In the UNIX edition only:
When the inner replica facility is used, the highest-order locked resource is the inner replica configuration management information or replica group configuration management information.
When the inner replica configuration management information cannot be locked, a lock is applied to the replica group configuration management information. When an RDAREA that does not define a replica RDAREA is accessed, locking is also applied. This prevents a replica RDAREA from being defined in a regular RDAREA or the configuration inside the inner replica group from being modified while a job is being executed.

#2
Temporarily acquired when a temporary table is instantiated. For details about the locks acquired in operations performed on temporary tables, see the HiRDB Version 9 Installation and Design Guide.

#3
If index key value no-lock is applied, the key value is not locked. For details about index key value no-lock, see the HiRDB Version 9 UAP Development Guide.

#4
The logical file is used by a plug-in.

(2) Setting the lowest-order locked resource unit

For each table, the user can set the lowest-order locked resource unit for the locking to be applied automatically by HiRDB. The lowest-order locked resource unit, the setting procedures, and their advantages and disadvantages are explained as follows.

(a) Locking by row

To set the row as the lowest-order unit of locking, LOCK ROW is specified in the CREATE TABLE definition SQL. Locking that uses the row as the lowest-order unit of locking is called row locking. Compared to locking by page, locking by row results in better concurrent execution because it is a lower unit of locked resources. On the other hand, locking by row increases the processing time required for locking and increases memory usage.

(b) Locking by page

To set the page as the lowest-order unit of locking, LOCK PAGE is specified in the CREATE TABLE definition SQL. Locking that uses the page as the lowest-order unit of locking is called page locking. Compared to locking by row, locking by page reduces the processing time required for locking and reduces memory usage. On the other hand, locking by page results in poor concurrent execution.