暂无图片
创建outline不生效
我来答
分享
暂无图片 匿名用户
创建outline不生效

【 使用环境 】测试环境
【 OB or 其他组件 】observer
【 使用版本 】企业版3.2.3/社区版3.1.3
创建outline一直不生效

有张表大概20000条数据,table 名test_otl, 字段(id int,name varchar(20))
创建了索引 idx_id(id)

select id from test_otl where id =1 这样现在是会走索引的,
我想测试让它走全表扫描,
select/*+FULL(test_otl)*/ id from test_otl where id =1;
使用explain select/*+FULL(test_otl)*/ id from test_otl where id =1; #查看确实走了全表扫描

创建outline
create outline otl_test on select/*+FULL(test_otl)*/ id from test_otl where id =1;

这样创建完成以后,按理说每次查询我都直接走全表扫描了,可是为啥还是走索引呢??? 命名空格啥的我都注意了啊

我来答
添加附件
收藏
分享
问题补充
1条回答
默认
最新
O
OceanBase社区传送门

outline 建好后,实际sql 要跑一次。然后去查看 实际执行计划。不是看 EXPLAIN 结果。
类似下面,查看这个视图。

mysql> SELECT plan_depth, plan_line_id, operator,name,ROWS,cost 
    -> FROM oceanbase.GV$OB_PLAN_CACHE_PLAN_EXPLAIN 
    -> WHERE tenant_id=effective_tenant_id() AND  svr_ip = '10.0.0.66' AND svr_port=2882 AND plan_id=190;
+------------+--------------+------------------------+--------------+------+------+
| plan_depth | plan_line_id | operator               | name         | ROWS | cost |
+------------+--------------+------------------------+--------------+------+------+
|          0 |            0 | PHY_NESTED_LOOP_JOIN   | NULL         |    2 |  172 |
|          1 |            1 |  PHY_SUBPLAN_SCAN      | NULL         |    1 |  154 |
|          2 |            2 |   PHY_SCALAR_AGGREGATE | NULL         |    1 |  154 |
|          3 |            3 |    PHY_SUBPLAN_SCAN    | NULL         |    1 |  154 |
|          4 |            4 |     PHY_TABLE_SCAN     | bmsql_oorder |    1 |  154 |
|          1 |            5 |  PHY_TABLE_SCAN        | bmsql_oorder |    1 |   17 |
+------------+--------------+------------------------+--------------+------+------+
6 rows in set (0.05 sec)
暂无图片 评论
暂无图片 有用 0
回答交流
提交
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
暂无图片墨值悬赏