cockroachdb / cockroachdb/cockroach

sql: add a way to control index choice in post-queries

Open
#141,662 1 comment 0 reactions 0 assignees View on GitHub
C-enhancement O-postmortem P-3 T-sql-queries
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

We currently support index hints in the main query (as well as subqueries (?)), and it would be nice if we had a way to control the plan in the post-queries. For example, we might want to force usage of the PK in the FK check query.

The main difficulty will be coming up with the UX around this. One idea could be utilizing the external query plan hints that Drew has the prototype for; another way could be annotating the FK constraint itself in the schema somehow. This would have been useful as a workaround during [this](https://github.com/cockroachlabs/support/issues/3184) support ticket.

Jira issue: CRDB-47946

Contributor guide

Open the contributing guide

Research direction

No files or tests are named. Start by reviewing how index hints work in the main query and subqueries, then examine Drew's prototype for external query plan hints and the alternative of annotating FK constraints. Done means an agreed UX and implementation path for controlling index choice in post-queries, with validation for FK check queries.

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
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.