Xaprb

Stay curious!

NoSQL doesn’t mean non-relational

with 30 comments

It seems that a lot of people equate non-SQL databases with non-relational-ness, or malign the word relational. This is pretty much pure ignorance. If you’ve ever uttered a sentence that includes the phrase “…non-relational database…” then I have two suggestions for you.

  1. Study relational algebra. At a bare minimum, read the Wikipedia article on relational algebra. There is much more you could do — take a class on the topic, or read C.J. Date’s SQL and Relational Theory (my review). Ask yourself how similar SQL is to the relational algebra. How is relational algebra different from SELECT and GROUP BY? Is relational theory about relationships between data? What part do transactions play in relational algebra? Is MySQL a relational database? What about PostgreSQL, Oracle, or DB2?
  2. Now that you understand relational theory more, choose a database that you think is non-relational and write a formal proof that it is not relationally complete. Please do post a link to the proof in the comments.

The truth is, a non-relational database would be of very little use. In layman’s terms, it would mean you have some data that represents true statements, and a piece of software designed to answer questions using those facts, and you can’t answer simple first-order logic questions with the software. How is this an improvement? How is this useful?

Written by Xaprb

March 8th, 2010 at 8:13 am

30 Responses to 'NoSQL doesn’t mean non-relational'

Subscribe to comments with RSS

  1. so supposedly the best resource on the net for nosql databases (nosql-database.org), defines it as:
    “DEFINITION: Next Generation Databases mostly address some of the points: being non-relational, distributed, open-source and horizontal scalable. The original intention has been modern web-scale databases. The movement began early 2009 and is growing rapidly. Often more characteristics apply as: schema-free, replication support, easy API, eventually consistency, and more. So the misleading term “nosql” (the community now translates it mostly with “not only sql”) should be seen as an alias to something like the definition above.”

    you might want to help them fix their definition :P

    colin

    8 Mar 10 at 9:16 am

  2. I’d be delighted to help them. My consulting rate is pretty pricey, though.

    Xaprb

    8 Mar 10 at 10:21 am

  3. While I agreee with you on principle (a non-relational database would be of very little use), we wouldn’t be talking about ‘relational databases’, if there were no other databases. We would just have ‘databases’. Word ‘relational’ is used here in slightly different meaning than presented in your post (although admittedly, I have too little experience in the subject, to be able to explain that difference clearly).

    Mchl

    8 Mar 10 at 11:26 am

  4. You think you’re using the word in a special way because you don’t know what it means.

    Xaprb

    8 Mar 10 at 11:32 am

  5. “Nonrelational” does not mean “has no relations” or “cannot be described in terms of relational algebra.” It means “is not based on E.F. Codd’s relational database model:”

    http://en.wikipedia.org/wiki/Relational_model

    E.F. Codd’s relational model is a particular application of theory – it is not the only database model in existance. Incidentally, no SQL products that I am aware of conform perfectly to the relational model – which is good, of course, since features like duplicate rows are pragmatically useful.

    Nevertheless, other products – those billed as “nonrelational” – have more than a flirtation with concepts outside of the relational model – they are based entirely on a separate and distinct concepts.

    Under the relational model, for example relations (usually called tables) must have a specified set of attributes (typically called columns.) This is not true of most products billed as nonrelational.

    Take it easy,

    David Berube

    David Berube

    8 Mar 10 at 12:01 pm

  6. @Xabrp: Actually, I took a course in relational algebra. I just do not have enough experience (pretty much none) with ‘non-relational’ databases.

    I guess what David above says is pretty close, to what I had in mind.

    Mchl

    8 Mar 10 at 12:14 pm

  7. An example of non-relational databases would be those databases in existance at the time E.F. Codd invented the relational model, largely in response to deficiencies in those databases. Primarily that would be IBM IMS and Cullinane/CA IDMS.

    These non-relational databases are still very useful, many large financial institutions still reply on them for their daily OLTP load. It is possible that even today more transactions are run through these old databases than relational products, though data on that is hard to find.

    Regards

    Gord Irish

    Gordon Irish

    8 Mar 10 at 2:40 pm

  8. Gordon, that’s the kind of context most “NoSQL kiddies” are lacking, and I’m glad you can provide it.

    Everyone: Calling SQL databases relational is wrong. Read my headline again: NoSQL doesn’t mean non-relational, or shouldn’t if you want to be taken seriously. I’m looking forward to someone picking a NoSQL database, whatever that means, and proving it’s not relational. I know of a few that are absolutely relational and I can’t think of any that absolutely aren’t, though I could be wrong.

    If I were going to do this, I’d start with the definition of relational: http://en.wikipedia.org/wiki/Codd%27s_12_rules It goes beyond the relational algebra.

    Xaprb

    8 Mar 10 at 4:02 pm

  9. Re Codd’s 12 rules: Consider my understanding of the topic improved now. Thanks :D

    Mchl

    8 Mar 10 at 4:07 pm

  10. Xaprb: Are you saying that “NoSQL databases” DO fit the relational model?

    Take it easy,

    David Berube

    David Berube

    8 Mar 10 at 4:20 pm

  11. Some of them are, definitely. I haven’t gone through all of them. I don’t want to name any names.

    Xaprb

    8 Mar 10 at 5:19 pm

  12. Xaprb: Isn’t a schema a requirement of the relational model? Aren’t many NoSQL databases schema-free? Therefore, aren’t many NoSQL databases outside of the relational model?

    Take it easy,

    Beaglemin

    David Berube

    8 Mar 10 at 7:45 pm

  13. Michael

    8 Mar 10 at 9:08 pm

  14. About this NoSQL thingy … i know it’s gaining momentum right now due to the continued bashing against Oracle but, could ***anyone*** show me a practical and real example of a ***big*** company using it?; i mean, stop writing theory, white papers and dissertions about the great NoSQL revolution and show us (mere mortals) an actual implementation of a NoSQL system that manages dozens of millions of transactions each day.

    We need (heck, we WANT) numbers, performance counters and real data instead empty words.

    Thanks.

    showme

    9 Mar 10 at 2:56 am

  15. Showme: First of all, as pointed out, NoSQL isn’t a particularly accurate term; most of the databases could conceivably be written to have a SQL frontend, and every SQL DB could have the SQL interface removed, so it really depends on what you mean by NoSQL…

    That being said, database system that typically fall under NoSQL moniker are being used in large real world deployments. Take Mongo, which is in use by Sourceforge, EA, Github, and the New York Times. Bigtable is being used and was developed by Google.

    However, if you’re looking to find deployments whose usecase closely resembles the ideal usecase of a traditional DBMS, you won’t find many – these systems are good at some things (Mongo supposedly has *lightning* fast inserts, for example,) but not at others – often, batch updates are slow, there’s typically little or no transactional support, and typically no join support. (Obviously, this depends on the database in question.)

    Take it easy,

    David Berube

    David Berube

    9 Mar 10 at 8:37 am

  16. Interesting hypothesis… so I thought you could prove that KV stores are relational. I pretty much failed using get/set only ops to achieve projections, joins, and a couple more others. So maybe you could prove how this works.

    bests,

    :- alex

    Alex Popescu

    9 Mar 10 at 7:54 pm

  17. Not all NoSQL databases are key-value stores. Just as not all of them are non-relational. But I’m glad that you took me up on my challenge — I couldn’t believe no one was going to do such a simple thing!

    Xaprb

    9 Mar 10 at 9:30 pm

  18. Berkley DB (BDB) is a key/value store.

    Many people say that key/value stores are NoSQL.

    There was a MySQL storage engine based on BDB.

    If it stores data, there is a good bet you can tack a SQL interface on it, for better or for worse.

    Justin Swanhart

    10 Mar 10 at 5:34 am

  19. Right, and I’m still quietly waiting for someone to prove that ALL NoSQL databases are non-relational. Quietly, so quietly!

    Xaprb

    10 Mar 10 at 7:30 am

  20. Xaprb: Isn’t that a shift from your original post – from talking about any (i.e. “choose *a* database”) NoSQL database to ALL NoSQL databases?

    In fact, I’d like to see *any* NoSQL database that fits the relational model.

    Take it easy,

    David Berube

    David Berube

    10 Mar 10 at 9:00 am

  21. I’m a UniVerse programmer http://www.rocketsoftware.com/u2/ UniVerse is a Pick database that is used all over the world. In fact the biggest users of Pick are Colleges and Universities (UniData). Whats great about UniVerse is that by default it is NoSQL, however if you want to use or have to use SQL that’s available too.

    I agree with the Xaprb that NoSQL does not mean non-relational.

    Norm

    10 Mar 10 at 9:14 am

  22. NoSQL was a terrible name, and I can only imagine it was done in some sort of jest against mySQL. NoSQL isn’t about SQL, or even relational databases; it seems to simply be a set of data stores that have abandoned ACID, which is completely fine — I just don’t think there needs to be this whole NoSQL is the future when they have very different sets of properties.

    Lamia

    10 Mar 10 at 10:07 am

  23. RE: Oracle Berkeley DB

    I was recently considering if Berkeley DB (BDB) is relational or not. Margo Seltzer has published whitepapers (now on oracle.com) that show how to map some common SQL constructs to the Berkeley APIs. This leads me to believe that BDB could be relational. I don’t have enough experience with those APIs to easily figure it out, they are pretty complex.

    Note also that Hugh Darwen uses an implementation of his (and Chris Date’s) “D” language that runs on top of BDB. This is probably the most relational system available today but I don’t know if the relational part comes from the “D” implementation or from BDB or a bit a both.

    Gordon Irish

    10 Mar 10 at 11:23 am

  24. David, I wanted to challenge someone to show that ANY NoSQL database is truly non-relational as a way to approach the straw-man question of whether this whole notion is about non-relationality. I am still keeping my lips buttoned, but to answer your question, I am aware of more than one NoSQL database that is relationally complete. (And so are you.)

    Xaprb

    10 Mar 10 at 1:56 pm

  25. Gordon Irish wrote “Note also that Hugh Darwen uses an implementation of his (and Chris Date’s) “D” language that runs on top of BDB. This is probably the most relational system available today but I don’t know if the relational part comes from the “D” implementation or from BDB or a bit a both.”

    The language is actually Tutorial D, which is *by definition* 100% relational and also *by definition* 0% SQL. The implementation is Rel, by Dave Voorhis, and I’m sure he chose BDB because that engine is primarily intended for use in RDBMSs.

    Hugh Darwen

    13 Mar 10 at 10:03 am

  26. Tutorial D has always looked a bit extra-cryptic to me, I don’t know why. I have always wondered if it could be made a little less formal-looking (only *looking*, you understand) and more accessible though a bit of syntactic change. But I can’t point to anything exactly about it that makes me say that. SQL may be an abomination that was created by committee, but maybe there’s a middle ground, too.

    Xaprb

    13 Mar 10 at 10:22 am

  27. Forgive the naiveté, but are you implying that the great thing about NoSql databases is not the lack of the relational model ( which some of them actually have), but the fact that they do not use SQL to implement the relational model?

    William

    15 Mar 10 at 3:28 pm

  28. Hugh Darwen is essentially correct when he suggests that I chose the Berkeley DB (Java edition) as the storage engine for Rel because it’s primarily intended for use in RDBMSes.

    I don’t know if it’s _specifically_ intended for use in RDBMSes, and I do know it is used outside of RDBMSes, but it’s ideal for implementing RDBMses because it provides transactional, persistent, high-performance key-value maps (aka associative arrays aka indexes). These are a fundamental building-block of OLTP-oriented RDBMSes.

    Dave Voorhis

    28 Mar 10 at 7:56 am

  29. NoSQL means that you talk to data storages in lower level languages (<4GL), in other words, you just have to write more lines of code to operate on your data sets than you would usually do using SQL :)

    Dmitri Mikhailov

    19 Apr 10 at 3:42 pm

  30. You may well be right, but you come across as obnoxious, especially in your comments

    Zenna

    1 Jun 10 at 8:47 pm

Leave a Reply