Open mgartner opened 3 years ago
We have marked this issue as stale because it has been inactive for 18 months. If this issue is still relevant, removing the stale label or adding a comment will keep it active. Otherwise, we'll close it in 10 days to keep the issue queue tidy. Thank you for your contribution to CockroachDB!
When a unique constraint is added to a
REGIONAL BY ROW
table, a validation query is run to ensure that the columns are indeed unique. This query normally uses the memory efficient streaming group-by operator rather than a more costly hash-based group-by operator.For example:
However, when a virtual computed column is included in the unique constraint the streaming group-by is not planned, making the validation of the constraint costly. Because expression indexes are built using virtual columns, validation queries of unique expression indexes will also be inefficient.
The optimizer should plan a streaming group by in this case.
Jira issue: CRDB-8911