
Not too long ago, this was the only data-storage device most companies needed. Those days are over.
For the past 40-some years, relational databases have ruled the data world. Relational models first appeared in the early 1970s thanks to the research of computer science pioneers such as E.F. Codd. Early versions of SQL-like languages were also developed in the early 70s, with modern SQL appearing in the late 1970s, and becoming popular by the mid-1980s.
For the past couple of years, the Internets have been filled with heated arguments regarding SQL vs NoSQL. But is the fight even legitimate? NoSQL databases have grown up a bit (and some, such as Google’s BigTable, are now mature) and prove themselves worthy. And yet the fight continues.
Before I continue, however, I want to make a clarification. In this article, I’m using the term “SQL” rather loosely. Technically speaking, SQL is the language used for accessing a relational database. You can use other languages or techniques for accessing the data. When people argue “SQL vs NoSQL,” they’re actually talking about relational versus non-relational databases. That’s what I’m talking about here: Relational databases (such as Oracle, MySQL, and SQL Server) versus newer non-relational databases (such as MongoDB, CouchDB, BigTable, and others).
Now back to the fight. I spend a great deal of time reading about it, and I’ve noticed that, while the majority of the people simply discuss the merits and differences of the relational versus non-relational databases, a small percentage of the people remain extremely vocal—and even angry—with their adamant support for one over the other. Often, those most vocal proponents are DBAs.
But what about the programmers, who write the client code that access the databases? Where do the disagreements leave them? From a programming perspective, is SQL really that horrible and outdated? Or is the new NoSQL really that awful to work with? Perhaps they both have strengths and good points.
So I’d like to take the disagreement into a different direction: Let’s study the problem at the coding level. Let’s actually look at a couple languages and how they work with the different databases and see if we can draw some conclusions. Our space is limited here, so at the end I’ll offer further thoughts on where you can continue the exploration.
The Old Arguments
Before diving into the code, I want to list some of the more common arguments I’ve seen.
First, here are some arguments against relational databases, the anti-SQL arguments. Now please understand I’m not saying these are necessarily accurate—only that these are arguments others have made—and that I’m sharing them here so we can look into them:
- Joins in relational databases can slow the system down to a crawl, especially when millions of users are doing lookups against tables with millions of rows of data. Google and Amazon found this to be the case, and thus developed their own non-relational systems.
- Relational data doesn’t map well to typical programming structures that often consist of complex data types or hierarchical data. Data such as XML is especially difficult because of its hierarchical nature. Complex objects that contain objects and lists inside of them do not always map directly to a single row in a single table.
- Relational data doesn’t map well. Combine that with the need to handle the syntax of SQL, and writing client code for accessing SQL databases becomes difficult.
Are these valid? If you ask proponents of SQL, you’ll get some good answers about why they’re not. For example, Oracle is extremely powerful and can optimize joins and cache them. Huge banks that serve thousands of branches and millions of customers, including hundreds of thousands of online members, survive just fine using SQL. So here are some arguments I’ve seen for SQL in response to the three big arguments against SQL:
- You’re not as big a Google and you’re not searching as much data as Google. (This is one of the most common arguments, and it probably has merit.) Further, today’s relational systems such as Oracle are extremely powerful and mature and can handle joins at the performance level that most systems require. This ain’t your daddy’s Oracle.
- Most data can be mapped to a relational database, even XML and complex objects. Complex objects can be mapped to multiple rows divided up through normalization into multiple tables and subsequently retrieved using a View that implements the proper joins.
- Code libraries aid in the development of client code, and aren’t that difficult to use.
Also, here’s one more argument for SQL that I’ve seen, but I’m not really going to touch here other than make a very quick point:
- Most people who argue against SQL simply don’t understand it.
There may be instances where that’s true, but the majority of the people I’ve worked with who use NoSQL databases have made the transition from SQL, spent years working with SQL, and really do understand it. So I won’t touch that one any further.
There are arguments against NoSQL that aren’t simply defenses of SQL. However, the early pioneers of NoSQL (Google and Amazon especially) developed databases after determining that relational databases didn’t serve their needs—setting the ground for the direct assault on SQL.
But if we look at actual case studies, there are plenty of situations showing that both really do scale. Oracle especially scales well, and a lot of SlashDot readers like PostgreSQL. In light of that, the “won’t scale” argument really doesn’t hold up.
That’s why I want to focus less on the scalability arguments and more on the actual coding. When you learn to code both, you can decide which is a better fit programmatically—for example, a better fit because your objects and classes are too complex to fit nicely into SQL, or perhaps you have an extreme system that churns out millions of records that fit perfectly into SQL. Maybe SQL will work for your project; maybe NoSQL would be better. Meanwhile, a certain subset of people will endlessly proclaim that one is great while the other is horrible and “must die.”
So with that, let’s look at some actual coding examples.
Note: In the following code examples, my goal isn’t to teach you how to code with these libraries. Instead, I’m showing you the code to compare the complexity and features.
NoSQL vs. SQL in Node.JS
One of the somewhat newer up-and-coming platforms is Node.js, which provides for server-side JavaScript. Node.js is useful for writing web applications, and includes drivers for different databases, including both SQL and NoSQL. In general, the drivers have been written by third-party developers. Some do really well, while others leave a bit to be desired.
SQL works well in Node.js with the help of some of these drivers, but you run into a problem where JavaScript language’s objects are dynamic without fixed structures. You can take virtually any object in JavaScript and add members to it dynamically at runtime. This can be both a blessing and a curse; the dynamic nature can be used to create code that’s either powerful or sloppy and bug-ridden.
To help in the effort to create better code, third-party developers have created various model-oriented packages that work well in Node.js, both for SQL and NoSQL databases. Mongoose is a good example for NoSQL, which I’ll demonstrate shortly. For SQL, there are several, including an intriguing one called Patio.
Let’s look at two different SQL approaches in Node.js. Both will use MySQL, with one relying on a strongly-typed model system and the other on a weakly-typed one. For this I’ll use a package called node-db, specifically for the MySQL database; you can find info here.
Weak typing with SQL and Node.JS
Here’s some Node.JS code that uses weak typing:
var mysql = require(‘db-mysql’);
new mysql.Database({ hostname: ‘localhost’, user: ‘root’,
password: ‘…’, database: ‘mydatabase’
}).connect(function(error) {
if (error) {
return console.log(‘CONNECTION error: ‘ + error);
}
this.query().
select(‘id, email’).
from(‘users’).
where(‘active = ?’, [ true ]).
order({‘timestamp’: false}).
execute(function(error, rows, cols) {
if (error) {
res.send(‘ERROR: ‘ + error);
return;
}
console.log(rows.length + ‘ ROWS found’);
console.log(rows);
res.send(rows);
});
});
This code is straightforward and actually quite elegant. It uses an interesting aspect of Node.js whereby Javascript’s closures can be put to use to handle the issue of asynchronicity, which is useful when dealing with databases. For example, suppose you write sequential code where the first step is saving to the database, and the second is writing out the identity field for the saved row. But you might run into a problem because the call to save to the database is asynchronous, meaning the next statement—writing out the identify field—will occur immediately after the call, whether the save to the database is finished or not. This can be overcome through a type of callback called a promise, which looks like this:
data.save().then(function() {
// do something after save
});
The chaining in the node-db package uses this technique.
Strong typing with SQL and Node.js
Now what about schemas? SQL tables have a fixed schema. Node.js uses the JavaScript language, which allows dynamic classes (meaning you can add any members you like, in contrast to strongly-typed languages such as C++). Before I show the strongly-typed one, I want to point out something interesting about the node-db driver. Notice that I didn’t actually use SQL itself, but I am accessing a relational database. This gets back to the confusion you can see going on in some forums regarding the name NoSQL: it’s a bit of a misnomer.
As mentioned earlier, NoSQL refers to non-relational databases. In this case, we’re not really even using SQL in our code—but we are using MySQL, a relational database. Either way, here’s the sample that attempts to strongly type the data in the weakly-typed JavaScript language. This code uses the Patio package.
For this code, I’m going to use one of their own examples from their Website:
connectAndCreateSchema()
.chain(defineModel, disconnectError)
.then(function(){
var User = patio.getModel(“user”);
var myUser = new User({
firstName : “Bob”,
lastName : “Yukon”,
password : “password”,
dateOfBirth : new Date(1980, 8, 29)
});
//save the user
myUser.save().then(function(user){
console.log(format(“%s %s’s id is %d”, user.firstName, user.lastName, user.id));
disconnect();
}, disconnectError);
}, disconnectError);
This relies on chaining as well, and you can see how the model is a constructor function. I should probably mention the Patio library is quite large, and I’m barely doing it a service by showing such a small amount of code. But you can see how you can create models and keep the data tightly wrapped within those models, more-or-less forcing you and other programmers to not stray from the model. It’s a bit more complex than some others, but it’s still pretty easy to use.
NoSQL and Node.js
Now here’s an example of connecting to MongoDB. For this I’m using a package called mongoose, which you can learn about here.
var PhoneSchema = new Schema({ type: String, number: String });
var ContactSchema = new Schema({ name: String, title: String, company: String, phones: [ PhoneSchema ] });
// Register the model
var ContactModel = mongoose.model(‘Names’, ContactSchema);
// Example of retrieving the data
Function test() {
return ContactModel.find(function(err, list) {
if (!err) {
handlers.success(list);
} else {
handlers.error(err);
}
});
}
This code creates a well-defined model called Contact, which includes a list of phones. Retrieving data involves calling a find function. In this case I’m just retrieving all the records, but you can also include a query, which the mongoose docs demonstrate.
What if you don’t want a strong schema, but want to use a NoSQL like MongoDB? Then it gets even easier. This is where some database purists might cringe, but there are legitimate reasons you might not want or need a fixed schema. As a simple example, you might have a Contacts database, and each person in the database could have varying fields. Some contacts might have several phone numbers of different types; some contacts might have several email addresses. Yes, you could normalize this into a relational database. But in this imagined application, rarely would you just get a list of phone numbers. Instead, most times you would want a name with all phone numbers associated with that name. Is it really necessary to force normalization into the picture and always store the phone numbers in a separate table, only to be joined during virtually every single lookup?
You can certainly do it either way: Store the phones in a separate phone table. Or you could use document storage and just group it all together, and then pull the data in as a single object. This is where a database such as MongoDB really shines. You can store ad-hoc records, and pull them into an object in one shot. You can index the collection on any fields you want (most likely name) and then pull the document into a single JavaScript object with one lookup.
Node.js Roundup
Let’s see where we stand: We’re able to do model-based data processing with both SQL and NoSQL in Node.js. Are there any strengths or weaknesses? Both sets of drivers work well and, although I didn’t show you any speed tests, both are fast. Any weaknesses or strengths are, for the most part, inherent in the databases themselves. MongoDB, for example, allows for a flexible document structure, but that can also open a can of worms and make for some horrible bugs. So far, I’m not convinced one is “better” than the other. But I am developing some personal feelings about when to use one or the other. So let’s move on to another language.
NoSQL vs SQL in Microsoft C#
This might seem like an odd choice of languages to demonstrate next, but there are two reasons I’ve chosen it: The MongoDB team has created a rather sophisticated driver for the strongly-typed C# language. It includes full object serialization. And second, Microsoft—love them or hate them (and I certainly have no love for them)—has actually created a powerful object-relational database library called Entity Framework. So for this example, I’m going to show two ways to access an SQL database in C# (one that uses the Entity Framework, and one that doesn’t), and a way to access a NoSQL database.
First, here’s some sample code for performing a query using the Entity Framework. To create this example, I used the driver created by the MySQL team that integrates with Microsoft’s own Entity Framework:
ProductEntities data = new ProductEntities();
List<Item> advisories = (from p in data.Items
where p.Category == 1
select p).ToList();
The Entity Framework includes several modeling tools that I won’t cover here; essentially, they work by attaching to the database, reading the schema information, and generating the classes for you. These classes include properties for accessing the fields in the row. Thus, you can query the SQL database, request a table or a view, include Where and Order clauses to filter and order your data, and the row or rows come back as a single object or a list of objects, respectively. If the table includes a primary key, you can then make changes to those objects, and write them back to the database. In this short code, I’m reading all rows whose Category column is set to 1, and I’m saving it into a list. (Normally, the library doesn’t read the entire result-set in at once, but it does here when I call the ToList() function.)
But if you prefer a more direct method, you can access the data directly using tables. The older ADO.NET framework includes classes for reading a table or view, for setting a filter to limit the rows in the result set, and for iterating through the rows in the table.
// connect is an object filled in earlier that contains the connection string
SqlCommand command = new SqlCommand(“select * from Person”, connect);
SqlDataAdapter da = new SqlDataAdapter(command);
DataTable dt = new DataTable();
da.Fill(dt);
foreach (DataRow row in dt.Rows) {
// pPeopleColumnNames was filled in with earlier code. It’s just a list of strings
foreach (string colname in pPeopleColumnNames) {
Console.WriteLine(row[colname].ToString());
}
}
connect.Close();
As you can see in this code, I just attached to the table and got back the rows I wanted, and then accessed the fields through an array notation. This is actually very similar to a way you can do it in PHP using the older-style PHP database routines. (There are newer ones also that are more OR/M based.)
Now here’s how you can access data in a MongoDB database. Again, I’m only showing a simple example, but it gives you an idea of what you can do with it.
MongoSiteSettings pCurrentSettings;
MongoCollection<MongoSiteSettings> settings =
mongolib.GetCollection<MongoSiteSettings>(“sitesettings”);
pCurrentSettings = settings.FindOne();
The GetCollection function is a helper function I had written for my own use, but it consists of only five lines that connect to the database, and return a collection object.
Notice this code has a slight similarity to the Entity Framework code: Using something similar to C++ templates (called generics in the .NET world), you can read the data from the MongoDB collection right into an object, in this case an object of type MongoSiteSettings. And you can make changes to the object, before saving it back to the collection, with a simple save function:
settings.name = “New Settings”;
settings.Save(pCurrentSettings);
C# Roundup
From a programming perspective, how do these compare? In terms of ease, they’re all close. The Entity Framework approach is especially comparable to the MongoDB code in that you get back a strongly-typed object. What I didn’t show you are the tools for generating the Entity Framework code; the code generation behinds the scenes uses a graphical interface that includes some nice visual modeling tools. The older style of reading the tables directly really isn’t all that awful either, although a bit dated in its approach.
Drawing Conclusions
Let’s be blunt: None of the code that I presented here was difficult. I’ve been doing SQL programming for about 20 years (I was on the team that developed the original ODBC drivers in the early 1990s). In the past, database client programming was kind of clunky and more than a bit painful. (Those ODBC drivers we developed included client libraries that were, frankly, pretty ugly.) But life has improved since then. There are frameworks that support OR/M and entities, and they’re really not that difficult to use. And they abstract away the actual SQL language, so if you don’t like that, you don’t have to deal with it.
And NoSQL is also pretty easy. I’ve worked with several NoSQL databases, and—as you probably realize at this point—when it comes to NoSQL, I personally prefer MongoDB. But the others aren’t very hard to use either. They have their quirks, but aren’t bad to program. Some allow for REST interfaces, and most include native libraries that make the coding easy.
So what can we conclude? Well, with the drivers here I focused primarily on ease-of-use. There are other factors that need to be considered, as well. Do they support connection pooling, for example? Do they cache? What about pulling in large amounts of data? (Hint: Most of the better drivers for most of the popular languages support cursors, so you don’t have to pull all the data in at once.) Those are factors you’ll need to investigate as you choose a driver for the language and database you’re using. But in general, virtually all the popular languages today, including Java, PHP, Python, PERL, and even C++, have nice libraries that make database programming far easier than it used to be.
As programmers we can embrace what we’re given. Most likely we’ll have our own opinions. I sure do. But if you’re doing something that lends itself nicely to SQL tables, then we can get our job done. If you’re doing something that requires complex data structures and lends itself nicely to a NoSQL database, then we can similarly get our job done.
But to wrap this up, I want to present a personal opinion that I’ve come to. You may agree or disagree; feel free to comment. With the right design, you can almost certainly map even the most complex data into a traditional, relational database such as Oracle. And with the right programming tools, you can easily pull that data into your objects and classes. But why? It’s even easier in a database such as MongoDB.
So I use both. For some projects, I use Oracle, MySQL, or SQL Server (yes, I’ve used all three on different projects) for clients who have large amounts of data that fit well into a tabular structure, and who will be doing queries that pull back thousands of records per query. (Think financial applications.) For software that’s more oriented towards pulling individual objects (such as an online organizer tool, or an online content management system that I’m presently working on), I opt for something like MongoDB.
MongoDB does great with large complex structures that are typically read in individually, while the large relational databases do well when I’m processing huge amounts of data. And no, my clients’ data needs are nowhere near as big as Google, so we don’t encounter any performance and scalability problems.
Image: Kuzmin Andrey/Shutterstock.com



