SQL vs NoSQL

Structured Query Language (SQL), the standard language for relational database management systems, is known for its reliability. This stalwart has allowed computers that are processing large and complex data to do it faster and more effectively since it was developed by IBM in the 1970s.

But a greater need for faster and more adaptive databases has arisen, which is why the NoSQL system was developed more than a decade ago. Forrester research calls NoSQL “critical for all businesses to support modern business applications” and notes that half of global data and analytics technology decision makers either have implemented or are implementing NoSQL platforms.

NoSQL databases can store and manage data both quickly and flexibly. Google, Amazon, Yahoo and Facebook have all had a hand in developing these databases as they sought to store their content or processive data for their websites. SQL databases cannot be scaled horizontally across thousands of servers – whereas NoSQL can.

Amazon says that NoSQL databases “are a great fit for many modern applications such as mobile, web and gaming that requires flexible, scalable, high-performance, and highly functional databases to provide great user experience.”

Still, NoSQL isn’t perfect for all situations. For one thing, SQL is seen as having greater data consistency than NoSQL (with only one or two NoSQL systems having strong consistency). For another, some applications, particularly financial, demand the kind of safeguards and consistency that are the hallmarks of SQL. However, other applications can benefit from strong consistency in NoSQL – it simplifies the programming as developers no longer have to account for inconsistent data scenarios. Given the minority of NoSQL systems have the best of both worlds, it’s often up to organizations to determine the right database for the right application.

Financial graphic

Choosing the right database system

As more companies embrace data and all it has to offer, they may be faced with the dilemma of how to choose the right software solution that not only fits their needs, but also supports their business strategy.

“The availability of choice in NoSQL databases, is both good and bad at the same time,” says Pramod Sadalage, director of ThoughtWorks Inc. “Good because now we have choice to design the system according to the requirements. Bad because now you have a choice and we have to make a good choice based on requirements and there is a chance where the same database product may be used properly or not used properly.”

One of the first steps to making the right choice is understanding the options. Among them:

  • Distributed database management systems (DDBMS). This is a type of database management system (DBMS) that manages a number of databases hosted at various locations and are tied together through a computer network. It supplies mechanisms so that users see it as a single database despite the distribution.
  • Relational Database Management Systems (RDBMS). This is a database program and the basis for SQL. A relational database means that the database stores data in a structured way using rows and columns. This makes it easy to locate and access specific values within the database. The “relational” aspect refers to the fact that the values within each table are related to one another. Or, tables are related to other tables. This enables users to run queries across several tables at one time. A drawback is the need for table “joins”, which greatly slow analytics considerably as the need to combine pieces of data across tables can be paramount. According to the American National Standards Institute (ANSI), the standard language for relational database management systems is SQL.
  • Non-relational database. Just as its name implies, a non-relational database is one that doesn’t use the “relational” rows and columns. Instead, it employs a storage model that is set up for the specific requirements of the type of data that needs to be stored. In this way, it is more specific in the type of data it supports and how the data can be queried. Non-relational data historically hasn’t been considered a good fit for transactional data, which is used for things like purchases, payments or subscriptions. While in practice NoSQL means “non-relational database,” many of these databases do support queries that are compatible with SQL.

Embracing NoSQL

