Prestashop: Database cleanup

PrestaShop is an e-commerce content management system that makes it easy to create and manage an online store, free of charge. From creating product pages to updating and tracking stock, this tool offers great flexibility of use.

However, after several buyer comments, deleted products and shopping carts, the Prestashop database is becoming overloaded. To keep converting your visitors into customers, a thorough clean-up is essential! This will keep your online store more responsive. So how do you clean up your PrestaShop database for greater efficiency? Here’s how!

clean prestashop database

Which modules should you use to clean your PrestaShop database?

To clean up your PrestaShop database, there are two free plugins: Prestashop Database Optimization and Prestashop Cleaner.

Prestashop Database Optimization

This completely free module is easy to use to clean up your online store database. You can also use it to reduce the loading time of your website. How does it work?

PrestaShop stores a lot of unnecessary information in the database. This plug-in allows you to clean up all this unwanted information, such as abandoned shopping baskets, customer login details and so on.

Use Prestashop Database Optimization every month to get rid of irrelevant data.

Prestashop Cleaner Pro

This module increases the speed of your site by eliminating all database integrity problems and cleaning up connection tables. It is useful when you have many visits to your store and when the size of these tables becomes too large.

To save space, this plug-in deletes abandoned shopping carts, expired vouchers and several other files from the database. You can also correct incorrect IDs and empty or missing fields automatically.

However, be careful not to select “Orders and customers” or “Catalog”, as this will delete all your store data.

prestashop database cleaning

Manual Prestashop database cleanup in 10 steps

To clean up your PrestaShop database, follow the steps below.

  • Step 1: Back up your entire Prestashop database before you start

Go to your PhpMyadmin on your hosting server and click on the name of your database. Then export! Choose Format = SQL, then click on the “Go” button.

  • Step 2: Delete the connection statistics report

SQL query execution :

TRUNCATE TABLE ps_connections ;

TRUNCATE TABLE ps_connections_source ;

TRUNCATE TABLE ps_connections_page ;

  • Step 3: Delete Prestashop logs

SQL query execution :

TRUNCATE TABLE ps_log ;

  • Step 4: Delete the Prestashop referrer statistics report

SQL query execution :

TRUNCATE TABLE ps_referrer ;

TRUNCATE TABLE ps_referrer_shop ;

TRUNCATE TABLE ps_referrer_cache ;

  • Step 5: Delete the statistical report page that can’t be found

Executing the SQL query

TRUNCATE TABLE ps_pagenotfound ;

  • Step 6: Delete the Prestashop mail log report

SQL query execution :

TRUNCATE TABLE ps_mail ;

  • Step 7: Delete temporary images

Log in with your FTP or hosting account, delete all files in PRESTASHOP_ROOT/img/tmp

  • Step 8: Remove specific prices from expired products

SQL query execution :

DELETE FROM ps_specific_price WHERE `to` != ‘0000-00-00 00:00:00’ AND `to` < NOW()

DELETE FROM ps_specific_price_rule WHERE `to` != ‘0000-00-00 00:00:00’ AND `to` < NOW()

  • Step 9: Delete the old Prestashop search statistics report

SQL query execution :

TRUNCATE TABLE ps_statssearch ;

  • Step 10: Delete the Smarty Cache database

Executing the SQL query

TRUNCATE TABLE ps_smarty_cache ;

TRUNCATE TABLE ps_smarty_last_flush ;

TRUNCATE TABLE ps_smarty_lazy_cache ;

Once you’ve followed this process, your database will be clean and your site faster.

To conclude on cleaning the Prestashop database

You’re now familiar with the different methods of cleaning your Prestashop database. Need help with your e-commerce maintenance or development? Get in touch with me! As an expert Prestashop developer since 2008, I’ll be happy to help you with your project.