I recently started working on a new PrestaShop site for a customer with 3.4 million items in their product catalog. During testing, I increased the number of items 10x for each test, starting at 1000 items. When I got to 1 million items, the site started behaving very poorly, requiring me to up the PHP process limit to 512MB just to display a product page.
After enabling the profiler, I noticed that a query which pulls back the entire list of active items in the product table is executed 3 times. At 1 million items, this is 3 million rows being fetched and loaded into RAM.
The query:
SELECT SQL_NO_CACHE p.id_product FROM ps_product p WHERE p.active = 1
Being executed by:
/modules/ps_viewedproduct/ps_viewedproduct.php:317
This is executed 3 times during the rendering of the product display page. This will never work for large catalogs.
After disabling this module as well as "items in the same category", the page execution time dropped from >4sec to 19ms and the memory usage went from 460M to 5MB. While I would expect load times and memory usage to be higher with these modules enabled, they are both fetching far more data than necessary to display the intended information (the number of items in the database doesn't change the amount of information these modules need to render).