Thursday, June 4, 2020

[google-cloud-sql-discuss] Add Column to CloudSQL Postgres 9.6

This is for CloudSQL based on Postgres 9.6.

When you add a new column (without a default) to an existing table, does CloudSQL update the entire table/all the indexes right away or does it only update metadata the way Postgres 9.6 does? I'm asking because I encountered a situation that would suggest it rewrites the table/indices right away.


When a column is added with ADD COLUMN, all existing rows in the table are initialized with the column's default value (NULL if no DEFAULT clause is specified). If there is no DEFAULT clause, this is merely a metadata change and does not require any immediate update of the table's data; the added NULL values are supplied on readout, instead.  

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/28a961eb-a0d4-4a1d-a6ee-7bb7913f459eo%40googlegroups.com.

No comments:

Post a Comment