简体   繁体   English

SQL vs NOSQL:这个架构使用哪个?

[英]SQL vs NOSQL: Which to use for this schema?

I've got an upcoming project and I can't decide whether to stick with SQL or switch over to NoSQL. 我有一个即将推出的项目,我无法决定是坚持使用SQL还是切换到NoSQL。 It's basically a reporting system with the main interface being reporting on the data entered in by users. 它基本上是一个报告系统,主界面报告用户输入的数据。

Here's the schema I've got mapped out: 这是我已经绘制出来的架构:

在此输入图像描述

Because this schema is so nested, I started thinking about NoSQL. 因为这个架构是如此嵌套,所以我开始考虑NoSQL。 With SQL, I'm afraid I'm going to have a crap-ton of joins to get to the bottom of the tree (the Record model). 使用SQL,我担心我会有一堆垃圾来到树的底部(Record模型)。

My concerns, though, are two-fold: 不过,我的担忧有两方面:

  1. I'm only just starting to get into NoSQL and I'm worried my knowledge may limit me because of the tight timeframe. 我刚刚开始进入NoSQL,我担心由于时间紧迫,我的知识可能会限制我。
  2. Although creating data at the bottom of the tree will probably be relatively simple, I'm worried that it may be hard to report on without getting into some heavy map/reduce stuff (that I have zero experience with) 虽然在树的底部创建数据可能会相对简单,但我担心如果不进入一些沉重的地图/减少的东西(我没有经验)可能很难报告

My question: Given my concerns, do you think this schema -- because of how deeply nested it is -- lends itself more to NoSQL? 我的问题:鉴于我的担忧,您认为这个架构 - 因为它的嵌套程度如何 - 更适合NoSQL? If so, do you think the reporting on the "records" will be difficult? 如果是这样,你认为对“记录”的报道会很困难吗?

I realize that it may be difficult to answer these questions without more info, so please let me know what other info may be helpful in coming up with an answer. 我意识到如果没有更多信息可能很难回答这些问题,所以请告诉我其他信息可能有助于提出答案。

Thanks in advance for your help! 在此先感谢您的帮助!

Just my opinion: 只是我的观点:

I Stared at diagram for approx 3 sec, this is clearly relational. 我盯着图表大约3秒钟,这显然是关系型的。 Benefits of an RDBMS heavily outweigh a NoSQL solution here. RDBMS的好处远远超过了NoSQL解决方案。 Why would you want to use NoSQL? 你为什么要使用NoSQL? Are there 100,000+ records (may a million plus)? 是否有超过100,000条记录(可能超过一百万)? You need microsecond/millisecond performance? 你需要微秒/毫秒的性能?

NoSQL, as I understand, is not because you don't like lots of joins. 据我所知,NoSQL不是因为你不喜欢很多连接。 It's because big systems for hierarchical data don't suit every situation. 这是因为分层数据的大系统并不适合所有情况。 This suit this perfectly, however. 然而,这非常适合这种情况。

You can probably implode all of the {organisation, region,campus,event } hierarchy into one hierarchical / tree based / self-referential relation. 您可以将所有{organization,region,campus,event}层次结构内嵌到一个基于层次/树的/自引用关系中。 Maybe "user", too. 也许是“用户”。 That would drastically reduce the number of tables needed. 这将大大减少所需的表数量。 for an example, please take a look at this implementation: Interesting tree/hierarchical data structure problem (which is actually more complex than yours). 例如,请看一下这个实现: 有趣的树/分层数据结构问题 (实际上比你的更复杂)。

BTW: I don't have the faintest idea what "metric model" means. 顺便说一句:我对“度量模型”的含义并不了解。 Inches? 寸? Miles to the gallon? 英里到加仑? Or just "measurements" ? 或者只是“测量”? Could you please explain a bit more what you intend to do? 你能解释一下你打算做什么吗?

EDIT: BTW2: the model you propose is technically not too difficult for postgres. 编辑:BTW2:你提出的模型在技术上对于postgres来说并不太难。 But it is probably bigger than necessary for humans. 但它可能比人类更大。

My question: Given my concerns, do you think this schema -- because of how deeply nested it is -- lends itself more to NoSQL? 我的问题:鉴于我的担忧,您认为这个架构 - 因为它的嵌套程度如何 - 更适合NoSQL?

Deep nesting is not a point pro or contra SQL/NoSQL. 深度嵌套不是专业或反对SQL / NoSQL。

If so, do you > think the reporting on the "records" will be difficult? 如果是这样,你>认为报道“记录”会很困难吗?

That's the tipping point and here you don't give us the relevant information: What is this "reporting" thing in your case? 这是临界点,在这里你没有给我们相关的信息:你的案子中这个“报告”的东西是什么?

  • Does one report aggregate much data? 一个报告汇总了多少数据?
    Eg does it simply aggregate all records and return a sum of them? 例如,它只是汇总所有records并返回它们的总和吗?

  • Does it aggregate over many of your layers? 它是否聚合了许多图层?

  • Does a report evaluate strictly hierarchical or does it correlate event1.metric4.record42 to event2.metric18.record50 (or something like that)? 报告是否严格评估层次结构,还是将event1.metric4.record42event2.metric18.record50 (或类似的东西)相关联?

  • How much data must be transfered from the NoSQL DB to your application only to aggregate it an throw most of the parts away. 必须将多少数据从NoSQL DB传输到您的应用程序只是为了聚合它而抛弃大部分部分。

  • How unstructured is your data? 您的数据有多结构化? Well - very structured it seems. 好吧 - 看起来非常有条理。

Those are typical situations/points where RDBMs have proven their value. 这些是RDBM证明其价值的典型情况/点。 If these items are not important in your case, then you can choose freely. 如果这些项目在您的情况下不重要,那么您可以自由选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM