2 19.12. Lock Management #
4 deadlock_timeout (integer) #
5 This is the amount of time to wait on a lock before checking to
6 see if there is a deadlock condition. The check for deadlock is
7 relatively expensive, so the server doesn't run it every time it
8 waits for a lock. We optimistically assume that deadlocks are
9 not common in production applications and just wait on the lock
10 for a while before checking for a deadlock. Increasing this
11 value reduces the amount of time wasted in needless deadlock
12 checks, but slows down reporting of real deadlock errors. If
13 this value is specified without units, it is taken as
14 milliseconds. The default is one second (1s), which is probably
15 about the smallest value you would want in practice. On a
16 heavily loaded server you might want to raise it. Ideally the
17 setting should exceed your typical transaction time, so as to
18 improve the odds that a lock will be released before the waiter
19 decides to check for deadlock. Only superusers and users with
20 the appropriate SET privilege can change this setting.
22 When log_lock_waits is set, this parameter also determines the
23 amount of time to wait before a log message is issued about the
24 lock wait. If you are trying to investigate locking delays you
25 might want to set a shorter than normal deadlock_timeout.
27 max_locks_per_transaction (integer) #
28 The shared lock table has space for max_locks_per_transaction
29 objects (e.g., tables) per server process or prepared
30 transaction; hence, no more than this many distinct objects can
31 be locked at any one time. This parameter limits the average
32 number of object locks used by each transaction; individual
33 transactions can lock more objects as long as the locks of all
34 transactions fit in the lock table. This is not the number of
35 rows that can be locked; that value is unlimited. The default,
36 64, has historically proven sufficient, but you might need to
37 raise this value if you have queries that touch many different
38 tables in a single transaction, e.g., query of a parent table
39 with many children. This parameter can only be set at server
42 When running a standby server, you must set this parameter to
43 have the same or higher value as on the primary server.
44 Otherwise, queries will not be allowed in the standby server.
46 max_pred_locks_per_transaction (integer) #
47 The shared predicate lock table has space for
48 max_pred_locks_per_transaction objects (e.g., tables) per server
49 process or prepared transaction; hence, no more than this many
50 distinct objects can be locked at any one time. This parameter
51 limits the average number of object locks used by each
52 transaction; individual transactions can lock more objects as
53 long as the locks of all transactions fit in the lock table.
54 This is not the number of rows that can be locked; that value is
55 unlimited. The default, 64, has historically proven sufficient,
56 but you might need to raise this value if you have clients that
57 touch many different tables in a single serializable
58 transaction. This parameter can only be set at server start.
60 max_pred_locks_per_relation (integer) #
61 This controls how many pages or tuples of a single relation can
62 be predicate-locked before the lock is promoted to covering the
63 whole relation. Values greater than or equal to zero mean an
64 absolute limit, while negative values mean
65 max_pred_locks_per_transaction divided by the absolute value of
66 this setting. The default is -2, which keeps the behavior from
67 previous versions of PostgreSQL. This parameter can only be set
68 in the postgresql.conf file or on the server command line.
70 max_pred_locks_per_page (integer) #
71 This controls how many rows on a single page can be
72 predicate-locked before the lock is promoted to covering the
73 whole page. The default is 2. This parameter can only be set in
74 the postgresql.conf file or on the server command line.