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

Commit06c4f3a

Browse files
committed
doc: Improve explanations when a table rewrite is needed
Further improvement for commit11bd831. That commit confusedidentity and generated columns; fix that. Also, virtual generatedcolumns have since been added; add more details about that. Also somesmall rewordings and reformattings to further improve clarity.Reviewed-by: Robert Treat <rob@xzilla.net>Discussion:https://postgr.es/m/00e6eb5f5c793b8ef722252c7a519c9a@oss.nttdata.com
1 parent9d924db commit06c4f3a

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

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

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,22 +1436,31 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
14361436

14371437
<para>
14381438
Adding a column with a volatile <literal>DEFAULT</literal>
1439-
(e.g., <function>clock_timestamp()</function>), a generated column
1440-
(e.g., <literal>GENERATED BY DEFAULT AS IDENTITY</literal>), a domain
1441-
data type with constraints will require the entire table and its
1442-
indexes to be rewritten, as will changing the type of an existing
1443-
column. As an exception, when changing the type of an existing column,
1439+
(e.g., <function>clock_timestamp()</function>), a stored generated column,
1440+
an identity column, or a column with a domain data type that has
1441+
constraints will cause the entire table and its indexes to be rewritten.
1442+
Adding a virtual generated column never requires a rewrite.
1443+
</para>
1444+
1445+
<para>
1446+
Changing the type of an existing column will normally cause the entire table
1447+
and its indexes to be rewritten.
1448+
As an exception, when changing the type of an existing column,
14441449
if the <literal>USING</literal> clause does not change the column
14451450
contents and the old type is either binary coercible to the new type
14461451
or an unconstrained domain over the new type, a table rewrite is not
1447-
needed. However, indexesmust always be rebuilt unless the system
1452+
needed. However, indexeswill still be rebuilt unless the system
14481453
can verify that the new index would be logically equivalent to the
14491454
existing one. For example, if the collation for a column has been
14501455
changed, an index rebuild is required because the new sort
14511456
order might be different. However, in the absence of a collation
14521457
change, a column can be changed from <type>text</type> to
14531458
<type>varchar</type> (or vice versa) without rebuilding the indexes
1454-
because these data types sort identically. Table and/or index
1459+
because these data types sort identically.
1460+
</para>
1461+
1462+
<para>
1463+
Table and/or index
14551464
rebuilds may take a significant amount of time for a large table,
14561465
and will temporarily require as much as double the disk space.
14571466
</para>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp