开发者

SQL Syntax error in EXPLAIN

I'm trying to get an explain command to work in mysql. I am trying to troubleshoot the performance of this delete query:

DELETE FROM boost_cache_relationships
WHERE base_dir = 'cache/normal/www.dane101.com'
    AND page_callback = 'node'
    AND 开发者_JAVA百科page_type = 'story'
    AND page_id = '2891';

This query is the output from a SHOW FULL PROCESSLIST command.

I understand that EXPLAIN does not work with delete so I copied it and replaced DELETE with SELECT to give the following:

explain select
FROM boost_cache_relationships
WHERE base_dir = 'cache/normal/www.dane101.com'
    AND page_callback = 'node'
    AND page_type = 'story'
    AND page_id = '2891';

When I hit enter, mysql gives me an error message that this is invalid SQL:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM boost_cache_relationships WHERE base_dir = 'cache/normal/www.dane101.com' A' at line 1

What am I doing wrong?


You need to specify a field list:

select * FROM boost_cache_relationships WHERE base_dir = 'cache/normal/www.dane101.com' AND page_callback = 'node' AND page_type = 'story' AND page_id = '2891';


A select query needs column names to select. A delete query doesn't.

SELECT *
FROM boost_cache_relationships 
WHERE base_dir = 'cache/normal/www.dane101.com' 
AND page_callback = 'node' 
AND page_type = 'story' 
AND page_id = '2891';


In your select try to select some columns:

SELECT *...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