|
6885 | 6885 | in the same way as in <structname>pg_description</structname> or |
6886 | 6886 | <structname>pg_depend</structname>). Also, the right to extend a |
6887 | 6887 | relation is represented as a separate lockable object. |
| 6888 | + Also, <quote>advisory</> locks can be taken on numbers that have |
| 6889 | + user-defined meanings. |
6888 | 6890 | </para> |
6889 | 6891 |
|
6890 | 6892 | <table> |
|
6985 | 6987 | <entry>any OID column</entry> |
6986 | 6988 | <entry> |
6987 | 6989 | OID of the object within its system catalog, or null if the |
6988 | | - object is not a general database object. |
6989 | | - For advisory locks it is used to distinguish the two key |
6990 | | - spaces (1 for an int8 key, 2 for two int4 keys). |
| 6990 | + object is not a general database object |
6991 | 6991 | </entry> |
6992 | 6992 | </row> |
6993 | 6993 | <row> |
6994 | 6994 | <entry><structfield>objsubid</structfield></entry> |
6995 | 6995 | <entry><type>smallint</type></entry> |
6996 | 6996 | <entry></entry> |
6997 | 6997 | <entry> |
6998 | | -For a table column, this isthecolumn number (the |
| 6998 | +Column number targeted bythelock (the |
6999 | 6999 | <structfield>classid</> and <structfield>objid</> refer to the |
7000 | | - table itself). For all other object types, this column is |
7001 | | - zero. Null if the object is not a general database object |
| 7000 | + table itself), |
| 7001 | + or zero if the target is some other general database object, |
| 7002 | + or null if the target is not a general database object |
7002 | 7003 | </entry> |
7003 | 7004 | </row> |
7004 | 7005 | <row> |
|
7015 | 7016 | <entry></entry> |
7016 | 7017 | <entry> |
7017 | 7018 | Process ID of the server process holding or awaiting this |
7018 | | - lock. Null if the lock is held by a prepared transaction. |
| 7019 | + lock, or null if the lock is held by a prepared transaction |
7019 | 7020 | </entry> |
7020 | 7021 | </row> |
7021 | 7022 | <row> |
|
7068 | 7069 |
|
7069 | 7070 | <para> |
7070 | 7071 | Advisory locks can be acquired on keys consisting of either a single |
7071 | | - <type>bigint</type> value or two integer values. A <type>bigint</type> key is displayed with its |
| 7072 | + <type>bigint</type> value or two integer values. |
| 7073 | + A <type>bigint</type> key is displayed with its |
7072 | 7074 | high-order half in the <structfield>classid</> column, its low-order half |
7073 | 7075 | in the <structfield>objid</> column, and <structfield>objsubid</> equal |
7074 | 7076 | to 1. Integer keys are displayed with the first key in the |
|
7078 | 7080 | so the <structfield>database</> column is meaningful for an advisory lock. |
7079 | 7081 | </para> |
7080 | 7082 |
|
7081 | | - <para> |
7082 | | - The <structname>pg_locks</structname> view displays data from both the |
7083 | | - regular lock manager and the predicate lock manager, which are |
7084 | | - separate systems. When this view is accessed, the internal data |
7085 | | - structures of each lock manager are momentarily locked, and copies are |
7086 | | - made for the view to display. Each lock manager will therefore |
7087 | | - produce a consistent set of results, but as we do not lock both lock |
7088 | | - managers simultaneously, it is possible for locks to be taken or |
7089 | | - released after we interrogate the regular lock manager and before we |
7090 | | - interrogate the predicate lock manager. Each lock manager is only |
7091 | | - locked for the minimum possible time so as to reduce the performance |
7092 | | - impact of querying this view, but there could nevertheless be some |
7093 | | - impact on database performance if it is frequently accessed. |
7094 | | - </para> |
7095 | | - |
7096 | 7083 | <para> |
7097 | 7084 | <structname>pg_locks</structname> provides a global view of all locks |
7098 | 7085 | in the database cluster, not only those relevant to the current database. |
|
7117 | 7104 | but it continues to hold the locks it acquired while running.) |
7118 | 7105 | </para> |
7119 | 7106 |
|
| 7107 | + <para> |
| 7108 | + The <structname>pg_locks</structname> view displays data from both the |
| 7109 | + regular lock manager and the predicate lock manager, which are |
| 7110 | + separate systems. When this view is accessed, the internal data |
| 7111 | + structures of each lock manager are momentarily locked, and copies are |
| 7112 | + made for the view to display. Each lock manager will therefore |
| 7113 | + produce a consistent set of results, but as we do not lock both lock |
| 7114 | + managers simultaneously, it is possible for locks to be taken or |
| 7115 | + released after we interrogate the regular lock manager and before we |
| 7116 | + interrogate the predicate lock manager. Each lock manager is only |
| 7117 | + locked for the minimum possible time so as to reduce the performance |
| 7118 | + impact of querying this view, but there could nevertheless be some |
| 7119 | + impact on database performance if it is frequently accessed. |
| 7120 | + </para> |
| 7121 | + |
7120 | 7122 | </sect1> |
7121 | 7123 |
|
7122 | 7124 | <sect1 id="view-pg-prepared-statements"> |
|