Lock Management

In GaussDB(DWS), a deadlock may occur when concurrently executed transactions compete for resources. This section describes parameters used for managing transaction lock mechanisms.

deadlock_timeout

Parameter description: Specifies the time, in milliseconds, to wait on a lock before checking whether there is a deadlock condition. When the applied lock exceeds the preset value, the system will check whether a deadlock occurs.

Type: SUSET

Value range: an integer ranging from 1 to 2147483647. The unit is millisecond (ms).

Default value: 1s

ddl_lock_timeout

Parameter description: Indicates the number of seconds a DDL command should wait for the locks to become available. If the time spent in waiting for a lock exceeds the specified time, an error is reported. (This parameter is supported only in 8.1.3.200 and later cluster versions.)

Type: SUSET

Value range: an integer ranging from 0 to INT_MAX. The unit is millisecond (ms).

Default value: 0

This parameter has a higher priority than lockwait_timeout and takes effect only for AccessExclusiveLock.

lockwait_timeout

Parameter description: Specifies the longest time to wait before a single lock times out. If the time you wait before acquiring a lock exceeds the specified time, an error is reported.

Type: SUSET

Value range: an integer ranging from 0 to INT_MAX. The unit is millisecond (ms).

Default value: 20 min

update_lockwait_timeout

Parameter description: sets the maximum duration that a lock waits for concurrent updates on a row to complete when the concurrent update feature is enabled. If the time you wait before acquiring a lock exceeds the specified time, an error is reported.

Type: SUSET

Value range: an integer ranging from 0 to INT_MAX. The unit is millisecond (ms).

Default value: 2 min

max_locks_per_transaction

Parameter description: Controls the average number of object locks allocated for each transaction.

Type: POSTMASTER

Value range: an integer ranging from 10 to INT_MAX

Default value: 256

ddl_select_concurrent_mode

Parameter description: Specifies the concurrency mode of DDL and SELECT statements. This parameter is supported only by clusters of 8.1.3.320, 8.2.1, and later versions.

Type: SUSET

Value range: enumerated values

Default value: none

  • To reserve time for the SELECT statement to respond to signals, if the value of ddl_lock_timeout is less than 1 second in the current version, 1 second is used.
  • Concurrency is not supported when there are conflicts with locks of higher levels (more than one level). For example, autoanalyze is triggered by select when autoanalyze_mode is set to normal.
  • Concurrency is not supported when there are conflicts with locks in transaction blocks.

max_pred_locks_per_transaction

Parameter description: Controls the average number of predicated locks allocated for each transaction.

Type: POSTMASTER

Value range: an integer ranging from 10 to INT_MAX

Default value: 64

partition_lock_upgrade_timeout

Parameter description: Specifies the time to wait before the attempt of a lock upgrade from ExclusiveLock to AccessExclusiveLock times out on partitions.

Type: USERSET

Value range: an integer ranging from -1 to 3000. The unit is second (s).

Default value: 1800