sql 查询条件不转化

为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。

  • 【TiDB 版本】:v3.0.8
  • 【问题描述】:假设A表的a字段是varchar 。内有数据a = 1 。我这实现select * form A where a = 1 ;查询不到数据。(上述是我描述业务中的情况)

a字段是union key的情况下

explain select * from A where a = 1 看一下查询计划是什么样子?

然后对比一下用的什么查询确认内有数据 a = 1,也 explain 看下查询计划

用 select * from A where a = ‘1’ 查询的到 。explain select * from A where a = 1 与select * from A where a = ‘1’ 计划是一样的

本地测试是 OK 的,建议看下使用姿势对不对。

你A表a加个唯一索引就不行了。

可能是0/d+,这样的类型