Add Column to CloudSQL Postgres 9.6

97 views
Skip to first unread message

Greg Rychlewski

unread,
Jun 5, 2020, 8:01:06 AM6/5/20
to Google Cloud SQL discuss
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.

Elliott (Google Cloud Platform Support)

unread,
Jun 9, 2020, 12:17:25 PM6/9/20
to Google Cloud SQL discuss
Hello Greg,

The Postgres in Cloud SQL should behave the same way as I could not find any public documentation that would indicate otherwise.

I hope this helps.

Reply all
Reply to author
Forward
0 new messages