Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow query when autocompleting custom fields for variables in title settings #21985

Open
2 tasks done
dgwatkins opened this issue Jan 21, 2025 · 2 comments
Open
2 tasks done

Comments

@dgwatkins
Copy link
Contributor

  • I've read and understood the contribution guidelines.
  • I've searched for any related issues and avoided creating a duplicate issue.

Please give us a description of what happened

To Reproduce

Step-by-step reproduction instructions

  1. Visit /wp-admin/admin.php?page=wpseo_page_settings#/post-type/pages
  2. Try inserting a variable in the SEO Title

Image

  1. There is a query that takes up to 60 seconds on setup. The purpose of the query is to fetch 30 items for autocomplete list:
SELECT DISTINCT meta_key
			FROM wp_postmeta
			WHERE meta_key NOT BETWEEN '_' AND '_z' AND SUBSTRING(meta_key, 1, 1) != '_'
			LIMIT 30;
  1. Please note that we have 80M records in the postmeta table.
  2. We should be able to achieve the same result using NOT LIKE instead of BETWEEN, in 7 seconds instead:
SELECT DISTINCT meta_key
FROM wp_postmeta
WHERE meta_key NOT LIKE '\_%'
LIMIT 30;
@josevarghese
Copy link
Contributor

Hi @dgwatkins

Thanks for reporting this to us. I have escalated this to our development team for further investigation. They will review it thoroughly to ensure we address the concern effectively.

We’ll keep you updated on the progress and resolution. In the meantime, please don’t hesitate to share any additional details or suggestions you might have.

@josevarghese
Copy link
Contributor

Internal Slack conversation: https://yoast.slack.com/archives/C01NCRHHN30/p1737524307216849

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants