Hello,
I run a large wordpress site with over 100,000 posts and about 200,000 comments. We have been experiencing extremely high load averages recently which have been shutting down the website.
These high loads are due to a high number of mySQL tmp tables being written
-----
| 81019491 | infora_db1 | localhost | infora_db1 | Query | 26 | Copying to tmp table | SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relat |
| 81019494 | infora_db1 | localhost | infora_db1 | Query | 2 | Copying to tmp table | SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relat |
| 81019502 | infora_db1 | localhost | infora_db1 | Query | 36 | Copying to tmp table | SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relat |
| 81019515 | infora_db1 | localhost | infora_db1 | Query | 0 | Copying to tmp table | SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relat |
| 81019565 | infora_db1 | localhost | infora_db1 | Query | 0 | Copying to tmp table | SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relat |
| 81019577 | infora_db1 | localhost | infora_db1 | Query | 36 | Copying to tmp table | SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relat |
| 81020187 | infora_db1 | localhost | infora_db1 | Query | 1 | Copying to tmp table | SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relat |
| 81020206 | infora_db1 | localhost | infora_db1 | Query | 11 | Copying to tmp table | SELECT
| 81020219 | infora_db1 | localhost | infora_db1 | Query | 3 | Copying to tmp table | SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relat |
| 81020233 | infora_db1 | localhost | infora_db1 | Query | 3 | Copying to tmp table | SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relat |
| 81020246 | infora_db1 | localhost | infora_db1 | Query | 5 | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts |
| 81020282 | infora_db1 | localhost | infora_db1 | Query | 8 | Copying to tmp table | SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relat |
| 81020351 | infora_db1 | localhost | infora_db1 | Query | 5 | Copying to tmp table | SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relat |
| 81020364 | infora_db1 | localhost | infora_db1 | Query | 5 | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts |
| 81020410 | infora_db1 | localhost | infora_db1 | Query | 4 | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts |
| 81020412 | infora_db1 | localhost | infora_db1 | Query | 5 | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts |
| 81020435 | infora_db1 | localhost | infora_db1 | Query | 2 | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts |
| 81020448 | infora_db1 | localhost | infora_db1 | Query | 2 | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts |
-----
I would like to know if there is any way to improve the efficiency of these queries and hopefully avoid the creation of tmp tables
Also, I read that SQL_CALC_FOUND_ROWS is not so great on large databases, I would also like to know if there is a way I can get rid of it (no_found_rows=true) without breaking pagination.
I would be eagerly awaiting feedback.
Thanks a lot.