Comprehensive SQL hints coverage
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Summary
This ticket will be served as an umbrella feature request to track all the small items.
Today, the coverage of hints in TiDB is not sufficient as they cannot uniquely express a specific query plan. Therefore, in the following scenarios, we are helpless and can only hope for the best:
* For a new query, if the TiDB planner is unable to find an optimal plan, is there a way to guide or force TiDB to select the optimal query plan?
* Once a performance regression occurs due to changes in the query plan, how can we quickly mitigate the situation?
By comparing with Oracle and MySQL hints, we have identified several categories of hints that are missing in TiDB:
1. It can not enforce a certain join type, e.g. enforce nest-loop join
2. Beside the join type, it also can not enforce a particular operator, e.g. full table scan
3. Execution runtime hints, for example executor parallelism for a query plan
4. It can not exclude certain types of operators, d.g. disabling hash join
## Workstreams
Contributor guide
Assessment
This issue has not been assessed yet.