Rightfield Posted April 15, 2004 Posted April 15, 2004 I am logging slow queries and one shows up consistently slow. I can't find the code that is doing it, but it's when customers look at the products of a category. My site is very slow if there are more than about 10 people on it, and I think if I speed up the query, it will be much faster. Can anyone help me speed this up? I am getting this result in my log file: # Query_time: 16 Lock_time: 0 Rows_sent: 10 Rows_examined: 19096 This is the line that is taking so long: select distinct p.products_id, pd.products_name from products p, products_description pd, products_to_categories p2c, categories c where p.products_status = '1' and p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and '29000' in (c.categories_id, c.parent_id) order by p.products_ordered desc, pd.products_name limit 10; My site is http://www.scrapbookersparadise.com/catalog/
♥ecartz Posted April 15, 2004 Posted April 15, 2004 I would try adding an index for products_ordered in the products table. If that's it, your query should drop to examining just 10 rows or so. Hth, Matt Always back up before making changes.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.