SQL versus NoSQL

For the uninitiated, databases come in two varieties:

  • Relational databases: These use SQL (with minor variations) for querying the database
  • NoSQL databases: These can store unstructured data and use the database specific query language

Relational databases have been around for a long time now, and a lot of effort has been put into optimizing their performance and making them as robust as possible. However, the reliability and performance requires us to plan and organize our data into well-defined tables and relationships. Our data is bound to the schema of the database tables. Anytime we need to add more fields/columns to our table, we will have to migrate the table to a new schema, and this would require us to create migration scripts that take care of adding the new fields, and also to provide conditions and data to fill the newly created fields for the already existing rows in your table.

NoSQL databases tend to have a more free-form structure. We need not define schemas for our tables since data is stored as a single row/document. We can insert data of any schema into a single table and then query it. Given that the data is not confined to schema rules, we might end up inserting wrong or ill-formed data into our database. This means that we will have to deal with ensuring that we retrieve the correct data and also have to take precautions to ensure that data of different schemas do not crash the program.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset