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 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 add Read More Read Less Button using JavaScript? #4 How to uninstall Cocoapods from the Mac OS? #5 PHP Login System using PDO Part 1: Create User Registration Page #6 How to Use SQL MAX() Function with Dates?

Recently Posted

#Aug 15 Is PHP still good for back-end programming? #Aug 10 How to create a multisite network in WordPress? #Aug 3 How to create a circle that follows a cursor using JavaScript and CSS? #Aug 3 How to make a curtain slider using jQuery and CSS? #Aug 2 How to progressively load images and add a blurry placeholder? #Aug 1 How to create a placeholder loader (throbber) using CSS?
You might also like these
How to create two segues with two UIButtons on a single page (Swift 5.0)?SwiftHow to Display Related Posts in WordPress?WordPressSolution for Xcode 11 Command PhaseScriptExecution failed with a nonzero exit code errorMiscellaneousWhat are Class Constants in PHP?PHPLearn to Make a Simple Contact Us Form using PHP and PDO-MySQLPHPHow to check if a link has http or https in it in JavaScript?JavaScript