cockroachdb / cockroachdb/cockroach
sql: missing details from plan gists cause crdb_pin_plan_gist to be less precise
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
Plan gists intentionally do not capture every detail of a query plan, in order to be more stable across plan variations and optimizer versions. But there are some plan details that might be important for `information_schema.crdb_pin_plan_gist` to more precisely match optimizer plans.
Here are some plan details that are either missing from plan gists or are lost during the execbuild -> plan gist -> plan gram conversion:
- scalar expressions (which in turn would contain some subqueries)
- sort order (list of columns)
- merge join order (list of columns)
- group by columns
- group by type
- distinct columns
- distinct type
- set op type
- locality-optimized search vs plain UNION ALL is lost during decompilation
- LockOp vs lookup join is lost during decompilation
- placeholder scan vs regular scan is lost during decompilation
- FK checks and unique checks exist in the plan gist but are lost during decompilation
(We also need to add some of these details to PlanGrams: see https://github.com/cockroachdb/cockroach/issues/172172 and https://github.com/cockroachdb/cockroach/issues/172277.)
Jira issue: CRDB-65490
Contributor guide
Research direction
Start by tracing information_schema.crdb_pin_plan_gist through the execbuild → plan gist → plan gram conversion, focusing on the listed missing or lost details. Review related PlanGrams work in issues 172172 and 172277; done means the relevant plan details are preserved so pinning matches optimizer plans more precisely.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, sql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100