Stopwatch SQL - 17911 queries
I noticed few queries is repeating but this one is repeating most times:
-
SELECT SQL_NO_CACHE * FROM uhep_cart_rule_product_rule pr LEFT JOIN uhep_cart_rule_product_rule_value prv ON pr.id_product_rule = prv.id_product_rule WHERE pr.id_product_rule_group = 224
Path: /classes/CartRule.php:606, here is the function in CartRule.php:
public function getProductRules($id_product_rule_group) { if (!Validate::isLoadedObject($this) || $this->product_restriction == 0) { return array(); } $productRules = array(); $results = Db::getInstance()->executeS(' SELECT * FROM ' . _DB_PREFIX_ . 'cart_rule_product_rule pr LEFT JOIN ' . _DB_PREFIX_ . 'cart_rule_product_rule_value prv ON pr.id_product_rule = prv.id_product_rule WHERE pr.id_product_rule_group = ' . (int) $id_product_rule_group); foreach ($results as $row) { if (!isset($productRules[$row['id_product_rule']])) { $productRules[$row['id_product_rule']] = array('type' => $row['type'], 'values' => array()); } $productRules[$row['id_product_rule']]['values'][] = $row['id_item']; } return $productRules; }
I really dont understand why this function is repeating but: IF I delete all cart rules, it runs about 3000 queries instead of 10'000-15'000 queries