diff options
author | Robert Haas <rhaas@postgresql.org> | 2022-04-01 08:48:44 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2022-04-01 08:48:44 -0400 |
commit | fa25bebb827a8cc4d62f15d564b0093f40b9d44d (patch) | |
tree | 6a11a1ef2566b65404c783e4580fed218def2601 | |
parent | af9e180495507a2b01f1bc31b7ea5125b8385903 (diff) | |
download | postgresql-fa25bebb827a8cc4d62f15d564b0093f40b9d44d.tar.gz postgresql-fa25bebb827a8cc4d62f15d564b0093f40b9d44d.zip |
docs: Changing column type doesn't always require an index rebuild.
James Coleman and Robert Haas, reviewed by Matthias van de Meent.
Discussion: https://postgr.es/m/CAAaqYe90Ea3RG=A7H-ONvTcx549-oQhp07BrHErwM=AyH2ximg@mail.gmail.com
-rw-r--r-- | doc/src/sgml/ref/alter_table.sgml | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml index 5c0735e08a8..e610cbbc0ec 100644 --- a/doc/src/sgml/ref/alter_table.sgml +++ b/doc/src/sgml/ref/alter_table.sgml @@ -1366,7 +1366,13 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM existing column, if the <literal>USING</literal> clause does not change the column contents and the old type is either binary coercible to the new type or an unconstrained domain over the new type, a table rewrite is not - needed; but any indexes on the affected columns must still be rebuilt. + needed. However, indexes must always be rebuilt unless the system can + verify that the new index would be logically equivalent to the existing + one. For example, if the collation for a column has been changed an index + rebuild is always required because the new sort order might be different. + However, in the absence of a collation change, a column can be changed + from <type>text</type> to <type>varchar</type> (or vice versa) without + rebuilding the indexes because these data types sort identically. Table and/or index rebuilds may take a significant amount of time for a large table; and will temporarily require as much as double the disk space. |