Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

It's just nonsense for me personally. I can't see any performance boost by using NoSQL instead of SQL. Maybe SQL over NoSQL, yes but not in that way.

I think that if I answer "I have no idea" or something like that it will be bad answer because this doesn't really look like a fake-question, it's a serious question on interview but how should be looking correct answer on this question?

Or am I missing something about NoSQL?

share|improve this question
3  
If you can't see a performance boost, that's what you say. Fact is that most of the NoSQL solutions forgo one (or more) of the ACID properties of a relational database, so they do less. –  Oded Nov 12 '12 at 9:58
1  
There are some workflows (and data structures) that can't easily be mapped to a traditional ACID-enabled relational database. For those, you can see huge performance increases by using a NoSQL database. If, however, you simply take an existing (well-designed) SQL DB and put it into a NoSQL Database, then your performance will surely suffer. –  Joachim Sauer Nov 12 '12 at 9:59
7  
Because X is always as fast as X, X cannot be faster than X, therefore "No SQL is faster than SQL. All SQL are as fast as SQL." –  user281377 Nov 12 '12 at 10:05
3  
Why's are cars faster than trucks? Well, not all cars are faster than all trucks. This is a silly question. The correct answer is to immediately question the premise and then wonder why the company is letting someone with such an unsophisticated understanding of databases interview programmers. –  GrandmasterB Nov 12 '12 at 16:38

7 Answers 7

up vote 22 down vote accepted

There are many NoSQL solutions around, each one with its own strenghts and weaknesses, so the following must be taken with a grain of salt.

But essentially what many NoSQL databases do is rely on denormalization and try to omptimize for the denormalized case. For instance, say you are reading a blog post together with its comments in a document-oriented database. Often the comments will be saved together with the post itself. This means that it will be faster to retrieve all of them together, as they are stored in the same place and you do not have to perform a join.

Of course you can do the same in SQL, and denormalizing is a common practice when one needs performance. It is just that many NoSQL solutions are engineered from the start to be always used this way. You then get the usual tradeoffs: for instance adding a comment in the above example will be slower because you have to save the whole document with it. And once you have denormalized, you have to take care of preserving data integrity in your application.

Moreover, in many NoSQL solutions it is impossible to do arbitrary joins, hence arbitrary queries. Some databases, like CouchDB, require you to think ahead of the queries you will need and prepare them inside the db.

All in all, it boils down to expecting a denormalized schema and optimizing reads for that situation, and this works well for data that is not highly relational and that requires much more reads than writes.

share|improve this answer
    
This, by the way can be realized with simple materialized view, or a cache layer, while still benefiting from all the SQL goodness. Anything properly modeled is relational, and logical data duplication is not a solution (the mat. view is a duplication but not a logical duplication because it is simply an image of something else). –  Morg. Oct 17 '13 at 11:54
    
As I have said in the answer, one can do the same in SQL; it is just that when this becomes the rule instead of the exception, NoSQL databases are usually faster and more natural to use. In theory, SQL is the best model one can use, but when data grows over a certain size, it just cannot accomodate some models, and data duplication becomes faster and easier to reason about. –  Andrea Oct 17 '13 at 13:55
    
That's bull. The relational model covers everything you can make in NoSQL and so much more. The only advantage of NoSQL is that a simple and inconsistent approach to scaling is built in and easy to use. It has nothing to do with SQL, and everything to do with not caring about ACID properties. You can have sync jobs between independent SQL nodes that will have exactly the same (very bad) scaling and consistency properties the NoSQL stores have. The difference is that SQL nodes can ALSO have consistency if you choose to. –  Morg. Oct 18 '13 at 14:25

The thing you are missing about NoSQL is that NoSQl cannot be compared to SQL in any way. NoSQL is name of all persistence technologies that are not SQL. Document DBs, Key-Value DBs, Event DBs are all NoSQL. They are all different in almost all aspects, be it structure of saved data, querying, performance and available tools.

So if someone asks you such question on interview, this should be the answer.

share|improve this answer
    
That's what I feel when I hear the question but I think your answer is not what interviewer does expect to get. The question is build in way that I feel alike there is some NoSQL "killer-feature" that I don't know... –  Heather Nov 12 '12 at 10:10
    
If there's one killer feature of NoSQL I'd say it IS the scalability. That's why the Facebooks and the Googles use it. Because of the gigantic volume of Data. NoSQL : when you have to deal with enormous amounts of Data. –  Pieter B Nov 12 '12 at 10:35

'NoSQL' (or more precisely: non-relational) databases give up some features of the traditional databases for speed, but more importantly for horizontal scalability.

The missing features depend on the concrete product, in general full ACID properties or even join operations are not supported. That is the price for the increased performance.

share|improve this answer

You're right, it would be nonsense to state that in a blanket statement. Which is probably the whole point; instead of a single answer, the interviewer is probably expecting you to reply with questions to help you figure out what the context of the problem is (what kind of data, how much of it, in what operating environment etc), the particular NoSQL solution. They'll try to find out how you analyse problems and along the way get an idea how much you know about the different solutions that are out there.

share|improve this answer

NoSQL databases normally only make sense if you design your data around them.

If you intend to simply use them as a RDBMS replacement, then you might get less performance rather than more, especially if you don't have enough budget to pay for servers with high amounts of RAM.

Look at this article which compares MySQL disk space usage with that of MongoDB: http://blog.trackerbird.com/content/mysql-vs-mongodb-disk-space-usage

share|improve this answer

Which NoSQL database? Which SQL database? If someone tells you that NoSQL is faster than SQL then you should walk away. Or better yet watch this video:

http://www.youtube.com/watch?v=b2F-DItXtZs

I won't say half the things claimed about NoSQL are wrong, but I will say that there is a lot of NoSQL fanboyism out there from people who really don't understand it very well.

SQL has its limits (of course) but it also is a very mature technology, which is well understood, and has a large pool of developers who understand how to use it well. I can not say the same for all forms of NoSQL.

share|improve this answer

NoSql supported by column oriented databases where RDBMS is row oriented database... And say for example we have a Employee table with Name, Age, Salery, Address, EmployeeId etc... we put same table in MySql (RDBMS support) and HBase (NoSQL support). If a customer/client writes a query to get the average Age or Salery details from 1Lakh employees records... what happens?

In RDBMS it will go around each row and collects the value and sum & divide for resulting. When it comes to Columnar database no need to worry about all one lakh row iterations. But deal with only one Row which is faster to compute. So this way sometimes NoSQL is faster than SQL. This case NoSQL don't care about ACID complaints are worth!

share|improve this answer
1  
I've fixed the formating a bit, though I'm not sure what you are trying to get between the two. And ACID isn't always supported by RDBMS either. –  MichaelT Sep 4 '13 at 4:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.