public
Created

SQL Query

  • Download Gist
one.sql
SQL
1 2 3 4 5 6 7 8
mysql> explain SELECT SQL_CALC_FOUND_ROWS wp_posts.post_title FROM wp_posts INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) WHERE 1=1 AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') AND ( (wp_postmeta.meta_key = 'my-field' AND CONVERT(wp_postmeta.meta_value, CHAR) = 'some value') ) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 10;
+----+-------------+-------------+--------+---------------------------------+----------+---------+---------------------------+------+----------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------------+--------+---------------------------------+----------+---------+---------------------------+------+----------------------------------------------+
| 1 | SIMPLE | wp_postmeta | ref | post_id,meta_key,meta_key_value | meta_key | 768 | const | 3 | Using where; Using temporary; Using filesort |
| 1 | SIMPLE | wp_posts | eq_ref | PRIMARY,type_status_date | PRIMARY | 8 | wp_32.wp_postmeta.post_id | 1 | Using where |
+----+-------------+-------------+--------+---------------------------------+----------+---------+---------------------------+------+----------------------------------------------+
2 rows in set (0.00 sec)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.