cockroachdb / cockroachdb/cockroach

Favor query plans with a home region using enforced properties for enforce_home_region

Open
#108,288 0 comments 0 reactions 0 assignees View on GitHub
C-enhancement T-sql-queries
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

This issue is opened to investigate an idea from @DrewKimball mentioned during review of #106334.
Currently the `enforce_home_region` session setting will use adjusted distribution costs (see `LargeDistributeCostWithHomeRegion`) when the setting is enabled to adjust the cost of Scan and LookupJoin expressions.

An alternative approach could be to create a new property enforcer to restrict query plans to not be able to choose joins and scans without a home region. This would essentially move home region checking out of the execbuilder and push it to optimization time. If we are unable to find a query plan for a query during exploration, we would error out and report the query has no home region. One challenge may be, how to provide a proper hint to the user on how to adjust their query to make it satisfy the home region restriction. Currently, it is the inspection of the built memo that allows us to do that.

Jira issue: CRDB-30412

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.