Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Speed up the product search


Rightfield

Recommended Posts

Posted

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/

Posted

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...