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

[Performance] WC_Subscriptions_Order->render_contains_subscription_column_content() adds extra performance overhead to orders management #731

Open
prettyboymp opened this issue Nov 20, 2024 · 1 comment

Comments

@prettyboymp
Copy link
Contributor

WC_Subscriptions_Order->render_contains_subscription_column_content() adds two additional queries for each order listed on the orders admin listing page.

A couple of ways to make an improvement:

  1. The underlying code for wcs_order_contains_subscription() could be made more performant by avoiding the loading of any subscriptions (avoiding extra unneeded callbacks/filters), or at least avoiding the extra count query added on.
  2. Consider priming the data needed for the ->render_contains_subscription_column_content() for all orders being rendered at once in a single query rather than one at a time.
@mattallan
Copy link
Contributor

Thanks @prettyboymp for raising these performance issues.

I've just pushed up #732 which improves the performance of our render_contains_subscription_column_content() using the first method you suggested.

FWIW I ran these changes on a test store with ~5000 orders and saw a decent reduction in the number of queries ran while viewing 200 orders on the WooCommerce > Orders page (could be wrong but it looked to be around ~50% reduction).

Consider priming the data needed for the ->render_contains_subscription_column_content() for all orders being rendered at once in a single query rather than one at a time.

I'm interested to dig deeper into this idea but will need to explore it a bit more to see what we can do.

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

No branches or pull requests

2 participants