Should we ever delete a record in an e-commerce website or just hide?

I have a small question :slight_smile: Im building an e-Commerce website. It have a lot of products. Now I thought of adding a delete function to products where it will hide the product from the list but still keep it on the database for records. Im planning to do this to Users too.

My question is, is this a good practice? Will it add junk to the database?

After many “deletes”, your database might become just a hair bloated; but that’s nothing to worry about.

My recommendation: keep it and just hide it from the public view (and as users go, mark the account inactive, or change the password to something incredibly long and complex, so no one can log on with that account.)

For starters, I don’t know how likely it is for a product to be “reintroduced”, but if it happens, you won’t have to re-create it.

Also, ESPECIALLY for users, you never know if you’ll ever need/want to review anything from the past, after a user has left and asked for their account to be deleted - from both a legal perspective and a plain ol’ pragmatic perspective (ie, just in case.)

If the “bloat” does start to affect site performance, you can always create a mirror of the table(s) in question, mark them as archive in the name of the table, and do a select from the live tables into the archive tables, and delete the “deleted” records from the live table - you’ll always have that old data, and keep your current data tables small for increased performance (assuming they are correctly indexed, of course.)

HTH,

:slight_smile:

2 Likes

You are right! Better keep the stuff and delete only if they have no activity at all!

Unless I have to for some reason, I never delete anything. There’s no reason to if your tables. Once it’s gone, it’s gone. You’re probably not going to get enough data in these tables to make a difference. It takes millions of rows or a poorly designed database to start effecting performance.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.