Slow DB queries on large sites
-
Hello,
We have a big website with thousands of posts. Now these posts have thousands of post meta entries.
We’re facing slow queries from the following functions and that is also spiking CPU usage:
does_file_exist_local() – SELECT COUNT ( * ) FROM wp_postmeta WHERE meta_key = ? AND meta_value = ?
and
offload_duplicate_items() – SELECT m . post_id FROM wp_postmeta AS m LEFT JOIN wp_posts AS p ON m . post_id = p . ID AND p . post_type = ? WHERE m . meta_key = ? AND m . meta_value = ? AND m . post_id != ? AND m . post_id NOT IN ( SELECT i . source_id FROM wp_as3cf_items AS i WHERE i . source_type = ? AND i . source_id = m . post_id )Is there any solution to this? We can’t reduce the number of posts and post meta entries. So either the queries need to be optimized or changed altogether and shifted to a new, properly indexed DB table.
Thanks
- You must be logged in to reply to this topic.