[Enhancement]: Improve slow admin orders list page #47350
Labels
focus: custom order tables / HPOS
Issues related to High-Performance Order Storage (HPOS) née Custom Order Tables.
focus: order
Issues related to orders.
focus: performance
The issue/PR is related to performance.
priority: normal
The issue/PR is of normal priority—not many people are affected or there’s a workaround, etc.
team: Proton
type: enhancement
The issue is a request for an enhancement.
Describe the solution you'd like
Opening admin order list page can be pretty slow due to some queries. Some notable slow queries:
Opening admin posts (
wp_posts
total rows are bigger thanwp_wc_orders
) list is not that slow and total time of DB queries is less than a second.Based on these slow queries, there are small quick wins that would improve the total queries time.
Cache count queries
From the list of slow queries, there are two count queries:
Count of all orders
Count of orders grouped by status
The results then used by list table views and both queries are not cached.
The
WP_Posts_List_Table
useswp_count_posts()
for the similar purpose, but it caches the result. WC hasOrderUtiil::get_count_for_type()
that counts similarly.Cache and improve month dropdown query
While it's possible to short-circuit before performing the query, it's something a store without customizations would run and the result is always the same for at least a month. The result seems like a good candidate to cache with a long TTL.
Also, the query attempts to get the result in local timezone using subquery—thus making it slower than WP's dropdown query. What if the query just returns the
date_created_gmt
as is (or do the conversion in PHP)?Describe alternatives you've considered
No response
Additional context
HPOS with sync disabled
The text was updated successfully, but these errors were encountered: