Nonstop Database, HiRDB Version 9 UAP Development Guide

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

3.4.1 Units of locking

Organization of this subsection
(1) Locked resources and inclusive relationships
(2) Setting the minimum unit of resource locking

(1) Locked resources and inclusive relationships

HiRDB locks a resource to prevent unauthorized referencing or updating.

HiRDB performs locking to maintain database integrity. In a HiRDB/Parallel Server, closed locking is performed for each server, because resources are not shared among servers.

When a higher-level resource is locked, the resources under that resource need not be locked, because locked resources maintain inclusive relationships. The following figure shows the resources that can be locked and their inclusive relationships.

Figure 3-7 Locked resources and inclusive relationships

[Figure]

#1: When the inner replica facility is used, the highest locked resource is the inner replica configuration management information or the replica group configuration management information.

If the inner replica configuration management information cannot be locked, the replica group configuration management information is locked. When an RDAREA is accessed, it is locked even if no replica RDAREA has been defined for it. This prevents a replica RDAREA from being defined for a normal RDAREA or the configuration of an inner replica group from being changed during job execution.

#2: This file is used by plug-ins.

(2) Setting the minimum unit of resource locking

For purposes of lock control that the HiRDB system implements automatically, the minimum unit of resource locking (the row or the page) can be specified for each table.

You can also disable lock control with the index key value for an index. This setting is called non-locking of index key values.

(a) When the row is specified as the minimum unit of resource locking

Because the row is a smaller unit of resource locking than the page, the efficiency of concurrent execution improves, but processing time and memory requirements associated with locking increase.

To specify the row as the minimum unit of resource locking, use the CREATE TABLE, ALTER TABLE, or LOCK statement. For details, see the HiRDB Version 9 SQL Reference manual.

(b) When the page is specified as the minimum unit of resource locking

Compared with row-level locking, the processing time and memory requirements associated with locking decrease, but the efficiency of concurrent execution is reduced.

To specify the row as the minimum unit of resource locking, use the CREATE TABLE, ALTER TABLE, or LOCK statement. For details, see the HiRDB Version 9 SQL Reference manual.

(c) When non-locking of index key values is specified

Locking is applied only to the table and not to the index key value. This setting allows you to avoid the following problems:

For details about non-locking of index key values, see 3.4.6 Non-locking of index key values.

These three settings each have different tradeoffs. These tradeoffs must be considered when the minimum unit of resource locking is specified.