skip to Main Content

i have a store that i have a lot of products, more than 50,000 products, and trying to figure out one of the issues with the pageload of my home page, one of them i already found it (frontend) but now im checking on the backend, for example i have different blocks of products like (featured, latest products and products by category), so since i only load like 8 products (each block) in my store home page maybe 50,000 (and it keeps groing) makes it slower i think, so maybe i can improve the performance on my code.

The Method im using to call the products are featured:

$_products = Mage::getModel('catalog/product')->getCollection();
        $_products->addAttributeToSelect("*");
        $_products->addFieldToFilter(
            array(
            array('attribute'=>'featured', 'eq'=> 1)     
        )
        );

Is there a way to make it faster? Or maybe the issue is also in the latest products or filtering the products by category?

2

Answers


  1. This code already creates optimal query. Try to reduce the number of selected fields when using addAttributeToSelect. Also consider usage of flat tables to gain more performance. (works on >100k catalogs). Profiler tools like newrelic may give you more info about specific performance bottlenecks of your code.

    Login or Signup to reply.
  2. In addition to samsonovits answer, I would also suggest clearing out your log tables. See here: https://docs.nexcess.net/article/how-to-perform-magento-database-maintenance.html.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search