AI Reports

Magento 2 troubleshooting › Database

Which Magento database tables are the biggest, and which can be cleaned?

Short answer: One query on information_schema lists table sizes. The usual giants are carts (quote), cron history, visitor and report logs, and on Adobe Commerce the admin action log. Most can be trimmed through Magento settings rather than by hand.

Check it step by step

These queries only read data. Run them on a copy of your database if you can, or ask your developer to. If your tables have a prefix (set in app/etc/env.php), add it to each table name.

The 25 largest tables

Works on Magento Open Source and Adobe Commerce:

SELECT table_name, table_rows,
       ROUND((data_length + index_length) / 1024 / 1024) AS size_mb
FROM information_schema.tables
WHERE table_schema = DATABASE()
ORDER BY data_length + index_length DESC
LIMIT 25;

table_rows is an estimate for InnoDB tables.

How to fix it

Related

Gaurav Harsh

Gaurav Harsh is a Magento developer who works on large Adobe Commerce stores and builds AI Reports, a Magento extension for asking your store's data questions in plain English. LinkedIn