Adds indices to the SEO Links table for the URL field and target_indexable_id_index field.#22861
Adds indices to the SEO Links table for the URL field and target_indexable_id_index field.#22861leonidasmi merged 3 commits intotrunkfrom
Conversation
…xable_id_index field. This is done to speed up at least two queries where theses fields are used in a single where statement. This way the where can use the index always and speed up the query for very large sites. Small sites should not notice any impact.
Pull Request Test Coverage Report for Build 1adb8f28cc693bf02bd6a0493c78e9a21e223320Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
There was a problem hiding this comment.
Pull request overview
This PR adds database indices to the SEO_Links table to optimize query performance on the url and target_indexable_id columns. This improvement targets large sites where these fields are frequently used in WHERE clauses, though small sites should see minimal impact.
- Adds an index on the
urlcolumn with nameurl_index - Adds an index on the
target_indexable_idcolumn with nametarget_indexable_id_index
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
leonidasmi
left a comment
There was a problem hiding this comment.
CR: 🟠 minor feedback that shouldn't bring regressions if applied
Acceptance: ✅
@thijsoo If you agree with the feedback and you address it, I can do a quick smoke test again and merge
… index removal order
leonidasmi
left a comment
There was a problem hiding this comment.
CR of latest changes is ✅
After another smoke test, I'm merging this.
Context
This is done to speed up at least two queries where theses fields are used in a single where statement. This way the where can use the index always and speed up the query for very large sites. Small sites should not notice any impact.
Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
Test instructions
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps:
SEO_Linkstable does not have indexes for theurlandtarget_indexable_idfield.explain SELECT target_post_id FROM wp_yoast_seo_links WHERE url = '{an url from your tables content}';explain SELECT COUNT( id ) AS incoming, target_indexable_id FROM wp_yoast_seo_links WHERE target_indexable_id IN ('1', '2', '231755', '3') GROUP BY target_indexable_id;Reset Indexables tables & migrationsRegression tests:
incoming_link_countcolumnincoming_link_countcolumn has now been incremented by one#primaryimagenode in the schema is as expected.Relevant test scenarios
Test instructions for QA when the code is in the RC
Impact check
This PR affects the following parts of the plugin, which may require extra testing:
Other environments
[shopify-seo], added test instructions for Shopify and attached theShopifylabel to this PR.[yoast-doc-extension], added test instructions for Yoast SEO for Google Docs and attached theGoogle Docs Add-onlabel to this PR.Documentation
Quality assurance
grunt build:imagesand commited the results, if my PR introduces new images or SVGs.Innovation
innovationlabel.Fixes #