YogeshChauhan.com

Should we ever delete data from a database?

March 23, 2021

I am just sharing what I think and what I have found in my research regarding the problem I was facing. Decide on your own what you really want to do. This article is just my point of view with pros and cons.

This is the trickiest question I was faced with when I was making a website that’s gonna keep students records few years back. I was confused a bit on whether I should delete data from the database when they delete the profile or just delete a particular record?

The answer was not straightforward and it’s still not. It all comes to “it depends on what kind of data we are talking about”.

Law and ethics point of view

Remember few years ago when some websites used to keep the data even if the user deletes “everything”? Those websites then give user an option to restore when they use the same email address or phone number! Only few of us paid attention to the fact that even after deleting everything, almost nothing got deleted.

So, if you are faced with a website or app where keeping the users data even after deleting them is necessary then go with that option. Nowadays there are tons of internet laws to protect privacy of users so keep all those things in mind and take the next step.

If your users are likely to return then it’s a good idea to keep the data but not forever. Just like Facebook, keep the data for 30 days and let the users know about it few times regarding the final deletion. That way at lease you create a win win situation for you and your users.

Personal data MUST be deleted at any point of time user wants to delete. Period.

Thanks to different laws related to privacy nowadays, they force companies to delete users’ data.

There are also laws that require some kind of data NOT to be deleted. Also, some fields like accounting and medical fields, they required to keep the users data.

Sometimes, companies require historical data to create different reports whether it’s a retail company or a stock market company — they need historical data.

Do your homework before deciding anything on whether to delete the data or not.

Developer’s point of view

Keeping your users data and adding more and more users data will eventually pile up and create a large database to manage. So, if you really don’t need the data then delete it.

If you still want to keep it then keep it in the archived database so that it won’t get loaded for every time you load the live database. That way at least we keep up minimum data in live site database.

No need to keep the data that can be created easily again or any duplicate data.

Sometimes the data collected by an application over few years is so large that directly impacts the performance of the application itself if it’s not optimized.

There should be a data deletion on a regular basis that cleans up the old users’ data or anything that is considered archives and not really needed in future at all.

Most of the developers or companies hardly follow this kind of routine.

Buying expensive servers and hard drives seem to be a cheaper and less time-consuming way I suppose!

dreamhost

Most Read

#1 How to check if radio button is checked or not using JavaScript? #2 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #3 How to uninstall Cocoapods from the Mac OS? #4 How to Use SQL MAX() Function with Dates? #5 How to add Read More Read Less Button using JavaScript? #6 PHP Login System using PDO Part 1: Create User Registration Page

Recently Posted

Apr 7 Solution for “Yarn build: Failed because of a stylelint error” Apr 7 Make sure your links have descriptive text Apr 7 How to add Laravel to WordPress using Sage theme (and install Tailwind CSS)? Apr 2 How to create a sidebar using pure CSS? Apr 1 How to switch dark and light themes using pure CSS? Apr 1 How to calculate elapsed time in JavaScript?

You might also like these

How to set opacity or transparency using CSS?CSSWhat is XP (Extreme Programming) and When should it be used?MiscHow to draw an SVG path on scroll using JavaScript?JavaScriptA quick introduction to API, REST API and PostmanMiscStyling Lists with CSSCSSHow to detect if browser supports WebP format on server side PHP script?PHP