Open enl opened 3 years ago
Hey @enl , Thanks for the report! We are currently checking the issue you have raised regarding the query slowness. I will get back to you with an update about it.
Hey @enl We are going with a new design to export orders. This issue will be addressed in future releases of the Yotpo plugin
Hi @pinchas13, this issue wasn't addressed yet I assume? We would really need this sync to work, but have 7.000.000+ entries in sales_order table... Which makes it totally unusable. Cron took 1.1 hours last time syncing only 50 orders per store (we have over 60 active at the moment.). Any upgrades in short-term plan? Thanks!
The query to retrieve list of orders to sync becomes bloody slow in certain cases:
https://github.com/YotpoLtd/magento2-module-yotpo-reviews/blob/master/Model/Jobs/OrdersSync.php#L179
This query looks like this in pure SQL:
In our case, there are 300k rows in
sales_order
table that suit this query. And usingleft join
on a subset of this size (especially checking on emptiness) is slow thing.This query is being executed for about 3 seconds on our database. Not a big deal? Multiply it by ~60 store views and the fact that cronjob is run every minute by default :)
Improvement Idea
sync_flag
columnyotpo_sync
table once order is created (only adding index reduces query time only to ~1.5s which is still huge amount of time)sync_flag = 0
condition.