- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2015
06:09 AM
05-04-2015
06:09 AM
addTierPriceData() is extremely slow
I'm trying to get a collection for the Block module I'm writing and for some reason when I add addTierPriceData() to the collection it becomes very slow and memory usage increases considerably.
For example the code below for my data set (7000 products) executed in about 12 seconds and uses 123MB of RAM.
$collection = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToSelect($attributes) ->addAttributeToSelect('featured') ->addAttributeToSelect('*') ->addMinimalPrice() ->addFinalPrice() ->addTaxPercents() ->addTierPriceData() ->addUrlRewrite() ->setStoreId($this->_storeId) ->joinField('category_id', 'catalog/category_product', 'category_id', 'product_id = entity_id', null, 'left') ->addAttributeToFilter(array(array('attribute' => 'category_id','in' => array($catids))));
If I remove addTierPriceData() it executes instantly and uses only 4 MB of RAM.
$collection = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToSelect($attributes) ->addAttributeToSelect('featured') ->addAttributeToSelect('*') ->addMinimalPrice() ->addFinalPrice() ->addTaxPercents() ->addUrlRewrite() ->setStoreId($this->_storeId) ->joinField('category_id', 'catalog/category_product', 'category_id', 'product_id = entity_id', null, 'left') ->addAttributeToFilter(array(array('attribute' => 'category_id','in' => array($catids))));
What could be the problem?
I'm running Magento 1.9.0.1.
Labels:
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2015
11:37 AM
08-14-2015
11:37 AM
Re: addTierPriceData() is extremely slow
How many products are you trying to load?
Magento Moderator since 2009
Keep Calm and Clear Cache!
Keep Calm and Clear Cache!