Optimizer should use index when comparing with user-defined variables #52742
Labels
affects-8.5
This bug affects the 8.5.x(LTS) versions.
sig/planner
SIG: Planner
type/enhancement
The issue or PR belongs to an enhancement.
Bug Report
Please answer these questions before submitting your issue. Thanks!
When I set user-defined variables in the
WHERE
clause, the optimizer doesn't use the index. Current behavior is different from MySQL.1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
The
EXPLAIN
should output the plan using the index on thedt
column, as same as using literal values.3. What did you see instead (Required)
4. What is your TiDB version? (Required)
The text was updated successfully, but these errors were encountered: