cockroachdb / cockroachdb/cockroach

opt, sql: support PlanGram matching in the right side of apply joins at execution time

Open
#172,276 0 comments 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

The right side of correlated joins are initially optimized with the main query, and can be influenced by PlanGram matching. But if the join is not decorrelated and stays an apply join, then at execution time we re-optimize the right side for each joined row. This optimization is done without the PlanGram, even if there was a PlanGram applied during initial optimization.

We should plumb the PlanGram into `ApplyJoinPlanRightSideFn` so that we perform PlanGram matching during execution time, too.

Jira issue: CRDB-65488

Epic: CRDB-66266

Contributor guide

Open the contributing guide

Research direction

Start at ApplyJoinPlanRightSideFn and trace how the PlanGram is available during initial optimization of correlated joins. Confirm the execution-time re-optimization path and make sure PlanGram matching also occurs there; done means an apply join's right side can use the same PlanGram during execution.

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
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.