Yogesh Chauhan's Blog

Should we ever delete data from a database?

in Miscellaneous on 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!


Most Read

#1 Solution to the error “Visual Studio Code can’t be opened because Apple cannot check it for malicious software” #2 How to add Read More Read Less Button using JavaScript? #3 How to check if radio button is checked or not using JavaScript? #4 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #5 PHP Login System using PDO Part 1: Create User Registration Page #6 How to uninstall Cocoapods from the Mac OS?

Recently Posted

#Apr 8 JSON.stringify() in JavaScript #Apr 7 Middleware in NextJS #Jan 17 4 advanced ways to search Colleague #Jan 16 Colleague UI Basics: The Search Area #Jan 16 Colleague UI Basics: The Context Area #Jan 16 Colleague UI Basics: Accessing the user interface
You might also like these
Window setInterval() Method in JavaScriptJavaScriptHow SCSS (Sass) finds a module without a file extension?SCSSHow to set up the local environment and workspace for Angular development?AngularPHP Login System using PDO Part 1: Create User Registration PagePHPIf statement shorthand examples in JavaScriptJavaScriptWhat are Conditional Tags in WordPress?WordPress