I often encounter this problem. I remember I heard someone say that setting a field indicates that it has been deleted. I usually use this method. I want to know which one is better? thank you all
漂亮男人2017-06-06 09:54:02
Today’s data is generally logically deleted, which is what you mentioned, and the other is physical deletion in the database. Just delete the data directly. Logical deletion is suitable for data that has been deleted by the user, but the website still needs statistics, while physical deletion can be used for data that is meaningless after verification, such as mobile phone verification codes.
为情所困2017-06-06 09:54:02
It is recommended to mark it. For specific reasons, you can refer to the articles I excerpted before.
Database design principles – don’t delete data
http://xingaiming.com/2015/12...
sf:
/q/10...
黄舟2017-06-06 09:54:02
No deletion: In many cases, it just takes up more disk space. Does not affect system performance
Delete: It doesn’t matter. In most cases, the scenarios you expect to use these deleted data will not actually occur. If it appears, then this function should be marked, not soft deleted.
So, when you encounter this kind of problem in the future and are at a loss, just choose the first one. Since there isn't much difference between the options, there isn't much to choose from.
过去多啦不再A梦2017-06-06 09:54:02
If sensitive data can be flagged, if it is not directly physically deleted
漂亮男人2017-06-06 09:54:02
Just delete unimportant data directly. It is better to delete fields like user information. . .