cockroachdb / cockroachdb/cockroach

opt: support more PlanGramMatchableFields

Open
#172,277 1 comment 0 reactions 0 assignees View on GitHub
A-plan-management A-statement-hint C-enhancement T-sql-queries
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

(Follow up from https://github.com/cockroachdb/cockroach/pull/170513 and https://github.com/cockroachdb/cockroach/pull/170556.)

PlanGrams currently only match on a few fields within expressions:
- `Table` / `LeftTable` / `RightTable`
- `Index` / `LeftIndex` / `RightIndex`
- `HasConstraint`
- `HasLimit`
- `JoinType`

There are other fields we could include that would make PlanGram matching more precise:
- sort order (list of columns)
- merge join order (list of columns)
- group by columns
- group by type
- distinct columns
- distinct type
- set op type
- autocommit
- eqColsAreKey

Jira issue: CRDB-65489

Contributor guide

Open the contributing guide

Research direction

Start by reading the two linked pull requests and tracing the existing PlanGram matching for Table, Index, HasConstraint, HasLimit, and JoinType. Compare those fields with the additional sort, grouping, distinct, set-operation, autocommit, and key-related fields listed here. Done means the selected additional fields participate in PlanGram matching with appropriate coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.