NoSQL doesn’t mean non-relational
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.
- 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?
- 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?



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
I’d be delighted to help them. My consulting rate is pretty pricey, though.
Xaprb
8 Mar 10 at 10:21 am
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
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
“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
@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
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
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
Re Codd’s 12 rules: Consider my understanding of the topic improved now. Thanks :D
Mchl
8 Mar 10 at 4:07 pm
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
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
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
nice pseudomath ramble.
http://en.wikipedia.org/wiki/G%C3%B6del%27s_incompleteness_theorems.
Michael
8 Mar 10 at 9:08 pm
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
You may well be right, but you come across as obnoxious, especially in your comments
Zenna
1 Jun 10 at 8:47 pm
Glad that the discussion on NOSQL is heating up. The fact is that CA-IDMS did use the terminology SQL access to NONSQL Databases. A schema definition in sql context did include the optional keyword NONSQL in IDMS.
In fact SQL can be used today for query against a NONSQL (CODASYL) db in IDMS. For example one could issue ‘SELECT * FROM DEPARTMENT d, EMPLOYEE where (“DEPT-EMPLOYEE”) and d.dept_id=100
Here the CODASYL set-name works as if we have provided a “d.dept_id= e.dept_id)
In some cases UPDATE also works (so long as CODAYL set is not involved)
UPDATE DEPARTMENT SET DEPT_NAME=”BBS” WHERE DEPT_ID=100 works and will use hash optimization for the dept_id, though DEPARTMENT is not a relational table at all.
In the modern world there is a tendency to reinvent the wheel. Now we have also reinvented a new name ‘NOSQL’.
‘SQL’ name has been misused all these years. SQL does not mean the database is relational but that is the impression spread by Oracle, MS/SQL, Sybase, Informix and all others. It was also very wrong to call the MS database as “SQL Server”, other than a marketing gimmick then.
RDBMS as such is trying to implement many things (unique identifier … Database KEY) behind the scene which has been a standard feature of CODASYL db and which has been declared ‘BAD’ by relational purists in the 1980s! (IDENTITY etc in MS/SQL).
RDBMS touted so much on relational theory of Dr Codd. All RDBMSs are built on top of INDEX-es. But indices are never part of the relational model. At the same time, all of them failed to implement any hashing for the keys. CA-IDMS was originally based on HASHed access for the primary (Index support was added later).
Bottomline is that SQL is just the access DML. Any non-relational system (old IMS inclusive) could have given SQL front-end support as done by CA-IDMS.
Now everyone is trying to do ORM mapping, NOSQL databases etc… A penalty for forgetting that the purpose of any commercial data processing is to store and retrive data from a store – which we call database!
Gopi Nathan
15 Sep 10 at 10:10 am
Here is a ‘LIVE’ display fron online IDMS where the term ‘NONSQL’ is used as a keyword.
OCF 16.0 IDMS NO ERRORS DICT=TSTDICT
DIS SCHEMA EMPNET AS SYN
CREATE SCHEMA EMPNET
*+ DATE CREATED 1997-03-06-15.07.19.549570 BY T06O
*+ DATE LAST UPDATED 1990-01-01-00.00.00.000000
FOR NONSQL SCHEMA TSTDICT.EMPSCHM VERSION 100
DBNAME EMPDEMO
;
Also IDMS is not mentioned as a relational database in most discussions and ‘guru’ talks today. But this is not true. Full SQL support was added to the CODASYL model in the 1990s. The SQL implementation in CA-IDMS has its origin in System-R prototype, which may surprise many!
Here is a partial display of SQL Schema
DIS SCHEMA IDMSSQL FULL AS SYN
*+ STATUS = 0 SQLSTATE = 00000
CREATE SCHEMA IDMSSQL
*+ DATE CREATED 1999-10-15-13.13.04.665279 BY T999649
*+ DATE LAST UPDATED 1990-01-01-00.00.00.000000
*+ FOR SQL
DEFAULT AREA MAINSQL.TEMP
;
CREATE TABLE IDMSSQL.DUMMY
*+ DATE CREATED 1999-10-15-13.14.05.473588 BY
*+ DATE LAST UPDATED 1999-10-15-13.14.05.473588 BY T99999
( ID LONGINT NOT NULL
)
*+ DEFAULT INDEX ON DBKEY
*+ TABLE ID 1024
*+ TIMESTAMP ’1999-10-15-13.14.05.473588′
;
CREATE TABLE IDMSSQL.TIMESHEET
*+ DATE CREATED 1999-10-21-08.41.02.875253 BY T999993
*+ DATE LAST UPDATED 1999-10-21-08.41.02.875253 BY T9999
( UKE NUMERIC(2) NOT NULL,
DATO DATE NOT NULL WITH DEFAULT,
START TIME NOT NULL WITH DEFAULT,
END TIME NOT NULL WITH DEFAULT,
HOURS NUMERIC(4,2),
………
CA-IDMS implementation of E-R model as a CODASYL as well as relational database within the same DBMS has shown that the end user views are irrelevant. But the industry never noticed this because the product was not available in the Unix or Windows world.
Ignorance of database systems have contributed to a lot of utterly useless discussions in the industry in the last 10 years… ORM (Object Relational Mapping) is the worst by-product of that discussion! Sometimes, I wonder how people can miss something obvious…well,if people. believing Ptolmey belived that the earth was flat for 4000 years, then anything is possible today also!
Gopi Nathan
17 Sep 10 at 9:19 am