Skip to main content
Update link, change to point to exact section of the docs, include quote about running ANALYZE
Source Link

The ALTER will automatically drop and rebuild the indexes (all indexes, not just on the column being altered). There is no point in micromanaging the process yourself, unless you want to build the indexes CONCURRENTLY or something like that, so that that part can be done outside the maintenance window.

Here is an extract from the docs for SET DATA TYPEthe docs for SET DATA TYPE:

This form changes the type of a column of a table. Indexes and simple table constraints involving the column will be automatically converted to use the new column type by reparsing the originally supplied expression.

[...]

When this form is used, the column's statistics are removed, so running ANALYZE on the table afterwards is recommended.

The ALTER will automatically drop and rebuild the indexes (all indexes, not just on the column being altered). There is no point in micromanaging the process yourself, unless you want to build the indexes CONCURRENTLY or something like that, so that that part can be done outside the maintenance window.

Here is an extract from the docs for SET DATA TYPE:

This form changes the type of a column of a table. Indexes and simple table constraints involving the column will be automatically converted to use the new column type by reparsing the originally supplied expression.

The ALTER will automatically drop and rebuild the indexes (all indexes, not just on the column being altered). There is no point in micromanaging the process yourself, unless you want to build the indexes CONCURRENTLY or something like that, so that that part can be done outside the maintenance window.

Here is an extract from the docs for SET DATA TYPE:

This form changes the type of a column of a table. Indexes and simple table constraints involving the column will be automatically converted to use the new column type by reparsing the originally supplied expression.

[...]

When this form is used, the column's statistics are removed, so running ANALYZE on the table afterwards is recommended.

The ALTER will automatically drop and rebuild the indexes (all indexes, not just on the column being altered). There is no point in micromanaging the process yourself, unless you want to build the indexes CONCURRENTLY or something like that, so that that part can be done outside the maintenance window.

Here is an extract from the docs for SET DATA TYPE:

This form changes the type of a column of a table. Indexes and simple table constraints involving the column will be automatically converted to use the new column type by reparsing the originally supplied expression.

The ALTER will automatically drop and rebuild the indexes (all indexes, not just on the column being altered). There is no point in micromanaging the process yourself, unless you want to build the indexes CONCURRENTLY or something like that, so that that part can be done outside the maintenance window.

The ALTER will automatically drop and rebuild the indexes (all indexes, not just on the column being altered). There is no point in micromanaging the process yourself, unless you want to build the indexes CONCURRENTLY or something like that, so that that part can be done outside the maintenance window.

Here is an extract from the docs for SET DATA TYPE:

This form changes the type of a column of a table. Indexes and simple table constraints involving the column will be automatically converted to use the new column type by reparsing the originally supplied expression.

Source Link
jjanes
  • 41.3k
  • 3
  • 40
  • 54

The ALTER will automatically drop and rebuild the indexes (all indexes, not just on the column being altered). There is no point in micromanaging the process yourself, unless you want to build the indexes CONCURRENTLY or something like that, so that that part can be done outside the maintenance window.