Usunięcie ps_guest usunie też ludziom niezrealizowane koszyki. Ponadto wątpie byś potrzebował modułu Kopalnia danych dla statystyk (statsdata) więc możesz go wyłączyć bo zapewne i tak korzystasz z Google Analytics jako źródła statystyk.
Wrzuć to np do folderu z jakimś modułem np do modules/mailalerts lub dowolnego jakiego chcesz i odpal link do niego adressklepu.pl/modules/mailalerts/dbclean.php - plik do pobrania pod kodem
<?php require_once(dirname(__FILE__).'/../../config/config.inc.php'); // https://gist.github.com/julienbourdeau/cca88e986a75e19488c2397f1386a3dc /* --- REMOVE CONNECTIONS FOR STATS ONLY ---*/ $sql = 'DELETE c, cs FROM ps_connections c LEFT JOIN ps_connections_source cs ON (c.id_connections = cs.id_connections) WHERE c.date_add < "'.pSQL(date('Y-m-d H:i:s', strtotime('-1 months'))).'"'; if (Db::getInstance()->execute($sql)){ echo 'Connections cleared<br>'; } else { echo 'Connections not cleared<br>'; } Db::getInstance()->execute('OPTIMIZE TABLE ps_connections, ps_connections_source'); /* --- REMOVE CONNECTIONS FOR STATS ONLY ---*/ /* --- REMOVE OLD CARTS THAT WAS NEVER USED ---*/ if (Db::getInstance()->execute(' DELETE FROM `'._DB_PREFIX_.'cart` WHERE id_cart NOT IN (SELECT id_cart FROM `'._DB_PREFIX_.'orders`) AND id_guest NOT IN (SELECT id_guest FROM `'._DB_PREFIX_.'guest`) AND date_upd < "'.pSQL(date('Y-m-d H:i:s', strtotime('-2 months'))).'" ')){ echo 'Carts cleared<br>'; } else { echo 'Carts not cleared<br>'; } Db::getInstance()->execute('OPTIMIZE TABLE ps_cart'); /* --- REMOVE OLD CARTS THAT WAS NEVER USED ---*/ // REMOVE GUEST INFOS if (Db::getInstance()->execute(' DELETE g FROM ps_guest as g LEFT JOIN ps_cart as c ON g.id_guest = c.id_guest LEFT JOIN ps_connections as con ON g.id_guest = con.id_guest WHERE id_cart IS NULL AND con.id_guest IS NULL ')){ echo 'Guest cleared'; } else { echo 'Guest not cleared'; } Db::getInstance()->execute('OPTIMIZE TABLE ps_guest'); /if (Db::getInstance()->executeS(' DELETE FROM `ps_pagenotfound` WHERE `date_add` < "'.pSQL(date('Y-m-d', strtotime('-1 months'))).'" ')){ echo '404 cleared'; } else { echo '404 not cleared'; }