pgsql: Teach ALTER TABLE .. SET DATA TYPE to avoid some table rewrites.

Поиск
Список
Период
Сортировка
От Robert Haas
Тема pgsql: Teach ALTER TABLE .. SET DATA TYPE to avoid some table rewrites.
Дата
Msg-id E1PoFlG-0005Et-J1@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Teach ALTER TABLE .. SET DATA TYPE to avoid some table rewrites.

When the old type is binary coercible to the new type and the using
clause does not change the column contents, we can avoid a full table
rewrite, though any indexes on the affected columns will still need
to be rebuilt.  This applies, for example, when changing a varchar
column to be of type text.

The prior coding assumed that the set of operations that force a
rewrite is identical to the set of operations that must be propagated
to tables making use of the affected table's rowtype.  This is
no longer true: even though the tuples in those tables wouldn't
need to be modified, the data type change invalidate indexes built
using those composite type columns.  Indexes on the table we're
actually modifying can be invalidated too, of course, but the
existing machinery is sufficient to handle that case.

Along the way, add some debugging messages that make it possible
to understand what operations ALTER TABLE is actually performing
in these cases.

Noah Misch and Robert Haas

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/d31e2a495b6f2127afc31b4da2e5f4e89aa2cdfe

Modified Files
--------------
doc/src/sgml/ref/alter_table.sgml |   16 ++++---
src/backend/catalog/index.c       |    5 ++
src/backend/commands/tablecmds.c  |   90 ++++++++++++++++++++++++++++---------
3 files changed, 83 insertions(+), 28 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Clean up installation directory choices for extensions.
Следующее
От: Peter Eisentraut
Дата:
Сообщение: pgsql: DDL support for collations