Jump to content

mysql - deleting records or marking them as deleted?


sw45acp

Recommended Posts

I'm interested in knowing which is a better alternative when working with mysql. If a record needs to be deleted using a php script, is it better to actually delete the record itself or instead mark it as deleted, such as having an extra column where deleted = 1 and active = 0.

 

Advantages of not actually deleting the record means that if the deletion was accidental, its still there. However, a disadvantage is that more space is taken up.

 

Fully deleting a record leaves overhead in the table, and if the records have an index that is auto incremented, a number is wasted, not that it means very much.  But if records will be deleted frequently the overhead will get quite large, and can be annoying to have to optimize the table.

 

What do you guys think is the better alternative?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.