V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  JasonLaw  ›  全部回复第 18 页 / 共 36 页
回复总数  714
1 ... 14  15  16  17  18  19  20  21  22  23 ... 36  
2021-09-17 06:30:50 +08:00
回复了 SirCarol 创建的主题 程序员 分布式系统数据一致性问题
2021-09-14 22:42:55 +08:00
回复了 JasonLaw 创建的主题 酷工作 [广州] 九毛九集团招聘高级后端开发工程师 2021-09-14
@0bit #1 🤣一家餐饮集团。官网地址: http://jiumaojiu.com/
@mkdir #127 是的,有几个是几年前的。
@mreasonyang #103 “DBA 与业务强耦合”和“在持久层耦合业务逻辑”是什么意思?
@mreasonyang #103 物理外键是人设置的,但外键约束不是由人保证,这样也叫“没有实质区别”?
我感觉讨论下去没有太大意义了,没有一个事情是绝对的,每个东西都有它适用的场景。
@chengyiqun #111 SQL ? NoSQL ?还是 NewSQL ?
@fkdog #99 “NULL 造成无效索引”?

https://www.v2ex.com/t/694500
@sy20030260 #96 我只是说国外大多数人会选择使用外键。

你应该是从这个 Reddit 找到那个 issue 的。

https://www.reddit.com/r/programming/comments/dtls30/at_github_we_do_not_use_foreign_keys_ever_anywhere/
@fkdog #95 希望大家都就事论事,不要说有的没的。外键最重要的作用是保证 referential integrity 。关于“ 删除一个 user,直接清空了与该 user 有关联的所有表的所有数据”,这个是显式声明了 ON DELETE CASCADE 。
@skiy #84 让我想起了以下这几段话。(来源: https://stackoverflow.com/a/85298/5232255

This is an issue of upbringing. If somewhere in your educational or professional career you spent time feeding and caring for databases (or worked closely with talented folks who did), then the fundamental tenets of entities and relationships are well-ingrained in your thought process. Among those rudiments is how/when/why to specify keys in your database (primary, foreign and perhaps alternate). It's second nature.

If, however, you've not had such a thorough or positive experience in your past with RDBMS-related endeavors, then you've likely not been exposed to such information. Or perhaps your past includes immersion in an environment that was vociferously anti-database (e.g., "those DBAs are idiots - we few, we chosen few java/c# code slingers will save the day"), in which case you might be vehemently opposed to the arcane babblings of some dweeb telling you that FKs (and the constraints they can imply) really are important if you'd just listen.

Most everyone was taught when they were kids that brushing your teeth was important. Can you get by without it? Sure, but somewhere down the line you'll have less teeth available than you could have if you had brushed after every meal. If moms and dads were responsible enough to cover database design as well as oral hygiene, we wouldn't be having this conversation. :-)
@illuz #78 所以我在#67 贴出了 reddit 上的一些讨论
@msg7086 #75 保证 referential integrity
@msg7086 #73 ON DELETE CASCADE 是可选的。
@msg7086 #71

更加准确的说,是数据库的 foreign key constraint 。

“物理外键删数据的时候连 hook 都不会走,天知道会漏跑什么东西”是什么意思?可以具体描述一下吗?
@fengpan567 #68 请问你有使用 primary key, unique 等数据库提供的约束吗?有使用事务吗?
@illuz #66 能够提供一下你所查阅的资料吗?我看到的绝大多数都是倾向使用外键的。

Google 搜索“foreign key database or application reddit”得到的一些结果:

* Are foreign keys really necessary in a database design? : programming - https://www.reddit.com/r/programming/comments/6xidz/are_foreign_keys_really_necessary_in_a_database/
* What Would Happen If Foreign Keys Not Used? : Database - https://www.reddit.com/r/Database/comments/ef38aq/what_would_happen_if_foreign_keys_not_used/
* Don't Most Databases Have Foreign Key Constraints? : SQLServer - https://www.reddit.com/r/SQLServer/comments/6wz2hu/dont_most_databases_have_foreign_key_constraints/dmd7dj1/
* ...
@agagega #55
@JasonLaw #61
@Rocketer #63

这里纠正一下,外键跟一致性( Consistency )没有太大的关系,更正确的说法是:外键能够保证 referential integrity 。Consistency 不是数据库本身的一个特性,它是应用怎么使用数据库的一个特性。
@passerbytiny #57 什么叫数据库编程?什么叫应用编程?
@agagega #55 同意你所说的“ 互联网公司的业务不太追求完整的数据一致性”
1 ... 14  15  16  17  18  19  20  21  22  23 ... 36  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5366 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 19ms · UTC 07:15 · PVG 15:15 · LAX 00:15 · JFK 03:15
Developed with CodeLauncher
♥ Do have faith in what you're doing.