cockroachdb / cockroachdb/cockroach
sql/schemachanger: add optional syntax for ADD COLUMN to store new column in existing secondary indexes
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
Adding a new column when nullable is relatively cheap and only involves modifying the primary index to add a new storing column without *any* backfill. Unfortunately, there can be side effects for existing queries that use `SELECT *`, since they will now need to join between the primary and secondary index to resolve a row (i.e. finding columns not stored in the secondary index via the primary index).
One good alternative would be to add a new clause on ADD COLUMN so that indexes with STORING columns are all updated to include this column (or a user-selectable subset). This new syntax would update existing secondary indexes to add this new nullable column.
related: https://github.com/cockroachdb/cockroach/issues/98777
Jira issue: CRDB-31878
Epic CRDB-60817
Contributor guide
Assessment
This issue has not been assessed yet.