cockroachdb / cockroachdb/cockroach
opt: randomized optimizer quality test
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
While discussing #64570, we had an idea for a way to randomly test the optimizer's decision making. It is based around the _rough_ heuristic that the optimizer should use a unique index when the columns in the unique index are held constant by the query.
The test could:
1. Setup a random table and indexes, with at least 1 unique index (ideally not the primary index because we have fast-paths the specifically target that index).
2. Insert random data.
3. Collect stats.
4. Run EXPLAIN on a query that holds the columns of a unique index constant.
5. If the unique index is not used, fail the test and collect a statement bundle as an artifact for debugging.
Jira issue: CRDB-25118
Contributor guide
Assessment
This issue has not been assessed yet.