我应该删除还是禁用关系数据库中的行? [英] Should I delete or disable a row in a relational database?

查看:83
本文介绍了我应该删除还是禁用关系数据库中的行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个空间不是很重要的全新程序中,最好删除一个行或禁用一个行,比如说一个布尔值"Disabled",然后让该程序忽略它?

In a brand new program where space isn't really that big a deal, is it better to delete a row or to disable a row by let's say a boolean "Disabled" and have the program just ignore it?

例如,如果我想从程序中删除用户.

For example, if I wanted to remove a user from a program.

推荐答案

这要视情况而定. (但是,您肯定已经猜到了.)

It depends. (But you guessed that already, I'm sure.)

在实践中,此处违反正确用法的行为几乎总是朝着删除的方向进行.

In practice, the violation of proper usage here is almost always in the direction of deleting.

删除的主要不良后果是,在其他表中有依赖记录的频率会在父记录消失时丢失其引用完整性.

The main bad consequence of deleting is how often there are dependent records in other tables whose referential integrity is lost when the parent record goes away.

一个用来防止删除的红鲱鱼(您已经通过消除存储容量问题来适当地进行了处理),期望这将对查询效率产生明显的影响.

One red herring used to defend deletion (which you've already dealt with properly by dismissing the issue of storage capacity), is expecting that it will make any noticeable difference in query efficiency.

在很多情况下,用户或软件问题导致某人需要按下撤消"按钮;如果删除,则表示您不走运(至少没有得到特殊帮助并加剧了您希望与之相处的人).

There are too many cases where user or software issues cause someone to need to hit the big "Undo" button; if you delete, you're out of luck (at least without getting special help and aggravating people you'd rather be nice to.)

我通常使用的术语是有效"和无效".

The terminology I usually use is "Active" and "Inactive".

(Totophil)需要考虑的其他几点:

A few more points to consider (by Totophil):

  1. 在某些数据库中删除记录不会自动释放磁盘空间.
  2. 清除所有不再需要的敏感信息有助于避免安全风险.
  3. 数据保护法规可能会要求您的组织在某些情况下清除有关个人的任何可识别信息.各国法律不同,有一些提示:

  1. Deleting a record in some databases will not automatically free up the disk space.
  2. Purging any sensitive information that you no longer require helps avoiding security risks.
  3. Data protection legislation might require your organisation under certain circumstances to purge any identifiable information about an individual. The legislation differs from country to country, some pointers:

  • EU http://ec.europa.eu/justice_home/fsj/privacy/law/index_en.htm
  • UK http://www.ico.gov.uk/what_we_cover/data_protection.aspx
  • Estonia http://www.riigiteataja.ee/ert/act.jsp?id=748829

另一方面,法律可能会要求您保留某些信息.

On the other hand you might be required by law to keep certain information.

这篇关于我应该删除还是禁用关系数据库中的行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