Jump to content

Slow Weird Queries ! Anyone knows what is this?


Recommended Posts

I found this query on line 191 of classes/Search.php that looks like that query:

$eligibleProducts = $db->ExecuteS('
SELECT DISTINCT cp.`id_product`
FROM `'._DB_PREFIX_.'category_group` cg
INNER JOIN `'._DB_PREFIX_.'category_product` cp ON cp.`id_category` = cg.`id_category`
INNER JOIN `'._DB_PREFIX_.'category` c ON cp.`id_category` = c.`id_category`
INNER JOIN `'._DB_PREFIX_.'product` p ON cp.`id_product` = p.`id_product`
WHERE c.`active` = 1 AND p.`active` = 1 
AND cg.`id_group` '.(!$cookie->id_customer ?  '= 1' : 'IN (
   SELECT id_group FROM '._DB_PREFIX_.'customer_group
   WHERE id_customer = '.intval($cookie->id_customer).'
AND '.implode(' AND ', $whereArray));

The query is searching through all your products. You must have a lot of products if it is going slow.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...