Ask questionsLogo image queries with meta_value slowing down database

<!-- Please use this template when creating an issue.

  • Please check the boxes after you've created your issue.
  • Please use the latest version of Yoast SEO.-->
  • [x] I've read and understood the contribution guidelines.
  • [x] I've searched for any related issues and avoided creating a duplicate issue.

Please give us a description of what happened.

Constant slow queries requesting post_id of an image attachment from the database. On our small server this is slowing down page loads to an excess of 10 seconds. The image requested always seems to be the same one (logo) image.

SELECT post_id FROM wp_postmeta WHERE meta_key = '_wp_attached_file' AND meta_value = 'same-logo-image.png'

This may have some similarity to issue #10195 however unfortunately I am still seeing a similar issue with version 11.2.1. As this was apparently resolved by caching the results to some of these queries, I checked the wpseo_social row in our database and image_id wasn't being set in any case. I tried to set the fields manually but this didn't stop the queries.

As we are only using a small server for this website we have had to disable Wordpress SEO entirely as the page loads were in excess of 10 seconds. Furthermore disabling the Opengraph parts didn't seem to help.

Please describe what you expected to happen and why.

Efficient queries with page loads similar speed without plugin. Caching of in-efficient queries.

How can we reproduce this behavior?

  1. Install Wordpress with Wordpress SEO plugin (we also use Woocommerce)
  2. Watch slow queries on website with traffic to posts

Technical info

<!-- You can check these boxes once you've created the issue.

  • If you are using Gutenberg or the Classic Editor plugin, please make sure you have updated to the latest version. -->
  • If relevant, which editor is affected (or editors):
  • [ ] Classic Editor
  • [ ] Gutenberg
  • [ ] Classic Editor plugin

<!-- You can check these boxes once you've created the issue. -->

  • Which browser is affected (or browsers):
  • [x] Server side <!-- please specify -->

Used versions

  • WordPress version: 4.9.10
  • Yoast SEO version: 11.2.1
  • Relevant plugins in case of a bug: <!-- Please make sure you can reproduce this bug with a default theme such as Twenty Seventeen. Sometimes issues may occur due to theme conflicts. -->
  • Tested with theme: Enfold

Answer questions raptor235


I'm still seeing this issue with premium 12.3 version...

<img src=''/>

query monitor is reporting the slow query

<img src=''/>


Related questions

An error occurred loading the Yoast SEO primary taxonomy picker hot 2
Notice: Undefined index: premium-free-translations.php hot 1
Custom Post Types CPT fail to output Article Schema and show Webpage hot 1
Warning: array_merge(): Arguments #1 &#2 are not arrays in class-wpseo-options.php on line 187 hot 1
Visual Composer no getting load in latest wordpress hot 1
Notice: Undefined index: premium-free-translations.php hot 1
Yoast SEO Meta Box Blank (due to issues with Avada?) hot 1
An error occurred loading the Yoast SEO primary taxonomy picker hot 1
textLength error hot 1
Github User Rank List