系统与基础设施highlyscalable.wordpress.com
NoSQL 数据建模技术
NoSQL Data Modeling Techniques
2012 — 2021,它一次次回到首页
黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。
导读
这篇文章系统梳理了 NoSQL 数据建模的常用技巧与模式,包括聚合、反规范化、预计算、层级结构等,并与关系型建模思路做了对比。文中配有大量图示,是一份对各类 NoSQL 数据库设计方法的概览式总结。
为什么经久不衰:它把散落在各 NoSQL 系统中的建模经验归纳成一套通用模式,即使多年后技术栈更迭,这些设计思路依然适用于现代数据存储的选择与建模。
HN 评论精选
质疑 NoSQL 建模的核心假设:预设计 join 和放弃数据库内聚合不符合实际业务需求
首先我觉得 NoSQL 这个词本身就很奇怪——对“所有不用 SQL 作为查询语言的东西”能说出什么有见地的话?就像不说 Ruby 而说 NoJava。文章写得不错、图表精美,但我不同意其中不少内容。比如“应用很少关心数据库内的聚合”——据我经验,99% 的业务支持类应用都在做聚合,放到应用代码里只会带来更多代码和 bug。还有“join 在设计时处理而非查询时处理”——恭喜你提前十年就知道需求会怎么变,这感觉和敏捷完全背道而驰。
bni查看英文原文
First off I find the NoSQL term in itself very strange. How can you say anything intelligent about "everything that is not using SQL as a query language"? Its like talking about NoJava, instead of talking about Ruby. Props for a well written article with lots of nice graphs but I dont agree with much of its content. A few examples: "software applications are not so often interested in in-database aggregation" In my experience this is what 99% of business support apps are doing. Doing this aggregation in procedural application code will only give you more code to maintain and more bugs. "joins are often handled at design time as opposed to relational model where joins are handled at query execution time" Im glad you know beforehand about your changing requirements over the next 10 years and can "design" your joins for every eventuality right now. It feels like the exact oppisite of agile. I also agree with the very insightful comment by Voice in the wind (comment #4 below the article)
NoSQL 建模技巧可以借鉴到关系型数据库中,两者并不互斥
我是主要用 PostgreSQL 的人,做各种 SQL 里的层级数据表示。读 NoSQL 建模技巧越多,越觉得其中一些技术在读多写少的关系型环境里也能用得很好。在 LedgerSMB 里我们已经在合适的地方用了键值建模(如系统设置)。这让我更加确信:NoSQL 和 SQL 模型并非完全互斥。
einhverfr查看英文原文
This is an interesting article. I am primarily a PostgreSQL guy who does all sorts of things like hierarchical data representation in SQL. While these things have come a long way in the past few years. This being said, the more I read about NoSQL data modelling techniques, the more it occurs to me that some of these techniques may work well in relational data environments where data is read-frequent/write-seldom. In LedgerSMB (http://www.ledgersmb.org) we already use key-value modelling in cases where it makes sense (system settings, and a few other things). Currently what hierarchical stuff we are doing wouldn't benefit from the ideas in this paper, but I wouldn't rule it out for some other things in the future. I guess what this is reinforcing for me is that NoSQL and SQL models are not entirely mutually exclusive.....
点出文章精髓:关系型从数据出发,NoSQL 从查询出发
我喜欢文中对两者设计主题的对比:关系型建模问的是“我有什么答案?”,NoSQL 建模问的是“我有什么问题?”。
malingo查看英文原文
I like the comparison of the design themes of relational modeling and NoSQL modeling as, respectively, "what answers do I have?" and "what questions do I have?"
这些“新”技巧多是旧技术翻新,但文章的实用变通方法仍有价值
像 1969 年那样开派对吧(指网状模型)!我只是很难理解,扔掉 ACID、反规范化数据怎么就算“后现代”而不是“回到未来”。反规范化?物化视图不就能支持常见查询、减少 I/O 吗?不过这其实是篇不错的文章,迟早我得维护某个“最新最潮”的系统——那些早已跑路的承包商用类似 70 年代大型机的数据库建应用。文中有不少应对索引能力差的系统的实用变通方法。
Roboprog查看英文原文
Party like it's 1969! http://en.wikipedia.org/wiki/Network_model Not that many old things don't work, well in some circumstances even. I'm just having a hard time seeing how throwing away ACID and denormalizing data is "post modern" rather than "back to the future". Denormalization? How about a materialized view to support common searches to reduce I/O from assembling data. Aggregates? You could probably abuse and extend entity attribute values to (physically) cluster arbitrary / sparse / repeating field values around a common parent. It's actually a pretty good article, otherwise, I should probably leave myself a marker to find it. Sooner or later, I'll end up having to maintain one of these things -- long gone contractors will build a "latest and greatest" app using a database system not unlike a 1970 mainframe. There are a number of good work-arounds in the article for dealing with systems with poor indexing capabilities -- a single key field to be filtered.
历次讨论
同类还值得读
TTY 揭秘(2008)
The TTY demystified (2008)
经典文章深入剖析了 Unix/Linux 中 TTY 子系统的工作原理,包括线路规程、终端驱动、信号与控制字符等机制。
系统与基础设施上首页 11 次 · 2009–2025linusakesson.net编辑精选为什么 GNU grep 这么快
Why GNU grep is Fast
FreeBSD 邮件列表上一篇广为流传的帖子,解释 GNU grep 为什么快:核心在于 Boyer-Moore 字符串搜索算法配合精心优化的内部循环和 I/O,让程序在搜索时“…
系统与基础设施上首页 9 次 · 2010–2022lists.freebsd.orgXplain:为普通人讲解 X11
Xplain – Explaining X11 for the rest of us
《Xplain》是作者(HN 用户 Jasper_)写的一系列 X11 长文,用他在浏览器中重建的 X11 绘图模型做交互演示,讲解 X11 的绘图模型与窗口系统设计。
系统与基础设施上首页 6 次 · 2013–2020magcius.github.io编辑精选旋风教程:为 Linux 创建极小 ELF 可执行文件(1999)
A Whirlwind Tutorial on Creating Really Teensy ELF Executables for Linux (1999)
breadbox 写于 1999 年的经典教程,主题是如何为 Linux 手工构造并裁剪出体积极小的 ELF 可执行文件。
系统与基础设施上首页 6 次 · 2007–2025muppetlabs.comPostgreSQL 内部原理
The internals of PostgreSQL
《The Internals of PostgreSQL》是一本免费在线书籍,系统讲解 PostgreSQL 的内部实现,包括查询处理、并发控制、WAL、缓冲区管理等核心机制。
系统与基础设施上首页 5 次 · 2017–2025interdb.jp编辑精选