Closed lbajsarowicz closed 1 year ago
@rhoerr The issue here is 2-fold, as "By Default" the Tokenbase Plugin is executed each time you load Sales Grid. The downside is that the same collection is applied for the Admin Dashboard order aggregation.
I'll investigate further in my personal time, as the issue turned out to be more complex than I anticipated. There's one thing I'm sure - The module requires optimization, as it significantly affects the Admin grids performance.
Thanks for calling out the dashboard aggregation as well. That would not have occurred to me.
For sure, the performance of the current plugin needs improvement. Thank you.
Resolved by 02a11b7c03a867e7bbd1926200d12646d712800e . I removed the plugin on Order\Collection, and moved the plugin from Order to Order\Payment such that the extension attributes are initialized on reference, but only after the payment object is otherwise loaded.
In testing, fetching 100 orders by REST API on slow hardware:
Before: 12.44s 11.03s 11.17s
After: 9.52s 9.21s 8.47s
So it definitely does help, albeit slightly. For very large collection loads the difference would be more substantial.
Thanks Lukasz
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
Performance optimization for Admin Sales grid by prefetching Payments for the whole Orders collection
With a listing of 100 Orders
The number of SQL calls dropped almost by half
What is the current behavior?
Fixes: #1
What is the new behavior?
Does this PR introduce a breaking change?
Other information
🙏🏻 Kindly please add information to Release Notes "Optimized by SwiftOtter.com" when the change gets merged.