[英]Why mysql explain analyze is not working?
Besides having mariadb 10.1.36-MariaDB I get following error.除了拥有 mariadb 10.1.36-MariaDB 之外,我还收到以下错误。
EXPLAIN ANALYZE select 1
MySQL said: Documentation
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ANALYZE select 1' at line 1
What additional I need to do here.我还需要在这里做什么。 My PHP version is 7.2.11.我的PHP版本是7.2.11。
As you can see in the docs https://mariadb.com/kb/en/explain-analyze/正如您在文档中看到的https://mariadb.com/kb/en/explain-analyze/
The syntax for the
EXPLAIN ANALYZE
feature was changed toANALYZE
statement, available since MariaDB 10.1.0.EXPLAIN ANALYZE
功能的语法已更改为ANALYZE
语句,自 MariaDB 10.1.0 起可用。 SeeANALYZE
statement .请参阅ANALYZE
语句。
So just use ANALYZE ...
without the explain keyword and you'll get the same output you got in the past.所以只需使用ANALYZE ...
没有解释关键字,您将获得与过去相同的输出。
In the analyze docs you have the info for the ANALYZE
statement, you can see it's the same that the deprecated EXPLAIN ANALYZE
.在分析文档中,您有ANALYZE
语句的信息,您可以看到它与已弃用的EXPLAIN ANALYZE
相同。
The
ANALYZE
statement is similar to theEXPLAIN
statement.ANALYZE
语句类似于EXPLAIN
语句。ANALYZE
statement will invoke the optimizer, execute the statement, and then produceEXPLAIN
output instead of the result set.ANALYZE
语句将调用优化器,执行该语句,然后生成EXPLAIN
输出而不是结果集。 TheEXPLAIN
output will be annotated with statistics from statement execution.EXPLAIN
输出将使用语句执行的统计信息进行注释。The syntax is语法是
ANALYZE explainable_statement;
where the statement is any statement for which one can run EXPLAIN.其中语句是可以运行 EXPLAIN 的任何语句。
This is a bug in mysql older versions(5), can be resolved by upgrading to mysql version 8. see official discussion https://bugs.mysql.com/bug.php?id=97416这是mysql老版本的bug(5),升级到mysql版本8可以解决。看官方讨论https://bugs.mysql.com/bug.php?id=97416
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.