use murielornaoh;
-- Delete all logs
TRUNCATE pre6538_log;
TRUNCATE pre6538_layered_filter_block;


-- Delete old connection data (only used for stats)
-- change 2016-02-01 00:00:00 according to you needs
DELETE c, cs
  FROM pre6538_connections c
  LEFT JOIN pre6538_connections_source cs ON (c.id_connections = cs.id_connections)
    WHERE c.date_add < '2026-01-01 00:00:00';
    
OPTIMIZE TABLE pre6538_connections, pre6538_connections_source;


-- Delete all guest without entry in ps_customer table
DELETE g
 FROM pre6538_guest g
 LEFT JOIN pre6538_customer c ON (g.id_customer = c.id_customer)
   WHERE c.id_customer IS NULL;
     
OPTIMIZE TABLE pre6538_guest;

