pingcap / tidb

TiDB is an open-source, cloud-native, distributed, MySQL-Compatible database for elastic scale and real-time analytics. Try AI-powered Chat2Query free at : https://www.pingcap.com/tidb-serverless/
https://pingcap.com
Apache License 2.0
36.88k stars 5.8k forks source link

Feature Request: Richer SQL Hints #12304

Closed zz-jason closed 4 years ago

zz-jason commented 4 years ago

Feature Request

Is your feature request related to a problem? Please describe:

The supported SQL Hints are not enough to control the behavior of TiDB SQL Optimizer. We need hints to:

Describe the feature you'd like:

A richer sql hint set:

Hint Name Priority Status PR
HASH_AGG P1 Completed https://github.com/pingcap/tidb/pull/11364
STREAM_AGG P1 Completed https://github.com/pingcap/tidb/pull/11364
USE_INDEX P1 Completed https://github.com/pingcap/tidb/pull/11746
IGNORE_INDEX P1 Completed https://github.com/pingcap/tidb/pull/12059
AGG_TO_COP P1 Completed https://github.com/pingcap/tidb/pull/12043
READ_FROM_STORAGE P1 Completed https://github.com/pingcap/tidb/pull/12479
READ_FROM_REPLICA P1 Completed https://github.com/pingcap/tidb/pull/11809
USE_INDEX_MERGE P1 Completed #12843
NO_INDEX_MERGE P1 Completed https://github.com/pingcap/tidb/pull/11809
USE_TOJA P1 Completed https://github.com/pingcap/tidb/pull/11809
MEMORY_QUOTA P1 Completed https://github.com/pingcap/tidb/pull/11809
QUERY_BLOCK P1 Completed https://github.com/pingcap/tidb/pull/11861
ENABLE_PLAN_CACHE P2
QUERY_TYPE P2
INL_JOIN P3 Completed https://github.com/pingcap/tidb/pull/11673
BNL_JOIN P3
HASH_JOIN P3 Completed https://github.com/pingcap/tidb/pull/11673
SM_JOIN P3 Completed https://github.com/pingcap/tidb/pull/11673
USE_PLAN_CACHE P4

Describe alternatives you've considered:

N/A

Teachability, Documentation, Adoption, Migration Strategy:

N/A

foreyes commented 4 years ago

Status updated.

zz-jason commented 4 years ago

All the P1 hints are added, I think we can close this issue. Once we need the P2 or P3 Hints, we can create a new issue to trace the progress. How do you think? @eurekaka