TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   Deleting rows from a large web app (http://www.talkphp.com/general/5090-deleting-rows-large-web-app.html)

Jmz 11-05-2009 09:17 AM

Deleting rows from a large web app
 
Say I'm making a web app which will hold a lot of data. If a user chooses to delete something, would you delete the row or use a field to mark that it's been deleted?

Deleting the row will keep the size of the table down and will mean I'm not storing data I don't need but just marking the row deleted will mean nothing is ever really lost, even if the end user can't get it back themselves.

Is there a best practice for situations like this?

Village Idiot 11-05-2009 04:29 PM

You really haven't provided any useful information, what type of system is this? Why would you want to undelete a row? Do you think that the situation would often present itself?

Jmz 11-05-2009 04:33 PM

I wasn't really thinking of a specific system, I was just wondering what people tend to do in general and why they do it so that I can get a better idea of when I should use each method or if people have a totally different method I haven't thought of.

Village Idiot 11-05-2009 05:15 PM

Quote:

Originally Posted by Jmz (Post 29106)
I wasn't really thinking of a specific system, I was just wondering what people tend to do in general and why they do it so that I can get a better idea of when I should use each method or if people have a totally different method I haven't thought of.

It depends on the type of data you are storing. If you want to keep records of that row, you obviously would not want to delete it. But if upon deletion it will never be needed again, delete it.

rguy84 11-06-2009 03:32 AM

Like VI said, it depend on the system. I know some people in the camp of you never ever delete records.

One thing you can do is make a deleted field.If the said field = 1, it is effectively deteleted in thze users eyes. Remember you will then have to make display queries have a where clause that doesn't display those rows.


All times are GMT. The time now is 03:59 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0