本文内容来自YashanDB官网,原文内容请见 https://www.yashandb.com/newsinfo/7802967.html?templateId=1718516
问题现象
使用leading hint调整SQL执行计划后,执行SQL时,报错:YAS-04522 invalid hint leading
问题的风险及影响
SQL语句无法正常执行
问题影响的版本
所有的YashanDB版本
问题发生原因
YashanDB优化器的Bug
解决方法及规避方式
规避方式:不使用leading hint
问题分析和处理过程
使用如下SQL语句验证当前版本YashanDB是否存在此问题:
drop table a;
drop table b;
drop table c;
create table a(tid number,tname varchar2(30));
create table b(tid number,tname varchar2(30));
create table c(tid number,tname varchar2(30));
select /\*+ leading(c) \*/ distinct a.tid
from a
left join b
on a.tid = b.tid
left join c
on b.tid = c.tid
where a.tname is not null;
AI 代码解读