Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customers API : Filter order collection by customer ID for performance cause #144

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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