skip to Main Content

Besides having mariadb 10.1.36-MariaDB I get following error.

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.

2

Answers


  1. As you can see in the docs https://mariadb.com/kb/en/explain-analyze/

    The syntax for the EXPLAIN ANALYZE feature was changed to ANALYZE statement, available since MariaDB 10.1.0. See ANALYZE statement.

    So just use ANALYZE ... without the explain keyword and you’ll get the same output you got in the past.

    In the analyze docs you have the info for the ANALYZE statement, you can see it’s the same that the deprecated EXPLAIN ANALYZE.

    The ANALYZE statement is similar to the EXPLAIN statement. ANALYZE statement will invoke the optimizer, execute the statement, and then produce EXPLAIN output instead of the result set. The EXPLAIN output will be annotated with statistics from statement execution.

    The syntax is

    ANALYZE explainable_statement;

    where the statement is any statement for which one can run EXPLAIN.

    Login or Signup to reply.
  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search