PrestaShop database cleanup: which tables grow and how to slim them down

PrestaShop database cleanup means removing old data the store no longer needs: visit history, abandoned guest carts, old log entries and tables left by uninstalled modules. Start by measuring table sizes, make a database backup, then delete rows older than a chosen date, in batches. Do not touch carts that have orders.

Author: The TellMyShop team. A guide for PrestaShop store owners: the cause, the manual fix and the same work in a chat conversation.
Last updated: · 7 min read

Why does the PrestaShop database grow when the product count does not?

Because the store records every visit. Stats modules note who came, from where and which pages they viewed. After a few years these tables can be bigger than the whole catalogue. On top of that come carts from guests who bought nothing, error log entries and tables of modules uninstalled without cleaning up.

The PrestaShop team writes in its guide on taking care of your store that some tables can grow very large over time, while the data in them stops being needed. Among them they list the connections tables, which can be regularly cleared of old entries.

A large database usually makes itself known like this:

  • the back office loads slowly, especially the dashboard and stats,
  • the backup with your host takes longer and longer or exceeds the limit,
  • your host warns about disk space or the database limit.

When the store front itself is slow, the cause usually lies elsewhere. We describe a broader diagnosis in the guide PrestaShop running slow.

Which tables can you clean, and which should you leave alone?

The names below use the default ps_ prefix. Your store may have a different one, set at installation.

TableWhat it holdsCan you clean itNote
ps_connections, ps_connections_page, ps_connections_sourcevisit history for statsyes, rows older than a chosen datestats for that period disappear; the tables contain IP addresses
ps_guesttechnical guest data (browser, system)carefullyrows may be linked to carts and customers
ps_cart, ps_cart_productcartsonly old carts without an ordera cart with an order is part of the sales history
ps_loglog of errors and back office actionsyes, old entrieskeep the last few weeks for diagnosis
ps_pagenotfoundURLs with a 404 erroryes, old entriesrecent ones are useful for redirects
ps_statssearchphrases from the store searchyes, old entriesthis is valuable customer insight, consider exporting it
ps_maillog of sent emailsyes, old entriescontains customer email addresses
tables from old modulesdata of modules that are goneafter checking whose they arethe module may only have been disabled
ps_orders, ps_customer, ps_product and similarsales, customer and catalogue datanothis is the core of the store, not clean-up material

Set the thresholds, for example “older than a year”, yourself. They depend on how long you need stats and what your data retention rules say.

To view data, PrestaShop has the SQL Manager in Advanced Parameters → Database. The PrestaShop 8 user guide explains that it is a tool for people who know SQL and that it blocks queries that change data, such as DELETE. The cleanup itself is therefore done outside the back office, in phpMyAdmin at your host or with a cleanup module.

How do you clean the database safely, step by step?

This list is for your developer, or for you if you work in phpMyAdmin and understand what you are doing.

  1. Make a full database backup with your host and check that it can be downloaded.
  2. Measure table sizes. Sort them from the largest. Often two or three tables account for most of the size.
  3. Decide the period to keep for each table on the cleanup list, for example 12 months of stats and 30 days of logs.
  4. Delete rows older than a date, in batches, instead of emptying whole tables. One big deletion can lock the database for a long time.
  5. Check the store after each batch: back office, stats, cart, one test order.
  6. Reclaim the disk space. After deleting rows, a table often does not shrink by itself. Table optimisation is usually done by your host or a developer.
  7. Note what you deleted and when, so the next cleanup does not start from scratch.

PrestaHero describes example queries and an approach to these tables. Some guides advise emptying the tables entirely. That is quicker, but you lose the whole history at once, so deleting by date is more cautious.

How does the chat help assess and clean the database?

It is safest to start with reading only. In TellMyShop Pro your chat (Claude or ChatGPT) reads the store's database without any switch turned on, so it can count table sizes and row numbers and point out leftovers from modules. It changes nothing while doing so.

You: The database is several gigabytes. Check what is taking up the space. Don't delete anything.

Your chat: The largest tables are the visit history and visited pages. Together they make up most of the database. In third place is the error log, where most entries are over a year old. I also found tables from a slider module that is no longer on the module list. The visit history contains IP addresses, so I can't see its contents at the current customer data level. I suggest a plan: error log entries older than 90 days, the slider tables for your decision, and visit history older than 12 months written up as a task for a developer. I'm not touching carts with orders.

You: Start with the log. Show me exactly what you'll delete.

Your chat: Preview of the first batch:

Saving requires the Service switch. The module made a database backup today, so you can turn it on.

Card status: waiting for your “yes”
change preview

old version: log entries from before 2026-07-13

new version: entries from 2026-07-13 onwards stay

Illustration: products, numbers and replies are examples.

The numbers and dates in the example are made up. The chat will give the real ones for your store.

What each step needs:

  • Measuring and planning is a database read, available in TellMyShop Pro straight away.
  • Deleting rows falls under the Service switch, which gives full technical access to the database and files. It lasts 3 hours and you can turn it on only with a successful database backup from the same day.
  • Each batch is a separate change with a preview and your approval. It goes into the change history.

A few honest caveats. Tables with IP and email addresses, such as visit history or the email log, are treated by the module as customer data. By default the chat cannot see their contents. You can temporarily turn on a higher customer data access level with a stated purpose, or hand that part to a developer. The chat will then prepare a task description for them. A big cleanup takes time, and you set hourly work limits in the module panel. Before larger work the chat checks whether it fits and suggests stages. Table optimisation after deletion and enlarging the database at your host we leave to your host or a developer.

When cleaning the database it is also good to review the modules themselves. The guide on unused PrestaShop modules will help. You will find example requests in the use cases orphaned rows and leftovers in the database and a custom report from store data.

How often should you clean the store's database?

Checking table sizes once a quarter or every six months and comparing them with the previous measurement is enough. If one table grows fast, it is worth asking which module writes to it and whether you need that module. Sometimes switching off stats nobody uses is a better solution than regular cleaning.

You can check the store's state in TellMyShop Free. Reading the database and cleaning it up with a preview work in TellMyShop Pro; prices are on the pricing page.

Questions and answers

Does a large database slow down a PrestaShop store?

It can slow down the back office, stats and backups, less often the store front itself. The tables that grow most are usually the ones with visit history, which the store does not need for selling. Before deleting anything, check which tables are really large.

Can I clear the ps_connections table?

Usually yes, because it holds visit history for the stats modules. After deleting you lose those stats for the deleted period. It is safer to delete rows older than a chosen date than to empty the whole table, and always with a database backup.

Is deleting old carts safe?

Only carts that did not become an order. A cart linked to an order is part of the sales history and must not be touched. This kind of cleanup should be prepared by a developer who knows your database structure.

Is the database backup made by TellMyShop enough?

TellMyShop Pro backs up the whole database before the first change of the day, and without it you cannot turn on the Service switch. Before a big cleanup it is worth having your own backup with your host as well. Two independent backups are a sensible minimum when deleting data.

Will TellMyShop Free show what takes up space in the database?

No. TellMyShop Free reads only ready reports: products, SEO, sales, the log and the module list. Reading the database, including table sizes, works in TellMyShop Pro without turning on any switches.

PrestaShop is a registered trademark of PrestaShop SA. Claude is a trademark of Anthropic PBC. ChatGPT and OpenAI are trademarks of OpenAI. TellMyShop is not affiliated with these companies.

The English version launches in January 2027

Join the list and you'll hear first when it opens, with a 72-hour head start on the launch offer.

A few emails before launch. Unsubscribe in one click. Privacy policy

Read next