Slashdot Mirror


SQL Vs. NoSQL: Which Is Better?

Nerval's Lobster writes "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. Tech writer (and programmer) Jeff Cogswell examines both sides from a programming perspective."

56 of 306 comments (clear)

  1. Flamebait in Headline by Fwipp · · Score: 5, Insightful

    SQL and NoSQL are different, with different use cases.

    1. Re:Flamebait in Headline by medv4380 · · Score: 5, Funny

      Actually the headline is a typical news headline stated as a questions. So the answer is always no.

    2. Re:Flamebait in Headline by Jeremiah+Cornelius · · Score: 4, Insightful

      "Hammer or Shovel! Only one of these will leave the room as the single, ULTIMATE TOOL!"

      I believe, in such cases, that the answer is always "The Ohio Players".

      --
      "Flyin' in just a sweet place,
      Never been known to fail..."
    3. Re:Flamebait in Headline by s.petry · · Score: 3, Insightful

      Exactly! As with all technology each has a purpose. I remember the old days when all we had was binary databases, the reason for the SQL was that the binary blobs could not do everything needed. While I find it interesting that we have seen a lot of growth in the older technology, it is not something new. SQL won't be going away, just like NoSQL never really went away (it just saw negative to no growth for a very long time).

      Remove the bias and fan boy status and what do you have? You have 2 technologies to choose from which can get the job done regardless of your use case.

      --

      -The wise argue that there are few absolutes, the fool argues that there are no probabilities.

    4. Re:Flamebait in Headline by gl4ss · · Score: 4, Insightful

      The heated battle is mostly heated because Google keeps throwing oil into fire. Oracle and Microsoft gladly showed that relational big corporate databases are much faster and better than NoSQL. But Google keeps promoting their own shit because it's their own shit. And it's shit.

      that statement makes no sense. just answering the headline with "BABABABA" makes more sense.

      maybe if the submitter of the article had included an actual scenario..

      --
      world was created 5 seconds before this post as it is.
    5. Re:Flamebait in Headline by Anonymous Coward · · Score: 5, Funny

      SQL and NoSQL are different, with different use cases.

      No. Wrong. Clearly, $CHOICE is superior in all cases. If you think you've found a situation in which !($CHOICE) is better, you're obviously using $CHOICE wrong and should RTFM before you EVER say anything against it again, n00b.

    6. Re:Flamebait in Headline by Eponymous+Hero · · Score: 4, Insightful
      agreed. even the summary is nothing but provocation.

      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

      too bad the ones perpetuating the fight haven't grown up.

      Tech writer (and programmer) Jeff Cogswell examines both sides from a programming perspective.

      no thanks. how about we just talk rationally about scenarios in which you would prefer to use one or the other? how about speaking intelligently about the benefits of both, and how they should be properly used, instead of giving any attention to the bickering that is only going on by people who don't know how to use either one properly?

      check out this gem FTA:

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

      you mean the developer actually has to do his job? the developer actually has to tell his ORM what he's thinking, and organize his objects in a way that makes the data well understood? shudder to think. "i thought it was all drag and drop in visual studio, i never became a programmer to WRITE CODE!!! omg!!"

      but wait, here's #3 in their list:

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

      look, it's just #2 written a different way. why should i care what incompetent programmers and dbas think about nosql? i eat their breakfast for lunch everyday.

      --
      insensitive clod overlords obligatory xkcd car analogy russian reversals whoosh pedant fanbois ftfy in 3...2...1..PROFIT
    7. Re:Flamebait in Headline by GuldKalle · · Score: 3, Interesting

      The name noSQL itself is flamebait.
      But yes, a much more informative article would br: SQL or NoSQL - when to use what.

      --
      What?
    8. Re:Flamebait in Headline by Anonymous Coward · · Score: 5, Insightful

      Last I checked, Google is not selling "their own shit" as a product.

      I am speaking here as a professional SQL developer with nearly a decade of experience and a very solid knowledge of relational theory. For many of the things we use relational DBs for, they are the best solution. But there are a lot of other applications for which a RDBMS is overkill, and a tool like BigTable is ideal. There are others where a single XML file would be better. There are others where a simple text file would be better.

      If people would stop arguing that you have to use a jack-hammer to solve a problem best suited to a ballpeen, we wouldn't have these arguments.

    9. Re:Flamebait in Headline by SQLGuru · · Score: 4, Insightful

      And thus, the answer (as in most cases with technology) is "it depends".

      There is no one tool to rule them all. The various languages and technologies were created to solve a specific problem that a different tool or technology didn't quite address well. SQL is great. NoSQL is great. Both have their place. The key is using the right tool for the problem and to quit thinking one is better than the other.

    10. Re:Flamebait in Headline by VGPowerlord · · Score: 4, Funny

      SQL and NoSQL are different, with different use cases.

      No. Wrong. Clearly, $CHOICE is superior in all cases. If you think you've found a situation in which !($CHOICE) is better, you're obviously using $CHOICE wrong and should RTFM before you EVER say anything against it again, n00b.

      Ah, but then you have to look at the implications of $UNRELATED_PROBLEM. After all, $CHOICE can't $BUZZWORD1, at least not without support for $BUZZWORD2.

      Once $CHOICE supports those, then maybe it'll be better in all cases.

      --
      GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
    11. Re:Flamebait in Headline by marcosdumay · · Score: 2

      Not relational databases are the only possible tool for companies that have a usage pattern similiar to Google's. In the real life, that set includes Google, and nobody else.

    12. Re:Flamebait in Headline by Dragonslicer · · Score: 5, Funny

      Complex objects that contain objects and lists inside of them do not always map directly to a single row in a single table.

      This is so true. If only relational databases had a way to connect a row in one table to a row in another table. It would be even more awesome if it could connect a row in one table to more than one row in another table. Just imagine if you could, I dunno, like, join the data together or something.

    13. Re:Flamebait in Headline by i_ate_god · · Score: 2

      And thus, the answer (as in most cases with technology) is "it depends".

      There is no one tool to rule them all. The various languages and technologies were created to solve a specific problem that a different tool or technology didn't quite address well. SQL is great. NoSQL is great. Both have their place. The key is using the right tool for the problem and to quit thinking one is better than the other.

      Every time I see this debate, this is what I always see. "it depends"

      it depends on WHAT?! NoSQL people keep touting features, SQL people keep touting history, neither say "well, RDBMS is best suited for [insert descriptions here], while MongoDB is best suited for [insert descriptions here] and Lucene/Solr is best suited for [insert descriptions here]".

      --
      I'm god, but it's a bit of a drag really...
    14. Re:Flamebait in Headline by Sarten-X · · Score: 5, Insightful

      That's because the factors for the "it depends" answer depends on other aspects, like the exact characteristics of your application. Here's some rules of thumb:

      NoSQL is good for statistics, where a few missing records won't matter. It's good for absorbing an enormous number of write operations at high speed. It's good for parallel computation across distributed data sets. It's good for when you have a lot of data to store, and little insight into how it will be queried in the future (management loves this one).

      RDBMS is good for absolute consistency. It's good for serving an enormous number of parallel reads at high speeds. It's good for legacy applications, and applications that have to interface with legacy applications. It's good for small-scale projects that just need to work now. It's good for compatibility.

      Of course there are exceptions to every statement I just made, but the nuances are subtle. Just bear in mind that NoSQL is generally more about single-record storage, where a RDBMS is by nature based around sets. If your algorithms are more easily applied to one model over the other, it might be a good indicator of what kind of storage to look at.

      --
      You do not have a moral or legal right to do absolutely anything you want.
    15. Re:Flamebait in Headline by PhrstBrn · · Score: 3, Informative

      Every time I see this debate, this is what I always see. "it depends"

      it depends on WHAT?! NoSQL people keep touting features, SQL people keep touting history, neither say "well, RDBMS is best suited for [insert descriptions here], while MongoDB is best suited for [insert descriptions here] and Lucene/Solr is best suited for [insert descriptions here]".

      RDBMS is better for dealing with transactions. NoSQL is really bad at dealing with transactions, as they don't guarantee immediate consistency (and if they do, it comes with a huge performance cost, slower than that of an RDBMS). NoSQL is better for general data warehousing. You can do data warehousing with a RDBMS, it's just extremely inflexible at that task.

    16. Re:Flamebait in Headline by afidel · · Score: 3, Informative

      It very much depends on the kind of data warehouse. If it's a financial data warehouse I think using NoSQL is insane (we report to the SEC out of our data warehouse, transactional integrity is important!). If your data warehouse is just trying to answer the question "what do users of my social media site find interesting" then sure, go at it with a NoSQL solution. Ultimately with NoSQL you're trading data integrity for performance/scalability, which is fine as long as you understand what the tradeoff is.

      --
      There are 4 boxes to use in the defense of liberty: soap, ballot, jury, ammo. Use in that order. Starting now.
    17. Re:Flamebait in Headline by LordLucless · · Score: 3, Insightful

      In that case, I think the answer to "what is the greatest tool?" would be "the person asking the question".

      --
      Just because you're paranoid doesn't mean there isn't an invisible demon about to eat your face
    18. Re:Flamebait in Headline by curunir · · Score: 2

      The name noSQL itself is flamebait.

      It's also incredibly misleading. If they'd named it correctly, it would be NoACID. That's the real issue at hand...making a different CAP compromise. The programming interface is really not that big of an issue. Yes, it's different, but as programmers we should be able to adapt to both fairly easily. What really is important is how to achieve high scalability. People have rightly zeroed in on the fact that if your application can tolerate eventual consistency, that problem can get a lot easier than the ACID-compliant data stores. The fact that those data stores all use SQL is more of a coincidence or a byproduct of the history of how databases developed rather than a fact of life...you can have a non-ACID SQL database and you can have an ACID non-SQL database.

      The whole article is wrong-headed as it only examines the programming interface which is, for the most part, unimportant. A valuable discussion of the topic would have examined what an ACID-compliant database would need to do to achieve the kinds of scale that a non-ACID database can and would have looked into the kinds of application logic that would be necessary to cope with the eventual consistency situation in non-ACID databases. Instead we got a primer on how to use both types of databases without any why, when or gotchas.

      --
      "Don't blame me, I voted for Kodos!"
    19. Re:Flamebait in Headline by williamhb · · Score: 2

      Last I checked, Google is not selling "their own shit" as a product.

      They were trying to work on a product like that, but they just couldn't get it polished.

  2. "No" by Anonymous Coward · · Score: 5, Informative

    "No".

    1. Re:"No" by TeknoHog · · Score: 3, Funny

      *sigh* Oh, for fuck's sake, some hipster asshole found that someone coined some convenient, soundbite-sized phrase, so now all the we're-definitely-not-sheep! are going to think they're smart and clever by linking to it every other fucking article, aren't they?

      No.

      --
      Escher was the first MC and Giger invented the HR department.
  3. Stupid question by adturner · · Score: 5, Insightful

    Might as well just ask: Which is better a BMW M3 or Ford F350 4x4 with 6.7 diesel?

    Both are great, have their place and will get you from point A to B, but neither are a practical replacement for the other.

    My current programming project is a mixture of Cassandra and Oracle (although, to be honest, I'd rather be using PostgreSQL or even MySQL).

    1. Re:Stupid question by Anonymous Coward · · Score: 2, Interesting

      Might as well just ask: Which is better a BMW M3 or Ford F350 4x4 with 6.7 diesel?

      Both are great, have their place and will get you from point A to B, but neither are a practical replacement for the other.

      My current programming project is a mixture of Cassandra and Oracle (although, to be honest, I'd rather be using PostgreSQL or even MySQL).

      ^ This.

      I am the architect of a NoSQL solution based on Hadoop (and some of its other related projects). The value Hadoop adds to our organization is undeniable ... but so are the traditional RDBMS where we store distilled information from our Hadoop cluster.

    2. Re:Stupid question by Villageidiot9390 · · Score: 2

      One question that I've always had: Why do people still use Oracle or other big name, expensive RDBMS when there are open-source offerings as complete as PostgreSQL? Is it a matter of organizational momentum?

    3. Re:Stupid question by lambent · · Score: 4, Informative

      Ability to tune for performance on know hardware; better permissions structures; ability to get support from the company; data security, replication, backup; clustering; not wanting to reinvent the wheel using man-hours when you can more easily pay for a known working solution that is well documented ...

      etc. There are a lot of reasons.

    4. Re:Stupid question by rtaylor · · Score: 2

      Have you ever tried suing Oracle?

      It might give you a target but you've not going to extract anything from them except perhaps 3 months credit on the licensing costs.

      --
      Rod Taylor
    5. Re:Stupid question by The+Dancing+Panda · · Score: 4, Insightful

      Not necessarily. MSSQL and Oracle come out as legitimately faster in many use cases. MSSQL is generally easier to set up and use in a small to midsized application than most other offerings, and the code written to use the database can be easily migrated from SQL Express all the way to MSSQL enterprise. MySQL is great, but has been shown to not perform as well on giant data sets. Oracle usually wins in those cases, but it is a BITCH to configure. MSSQL also supports a lot of different data types natively.

      The Open Source solutions are great for a small project, but from many DBAs I've spoken to, don't scale well.

      I should note that I use MySQL on all my home projects. It works wonders. But I wouldn't choose it if I was looking to do something that requires blazing fast query speeds. MS and Oracle have some good products here, despite Oracle not being able to design a user interface to save their lives. MS is good because they bought it, but the Management Studio is quite nice to work in (MS is very good at making developer tools).

    6. Re:Stupid question by marcosdumay · · Score: 2

      Ability to tune for performance on know hardware

      That means you don't know the hardware you buy for other companies, only from Oracle?

      better permissions structures

      Yes and no. In some ways the permission structure of Postgres is more versatile than Oracle's. In other ways it's not. The differences between the big DBMS are getting less and less relevant each day.

      ability to get support from the company

      As oposed to the ability to get support from hundreds of companies, all with the same level of access to Postgres as Oracle's people have to Oracle, and with as competent people. Oh, and as a bonus, you get to deal with Oracle. They are a great company at parties.

      data security, replication, backup

      Are you joking? Are you really implying Oracle does something here that Postgres doesn't?

      clustering

      Oracle is way behind on clustering.

      not wanting to reinvent the wheel using man-hours when you can more easily pay for a known working solution that is well documented ...

      Now you are joking! Well documented?! If you don't want to reinvent the weel, you should use a DBMS that actualy do things for you, instead of one that is stuck at last century's features.

  4. MySQL vs MongoDB by djbckr · · Score: 5, Funny

    I'm sure many of you reading this have seen this, but it's still funny anyway... http://www.youtube.com/watch?v=b2F-DItXtZs

  5. Dumb question by dissy · · Score: 4, Insightful

    Replace "SQL" with "hammer" and replace "NoSQL" with "Screw Driver" and then ask the question again. You will see how silly it actually is.

    The right tool is best for the particular job at hand, always. If you refuse to define the job, it is not possible to guess ahead of time which tool will be better for it.

    1. Re:Dumb question by steelfood · · Score: 3, Insightful

      You don't even have to leave computer science for an analogy. Is a hash map better than an array?

      That's effectively the question. Those who cannot answer this question have no business writing code.

      --
      "If a nation expects to be ignorant and free in a state of civilization, it expects what never was and never will be."
    2. Re:Dumb question by gbjbaanb · · Score: 2

      unfortunately, there's a lot of people who seem to want to say "use the best tool" and then try to make everything work in a single language (most commonly Java and .NET programmers).

      I see this with the introduction of ORMs - its like programmers don;t want to learn SQL (the tool of choice when using databases) and instead want to make the DB look like a collection of objects. The NoSQL proponents seems also to make the same mistake - that NoSQL is somehow better because you access the data using an API that is native to your language.

      Its a sad indictment of the modern programming community (well, those lesser programmers at least), but I think this is the main driving force behind it all. Blame the holy wars for all this, otherwise we'd be (correctly) talking about NoSQL as just another data storage technology along with relational databases and flat files that has specific use cases.

    3. Re:Dumb question by spiffmastercow · · Score: 2

      unfortunately, there's a lot of people who seem to want to say "use the best tool" and then try to make everything work in a single language (most commonly Java and .NET programmers).

      I see this with the introduction of ORMs - its like programmers don;t want to learn SQL (the tool of choice when using databases) and instead want to make the DB look like a collection of objects. The NoSQL proponents seems also to make the same mistake - that NoSQL is somehow better because you access the data using an API that is native to your language.

      Its a sad indictment of the modern programming community (well, those lesser programmers at least), but I think this is the main driving force behind it all. Blame the holy wars for all this, otherwise we'd be (correctly) talking about NoSQL as just another data storage technology along with relational databases and flat files that has specific use cases.

      I have quite the background in database development, tuning, and pretty much everything to do with DBA work minus the backups, but I love ORMs. Most ORMs these days produce quite good SQL, and they reduce development time dramatically -- especially if you model your DB from your data classes instead of vice versa. Is there a performance hit? Maybe -- you'd be surprised how often the ORM spits out better code than an experienced SQL developer. If there is a performance deficit, you can take care of that mostly with indexing, which is an automatic or nearly-automatic process on most currend RDBMS's. Unless you need the absolute tightest possible code, there's no reason to sink a bunch of resources into something that takes up all your time and ties your implementation to a specific external dependency.

  6. The answer to all "Which is better" questions... by Jason+Levine · · Score: 4, Insightful

    Here's the answer to pretty much every "Which is better" question:

    - Option 1 is better in cases where option 1 provides more advantages and less disadvantages than Option 2.

    - Option 2 is better in cases where option 2 provides more advantages and less disadvantages than Option 1.

    - In cases where neither Option 1 nor Option 2 provide a clear advantage/disadvantage distinction, neither is better and either may be used depending on preference.

    Rarely is the answer ever "X is better than Y in all possible cases."

    --
    My sci-fi novel, Ghost Thief, is now available from Amazon.com.
  7. SQL for Some Projects ... by eldavojohn · · Score: 4, Funny

    Kang: SQL for all.
    *crowd boos*
    Kang: Very well, NoSQL for anyone.
    *crowd boos*
    Kang: Hmm... SQL for some projects, miniature NoSQL implementations for others.
    *crowd cheers*

    --
    My work here is dung.
    1. Re:SQL for Some Projects ... by arth1 · · Score: 2

      SQL for some projects, miniature NoSQL implementations for others.

      That's the problem - pretty much every NoSQL implementation that calls itself NoSQL are heavy java apps.

      My rules of thumb:
      - Don't put a database to do a hash table's job.
      - If the reason for the database is that maybe, in the future, someone might want queries run against the data, store the data raw now, and put it in a database then.
      - If you have everything in X, and X will do, don't change it for the reason of changing it.

  8. Re:Which is better? A Bus or a bicycle ? by greg1104 · · Score: 2

    This is very close to providing the car anology I was looking for, but it just misses the bus on that.

  9. Re:No! by greg1104 · · Score: 3, Informative

    Betteridge's Law of Headlines is the rule you're looking for.

  10. an Oracle DBAs perspective by Anonymous Coward · · Score: 5, Interesting

    For generic applications that do not have a vast amount of user volume or data set size, NoSQL or any SQL Generator is fine. It is also fine for most of the standard and generic go down a primary key query or do a simple join. However, the more complex queries on larger systems need reviewing. The biggest problem with NoSQL is developers just don't want to be bothered and expect their procedural logic to automatically run in a 20 terabyte database that gets over a million hits a minute. This is the higher end for systems I work on, but it also happens in smaller ones.

    We get by far the worst SQL submitted to us by developers who generate SQL and in general don't know anything. Large Databases rarely stay extremely well normalized. There are rarely data architects around to enforce this. Developers who are in a hurry to meet deadlines denormalize and just add columns. When you do this, over time your sql gets more complex and query generators are not very good.

    Query generators can generate alot of basic sql, but as time goes on requirements get more complex. Developers are building on what other developers did before them. A lot of this data is not normalized and have ridiculously complex logic. We generally get emails from developer going 'this query is slow' and that is it. Or we get I did a query just like this before, but this one is slow. The query generator may be making queries on the fly. So they think its the same thing, but its actually different.

    One other thing that often happens that people overlook is that these tools generate too much SQL. Instead of getting data in 1 sql statement and have a normalized set of tables, I have clicked a button and run 15 sqls serially. When you get alot of traffic, the round trips and the CPU increase adds up. Developers don't know this is happening because it is all done behind the scenes.

    I have had developers with over 10 years experience (some up to 30 years) who can't even figure out the following:

    1. why a query that returns millions of records is slow or can understand the question of 'what the hell is the user going to do with all this?'
    2. why taking fields out of the 'where' clause can affect the query. Dude, cause your no longer using an index.
    3. why running the same query millions of times in a loop would be slow (this is serial). databases are optimized to do stuff in straight sql. Ok this one is not really easy to get at first and it won't be obvious, but if you have done this for 10 years you should have seen it and if I tell you this 5 times and you keep doing it... seriously. This is not that hard.
    4. how different parameters can affect a query. If you run a query that brings back one record, then change the parameters and it has to go through 500 gbs of data your response time will slow down a bit right?
    5. 'it worked in dev'. your Dev DB had tables with 10 records. Prod has 20 terabytes of data. We have told you that prod is much bigger. So you need to atleast check to see if its using an index. This is NOT difficult and I show them how, but they don't care.
    6. your queries are 'slow' because your query generators run 26 queries(serially) when I click this one button. You can combine these to 4 or less and if you pay more attention to the data model and let us making a few simple changes we can get it to 1. However, the 4 i am giving you is fine for now. i can even show them how to audit their sessions activity and how to run a simple query to see what is going on. They click a button and they can see exactly what is happening in the DBA. Most don't care.

    My biggest beef is I tell them what is wrong, I try to explain to them why this is a problem and the vast majority just don't care. They ignore and then do the same thing again. Apparently they don't care that I am subject to 24x7 paging on this stuff and I can't go home if users are complaining, while the developers can go home to their families.

    My other beef is that SQL is not that hard. Its easier than coding. I have been a developer before

    1. Re:an Oracle DBAs perspective by ahem · · Score: 2

      You shouldn't have posted this anonymously. I think it's great that you've identified the key friction present in all software development efforts: tossing the product over the wall and assuming the downstream person will fix it. Whether it's a product owner tossing incomplete requirements to a developer, a developer tossing code without unit tests or non-performant code to a tester, a tester not validating whether the code will really run in prod, or an operations person blindly deploying whatever comes down the pipe.

      All of these non-communicative behaviors work together to create a sub-optimal user experience (and pissing off the people who benefit from the system you build is a self-defeating practice, since they're the ones that indirectly sign your paycheck).

      --
      Not A Sig
    2. Re:an Oracle DBAs perspective by vlm · · Score: 4, Insightful

      Let me put in the "answers" you probably get from noob programmers.
      1) I don't know what a WHERE clause is so I SELECT * and use if statements on each row of the gigs of results
      2) I don't know what a index is
      3) I don't know what a JOIN is so they wrote one in software
      4) ... I donno some workplaces need employee drug testing?
      5) I don't have a real DEV box. Oh I've got a box that endusers can't reach full of non-production code, but I don't have a DEV box that I can test real code on real data. You could simulate a 20 TB prod by provisioning a 2 TB dev on a virtual image of only 1/10th "power", at least for linear scale problems (and the major problems are never linear scale anyway)
      6) I don't know what a GROUP BY is

      I've also done both DBA and code and I can now look back and laugh at my earliest coding. Every noob does stuff like this.

      I have had developers with over 10 years experience (some up to 30 years)

      The world is full, not just devs, but the whole world is full, of people who have 60 "first six months" of experience over and over and over. Some folks just never learn.

      --
      "Science flies us to the moon. Religion flies us into buildings." - Victor Stenger
    3. Re:an Oracle DBAs perspective by garett_spencley · · Score: 2

      "My other beef is that SQL is not that hard. Its easier than coding."

      Right. As you said:

      "SQL is just a programming language."

      It's not SQL that can trip a developer up, it's understanding how the RDBMS stores and fetches data, builds indexes and optimizes queries. It's a little like understanding how the compiler will optimize your code, but then it goes even further.

      For example, it would be easy for a developer to be tempted to store a UUID as a primary key in an InnoDB database for a user session table, since to do otherwise would be adding a redundant ID field, not knowing that InnoDB stores it's rows with the primary key index and thus orders all inserts by primary key.

      It's also not always clear how to make full use of indexes ... especially when you need to optimize ORDER BY's (which as you would know can't always be done, and thus need to rely on narrowing the result set as much as possible before the sort), and it's not always obvious how adding a second column in your WHERE or by using aggregates on your indexed columns can make using the index impossible. Those aren't really SQL issues, they're DB issues. Heck, the entire concept of an index has nothing at all to do with SQL (unless you're doing something directly with the index on the schema, but then developers rarely touch the schema when there's a DBA involved) .

      You're absolutely right, though, that a competent developer would take the time to learn as much of this as possible. DBAs are in an unfortunate situation because it's tempting for the developer to adopt an attitude of "That's why we have a DBA." I definitely sympathize with you.

    4. Re:an Oracle DBAs perspective by bob8766 · · Score: 2

      As a DBA my solution to this is first and foremost, to make sure the developer and tester are on call. If I get a call in the middle of the night because of their code, they are going to get one as well. The developer is going to check in and build the fix I create, and the tester is going to test it. Losing sleep for a few nights waiting for the build to complete and tests to finish tends to cure these kinds of issues. They also tend to be a little more dilligent about letting their DBA review their code before they check in.

  11. Re:One point for NoSql Data bases by zifn4b · · Score: 2

    Typically Sql developpers tend to throw everything into the data base, then create marvelously large queries, and finally pout when you complain about performance, that "if they had had the time they would have some stored procedures, and the server is too slow anyway...."

    This should be marked as flamebait. This is only true of some developers i.e. those who are ignorant about RDBMS. They should make it their business to understand RDBMS especially in large scale applications where performance is critical. This particular aspect alone forces any developer or DBA to have think "hard" about the structure of their data such as transactional vs. analytical needs. If used appropriately, an RDBMS can be quite intuitive and performance/space efficient. It all comes down to understanding the tool you're using. If you don't know how to use a screw driver or a hammer, you probably shouldn't be using it!

    --
    We'll make great pets
  12. Re:Legit question by serviscope_minor · · Score: 4, Insightful

    NoSQL does make developers' lives easier, though, because they don't necessarily have to think about their data in advance,

    I've heard claims like these a lot, and I must say that I've never understood them. Programs maniuplate data. I just don't see how you can write a program without knowing about your data. It makes no sense.

    --
    SJW n. One who posts facts.
  13. Wrong person doing analysis by aristotle-dude · · Score: 3, Insightful

    "Tech writer (and programmer) Jeff Cogswell examines both sides from a programming perspective."

    Irrelevant. The data exists to serve the needs of the business and programmers/developers work to serve those needs. The company should chose the best tool for the job which is a usually a relational database as it serve the needs of the "business" the best in most cases. If you are looking to see which is easier for you then you are a shitty programmer and you need to upgrade your skills to understand how to work with relational databases. You should not be dictating what storage methodology is used for the data.

    To be a competent developer, you need to have some understanding of how databases work because you cannot rely on the DBA to babysit all of the projects. You should understand what indexes are, the difference between and inner and outer join and when you can use each time and you should test your code against a large data set to find any bottlenecks on the database side.

    --
    Jesus was a compassionate social conservative who called individuals to sin no more.
    1. Re:Wrong person doing analysis by sbjornda · · Score: 2

      The data exists to serve the needs of the business and programmers/developers work to serve those needs.

      +1. Every developer should be made to write 100 times on the whiteboard: "The data belongs to the enterprise, not to the application."

      Data architecture is a discipline in itself, not something a developer does off the side of his/her desk.

      --
      .nosig

  14. ignoring history, are we? by sribe · · Score: 5, Informative

    For the past 40-some years, relational databases have ruled the data world.

    Bullshit.

    In 1972 hierarchical databases ruled the world (with a few network-model attempts here and there) and continued to do so well into the 1980s. In fact, the theory behind relational databases had only been articulated and published in June 1970. In further fact Oracle wasn't founded until 1977, and didn't ship anything until 1979, and they were the first to successfully promote that new-fangled "relational" stuff in a commercial product--prior to that IBM kept it locked up in the lab, except for some very obscure "mostly demo-ware" things, so it wouldn't threaten their then-current cash cow: IMS. IBM's entry into the relational database world, in the early 1980s or so, was a direct response to the growing sales of Oracle.

    Also in the 1980s we got: Sybase, Informix, Ingres, MS SQL Server. Then in the 1990s we started getting open-source RDBMSs, along with actually robust versions for Windows-based servers. Then in the 2000s holy crap we even got good database servers on Macs!

    Anyways, relational databases have really only "ruled the world" for the past 20 some years ;-)

  15. Best tool for the job by ianare · · Score: 2

    As other have said, there isn't one that's "better" than the other in a general sense. However, there are situations in which one is better suited to a task at hand.

    This is of course something that applies to many different aspects of application design and architecture.

    As an example, I'm developing a high volume, high transaction website application and use both PostgreSQL and MongoDB.

    We use SQL where strict relations, type checking, and data integrity are required. The SQL database has the extremely important function of making sure the data given to it by the application is coherent. I realize that MongoDB has functions for checking data integrity, but it is tricker to get right in my opinion and experience (it does allow greater flexibility however). Also, the application has the need for atomic operations and transactions, which MongoDB does not provide.

    MongoDB on the other hand, is used where it delivers better performance than PostgreSQL. For example all our logging is sent there, giving near-disk performance while allowing quick and easy searching and archival. Our session is also handled by MongoDB. Finally we make great use of gridFS for all our uploaded content and document storage. We're also looking into MongoDB for data analysis and reporting, fed data from SQL.

    So there's no reason to pick one over the other, a mix and match approach will yield better results. Where tasks require greater speed and have loose integrity requirements, go for NoSQL. When the data absolutely needs to be coherent and is by its nature relational, go for SQL.

    Also, PostgreSQL will soon support embedding JSON objects directly, so some sort of hybridization is foreseeable in the future. As of now we simply put the Mongo ID in SQL when we need to reference.

  16. Re:The answer is "yes". by Bill_the_Engineer · · Score: 2

    Currently the NoSQL folks seem to have a stronger tendency to do this, but that's a problem with the culture, not the tools.

    I think it has more to do with inexperience than culture. The inexperienced tend to gravitate to the shiny hammer and look at all the problems as nails. The experienced have the skill set to pick the right tool for the job.

    New tools tend to attract more inexperienced developers since they haven't developed much of a preference and seem to be the most affected by hype. This ultimately leads to the new tool being used in all cases (regardless of suitability) instead of the correct or more appropriate tool.

    Notice that I'm not saying that the new tool is inferior, just being misused.

    --
    These comments are my own and do not necessarily reflect the views or opinions of my employer or colleagues...
  17. Huh by Safety+Cap · · Score: 4, Interesting

    Speaking as a professional SQL Developer with OVER TWENTY YEARS of experience, an RDBMS is not the answer to every problem. Sometimes NoSQL makes sense.

    For example, if I'm dumping some random user data that will never be formatted/standardized/normalized—that can be different domains for every user—NoSQL might be the right choice.

    Maybe I want to store a user's favorite object (puppy, car, toy, steak 'doneness') and I don't want to have a child-table-from-hell lookup table. NoSQL is a great option.

    On the other hand, if I want to do some sort of row lookback, then it is far easier in a relational DB. For example, if I want to find the salary average and of all of people in the same department as the most recent new hire or the average working 'lifespan' (how long before the person quits, gets fired or dies) of every department vs. their salary range*, then it is pretty easy.

    Now get off my lawn.

    * Yes, real-world examples.

    --
    Yeah, right.
  18. You know ... by bhunachchicken · · Score: 2

    I've been coding professionally for 11 years, have been hobby coding for about 20.

    Recently, I've been exposed to Agile, Scrum, XP, TTD, User Stories, Sprints, Pair Programming, and now NoSQL. All these things, I have to say, are contributing massively to my strong considerations to hang up my mouse and keyboard.

    My first experience of Agile was working for an investment bank where they decided that, no matter if the code was buggy or was only partly complete, we would push it out to the clients. No problem, our next sprint would fix the bugs. Another project I worked on saw me having to attend hours and hours of meetings, filling out small cards to stick to white boards, listening to people who have no relevance to my project talking about what they were doing, and constantly giving estimates to project managers so that they could make further adjustments to later sprints. When I finally sat down to code that day, it was about 3 lines. I wasn't allowed to work on anything else, because that hadn't been assigned to this sprint. Fun.

    I recently had a telephone interview with a man who spoke to me for 40 minutes straight about agile and did not ask me one single technical question. Nothing on Java, Spring, Hibernate, XML, SQL, or anything else listed on my CV. He even wanted to know whether I used physical note paper or software for details the tasks and user stories. When he asked me two days later if I would like to come in for an interview, I declined. I want to code, not work for a bureaucracy.

    I remember when coding was fun and we didn't have to adopt all these so-called methods. I have no idea what NoSQL is, all I remember is someone at my last contract deciding we were going to use it and then teaching everyone how to query using JSON or Javascript or whatever. It took us a few weeks to get our heads around the idea, and I have to wonder what the benefit of writing Java-JSON-Mongo DB interfaces were over SQL. He did not do this because the project needed it, but because he had heard about the system and wanted to shoe horn it into the project. Seriously, that was the only reason.

    I'm not even sure what Agile is, to be honest. I think it's just some fancy term used by managers to make it sound as if they're being efficient and know what's happening.

    One has to wonder exactly what was wrong with the previous approaches. We all still had working software 6 years ago, from what I remember ...

  19. Re:Programmers should NOT be allowed to write SQL. by pigiron · · Score: 2

    I disagree, especially for inserts and updates. There should be no raw SQL embedded in programs. Most programmers are most decidedly not competent in the relational model (the very existence of numerous NoSQL fanbois is a testament to this fact.) Indeed, even many DBA's aren't either as the job is rife with far too many sys admin types rather than people that are concerned that they do a properly normalized logical model as a mandatory first step before physical implementation.

  20. Re:Programmers should NOT be allowed to write SQL. by DragonWriter · · Score: 2

    There should be no raw SQL embedded in programs.

    That's kind of different than programmers not writing SQL. Since SQL is strings, and there shouldn't be hardcoded strings embedded in programs, it stands to reason that there shouldn't be raw SQL embedded in programs.

    That doesn't mean that programmers shouldn't write SQL, or that non-programmers should be writing stored procedures so that programmers can avoid writing SQL.

    Most programmers are most decidedly not competent in the relational model (the very existence of numerous NoSQL fanbois is a testament to this fact.)

    While I agree that most programmers aren't competent in the relational model, the solution isn't to accept that and ban programmers from writing SQL, its to demand that programmers -- at least those working on the model side (less reason for concern from programmers doing, say, pure UI work) -- be competent with the relational model, which is fundamental to understanding data. Further, while I agree with your conclusion, it doesn't follow from the evidence you cite: proficiency with the relational model doesn't mean that you have an obsessive need to have either a RDBMS or a DBMS that speaks SQL (which aren't the same thing, as you can be either without the other) used for all data storage needs. Understanding the relational model is fundamental to effectively modelling data, whether its going to be stored in a black box where someone else has implemented the relational model for you or not (probably moreso when "not".)

    Indeed, even many DBA's aren't either as the job is rife with far too many sys admin types

    That's why they are called data base administrators. Data modelling and database development are more related to programming than to database administration.

  21. That's what I get for trying to use humour by Safety+Cap · · Score: 2

    I was tweaking the AC's reliance on Argumentum ad Verecundiam, which is (often) a fallacy.

    I looked up alternatives to Alzheimer's, and Pick's Disease looks like an introvert-troll/basement-dweller's dream. Check out the list of behavioural and emotional changes.

    --
    Yeah, right.