Can someone provide a real world scenario where using NoSQL would be useful?
- spam
- offensive
- disagree
- off topic
Likeanonymous
As a simple example, you might have a Contacts database, and each person in the database could have varying fields. Some contacts might have several phone numbers of different types; some contacts might have several email addresses. Yes, you could normalize this into a relational database. But in this imagined application, rarely would you just get a list of phone numbers. Instead, most times you would want a name with all phone numbers associated with that name. Is it really necessary to force normalization into the picture and always store the phone numbers in a separate table, only to be joined during virtually every single lookup?
You can certainly do it either way: Store the phones in a separate phone table. Or you could use document storage and just group it all together, and then pull the data in as a single object. This is where a database such as MongoDB really shines. You can store ad-hoc records, and pull them into an object in one shot. You can index the collection on any fields you want (most likely name) and then pull the document into a single JavaScript object with one lookup.
- spam
- offensive
- disagree
- off topic
Likeseriously no linq in code samples in c# this is bias towards SQL. I can use linq to store xml documents in an sql database or to create an xml document easily like your c# example above which is easy in linq.
- spam
- offensive
- disagree
- off topic
LikeDid I miss it or was there nothing said about the security. SQL vs NoSQL. In today’s world, with the regulations and an increase in data theft, security must be a part of this discussion.
- spam
- offensive
- disagree
- off topic
LikeI have a question which doesn't seem to be answered (If it's there and I just missed it, I apologize). You've talked a great deal about creating schemas and populating/retrieving data, but you haven't talked much about what happens when the *analysis* requirements have changed?
To use your contact example, in MongoDB you can create a contact with all the phone numbers as one object that can be pulled as one operation. But what happens if down the line, a new requirement appears where you want to get a list of all contacts that have specifically have home phone numbers?
In SQL, such a requirement would be trivial to implement. But if you've stored everything in a single blob of data in MongoDB, wouldn't you need to redesign and refactor the whole database to match this new need?
- spam
- offensive
- disagree
- off topic
LikeA quick correction to the previous post. Some newlines were removed from the sample Executable English.
Here is the correct version:
for the purpose of this study, the current season is some-season
some-month is within the season that-season
for production purposes in that-season an order for some-finished-product can be filled with the alternative
some-base-product ------------------------------------------------------------------------------------------------------------------------------------------------
in that-month an order for that-finished-product can consist in whole or part of that-base-product
By the way, the vocabulary for Executable English is open, and so to a large extent is the syntax. So, authors are free to use their own words and phrases.
- spam
- offensive
- disagree
- off topic
LikeA quick correction to the previous post. Some newlines were removed from the sample Executable English.
Here is the correct version:
for the purpose of this study, the current season is some-season
some-month is within the season that-season
for production purposes in that-season an order for some-finished-product can be filled with the alternative
some-base-product ---------------------------------------------------------------------------------------------------------------------------------
in that-month an order for that-finished-product can consist in whole or part of that-base-product
By the way, the vocabulary for Executable English is open, and so to a large extent is the syntax. That is, authors are free to use their own words and phrases.
- spam
- offensive
- disagree
- off topic
LikeArguably, SQL is a terrible language for understanding what question you are asking. It dates from the 1970s, and it was good for its intended purpose back then. However, who could reliably paraphrase the following query fragment into English?
select distinct x6,T2.PRODUCT,T1.NAME,T2.AMOUNT,x5 from T6 tt1,T6 tt2,T5,T4,T3,T2,T1,T6, (select x3 x6,T6.FINISHED_PRODUCT x7,T6.ID x8,tt1.ID x9,tt2.ID x10,sum(x4) x5 from T6,T6 tt1,T6 tt2, ((select T6.ID x3,T3.PRODUCT1,T1.NAME,T2.AMOUNT x4,T2.PRODUCT from T1,T2,T3,T4,T5,T6,T6 tt1,T6 tt2 where T1.NAME=T2.NAME and T1.REGION=T6.REGION and T2.MONTH1=T4.MONTH1 and T2.MONTH1=T6.MONTH1 and T2.PRODUCT=T3.PRODUCT2 and T4.MONTH1=T6.MONTH1 and T3.PRODUCT1=T6.FINISHED_PRODUCT and T3.SEASON=T4.SEASON and T3.SEASON=T5.SEASON and T4.SEASON=T5.SEASON and T6.ID=tt1.ID and T6.ID=tt2.ID and tt1.ID=tt2.ID)...
There's a way to overcome this difficulty (and the similar difficulty with SPARQL). Specify your application in Executable English, and have the system automatically generate and run equivalent SQL.
The paper
www.reengineeringllc.com/Oil_Industry_Supply_Chain_by_Kowalski_and_Walker.pdf
describes how to write Executable English like this:
for the purpose of this study, the current season is some-season some-month is within the season that-season for production purposes in that-season an order for some-finished-product can be filled with the alternative some-base-product ----------------------------------------------------------------------------------------------------------------------------
in that-month an order for that-finished-product can consist in whole or part of that-base-product
and how to use that to generate SQL queries like the one above.
You can view, edit and run the example (and many others) by pointing a Firefox or Chrome browser to
www.reengineeringllc.com
and choosing Oil-IndustrySupplyChain1MySql1 . You are welcome to write and run your own examples.
Shared use of the system is free, and there are no advertisements.
- spam
- offensive
- disagree
- off topic
LikeFirstly, it's easy to map XML into an SQL database. You assign a unique number to each node encountered in the XML as you parse it and make it the primary key of a "node" table. You store the node's tag as a string in this table; also the node's parent node number, with zero meaning this node has no parent, it's the root; also a "sequence of this node within the parent node" number. 4 columns. You create a second "attribute" table keyed on the node number and the attribute name, with the attribute value as another column. 3 columns. You create a third "content" table to contain the text within and between nodes, keyed on the node number and a "sequence of this text element within the node" number, with the text content of the node as another column. 3 columns. This is kindergarten SQL.
Secondly, focussing on how easy it is for professional programmers to program misses the big point. Nowadays most programs are developed by end users using tools like spreadsheets and ad-hoc query languages. SQL databases intentionally facilitate this because the data is easy for end-users to access and understand, and mainline end-user programming tools like spreadsheets allow end-users to access SQL databases directly, with tight controls as to what they can do. Before SQL, all of these programs had to be written by professional programmers. There weren't enough then, there still aren't enough now.
If you're hankering for the days of programmer-as-hero, you were born 40 years too late.
My guess is that once a NoSQL database has been running for a while you'll tend to find an SQL data warehouse running behind it with periodic snapshots of the live data moving across and the users happily using the good old end-user tools that they know and love to get their work done.
- spam
- offensive
- disagree
- off topic
LikeSo what are good C++ database libraries?
- spam
- offensive
- disagree
- off topic
LikeSQL can do NoSQL using XML data types
NoSQL cant do SQL
The main problem with NoSQL is it is not ACID compliant. It is not an issue if Google returns different results to two users, it is a major issue if the bank gives you the wrong balance.
- spam
- offensive
- disagree
- off topic
Likeanonymous
GT.M is a database engine with scalability proven in the largest real-time core processing systems in production at financial institutions worldwide, as well as in large, well known healthcare institutions, but with a small footprint that scales down to use in small clinics, virtual machines and software appliances.
The GT.M data model is a hierarchical associative memory (i.e., multi-dimensional array) that imposes no restrictions on the data types of the indexes and the content - the application logic can impose any schema, dictionary or data organization suited to its problem domain.* GT.M's compiler for the standard M (also known as MUMPS) scripting language implements full support for ACID (Atomic, Consistent, Isolated, Durable) transactions, using optimistic concurrency control and software transactional memory (STM) that resolves the common mismatch between databases and programming languages. Its unique ability to create and deploy logical multi-site configurations of applications provides unrivaled continuity of business in the face of not just unplanned events, but also planned events, including planned events that include changes to application logic and schema.
Worldwide, GT.M is used in multiple industries, including finance, health care, transportation, manufacturing and others. GT.M supplies the processing power to the FIS Profile™ enterprise banking application.
* Many popular database products impose relational or object-oriented schema within the engine itself. Database engines that do not impose schemas, but which allow layered application software to impose and use whatever schema that is appropriate to the application are popularly referred to as "key-value", "document oriented", "schema-less", "schema-free" or “NoSQL” databases.
- spam
- offensive
- disagree
- off topic
Likeanonymous
(Intersytems) Caché's Multidimensional Data Server
Caché’s high-performance database uses a multidimensional data engine that allows efficient and compact storage of data in a rich data structure. Objects and SQL are implemented by specifying a unified data dictionary that defines the classes and tables and provides a mapping to the multidimensional structures – a mapping that can be automatically generated. Caché also allows direct multidimensional data access.
INTEGRATED DATABASE ACCESS
Caché gives programmers the freedom to store and access data through objects, SQL, or direct access to multidimensional structures. Regardless of the access method, all data in Caché’s database is stored in Caché’s multidimensional arrays.
- spam
- offensive
- disagree
- off topic
LikeI didn't understand the article but then I looked at the stock image and it all made sense. Good thing you included that stock image!
- spam
- offensive
- disagree
- off topic
LikeVery articulate. Like opening a window to let in some air. But I will take issue with one thing. Instead of writing, "Our space is limited here..." tell us more accurately "This isn;t the most important thing in my life..." I mean, yes, technically space in your blog is limited -- but not in any practical way which would kick in before we all drift off.
- spam
- offensive
- disagree
- off topic
LikeI think this article sums up the use cases very nicely and definitely echoes my own personal findings on when to use NoSQL vs SQL. In response to other's who mentioned no including things like ACID compliance comparison etc, I think the point of the article was to go more into details around the use cases vs the technical comparisons. There's a million articles out there that touch on the technical side.
- spam
- offensive
- disagree
- off topic
LikeGood article all around, and some additions I would like to add in the argument,.
Here are some great points of discussion for NoSQL vs SQL implementations, just from the coding basis:
1. Most relational databases have a robust engine for generating and optimizing query plans, as well as very nice analytical packages that can do things such as create OLAP cubes quickly and easily. Does this functionality justify usage of SQL over NoSQL? How complex are your queries?
2. How difficult/maintanable is it to write code for specific purposes in either paradigm? SQL can be really hard to read since it is a declarative language, but some things are way easier to write in one vs. the other
3. What sort of toolkits are provided for each paradigm. Some of the tools Java developers (Maven, subclipse, etc..) make it so easy to create a nice coding environment.
4. For analytical reporting, how will can your SQLor NoSQL implementation handle the volumes of data you are looking at? How extensible and performant is a Hadoop implementation as compared to Oracle/MySQL, etc. For an application that does parsing and aggregation based off of only a few levels, Hadoop is great.
- spam
- offensive
- disagree
- off topic
LikeLike anon, I noticed the lack of discussion of ACID, which is generally one of the major talking points both for and against Traditional SQL DBs. However I assumed it was intentional, given that any discussion of ACID in relation to NoSQL will devolve into a cost/benefit analysis of SQL at various scales, and the author wanted to focus on ease of use with both approaches.
- spam
- offensive
- disagree
- off topic
LikeORM's are not a silver bullet. Several times I've used ORMs in C# to rapidly create an application, only to spend the next few months replacing the slow dynamic SQL code with stored procedures. This creates a situation where your DB is no longer a repository, but a separate application that you must integrate with to get your data and most if not all business logic also gets moved down and locked into your DB making a change in DB technology very difficult.
So to me when writting high-performance apps with SQL the process goes like this:
1. Design DB tables
2. Generate Objects using a external APP
3. Rapidly develop app using ORM layer
4. Convert lazy-loaded calls into stored procedures
5. De-normalize tables to increase performance
6. Create separate reporting DB to prevent big reports from killing the front end sites.
MongoDB:
1. Design your object struture by hand exactly as you want to use them in your application
2. Save the entire object package as one document
3. Ensure indexes are in place so you can quicly fetch the documents.
4. Build REST API's (or whatever type of service) so other apps can work with your data
I've found that a good compromise is to design your system with 3 logical DBs the first a normal SQL DB used by your admin application to create content. The second a No-SQL DB for front-end/public/high-volume applicaiton used by the public internet, then the last DB is your analytical reporting system using cubes and all that good stuff. Then data flows from the Admin DB to the client DB when someone "Publishes" a peice of content, the client (NoSQL) db provides very fast read access and records user interactions with the content. Then you have a scheduled job that pulls the data from the client DB into the reporting system.
Since Admin, client, and reporting are often separate apps, each application team can work with data in the format that best serves the application and the transition from one system to the other is handled in the service layers.
- spam
- offensive
- disagree
- off topic
LikeC#? Java?
Seriously?
Serious article is not serious.
- spam
- offensive
- disagree
- off topic
LikeSensationalist headline is sensational. Can't wait for the next rivetting analysis, why are Macs better than PCs...oh /. how ye have fallen.
- spam
- offensive
- disagree
- off topic
LikeJeff, you're a seasoned developer, and I wonder why you missed the to note that NoSQL is just a rehash of what was dbase in its time - albeit with more emphasis on distributed computing, obviously. You also missed an important feature of RDBMS: ACID.
I'm seeing enough RDBMS treated as stuff-everything-in-key-value-pair-tables these days that you should at least hint at such a feature. And it should in fact me mentioned everytime you talk about RDBMS as for the moment AI is not close to being able to make enough sense of freeform data that we can forget proper data structuring.
- spam
- offensive
- disagree
- off topic
LikeSeriously, use the right tool for the right task - that means that sometimes a NoSQL (and yes MongoDB is great) datastore is the right thing, but sometimes it is not, you more often need a relational DB instead. Your arguments about data access is poor though - learn SQL, it's not hard. Do not try to turn the DB into something that looks native to your language, use the right tool remember - and that means using SQL. Sure, data access libraries that make mapping the data returned into your language objects is something we should have, but not to abstract the data access itself away as well. That's a poor design choice.
Anyway, check out PostgreSQL that has a new JSON column type - so you can put your JSON-formatted documents into it, index them based on the data, and still get relational linkage when needed too. All the benefits of NoSQL with all the benefits of SQL.. what could be better?!
- spam
- offensive
- disagree
- off topic
Like+1 to Akoman's comment. I quit reading the article at the first unindented code sample.
- spam
- offensive
- disagree
- off topic
LikeI think you neglect the difficulty level of scaling up with RDBMS and the maintainability and extensibility of having to map data. Oracle RAC is complex in itself, let alone trying to scale out the storage behind it. Examples in other databases like sharding also are difficult to setup, maintain and debug. As for the mapping, if you want to restructure or refactor your model, you have to change the n-tiers of code and schemas that exist just to do a simple thing like adding a field or even changing its name (not its label).
- spam
- offensive
- disagree
- off topic
LikeFirst Slashdot BI article that did not feel like a cut and paste from press releases. Keep it up!
- spam
- offensive
- disagree
- off topic
LikeHierarchical databases predate relational databases. For certain circumstances, their usage still makes sense. So what is ancient history is now new again.
- spam
- offensive
- disagree
- off topic
LikeYawn
- spam
- offensive
- disagree
- off topic
LikeIt's a shame none of the suggested relational databases are true open-source ones. PostgreSQL is the obvious alternative to Oracle, MySQL, and SQL Server. The upcoming 9.2 version (currently in beta) even includes a built-in JSON type. Combining that with some of the existing PostgreSQL facilities, like the hstore storage type, gives many of the advantages claimed for NoSQL--all co-existing with fully relational storage too.
- spam
- offensive
- disagree
- off topic
LikeThe code samples are unreadable. Remove the double-spacing and add some indentation. Syntax highlighting would be nice too, but the first two steps will bring the readability to adequate levels.
- spam
- offensive
- disagree
- off topic
LikeThis is a very useful article. Please, more comparison pieces and fewer 'news' items. Thanks.
- spam
- offensive
- disagree
- off topic
LikeConversation from Twitter
@sbelhadj http://t.co/l5pJeRfe
Conversation from Facebook
Do not trust the machine. Good old stickers are still the best base for your data.
lame article (n00bish), rediscovering the wheel
The choice is clear: - They both have the same amount of calories. - NoSql is slightly higher in saturated fats. - Sql is high in trans fatty acids. - Sql lowers quality of breast milk.
One is clearly better
Flat files