Przemysław Suszek Posted March 10, 2017 Share Posted March 10, 2017 Hi, I want to optimize my shop. How can I remove SQL_NO_CACHE from query: SELECT SQL_NO_CACHE c.`name`, cl.`id_lang`, IF(cl.`id_lang` IS NULL, c.`value`, cl.`value`) AS value, c.id_shop_group, c.id_shop FROM `ps_configuration` c LEFT JOIN `ps_configuration_lang` cl ON (c.`id_configuration` = cl.`id_configuration`) /classes/Configuration.php /** * Load all configuration data */ public static function loadConfiguration() { self::$_cache[self::$definition['table']] = array(); $sql = 'SELECT c.`name`, cl.`id_lang`, IF(cl.`id_lang` IS NULL, c.`value`, cl.`value`) AS value, c.id_shop_group, c.id_shop FROM `'._DB_PREFIX_.bqSQL(self::$definition['table']).'` c LEFT JOIN `'._DB_PREFIX_.bqSQL(self::$definition['table']).'_lang` cl ON (c.`'.bqSQL(self::$definition['primary']).'` = cl.`'.bqSQL(self::$definition['primary']).'`)'; $db = Db::getInstance(); $result = $db->executeS($sql, false); while ($row = $db->nextRow($result)) { $lang = ($row['id_lang']) ? $row['id_lang'] : 0; self::$types[$row['name']] = ($lang) ? 'lang' : 'normal'; if (!isset(self::$_cache[self::$definition['table']][$lang])) { self::$_cache[self::$definition['table']][$lang] = array( 'global' => array(), 'group' => array(), 'shop' => array(), ); } if ($row['id_shop']) { self::$_cache[self::$definition['table']][$lang]['shop'][$row['id_shop']][$row['name']] = $row['value']; } elseif ($row['id_shop_group']) { self::$_cache[self::$definition['table']][$lang]['group'][$row['id_shop_group']][$row['name']] = $row['value']; } else { self::$_cache[self::$definition['table']][$lang]['global'][$row['name']] = $row['value']; } } } Link to comment Share on other sites More sharing options...
Eolia Posted June 7, 2018 Share Posted June 7, 2018 $result = $db->executeS($sql, true, false); set true instead of false, but it's a bad idea for this specific request... public function executeS($sql, $array = true, $use_cache = true) 2 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now