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

Review uses of WP_Query and consider using no_found_rows , update_post_term_cache and update_post_meta_cache to speed up processing and reduce SQL workload #6392

Closed
MathieuLamiot opened this issue Jan 18, 2024 · 2 comments · Fixed by #6403
Assignees
Milestone

Comments

@MathieuLamiot
Copy link
Contributor

Context
A user suggested the following through the Support:

Your query on line 245 of /inc/functions/posts.php can be made 5-10x faster with no_found_rows => true being added. Since you are no totals needed or pagination occurring you will skip the expensive SQL_CALC_FOUND_ROWS that query translates to.

Referring to this

The use of WP Query implies a few steps on top of the query requested. More details here.

To do
Review our usage (at least the main ones) of WP Query and consider the use of the following option: no_found_rows, update_post_term_cache and update_post_meta_cache

@MathieuLamiot
Copy link
Contributor Author

Reported here. @Tabrisrp to have a second look 🙏

@Tabrisrp
Copy link
Contributor

Adding those make sense in this case, We are doing a query to get the ID of a single post, and don't need anything else.

This is the only case where we do a direct WP_Query in the code.

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

Successfully merging a pull request may close this issue.

4 participants