Confidence Posted August 28, 2009 Share Posted August 28, 2009 Hi guys, for my new job my boss gave me a little task of optimization that i need to research, so i hope some of u have ideas on it, the case is the following: We have a shop with around 100 000 products and around 1000 categories. When calling the "top sold" products, all the categories and products gets searched, which totally slows down the server. My task is researching all possible optimization possibilities the query looks like this somehow: $sql="select distinct pr.product_id, pr.product_tax_class_id, pr.product_image, pr.product_price, pr.product_price_ratio, pr.product_base_price_id, pd.product_name from products p, " . product_description . " pd, ". product_to_categories . " p2c, " . categories . " c where pr.product_status = '1' and cat.categories_status = '1' and pr.product_ordered > 0 and pr.product_id = pd.product_id and pr.product_id = p2cat.product_id and p2cat.categories_id = cat.categories_id order by pr.product_ordered desc, pd.product_name limit " . MAX_SHOW_BESTSELLERS; i know first that caching (APC, Memcache) would help, also setting an index, but i dunno on what column to be honest....any more ideas? Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/172248-help-on-optimizing-a-query/ Share on other sites More sharing options...
fenway Posted September 7, 2009 Share Posted September 7, 2009 Let's see some EXPLAIN output. Quote Link to comment https://forums.phpfreaks.com/topic/172248-help-on-optimizing-a-query/#findComment-914128 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.