Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

re-order diff output: Create new INDEX and FOREIGN KEYS immediately after the TABLE #70

Open
nielm opened this issue Jan 29, 2024 · 0 comments

Comments

@nielm
Copy link
Collaborator

nielm commented Jan 29, 2024

In the [Spanner update Schema docs](https://cloud.google.com/spanner/docs/schema-updates#large-updates:

It's best practice to create the indexes immediately following the table in the list of DDL statements.

The reason for this is that if any other statements occur between the creation of a table and an index referencing that table, the index creation becomes a more complex operation requiring backfill, and cannot be batched with other statements.

The same applies to foreign key creation -- as the creation of a foreign key requires a backing index on the referencing columns

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant