Support » Plugin: Yoast SEO » Duplicate entry inserting into wp_yoast_indexable_hierarchy table

  • Resolved rayrutjes

    (@rayrutjes)


    Hello,

    We are regularly seing the following error pop:

    
    Erreur de la base de données WordPress Duplicate entry '43275-4' for key 'PRIMARY' pour la requête INSERT INTOwp_yoast_indexable_hierarchy(indexable_id,ancestor_id,depth,blog_id) VALUES ('43275', '4', '2', '1') faite par do_action('wp_ajax_save-attachment'), WP_Hook->do_action, WP_Hook->apply_filters, wp_ajax_save_attachment, wp_update_post, wp_insert_attachment, wp_insert_post, do_action('edit_attachment'), WP_Hook->do_action, WP_Hook->apply_filters, Yoast\WP\SEO\Integrations\Watchers\Indexable_Post_Watcher->build_indexable, Yoast\WP\SEO\Builders\Indexable_Builder->build_for_id_and_type, Yoast\WP\SEO\Builders\Indexable_Hierarchy_Builder->build, Yoast\WP\SEO\Builders\Indexable_Hierarchy_Builder->save_ancestors, Yoast\WP\SEO\Repositories\Indexable_Hierarchy_Repository->add_ancestor, Yoast\WP\Lib\Model->save, Yoast\WP\Lib\ORM->save, Yoast\WP\Lib\ORM::_execute
    Jul 15 06:21:05 prod-sd-wordpress-1 apache2: Erreur de la base de données WordPress Duplicate entry '43275-43261' for key 'PRIMARY' pour la requête INSERT INTO wp_yoast_indexable_hierarchy (indexable_id, ancestor_id, depth, blog_id) VALUES ('43275', '43261', '1', '1') faite par do_action('wp_ajax_save-attachment'), WP_Hook->do_action, WP_Hook->apply_filters, wp_ajax_save_attachment, wp_update_post, wp_insert_attachment, wp_insert_post, do_action('edit_attachment'), WP_Hook->do_action, WP_Hook->apply_filters, Yoast\WP\SEO\Integrations\Watchers\Indexable_Post_Watcher->build_indexable, Yoast\WP\SEO\Builders\Indexable_Builder->build_for_id_and_type, Yoast\WP\SEO\Builders\Indexable_Hierarchy_Builder->build, Yoast\WP\SEO\Builders\Indexable_Hierarchy_Builder->save_ancestors, Yoast\WP\SEO\Repositories\Indexable_Hierarchy_Repository->add_ancestor, Yoast\WP\Lib\Model->save, Yoast\WP\Lib\ORM->save, Yoast\WP\Lib\ORM::_execute
    

    Note that CRON is configured to run every minute and that the site is decently big (hundreds of thousands of posts).

    Everything has been indexed through the wp cli tool.

    • This topic was modified 1 year, 3 months ago by rayrutjes.
    • This topic was modified 1 year, 3 months ago by rayrutjes.
Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Support devnihil

    (@devnihil)

    @rayrutjes We’re sorry to hear you are having difficulties with the plugin creating an error.

    This error may be caused due to that in an earlier version of Yoast 14.x, some data was improperly stored. If you reset the indexables, the data will then be stored properly.

    To resolve this, can you please try the following steps?:

      1. Install & activate the Yoast Test Helper plugin
      2. Go to Tools -> Yoast Test
      3. Hit the “Reset indexables & migrations” button
      4. Run the following WP-CLI command: wp yoast index --reindex

    Can you please try this and let us know whether this resolves your issue with the error?

    Thread Starter rayrutjes

    (@rayrutjes)

    Thanks for your answer.
    Should we have any concerns following your steps on a website having hundreds of thousands of posts?

    I think the first time we ran wp yoast index --reindex it took a couple hours.

    What is Hit the “Reset indexables & migrations” button doing exactly under the hood? Is it doing more than truncating a table? Because if we have the option not to install a plugin we would gladly take it.

    Thanks again for your help.

    Plugin Support Rumejan Barbarona

    (@onlyincebu)

    Hello @rayrutjes!

    Hitting the “Reset indexables & migrations” button will delete the Indexables tables. So you need to perform the indexation again after that.

    Thread Starter rayrutjes

    (@rayrutjes)

    Hey again,

    > Hitting the “Reset indexables & migrations” button will delete the Indexables tables.

    What tables exactly? Can we just run the SQL query truncating the tables to obtain the same result?

    > So you need to perform the indexation again after that.
    In the meantime, what happens when cache is empty? Will it affect the output of all the metadata? Will it affect perf?

    Plugin Support Jeroen Rotty

    (@jeroenrotty)

    Hi @rayrutjes,

    Thank you for your reply!

    A) Yes, you can also clear it through SQL if you’re comfortable with it. However, the test helper plugin will do the same thing with a simple click of a button. We do recommend to have database backups in place before doing this.

    The new Yoast database tables are prefix_yoast_indexables, prefix_yoast_indexable_hierarchy and wp_yoast_migrations.

    B) In the meantime, the metadata will be served from the post meta table. Running the indexation process again to copy over the data to the new tables again, will take some resources when it’s copying this over. On sites with this many posts as you mentioned (couple hundred thousand posts), we would recommend not to run this process through the tool but let Yoast ‘lazyload’ the new data.

    Yoast SEO will “lazy load” the new indexable feature as you, your authors, and your visitors read, write, and update content. In a few weeks, try running the site-wide scan again. If it still times out, you can continue to lazy load the content on your site until the process is low enough for your server resources or ask your server admin or web host to temporarily increase the timeout length while the process completes. Once it’s done, you should not need to do it again.

    You can also want to look into the WP-CLI command for the indexation. We have some developer documentation on this here: https://developer.yoast.com/customization/yoast-seo/indexables-cli/

    Thread Starter rayrutjes

    (@rayrutjes)

    Hoi Jeroen,

    Thanks a lot for this very detailed answer. That helps a lot.

    A) For us it is indeed simpler to truncate 3 tables than installing a new plugin.
    B) Lazy loading sounds good, but I believe the cache is used in order to do some smart recommendation to editors (which motivated the wp-cli reindexing in the first place). We can re-run the full indexation I think, it shouldn’t be a problem.

    I’ll keep you posted. Thanks for the help.

    Plugin Support Jeroen Rotty

    (@jeroenrotty)

    Happy to help, looking forward to the update.

    Thread Starter rayrutjes

    (@rayrutjes)

    We went ahead and did the following:

    Truncated the 3 mentioned tables:

    
    TRUNCATE TABLE wp_yoast_indexable;
    TRUNCATE TABLE wp_yoast_indexable_hierarchy;
    TRUNCATE TABLE wp_yoast_migrations;
    

    Then ran wp yoast index.

    We will keep you posted in the upcoming days to see if the errors keep coming in.

    Plugin Support devnihil

    (@devnihil)

    @rayrutjes Thanks for the update, please let us know.

    Thread Starter rayrutjes

    (@rayrutjes)

    Hello,

    I have some bad news, unfortunately we still have the issue.

    Maybe the new caching approach of the plugin is not really playing well with horizontally scaled setups.

    We have multiple PHP servers, so there is probably some racing going on.

    Plugin Support Pcosta88

    (@pcosta88)

    Hi,

    That error message was expected to be resolved in an earlier version of Yoast. We would like some more information.

    1. Can you confirm you are using the most recent Yoast SEO, v14.5? If you update, does the issue resolve?

    2. Are all your non-Yoast plugins and themes also updated?

    3. Can you confirm you are using WordPress 5.4.2? You can check by clicking on the W in the top left and selecting About. If you need to update, please check with your host provider. Please know that if you are using an older version of WordPress Core you may experience unexpected behavior with Yoast. This guide explains more: https://yoast.com/why-we-dont-support-old-wordpress-versions/.

    4. Are you able to determine what kind of post-type is being used? For example, is the error originating from a default WordPress post-type (like a post or page) or some kind of custom post type you created? If it is with the custom post type, does the Gutenberg block editor work with it?

    Thread Starter rayrutjes

    (@rayrutjes)

    Hey,

    Thanks for your consideration & time, very much appreciate it.

    1. I confirm, here is the excerpt from wp plugin list:

    
    | wpseo-news                                 | active   | none      | 12.4.1  |
    | wordpress-seo-premium                      | active   | none      | 14.5    |
    

    2. Our theme is custom, and all plugins are updated.

    3.

    
    wp core check-update
    Success: WordPress is at the latest version.
    

    4. So I checked the post IDs, and sometimes it seems to be medias, sometimes posts do not exist anymore, sometimes even as an admin I cannot access the post type. (I could check de DB).
    The conclusion seems to be that it happens on multiple post types.
    We have Gutenberg completely turned off with this plugin: https://wordpress.org/plugins/classic-editor/
    The website mainly has normal posts, no custom post types, except maybe for the ones introduced by the AMP plugin: https://wordpress.org/plugins/amp/

    5. We are using a very customized version of https://wordpress.org/plugins/do-spaces-sync/, maybe that is somehow not playing well with the cache indexing.

    I hope that helps, let me know if I can provide more information.

    • This reply was modified 1 year, 3 months ago by rayrutjes.
    • This reply was modified 1 year, 3 months ago by rayrutjes.
    Plugin Support Michael Tina

    (@mikes41720)

    Hi,

    Thanks for getting back to us with this information. You did mention that you are using Yoast SEO for WordPress Premium and News SEO. Do you have an active subscription for these plugins? If so, we recommend that you contact us directly in order to receive premium support and so we can investigate this further — https://yoast.com/help/support/#premium

    Please feel free to reference this forum thread as well when contacting us so we can try to check further. Thanks!

    Plugin Support Jerlyn

    (@jerparx)

    Hi!

    We’re closing this forum post as this has been inactive for a while. For Premium plugin issues, please reach out to our Premium support here: https://yoast.com/help/support/#premium.

    Thanks!

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Duplicate entry inserting into wp_yoast_indexable_hierarchy table’ is closed to new replies.