We've recently migrated from Magento 1 to Magento 2 and it seems that there is a large amount of information in our database files.

We'd like to try to mitigate this by clearing the log files but unlike Magento 1, there does not seem to be a built in facility to do this in Magento 2.

Is there a way to clean out the log files in the database in Magento 2 so that we can hopefully free up some space.

Our database is accessible through phpmyadmin if that helps.

  • have you tried exporting it with gzipped compression ?
    – fmsthird
    Mar 12, 2019 at 10:59
  • Thanks. I'm afraid that it came up with the following: [Symfony\Component\Console\Exception\CommandNotFoundException] There are no commands defined in the "log" namespace. Did you mean one of these? catalog:product:attributes catalog:product catalog:images catalog dev:query-log dev:urn-catalog
    – CJNotts
    Mar 12, 2019 at 11:02
  • @ShoaibMunir, I think this command is not exist php bin/magento log:clean .where you got it?
    – akgola
    Aug 5, 2019 at 10:28

1 Answer 1


these are the tables you can clear/exclude from dumping:

  • "email_abandoned_cart"
  • "email_automation"
  • "email_campaign"
  • "email_contact"
  • "persistent_session"
  • "report_compared_product_index"
  • "report_event"
  • "report_viewed_product_aggregated_daily"
  • "report_viewed_product_aggregated_monthly"
  • "report_viewed_product_aggregated_yearly"
  • "report_viewed_product_index"
  • "session"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.