cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
29.98k stars 3.79k forks source link

opt: close the gap between constraints and index constraints #32320

Open RaduBerinde opened 5 years ago

RaduBerinde commented 5 years ago

We have separate, similar logic for deriving constraints and index constraints. The index constraints code is more powerful and can deduce more FDs in various cases. This leads to logical property mismatch which can be problematic.

For example, if a constrain scan knows a column is constant but an IndexJoin on top of it does not (because it lives in the group that was created from a Select), it can cause problems with orderings (the Scan doesn't provide an ordering on the constant column).

We should move most of the smartness into the constraints library, and derive index constraints from the constraints (possibly with a limited set of additional checks that can be determined to not cause differences in logical properties).

Jira issue: CRDB-4754

github-actions[bot] commented 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 5 days to keep the issue queue tidy. Thank you for your contribution to CockroachDB!

github-actions[bot] commented 1 year 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!