Archiving Old Data Print

  • databasesphpmyadmin, databases, performance, spam, domainrenewal, database, woocommerce, guide
  • 0

Reducing a database without losing records.

WHY

A shop with years of orders, or a site with years of logs, accumulates data that is rarely read and slows everything.

THE OPTIONS

Export and remove, keeping the export as a record Move to an archive table, which keeps it accessible and out of the main query path Delete, where the data has no ongoing value

WHAT CAN USUALLY GO

Old log entries Expired sessions Old statistics, where you have summaries Spam Very old revisions

WHAT CANNOT

Orders and financial records, which frequently have retention obligations Customer records still in use

TAKE ADVICE

Retention requirements vary. Speak to an accountant about what your business must keep.

THE PROCEDURE

  1. Back up.
  2. Export what you are removing, and store it off the server.
  3. Delete in batches rather than one enormous statement, which locks the table.
  4. Optimise the table afterwards to reclaim space.

BATCHING

DELETE with a LIMIT, run repeatedly, is gentler on a busy site than removing a million rows at once.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot