What is the meaning of Select tables optimized away
in MySQL Explain plan?
explain select count(comment_count) from wp_posts;
+----+-------------+---------------------------+-----------------------------+
| id | select_type | table,type,possible_keys, | Extra |
| | | key,key_len,ref,rows | |
+----+-------------+---------------------------+-----------------------------+
| 1 | SIMPLE | all NULLs | Select tables optimized away|
+----+-------------+---------------------------+-----------------------------+
1 row in set (0.00 sec)
Note: explain plan
output edited for legibility.
From the MySQL documentation:
The query contained only aggregate functions (MIN(), MAX()) that were all resolved using an index, or COUNT(*) for MyISAM, and no GROUP BY clause. The optimizer determined that only one row should be returned.
Basically this means your query uses data that is directly available to MySQL and the query will run in constant time.