You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there an existing issue for the same feature request?
I have checked the existing issues.
Is your feature request related to a problem?
prepare st from 'select * from t where i = ?';
set @a = 42;
execute st using @a; // runs fine
mysql> explain execute st using @a;
ERROR 1064 (HY000): SQL parser error: You have an error in your SQL syntax; check the manual that corresponds to your MatrixOne server version for the right syntax to use. syntax error at line 1 column 25 near " using @a";
mysql>
Describe the feature you'd like
explain execute st using @A;
should print explain plan
Describe implementation you've considered
No response
Documentation, Adoption, Use Case, Migration Strategy
prepare st1 from'select * from test.t2 where a = ? and b = ?';
set @a =1, @b=1;
execute st1 using @a,@b;
explain force execute st1 using @a,@b;
explain verbose force execute st1 using @a,@b;
explain analyze force execute st1 using @a,@b;
explain analyze verbose force execute st1 using @a,@b;
//. ===
prepare st2 from'select * from test.t2 where a = 1 and b = 1';
execute st2;
explain force execute st2;
explain verbose force execute st2;
explain analyze force execute st2;
explain analyze verbose force execute st2;
Activity
[-][Feature Request]: explain an prepared statement[/-][+][Feature Request]: explain prepared statement[/+]daviszhen commentedon Feb 19, 2024
explain 能看 execute 的plan。之前没有。
explain碰到execute的plan时,会将plan替换为prepare生成的plan 并替换其中的参数,最后显示出来。
语法:
explain force execute ...;
explain verbose force execute ...;
explain analyze force execute ...;
explain analyze verbose force execute ...;
加force关键字,是因为要与mysql兼容。mysql是不支持对execute进行explain的。
在实现过程中,碰到
explain execute语法冲突的问题。一种解决冲突的办法是将execute 改为保留关键字。
一种是在execute前面区分用的保留关键字force。
为了与mysql保持兼容,execute没有改为保留关键字。最终选择了方案2。
支持下面的形式:
Ariznawlll commentedon Mar 12, 2024
test done.