Luca S Luca S - 1 month ago 15
SQL Question

Magento - huge number of db queries x page

I would to know what is the right average number of db queries in a standard installation of magento for catalog pages, because I think to have a big problem with my pages.

My catalog page does about 2000 queries! This is too much and I think that is the reason that my pages are so slow.

Furthermore if you open magento toolbar (at top right) and open queries's table, you can see that more queries are executed many times, query like this:

SELECT `eav_attribute_set`.* FROM `eav_attribute_set` WHERE (eav_attribute_set.attribute_set_id='10')


And it seems to be a loop.

Now I have to find the problem, maybe some bad extension or bad custom code, but what could be the right number of queries for catalog pages?

Answer

Tim Hofman's answer (with wee-developer toolbar installed) was very useful to understand which queries were bad coded by developer before me.

Almost all these queries were load() to retrieve the full product when needed only one product's attribute, so i edited the code.

thx for replies! :)