Help with explain query and code 1003
I have the following query which is showing up as a slow query (it appears to get slower the more items I have in the system):
mysql> explain extended SELECT COUNT(*) FROM wp_term_relationships, wp_posts WHERE wp_posts.ID = wp_term_relationships.object_id AND post_status = 'publish' AND post_type = 'post' AND term_taxonomy_id = 1;
+----+-------------+-----------------------+--------+--------------------------------------+------------------+---------+--------------------------------------+------+----------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+-----------------------+--------+--------------------------------------+------------------+---------+--------------------------------------+------+----------+-------------+
| 1 | SIMPLE | wp_term_relationships | ref | PRIMARY,term_taxonomy_id | term_taxonomy_id | 8 | const | 9190 | 100.00 | Using index |
| 1 | SIMPLE | wp_posts | eq_ref | PRIMARY,type_status_date,post_status | PRIMARY | 8 | dcwp.wp_term_relationships.object_id | 1 | 100.00 | Using where |
+----+-------------+-----------------------+--------+--------------------------------------+------------------+---------+--------------------------------------+------+----------+-------------+
2 rows in set, 1 warning (0.00 sec)
mysql> show warnings;
+-------+------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Level | Code | Message |
+-------+------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Note | 1003 | select count(0) AS `COUNT(*)` from `dcwp`.`wp_term_relationships` join `dcwp`.`wp_posts` where ((`dcwp`.`wp_term_relationships`.`term_taxonomy_id` = 1) and (`dcwp`.`wp_posts`.`ID` = `dcwp`.`wp_term_relationships`.`object_id`) and (`dcwp`.`wp_posts`.`post_status` = 'publish') and (`dcwp`.`wp_posts`.`post_type` = 'post')) |
+-------+------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
Here is the output from running the query:
mysql> SELECT COUNT(*) FROM wp_term_relationships, wp_posts WHERE wp_posts.ID = wp_term_relationships.object_id AND post_status = 'publish' AND post_type = 'post' AND term_taxonomy_id = 1;
+----------+
| COUNT(*) |
+----------+
| 18000 |
+----------+
1 row in set (0.11 sec)
I don't understand what the 1003 means or what I should do to try to speed this up. Does anyone have any suggestions?
Thanks
Subject
Views
Written By
Posted
Help with explain query and code 1003
42204
May 29, 2009 07:05AM
20078
May 29, 2009 10:57AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.