pingcap / pingcap/tidb

planner: support TiFlash late materialization filter hint

Open
#70,186 0 comments 0 reactions 0 assignees View on GitHub
affects-8.5 sig/planner type/enhancement
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Enhancement

TiFlash late materialization currently relies on planner heuristics to decide which selection predicates should be pushed down as late materialization filters.

For some workloads, users need a query-level hint to explicitly control the filter columns used by TiFlash late materialization. This can help when the cost-based decision does not pick the desired filter split.

Proposed behavior:

- support a `TIFLASH_LM_FILTER(table_name, column_name[, ...])` optimizer hint;
- allow qualified query block syntax, for example `TIFLASH_LM_FILTER(@qb1 t, a, b)`;
- use the hinted columns to choose predicates eligible for TiFlash late materialization filter pushdown;
- keep predicates that do not fully match the hinted columns in the normal selection path;
- emit hint warnings when the hint is malformed or cannot match the target table/columns.

The feature should be implemented in the parser and planner hint handling, and should preserve existing cost-based late materialization behavior when the hint is absent.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the existing parser and planner hint-handling paths for optimizer hints and TiFlash late materialization. Check how qualified query blocks, table and column matching, predicate selection, and hint warnings are represented. Done means the TIFLASH_LM_FILTER forms and warnings behave as specified while queries without the hint retain existing cost-based behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.