• Post Reply Bookmark Topic Watch Topic
  • New Topic

Archiving deleted Records  RSS feed

 
raj malhotra
Ranch Hand
Posts: 288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am working on one web application which maintains the inventory of products.I want to archive the deleted records.I thought of creating new table and store the deleted records in it.Just wanted to make sure if this approach is good.Or can there be still better approach than this?

thanks
Raj
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about a boolean attribute 'deleted' ? Seems easier than to keep an extra table.
 
raj malhotra
Ranch Hand
Posts: 288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ulf

Thanks for your reply.Your solutions looks simple,let me check if its possible to add the extra column representing deleted flag in the existing table.I'll then update this post.

Thanks
Raj
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unless you insert data without specifying column names ("INSERT INTO table VALUES (...)" instead of "INSERT INTO table (...) VALUES (...)") it shouldn't be a problem.

Instead of a deleted flag, using a deleted date might also be a good idea if you want to maintain information on when each record was actually deleted. In your query you just add "datedeleted IS NULL" to your query's WHERE clause.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if it's a large database, you could consider creating an archive/deleted table for efficiency... but then it becomes a question of if there is a performance issues and how big an issue is it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!