Skip to content

Conversation

Dnd-Coch
Copy link

Filter by customer email on each request takes a long time on large order collection and creates performance issues (slow queries in database):

# Query_time: 2.330689 Lock_time: 0.000100 Rows_sent: 3 Rows_examined: 372888 SELECT main_table.* FROM sales_flat_order AS main_table WHERE (customer_email = 'xxxxxxxxx@gmail.com');

It is much faster to filter by customer ID if customer exists, and filter by email only if required.

@luigifab
Copy link

luigifab commented Apr 9, 2020

I suggest to replace Mage::getModel('sales/order')->getCollection() by Mage::getResourceModel('sales/order_collection').

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

Successfully merging this pull request may close these issues.

2 participants