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

Viewing post list table with large number of hierarchical posts has unbounded query #763

Open
1 task
rmccue opened this issue Dec 8, 2023 · 1 comment
Open
1 task
Labels
bug Existing functionality isn't behaving as expected

Comments

@rmccue
Copy link
Member

rmccue commented Dec 8, 2023

wp_edit_posts_query() has an unbounded query that triggers when viewing a hierarchical post type; specifically, this code sets posts_per_page to be unlimited and overrides the order, but only when no orderby is set.

This means page loads can take vast amounts of time, but if you click on the Date column to "reorder" the page, it's suddenly fast, even though it renders the same page.

I've checked and VIP is overriding this when the page is loaded so clearly they've hit this issue previously too - we should apply a similar workaround to ensure the query is not unbounded.

Steps to reproduce:

  1. Create 100k+ pages or other hierarchical post type
  2. Load the list table for the post type
  3. Observe unbounded query in Query Monitor for the post

Acceptance criteria:

  • ...
@rmccue rmccue added the bug Existing functionality isn't behaving as expected label Dec 8, 2023
@rmccue
Copy link
Member Author

rmccue commented Dec 8, 2023

As an aside, Extended CPTs also does an unbounded, uncached SELECT DISTINCT post_author, presumably for the dropdown list?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Existing functionality isn't behaving as expected
Projects
None yet
Development

No branches or pull requests

1 participant