When organizations are considering NoSQL, it’s often because they fear failure without it. But organizations need to do their homework to ensure they make the right decision. Here are some common questions about NoSQL:

  1. How is NoSQL different than SQL?The simple answer is that each one stores data differently. Specifically, SQL uses a “schema,” which is used to define how data that is composed will be put into the database. SQL schema is more rigid than the more flexible NoSQL schema.
  2. What’s the advantage of using NoSQL?

    With it’s more free-form style, any data can be stored in any record. This gives an organization faster access to data, an important consideration if you really need speed and simple accessibility over reliability or consistency. Another advantage: If you don’t want to be tied to a specific schema because you may want to make changes later, NoSQL allows you to do so, even with large amounts of data. NoSQL requires less management with automatic repair, easier data distribution and simpler data models.

  3. What are the disadvantages of NoSQL?Not every application will succeed under such flexibility. SQL provides more safeguards and greater consistency than NoSQL databases. At the same time, NoSQL is still the new kid on the block and there are potential problems that go along with being untested in many situations.
  4. What are the types of NoSQL?There are four basic types: key-value store, document-based store, column-based store and graph-based store (though you can build graph on top of key-value). Key value is designed for storing, retrieving and managing associative arrays, a data structure known as a hash table. A good fit for key-value databases would be for storing session information, user profiles, preferences and shopping cart data. Document-based stores documents composed of tagged elements, and may be the most useful to content management systems, blogging platforms and web analytics. With a column store, data is stored in cells grouped in columns of data rather than as rows, and is also considered a good fit for content management, as well as expiring usage. Graph based has a flexible graph representation. It is often ideal for scalability concerns and where there are problem spaces such as connected data that is used in things like social networks.
  5. What are the consistency levels for NoSQL?The two most common consistency models are either ACID (atomic, consistent, isolated, durable) or BASE (basic availability, soft-state, eventually consistency). With ACID, once the data is written, you will be able to access the data and get a consistent view of it. With BASE, once data is written, it will eventually appear for reading, which is why it is seen as having looser consistency. The majority of NoSQL databases don’t provide ACID guarantees, which may not be a big deal when talking about having to wait a few moments to see a Facebook post. But if an organization is dealing with billion-dollar financial transactions, then that may be opening the door for fraud. (Note, there are just a couple NoSQL systems that have some form of strong consistency). Choosing the consistency needs to be decided on a case-by-case basis.
  6. How does NoSQL scale up?Scale out? NoSQL databases use distributed clusters of hardware to scale up, and are considered to be cheaper and more scalable that SQL databases. The flexible, schema-less model can store, process and access various types of business data, while providing greater control over data storage and processing. Some enterprises are using relational databases along with NoSQL, while others are scrapping their relational databases in certain scenarios because they get a better performance and scale at a lower cost with NoSQL.
  7. What about server costs for NoSQL?The bottom line is that NoSQL databases are cheap and open source. NoSQL typically uses inexpensive servers to manage fast-growing amounts of data and transactions. This can be an important consideration if an organization can’t afford costly RDBMS databases that use big servers and storage systems. Since there are options in how NoSQL systems store data, they can use less or more servers, but typically at the detriment of some other performance characteristic.
  8. What’s the most popular way NoSQL systems store data?There are a few, but the most common is in-memory (DRAM). In-memory has fast performance characteristics, but since DRAM is expensive, it can be costly to scale out. In addition, multiple copies of data need to be stored for redundancy as in-memory data isn’t persistent.
  9. What other storage mechanisms exist for NoSQL?

    The complementary storage mechanism is on-disk, but performance degrades significantly with typical NoSQL systems. The benefit is fewer servers, however. Aerospike, however, combines the best of both worlds with their Hybrid Memory Architecture™, which only stores indexes on DRAM yet persists data on disk, with yet the same performance levels of in-memory. Aerospike also has All Flash, which preserves 95% of the performance but has all the data on disk, condensing server footprint. Lastly, Intel has their Optane DC Persistent Memory, which has the performance of DRAM with the persistence of disk, also for much higher data densities

  10. What are some of the best use cases for NoSQL?

    If your organization wants to provide a personalized experience, then it’s going to require a lot of data from demographics to behavioral – and the flexibility of NoSQL is just the ticket. Other top uses can be profile management, real-time big data, content management, catalogs, customer 360-degree view, mobile applications, the internet of things (IoT), digital communications and fraud detection (which is also dependent on behavioral analysis). Organizations that need low latency, high scalability and speed for large amounts of data find that NoSQL gives them the responsiveness they need.

  11. What’s the future hold for NoSQL?

    There are a number of innovative features for NoSQL that are being developed, according to Forrester. Among them: greater automation that helps speed up NoSQL deployments and support more complex applications with little effort. In addition, open-source NoSQL solutions “are stable and ready for primetime,” Forrester reports.

Many organizations will use both SQL and NoSQL databases because there are instances where organizations need the fixed schema, vertical scalability and predictability of SQL. Then, there are other situations that call for NoSQL with its flexibility and horizontal scalability. The key is defining the requirements needed for a database and then choosing the one that will provide the best support for the project.

When, Where & Why to Use NoSQL? eBook

To learn more about these tell-tale signs and how Aerospike can help, download our white paper, “Five Signs You Have Outgrown Redis.”

Matt Bushell

Matt Bushell, Director of Product Marketing

Matt is the Director of Product Marketing for Aerospike, responsible for the creation and execution of both inbound and outbound messaging and materials including the company website. Matt has also served in similar capacities at both Nlyte Software and Pluribus Networks. He worked at IBM for more than ten years, helping to launch multiple products in their Information Management and SMB groups including DB2 10. Matt has both a bachelors in engineering and a masters in engineering management from Northwestern University and an MBA from their Kellogg School of Management.