outline问题

ob:4.3.0.1


mysql> create outline ol_1 on select/*+max_concurrent(0)*/ * from t1 where b =1 and c = 1;
Query OK, 0 rows affected (0.10 sec)

mysql>  select * from t1 where b =1 and c = 1;
ERROR 5268 (HY000): SQL reach max concurrent num 0
mysql>  select * from t1 where b =1 and c = 2;
Empty set (0.00 sec)
mysql>  create outline ol_2 on select/*+max_concurrent(0)*/ * from t1 where b =1 and c = ?;
ERROR 5264 (HY000): Outline 'select/*+max_concurrent(0)*/ * from t1 where b =1 and c = ?' already exists
mysql> 
mysql>  create outline ol_2 on select/*+max_concurrent(0)*/ * from t1 where b =1 and c = ?;
ERROR 5264 (HY000): Outline 'select/*+max_concurrent(0)*/ * from t1 where b =1 and c = ?' already exists
mysql> 
mysql> select * from t1 where b =1 and c = 1;
ERROR 5268 (HY000): SQL reach max concurrent num 0
mysql> select * from t1 where b =1 and c = 2;
Empty set (0.00 sec)

这是官方的3.x文档上的demo演示,4.3就不可以。

试下4.3版本得语句呢 CREATE OUTLINE

image

如何有效使用 outline 功能?

为了防止某些 SQL 的执行计划发生变化,我们通常会创建 outline 来绑定执行计划。但是为什么实际过程中,我们创建 outline 并验证时总会遇到不生效的情况?

阅读本文你将了解:

  1. 如何获取 SQL ID
  2. 如何创建 outline
  3. 如何正确验证 outline 效果