Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. 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:

enter image description here

Because this schema is so nested, I started thinking about 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).

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.
  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? 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!

like image 263
jmccartie Avatar asked Oct 09 '11 18:10

jmccartie


People also ask

When should I use SQL vs NoSQL?

NoSQL doesn't support relations between data types. Running queries in NoSQL is doable, but much slower. You have a high transaction application. SQL databases are a better fit for heavy duty or complex transactions because it's more stable and ensure data integrity.

Which type of schema will be used for NoSQL database?

Flexibility: NoSQL databases generally provide flexible schemas that enable faster and more iterative development.

Does NoSQL use schema?

Does NoSQL have a schema? NoSQL databases do not have a schema in the same rigid way that relational databases have a schema. Each of the four main types of NoSQL database has an underlying structure that is used to store the data.

Why would you suggest using NoSQL instead of the SQL database?

NoSQL databases were created to handle big data as part of their fundamental architecture. Additional engineering is not required as it is when SQL databases are used to handle web-scale applications. The path to data scalability is straightforward and well understood.


2 Answers

Just my opinion:

I Stared at diagram for approx 3 sec, this is clearly relational. Benefits of an RDBMS heavily outweigh a NoSQL solution here. Why would you want to use NoSQL? Are there 100,000+ records (may a million plus)? You need microsecond/millisecond performance?

NoSQL, as I understand, is not because you don't like lots of joins. It's because big systems for hierarchical data don't suit every situation. This suit this perfectly, however.

like image 135
Kieren Johnstone Avatar answered Oct 13 '22 00:10

Kieren Johnstone


You can probably implode all of the {organisation, region,campus,event } hierarchy into one hierarchical / tree based / self-referential relation. 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. But it is probably bigger than necessary for humans.

like image 33
wildplasser Avatar answered Oct 13 '22 01:10

wildplasser