klaviyo / magento2-klaviyo

37 stars 51 forks source link

Use category collection to load product categories in single query #53

Open andrewkett opened 4 years ago

andrewkett commented 4 years ago

Currently on product pages the extension carries out a category load for every category that the product is in, this results in a database read each time. On sites that have a lot of categorisation this means a large number of queries are carried out for something that could be achieved in a single query.

This pull request replaces the category load with a category collection loading categories by id, this will always use a single query to load the product categories.

snoop0x7b commented 11 months ago

Any update on this Klaviyo team? Query in a loop can be a huge performance anti-pattern in Magento which could make customers' stores really slow.