What are best practices around adding new columns to tables? How do people usually do this since non-NULL defaults aren't allowed?
答案 0 :(得分:0)
There are a few steps:
attr
constraint, you can do it (assuming you've
actually populated every row). If you have other processes that are
adding rows in parallel, then those processes will need to be
updated to also populate your new column, else you'll be playing a
never-ending game of catch-up. Note that, when a WriteAttr
constraint is added, cloud spanner initiates a background process to
validate your data (i.e. checks that all cells are not null) before
actually finalizing the schema change. More info on data validation
is here.More info is here.