If your database is getting bigger and bigger you can save some space by clearing data of few tables in PrestaShop. Of course it will keep your database in correct state and it won’t remove necessary items to run your shop.
Have a look at the above image where you can see the size of each table. Those values are quite high and (depeneding on the store) could be much higher.
We will consider only those tables because removing data from them will not clear any important data or break PrestaShop structure. This is the barely minimum for cleaning considered as safe.
However it is still recommended to make backup of those tables first.
Make a backup
1. Go to your phpMyAdmin, select your database, click “Structure”:
2. Select all tables which you can see in the image, like this:
3. Go to the bottom of page and select “Export”:
4. Change the output format if you want to and click “Go”:
Now when you have copied those tables, it’s time to explain the purpose of each table and what are we going to remove.
ps_connections – It contains informations about each visit in your shop. For example you can see there the IP address or referer link which caused visitor to enter your website.
ps_connections_page – Connections to specific pages.
ps_connections_source – URL of pages where users came from.
ps_pagenotfound – All 404 error hits (page not found).
ps_statssearch – Your store search engine statistics.
Remove data from those tables
Run following command in your phpMyAdmin:
TRUNCATE TABLE ps_connections;
TRUNCATE TABLE ps_connections_page;
TRUNCATE TABLE ps_connections_source;
TRUNCATE TABLE ps_pagenotfound;
TRUNCATE TABLE ps_statssearch;
Some people recommend to clear also ps_guest table but I would not do that. Why? Because guests infos are located in more tables, so those informations (based on guests IDs) would not have connection to specific guests (when you would clear main guest table).
That’s all. Thanks for reading 🙂