Created
March 10, 2017 21:28
-
-
Save goldenapples/749994fba1f5ea8a0fbe5ff0bf6054fb to your computer and use it in GitHub Desktop.
Comparison of SQL query performance before and after change
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql> SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts LEFT JOIN wp_postmeta AS sq1 ON ( wp_posts.ID = sq1.post_id AND sq1.meta_key = '_wp_attached_file' ) WHERE 1=1 AND (((wp_posts.post_title LIKE '%AAPL%') OR (wp_posts.post_excerpt LIKE '%AAPL%') OR (wp_posts.post_content LIKE '%AAPL%') OR ( sq1.meta_value LIKE '%AAPL%' ))) AND wp_posts.post_type = 'attachment' AND ((wp_posts.post_status = 'inherit' OR wp_posts.post_status = 'private')) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 40; | |
+--------+ | |
| ID | | |
+--------+ | |
| 844868 | | |
| 844279 | | |
| 843458 | | |
| 840260 | | |
| 839870 | | |
| 837818 | | |
| 836996 | | |
| 836995 | | |
| 836636 | | |
| 836011 | | |
| 835988 | | |
| 835984 | | |
| 835970 | | |
| 835334 | | |
| 833786 | | |
| 833610 | | |
| 832966 | | |
| 832786 | | |
| 831838 | | |
| 831503 | | |
| 831185 | | |
| 831012 | | |
| 830153 | | |
| 829331 | | |
| 829266 | | |
| 829076 | | |
| 828415 | | |
| 828328 | | |
| 828156 | | |
| 827337 | | |
| 826489 | | |
| 825546 | | |
| 825157 | | |
| 825156 | | |
| 824692 | | |
| 824006 | | |
| 823531 | | |
| 822648 | | |
| 822620 | | |
| 820325 | | |
+--------+ | |
40 rows in set (11.81 sec) | |
mysql> SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND (((wp_posts.post_title LIKE '%AAPL%') OR (wp_posts.post_excerpt LIKE '%AAPL%') OR (wp_posts.post_content LIKE '%AAPL%') OR (wp_posts.guid LIKE '%AAPL%'))) AND wp_posts.post_type = 'attachment' AND ((wp_posts.post_status = 'inherit' OR wp_posts.post_status = 'private')) ORDER BY wp_posts.post_date DESC LIMIT 0, 40; | |
+--------+ | |
| ID | | |
+--------+ | |
| 844868 | | |
| 844279 | | |
| 843458 | | |
| 840260 | | |
| 839870 | | |
| 837818 | | |
| 836996 | | |
| 836995 | | |
| 836636 | | |
| 836011 | | |
| 835988 | | |
| 835984 | | |
| 835970 | | |
| 835334 | | |
| 833786 | | |
| 833610 | | |
| 832966 | | |
| 832786 | | |
| 831838 | | |
| 831503 | | |
| 831185 | | |
| 831012 | | |
| 830153 | | |
| 829331 | | |
| 829266 | | |
| 829076 | | |
| 828415 | | |
| 828328 | | |
| 828156 | | |
| 827337 | | |
| 826489 | | |
| 825546 | | |
| 825157 | | |
| 825156 | | |
| 824692 | | |
| 824006 | | |
| 823531 | | |
| 822648 | | |
| 822620 | | |
| 820325 | | |
+--------+ | |
40 rows in set (4.69 sec) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment