NoSQL vs SQL, My Takeaways
By: Hunter Campbell
Tags: Sql, Computer Science, Database, NoSQL, Programming

NoSQL vs SQL, My Takeaways

Photo by Taylor Vick on Unsplash

I’ve been wanting to learn a database (db) language for sometime now but have had the hardest time deciding on which one to use. So in the spirit of learning, I decided to put pen to paper (fingers to keyboard) and share my findings to A) solidify my understanding and B) hopefully help someone else along the way. Let’s first start by doing a quick Google search. What you’ll find are a number of options such as MySQL, MongoDB, PostgreSQL, Oracle, Apache Casandra, DynamoDB, etc… This list keeps going but we’ll stop there for simplicity purposes. By this point you can already see the “rabbit hole” and feel your curiosity pulling you in. Or if you’re like me, you may be starting to back peddle a little. But have no fear, for we are going to break this topic down into two questions that will at least help you divvy up your choices a bit. Let’s begin…

For starters we can already divide this group in half, (with the exception of PostgreSQL which is a hybrid of both) SQL and NoSQL. This is the real question in which you need to ask yourself when first learning a db. You see, a SQL db is a relational database and a NoSQL db is a non-relational database. Now at this point you may find yourself asking… “what the heck is a relational and non-relational database?”. Once again let’s go a bit further in the breakdown.

SQL

As in the name, Structured Query Languages (SQL) utilize a static schema for data storage. In layman’s terms, a SQL db stores your data under a specified set of rules that can’t be changed without affecting your entire data store. This is why they are referred to as a relational db. Because all of your data is structured the same it can be organized based on its shared relation to the schema. Think of it this way, if you were building a brick wall you wouldn’t want find wooden beams in your materials halfway through wood you (see what I did there)? No, you woodn’t (I did it again). Not saying that it would be impossible to incorporate the beams in your wall but it would affect the overall structure and ability of the wall itself, aka your database store. Though structure may seem limiting at first it actually makes for simplifying the learning process. If you know the rules then you know how to play the game. Lastly let’s take a look at its scalability. SQL databases are vertically scalable meaning that you can increase a server’s capacity by adding RAM, CPU or SSD.

NoSQL

Hopping over to NoSQL databases we find pretty much the opposite. First off, a NoSQL db is a non-relational database because it follows a dynamic schema, or ever-changing schema. The data you store can be saved without much forethought on how it should be organized or shaped. The tactic here is as your data store grows in size, it organizes itself slowly based on what your data contains, a lot like chaos theory for those of you out there with a larger CPU than myself. Looking at scalability, NoSQL databases are said to be horizontally scalable which allows them to take advantage of sharding, or adding servers to handle increasing load size.

Takeaways

With that in mind, when choosing a db for your project or just to learn, ask yourself if adjusting your data schema down the road is likely, or better yet is it even following a schema. If you can answer these questions then you should be able to at least trim your choices in half between the types of databases. Your next question should be based on which db makes more sense to you and your price range. I recommend visiting each database’s website and reading their documentation/product pricing pages in order to make your decision.

My last takeaway is that to me it looks like NoSQL databases may be a better choice for a startup/early years business due to how fast things can change for a young company. The ability to not worry about how your data is structured and being able to let it grow and evolve over time is freeing in a sense that it will allow the owner/creator to focus on the business itself. On the other hand, for a well established organization that already has guidelines put in place a SQL db is the obvious choice.

I hope this article has been a good use of your time and has been written well enough to explain the major differences in databases out there. If you enjoyed it please leave a clap at the bottom of the article or if you have any suggestions please leave a comment. Thanks for reading!