SQL:
The age-old standing solution to persist data in a query-able manner has stood the test of time. It started with Web 1.0 and is still serving in Web 2.0. SQL databases store data where rows placement takes precedent over the columns, i-e singular rows are expected to be of more importance to ensure foreign key constraints across tables. This ensures the strong consistency of keys within the table and across the tables as well. Moreover, SQL provides a lot of precise filters to operate on attributes within the table and complex joins to go beyond a table. It also provides enriched features to what goes within your table, I-e you can define constraints other than your keys.
NoSQL:
NoSQL originated with the birth of Web 2.0. Web 2.0 became quickly abundant with data at rest and in transit. SQL faced dire consequences of the bulk of load moving in and out. Those were the few challenges that were faced by SQL databases. NoSQL tackled the problem by being able to shard horizontally. But, in order to be able to shard horizontally, shards used the concept of hash maps to distribute table keys. Columns took exclusive precedence instead of rows for the access pattern. This had a reason, in order to bulk load values, the row-by-row access pattern had to be removed. It solved two problems, the first one being bulk loading data by fetching the entire columns and the other one being column values share more resemblance than row values, so, it yelled better compression ratios. But data embedding and establishing relations across tables became a problem since there is no foreign key to extend the relations. This was partially solved by the massive reduction in storage prices. NoSQL SQL proffered storing data with relations within the same table even if it meant replication of some attributes to favor speed. NoSQL doesn’t provide constraints on attributes. So, a faster speed with a less grip on the data than SQL.
Graph:
Graph databases contain a mix of both two. Based on graph theory, it uses a linked-list data structure that captures the qualities of SQL and NoSQL databases. Graph databases provide precedence over the row operations but distribute the entities by hashed node ids. It provides NoSQL-like columnar distribution but has relations to serve as foreign keys to establish relationships with different entities without creating replicated data. Complex join operations requiring foreign keys are replaced with an already established path between nodes, called relationships. Labels are just a columnar grouping of nodes with a logical category that speeds up columnar queries. It provides constrains on attributes as well and is still schema-less like NoSQL but provides the grip of data like SQL.
Top comments (0)