Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfcb4bfd

Browse files
Reduce lock level for altering fillfactor
Fabrízio de Royes Mello and Simon Riggs
1 parent090b287 commitfcb4bfd

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

‎doc/src/sgml/ref/alter_table.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ ALTER TABLE ALL IN TABLESPACE <replaceable class="PARAMETER">name</replaceable>
561561
</para>
562562

563563
<para>
564-
Changing autovacuum storage parameters acquires a <literal>SHARE UPDATE EXCLUSIVE</literal> lock.
564+
Changingfillfactor andautovacuum storage parameters acquires a <literal>SHARE UPDATE EXCLUSIVE</literal> lock.
565565
</para>
566566

567567
<note>

‎src/backend/access/common/reloptions.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ static relopt_int intRelOpts[] =
100100
"fillfactor",
101101
"Packs table pages only to this percentage",
102102
RELOPT_KIND_HEAP,
103-
AccessExclusiveLock
103+
ShareUpdateExclusiveLock/* since it applies only to later inserts */
104104
},
105105
HEAP_DEFAULT_FILLFACTOR,HEAP_MIN_FILLFACTOR,100
106106
},
@@ -109,7 +109,7 @@ static relopt_int intRelOpts[] =
109109
"fillfactor",
110110
"Packs btree index pages only to this percentage",
111111
RELOPT_KIND_BTREE,
112-
AccessExclusiveLock
112+
ShareUpdateExclusiveLock/* since it applies only to later inserts */
113113
},
114114
BTREE_DEFAULT_FILLFACTOR,BTREE_MIN_FILLFACTOR,100
115115
},
@@ -118,7 +118,7 @@ static relopt_int intRelOpts[] =
118118
"fillfactor",
119119
"Packs hash index pages only to this percentage",
120120
RELOPT_KIND_HASH,
121-
AccessExclusiveLock
121+
ShareUpdateExclusiveLock/* since it applies only to later inserts */
122122
},
123123
HASH_DEFAULT_FILLFACTOR,HASH_MIN_FILLFACTOR,100
124124
},
@@ -127,7 +127,7 @@ static relopt_int intRelOpts[] =
127127
"fillfactor",
128128
"Packs gist index pages only to this percentage",
129129
RELOPT_KIND_GIST,
130-
AccessExclusiveLock
130+
ShareUpdateExclusiveLock/* since it applies only to later inserts */
131131
},
132132
GIST_DEFAULT_FILLFACTOR,GIST_MIN_FILLFACTOR,100
133133
},
@@ -136,7 +136,7 @@ static relopt_int intRelOpts[] =
136136
"fillfactor",
137137
"Packs spgist index pages only to this percentage",
138138
RELOPT_KIND_SPGIST,
139-
AccessExclusiveLock
139+
ShareUpdateExclusiveLock/* since it applies only to later inserts */
140140
},
141141
SPGIST_DEFAULT_FILLFACTOR,SPGIST_MIN_FILLFACTOR,100
142142
},

‎src/test/regress/expected/alter_table.out

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2065,19 +2065,19 @@ select * from my_locks order by 1;
20652065
commit;
20662066
begin; alter table alterlock set (fillfactor = 100);
20672067
select * from my_locks order by 1;
2068-
relname | max_lockmode
2069-
-----------+---------------------
2070-
alterlock |AccessExclusiveLock
2071-
pg_toast |AccessExclusiveLock
2068+
relname |max_lockmode
2069+
-----------+--------------------------
2070+
alterlock |ShareUpdateExclusiveLock
2071+
pg_toast |ShareUpdateExclusiveLock
20722072
(2 rows)
20732073

20742074
commit;
20752075
begin; alter table alterlock reset (fillfactor);
20762076
select * from my_locks order by 1;
2077-
relname | max_lockmode
2078-
-----------+---------------------
2079-
alterlock |AccessExclusiveLock
2080-
pg_toast |AccessExclusiveLock
2077+
relname |max_lockmode
2078+
-----------+--------------------------
2079+
alterlock |ShareUpdateExclusiveLock
2080+
pg_toast |ShareUpdateExclusiveLock
20812081
(2 rows)
20822082

20832083
commit;
@@ -2110,10 +2110,10 @@ rollback;
21102110
-- test that mixing options with different lock levels works as expected
21112111
begin; alter table alterlock set (autovacuum_enabled = off, fillfactor = 80);
21122112
select * from my_locks order by 1;
2113-
relname | max_lockmode
2114-
-----------+---------------------
2115-
alterlock |AccessExclusiveLock
2116-
pg_toast |AccessExclusiveLock
2113+
relname |max_lockmode
2114+
-----------+--------------------------
2115+
alterlock |ShareUpdateExclusiveLock
2116+
pg_toast |ShareUpdateExclusiveLock
21172117
(2 rows)
21182118

21192119
commit;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp