Jump to content

Can we delete ps_modules_perfs. It has too many rows. What will be its impact if we delete it


husein522

Recommended Posts

Hello @husein522

I have check this table on a Prestashop version 1.6.1.25.

  • I have truncated the table (do not drop it!)
  • Check frontoffice: No errors
  • Check backoffice: No errors

Looking into Prestashop files we can find this function:

    if (Module::$_log_modules_perfs) {
        $time_end = microtime(true);
        $memory_end = memory_get_usage(true);

        Db::getInstance()->execute('
        INSERT INTO '._DB_PREFIX_.'modules_perfs (session, module, method, time_start, time_end, memory_start, memory_end)
        VALUES ('.(int)Module::$_log_modules_perfs_session.', "'.pSQL($module_name).'", "__construct", "'.pSQL($time_start).'", "'.pSQL($time_end).'", '.(int)$memory_start.', '.(int)$memory_end.')');
    }

In the prestashop classes\Hook.php we can find this function:

    public static function coreCallHook($module, $method, $params)
    {
        // Define if we will log modules performances for this session
        if (Module::$_log_modules_perfs === null) {
            $modulo = _PS_DEBUG_PROFILING_ ? 1 : Configuration::get('PS_log_modules_perfs_MODULO');
            Module::$_log_modules_perfs = ($modulo && mt_rand(0, $modulo - 1) == 0);
            if (Module::$_log_modules_perfs) {
                Module::$_log_modules_perfs_session = mt_rand();
            }
        }

        // Immediately return the result if we do not log performances
        if (!Module::$_log_modules_perfs) {
            return $module->{$method}($params);
        }

        // Store time and memory before and after hook call and save the result in the database
        $time_start = microtime(true);
        $memory_start = memory_get_usage(true);

        // Call hook
        $r = $module->{$method}($params);

        $time_end = microtime(true);
        $memory_end = memory_get_usage(true);

        Db::getInstance()->execute('
		INSERT INTO '._DB_PREFIX_.'modules_perfs (session, module, method, time_start, time_end, memory_start, memory_end)
		VALUES ('.(int)Module::$_log_modules_perfs_session.', "'.pSQL($module->name).'", "'.pSQL($method).'", "'.pSQL($time_start).'", "'.pSQL($time_end).'", '.(int)$memory_start.', '.(int)$memory_end.')');

        return $r;
    }

 

So i am guessing its an logging system for the prestashop hooks, as long you don't drop the table you should be fine.

WARNING: make sure to make a backup just in case...

In Prestashop 1.7 the table ps_modules_perfs does not exist anymore.

Edited by Crezzur (see edit history)
  • Like 1
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...