Closed (fixed)
Project:
Commerce Core
Version:
7.x-1.x-dev
Component:
Order
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
10 Dec 2015 at 14:31 UTC
Updated:
23 Feb 2019 at 05:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
targoo commentedSplit the main query into multiple ones.
Comment #3
bojanz commentedCan you do an EXPLAIN of the query in question? A query like this should always be fast, we might be missing an index?
Comment #4
adaddinsanePatch looks good. Ordering ensures the latest matching order number comes first.
@bojanz: We have a 50Gig table so, yes, it's slow. We don't need you to merge this patch into the branch but we need it for composer to apply it into the deployed code.
Comment #5
bojanz commentedThere is no porting to be done here.
Anyway, waiting on the EXPLAIN.
Comment #6
rszrama commentedComment #7
targoo commentedWe are going to update the description and provide more details. We just needed that patch asap.
Comment #9
rszrama commentedGood deal; I understand - I've posted patches to the queue to use in drush make before as well. : )
Comment #10
rszrama commentedfwiw, patch looked good to me on initial review. I think the test fails might be unrelated.
Comment #11
targoo commentedThanks rszrama. Yeah we kind of needed that patch urgently since we needed to hotfix our boxes.
We will probably provide a clean up patch if this considered to be merged.
Will get the EXPLAIN asap.
Comment #12
rszrama commentedComment #13
smccabe commentedThis query just needs an proper index as bojan suspected.
Ideally a specific index of order_id, uid and status, in that order.
Comment #14
smccabe commentedComment #15
travis-bradbury commentedI don't have anything to replicate the original slow query (mine seem to be fast anyway since I either don't have or don't have many anonymous orders) but I do see a dramatic before and after when filtering by status. Query time for admin/commerce/orders with an exposed filter for order status went from 503.85 ms to 1.38ms.
Before:
After:
This new patch is just a teeny change to the update description: fixing a typo, adding a period, and changing how the table name is written to match previous update descriptions.
Comment #16
torgospizzaI can confirm that the patch in #15 makes queries such as
select order_id, status from commerce_order where created < :time and status in ('cart', 'checkout_checkout', 'checkout_review') limit 20much faster. (This is a query we run in Cron to expire very old orders.)Let's please get this in soon. Thanks!
Comment #17
rszrama commentedThanks guys! Committed.