Nonstop Database, HiRDB Version 9 Description
This section explains the units of locking 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
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.
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.
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.
All Rights Reserved. Copyright (C) 2015, Hitachi, Ltd.