Should I do archive database records if they're getting too big?

I know there isn’t a hard limit to database size.

But I have a database that’s already 300K+ records and it’s growing at 100K+ per month.

Is it a good idea to purge older records or move them to another table? I reckon such a backend operation would probably take a long time (and might possibly be very risky if it fails halfway).

Or should I just leave it as it is?

As a general rule of thumb, you don’t want to delete historic data but there are some situations where deleting the data makes sense such as;

  1. Holding onto the data creates a growing security risk, for example if you’re holding PII data on customers who haven’t interacted with your brand in years.
  2. The data basically expires after a short amount of time and there is no value in keeping it

The other thing to check is whether there’s any regulatory requirement to keep the data for a set period of time in case there’s a regulatory audit.

If you want a technique for purging older records, I’d just setup a database trigger event with whatever criteria you deem appropriate and it will just tick them off one at a time, for example deletes a record after 12 months.

1 Like