【 使用环境 】测试环境
【 OB or 其他组件 】
【 使用版本 】3.2.4
【问题描述】
https://www.oceanbase.com/docs/enterprise-oceanbase-database-cn-10000000000945967
MySQL [test]> CREATE TABLE t1(a INT, b INT, c INT, d INT, e INT, INDEX IDX_a(a),
-> INDEX IDX_b(b));
Query OK, 0 rows affected (0.20 sec)
MySQL [test]> EXPLAIN SELECT/*+NO_REWRITE()*/ * FROM t1 WHERE t1.a = 1 OR t1.b = 1;
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Query Plan |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ===================================================
|ID|OPERATOR |NAME |EST. ROWS|COST |
---------------------------------------------------
|0 |EXCHANGE IN REMOTE | |1485 |35144|
|1 | EXCHANGE OUT REMOTE| |1485 |34868|
|2 | UNION ALL | |1485 |34868|
|3 | TABLE SCAN |t1(IDX_a)|990 |17417|
|4 | TABLE SCAN |t1(IDX_b)|495 |17429|
===================================================
Outputs & filters:
-------------------------------------
0 - output([UNION([1])], [UNION([2])], [UNION([3])], [UNION([4])], [UNION([5])]), filter(nil)
1 - output([UNION([1])], [UNION([2])], [UNION([3])], [UNION([4])], [UNION([5])]), filter(nil)
2 - output([UNION([1])], [UNION([2])], [UNION([3])], [UNION([4])], [UNION([5])]), filter(nil)
3 - output([t1.a], [t1.b], [t1.c], [t1.d], [t1.e]), filter(nil),
access([t1.a], [t1.b], [t1.c], [t1.d], [t1.e]), partitions(p0)
4 - output([t1.a], [t1.b], [t1.c], [t1.d], [t1.e]), filter([lnnvl(cast(t1.a = 1, TINYINT(-1, 0)))]),
access([t1.a], [t1.b], [t1.c], [t1.d], [t1.e]), partitions(p0)
|
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.02 sec)
MySQL [test]> EXPLAIN SELECT * FROM t1 WHERE t1.a = 1 OR t1.b = 1;
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Query Plan |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ===================================================
|ID|OPERATOR |NAME |EST. ROWS|COST |
---------------------------------------------------
|0 |EXCHANGE IN REMOTE | |1485 |35144|
|1 | EXCHANGE OUT REMOTE| |1485 |34868|
|2 | UNION ALL | |1485 |34868|
|3 | TABLE SCAN |t1(IDX_a)|990 |17417|
|4 | TABLE SCAN |t1(IDX_b)|495 |17429|
===================================================
Outputs & filters:
-------------------------------------
0 - output([UNION([1])], [UNION([2])], [UNION([3])], [UNION([4])], [UNION([5])]), filter(nil)
1 - output([UNION([1])], [UNION([2])], [UNION([3])], [UNION([4])], [UNION([5])]), filter(nil)
2 - output([UNION([1])], [UNION([2])], [UNION([3])], [UNION([4])], [UNION([5])]), filter(nil)
3 - output([t1.a], [t1.b], [t1.c], [t1.d], [t1.e]), filter(nil),
access([t1.a], [t1.b], [t1.c], [t1.d], [t1.e]), partitions(p0)
4 - output([t1.a], [t1.b], [t1.c], [t1.d], [t1.e]), filter([lnnvl(cast(t1.a = 1, TINYINT(-1, 0)))]),
access([t1.a], [t1.b], [t1.c], [t1.d], [t1.e]), partitions(p0)
|
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.02 sec)
【复现路径】问题出现前后相关操作
【附件及日志】推荐使用OceanBase敏捷诊断工具obdiag收集诊断信息,详情参见链接(右键跳转查看):