We have all asked ourselves this question when starting a new project. Should I ditch SQL and jump on the NoSQL train? Maybe you are starting to cave into pressure form your peers to embrace the sweet promises that come with ditching your trusty relational database. Whatever the case is, let’s go over some of the pros and cons of ditching SQL for the NoSQL approach.
A brief history
SQL or Relational databases hail from the later part of the last century, sometime in the 1970s this revolutionary way of storing and retrieving data became incredibly popular. As this approach grew in popularity so did the available versions or flavors. SQL databases use structured query language. This language is extremely lightweight and easy to understand. There are notable differences between different version of these languages, but thankfully there are standards in place to make the differences very manageable. One important thing to note is that SQL implements pre-defined schemas which are strictly enforced.
NoSQL or Non Relational databases are a departure from the relational model, thus the name. However you’d be surprised to learn that these types of databases have been around for a very long time, however they did not gain wide acceptance or popularity until around the year 2010. Each flavor or implementation of this approach can have its own query language, this lack of standardization cane sometimes be a deterrent to adoption, but it has not hindered the explosive adoption of this model across industries, especially those managing large data sets. In contrast to SQL, NoSQL query language is non-declarative by nature.
- Data is stored in tables with mutable but pre-defined Columns. Records are stored as Rows in these tables.
- Implements the ACID database model, which basically means it favors consistency over availability.
- Scalability is mainly achieved by increasing the resources on the host, usually this means more cpu, memory, storage or network capacity.
- Data can be stored as documents, key-value pairs, tables and graphs.
- Implements the BASE database model, which basically means it favors availability over consistency.
- Scalability is mainly achieved by spreading datasets across multiple servers.
Every project presents us with unique challenges. There is no one tool which can be said to solve all of our problems, however doing your homework before picking a solution greatly reduces the chances you might run into design or scalability problems and improves your odds for success. When making a decision you should take a few things into consideration. What kind of data are you looking to store? How often will it need to be updated and/or retrieved and what are the performance and availability requirements of the project. Given what you now know about these systems, it helps making an informed decision much easier.
Here are some options to consider for your next project:
- Microsoft SQL Server (SQL)
- Oracle (SQL)
- MySQL (SQL)
- MongoDB (NoSQL)
- Azure CosmoDB (NoSQL)
- Apache Cassandra (NoSQL)
Which database do you prefer or have used in your latest projects? Why did you choose it? Let us know below!