mariadb - EXPLAIN works but ANALYZE throws ERROR 1064 (42000) error in SQL syntax I want to see the execution plan of a query to find out why it is slow, but ANALYZE does not seem to work, it throws an error on the same query that EXPLAIN accepts.

MariaDB [dbx]&gt; explain select `id` from `pics` where `user_id` = '3';
+------+-------------+-------+------+---------------+---------+---------+-------+------+-------+
| id   | select_type | table | type | possible_keys | key     | key_len | ref   | rows | Extra |
+------+-------------+-------+------+---------------+---------+---------+-------+------+-------+
|    1 | SIMPLE      | pics  | ref  | user_id       | user_id | 4       | const | 1087 |       |
+------+-------------+-------+------+---------------+---------+---------+-------+------+-------+
1 row in set (0.00 sec)

MariaDB [dbx]&gt; analyze select `id` from `pics` where `user_id` = '3';
ERROR 1064 (42000): 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 'select `id` from `pics` where `user_id` = '3'' at line 1


I use mysql  Ver 15.1 Distrib 10.0.14-MariaDB, for Linux (x86_64) using readline 5.1
EXPLAIN will get the execution plan for a query

ANALYZE TABLE recalculates the index statistics. So just run 

ANALYZE TABLE `pics`;


Give it a Try !!!