Ask questionsQuery with meta_value slowing down database
We had to deactivate Yoast Plugin because with the count of near to 200.000 posts (around 800.000 rows in posts) and around 730.000 ( 365.000 _wp_attached_file ) post_meta rows it was slowing down the server from 25% to 75% database load and more.
We tracked it down to this query that seems to come from you plugin:
SELECT post_id FROM postmeta WHERE meta_key = '_wp_attached_file' AND meta_value = '2017/06/vers1-1.jpg'
Seems be be the image of twitter cards.
We did not look into you code, but with deactivating Yoast Plugin all went back to normal.
I think searching in the not indexable post_meta.meta_value field should be moved elsewhere for performance reasons. Perhaps it is possible to store the post ID for the attachment in the wp_options or something like this.
Answer questions raptor235
I'm still seeing this issue with premium 12.3 version...
query monitor is reporting the slow query