示例。
实际
gv$plan_cache_plan_stat中存在 null 值。obclient [mysql]> select length(sql_id) a,plan_id from gv$plan_cache_plan_stat order by a limit 5;输出结果如下:
+---+---------+ | a | plan_id | +---+---------+ | NULL | 203 | | NULL | 200 | | NULL | 201 | | NULL | 190 | | NULL | 199 | +---+---------+ 5 rows in set (0.01 sec)使用 sql_id is null 和 sql_id='NULL' 都无法过滤出结果。
obclient [mysql]> select sql_id,plan_id from gv$plan_cache_plan_stat where sql_id is null; Empty set (0.00 sec) obclient [mysql]> select sql_id,plan_id from gv$plan_cache_plan_stat where sql_id='NULL'; Empty set (0.01 sec)
适用版本
OceanBase 数据库 V3.2.4 BP8(oceanbase-3.2.4.8-108000142024041520)之前版本。