SQL vs. NoSQL
Take a look at the most recent developments between SQL and NoSQL databases. And remember, make your DB decision based on the project, not on the hype.
Join the DZone community and get the full member experience.Join For Free
despite the traditional relational db world, there's also a trend toward nosql. the nosql databases enable storing unstructured and heterogeneous data. the enhanced scalability have helped grow their popularity to a greater extent in the current market. horizontal scaling means the organization doesn't have to worry about the underlying infrastructure. conceptually, data is stored in json files. in fact, sql 2016 has a feature to support json queries, just like support for xml. the ability for data to scale out naturally takes advantage of nosql's characteristics.
many of us think that sql is the oldest type of db that we have, so it might be surprising for you to know that nosql existed before sql’s usage exploded in the 1990s. nosql is as old as the 1960s; however, they have gained traction lately with the eruption of several options like mongodb, cassandra, and hbase. the choice does not depend on the benefits and disadvantages of these database systems, rather it’s the type of web applications you deal with and the results you expect from a query system. it’s really hard to define nosql. you will get a lot of information and opinions on what nosql is all about. this is just my understanding and experience when using nosql.
nosql is a definitely different from relational databases. nosql is often used to refer to data management systems that are "not sql" or an approach to data management that includes "not only sql." there are a number of technologies in the nosql category, including document databases, key-value stores, column family stores, and graph databases, which are popular with gaming, social, and iot apps. nosql, the non-relational db, can be classified under key-value pair, document oriented type, column family, and graph.
it’s all about
- open source.
- no join.
- humongous volume of data.
- easy development.
- easy administration.
other factors such as license cost, business process, and organization decisions play a major role in opting for the brand of nosql, but relational db’s are still very good for various scenarios and answers our long-term questions.
with nosql, and thus without acid-compliance, it's very difficult to write reliable software even though it follows the cap theorem. it is clear that without acid, the developers have to spend a significant fraction of their time building extremely complex and error-prone systems. also, this totally depends on the business decision and use cases. there is a lot of new development and research taking place to come out with stable nosql products.
there are always pros and cons when choosing a database product, but it’s all driven by the business case. the cost and the decision need to be worked out at the management level. there is a new mindset in many organizations to try and go for nosql products — thinking of the lower expense and maintenance overhead. most of the time, only the project life cycle phase may give an insight of success or failure of the implementation. if you hear someone saying that nosql overpowers sql and is better, you may end up in making a bad decision if you run with that. remember, none of them supersedes the other. nosql is not a replacement for sql, but an alternative to it in some cases.
the problem is that when you have a tremendous amount of data scattered across multiple systems, it’s nearly impossible to maintain transaction consistency that satisfies all the acid properties. but as technology grows and matures, the data consistency and integrity can be easily handled. a lot of work is in place to add sql (querying) support to the query data layer, as it gives the flexibility to query and design complex reports. this is the only reason, and it's hard to say it’s a schema-less design, as it’s indirectly bound to the schema.
differences between sql and nosql
sql : mssql, oracle, mysql,maria, ibm db2, sybase, microsoft azure, and postgres
nosql : mongodb, bigtable, redis, ravendb, cassandra, hbase, neo4j, oracle nosql, and couchdb.
types of nosql databases
the least complex nosql option, which stores data in a schema-less way that consists of indexed keys and values. examples: cassandra, azure, leveldb, and riak.
column store — or wide-column store
it stores data tables as columns rather than rows. it’s more than just an inverted table — sectioning out columns allows for excellent scalability and high performance. examples: hbase, bigtable, and hypertable.
taking the key-value concept and adding more complexity, each document in this type of database has its own data and its own unique key, which is used to retrieve it. it’s a great option for storing, retrieving, and managing data that’s document-oriented but still somewhat structured. examples: mongodb and couchdb.
here, the data is interconnected and best represented as a graph. this method is capable of lots of complexity. examples: polyglot andneo4j.
the choice of the database between sql and nosql cannot be concluded on the differences between them but the project requirements. if your application has a fixed structure and doesn’t need frequent modifications, sql is a preferable database. conversely, if you have applications where data is changing frequently and growing rapidly, like in big data analytics, nosql is the best option for you. and remember, sql is not deceased and can never be superseded by nosql, or any other database technology.
all the technologies are best in what they do. it is up to the architect/developer/dba to make a better use of them depending on the situations and needs.
Published at DZone with permission of Prashanth Jayaram, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.