Contributed by Sandra Wiecki
With digital transformation, software has become the most important tool to attract, keep and grow customer accounts. For a company to stay competitive in a market, its digital offerings need to stay up-to-date with modern technology, cool competitive features and growing user expectations.
Digital offerings are now a business imperative, as companies can easily lose clientele because a competitor has a better website experience, an easier-to-use mobile app, smarter customer service, or cloud-based offerings.
Thanks to all of the above and unlike a physical product, software can be modified almost in the blink of an eye. Some companies release software every two weeks while others make changes many times a day.
The Rise of NoSQL
Relational database management systems have dominated the IT landscape for more than 40 years and they still are the most reliable and secure options today. However, they have not been designed for all of the workloads of the 21st century. Hence the rise of new models.
This is why unstructured data types like JSON, and databases to work with them, emerged. NoSQL does not describe one single technology; it is rather a variety of non-relational technologies and architectures aiming to address the challenges of new use cases.
Benefits of JSON
While designing a database schema for a relational database often involves a team of developers, database architects, DBAs, and business users, creating a JSON document does not.
With JSON, developers have the flexibility to store any kind of data without prior planning, which allows them to start development sooner. They can also go through many iterations of data changes without having to rely on and wait for a DBA to implement those changes. All they need to do is change their application code. This is why many developers love JSON.
Due to its flexibility, JSON is often used for unstructured, non-standard, or rapidly changing data.
JSON also has a performance benefit over relational data. When storing all related data about a user, process or thing within one JSON document, “joins” become mostly unnecessary. Joins are costly and reducing them to a minimum saves query time.
One good example to demonstrate a valid use for the JSON data type is a B2C catalog. While some data types are static, easily defined and common to all items, other data might not be. One can assume that every product has a name and a description and probably some other data in common. Not every product has data like “batteries included”, “water resistant depth” or “age restriction”. While data patterns are best stored in a relational data type field, unusual product properties can be stored flexibly using a JSON data type.
Another valid use case is the collection of data from various sources – sensor data for example. When using sensors from different vendors, data might be submitted in different formats. While a relational database would require this data to be standardized, JSON allows the storage of this data as is.
JSON is a non-relational data type. Hence when using JSON, you are giving up some of the benefits of relational database models, such as the relational structure, schema control, and data governance.
While NoSQL’s flexible data structure is its greatest benefit, it can also be a disadvantage.
The relational model aims to normalize data to eliminate redundancy and reduce storage. The NoSQL data type does not. If ten employees work for the same department and the same manager, the department name and the manager’s name will be stored 10 times. This introduces data redundancy and a possibility that data gets out of sync. The manager’s name might be spelled “Johnson” nine times and “Jonson” once. Querying for employees working for Mr Johnson will now show nine employees instead of ten.
Many applications, especially off-the-shelf applications, require a fixed data structure to be able to work with the data. Using JSON might not be an option in this case.
Some vendors base their database entirely on NoSQL. Besides offering JSON’s flexible data model, these technologies and architectures are designed to scale-out horizontally to cope with big data. This scalability comes at a price though.
In order to achieve this level of horizontal scalability some NoSQL-only technologies trade data integrity. Instead of ACID (Atomicity, Consistency, Isolation, Durability) compliance, which is the foundation of database transactions, these databases offer BASE (Basic Availability, Soft-state, Eventual consistency).
While this trade-off can be easily made for some use cases, it should not be made in others.
This might be true for extreme cases of big data that need to be captured, but losing a click here and a “like” there is not critical to your business. If that is the case, a NoSQL-only technology will do the job.
While this means that you are giving up the relational view of data within the database itself, EDB Postgres helps you to integrate this solution with the rest of your data, thereby building a relational view on top of NoSQL-only databases.
EDB Postgres Data Adapters allow you to connect to external data sources like MongoDB or Hadoop to query and join data with data in EDB Postgres building a data platform viewing your enterprise data in one single place making it accessible for company-wide analytics through a standard SQL interface.
NoSQL with EDB Postgres
PostgreSQL is a traditional relational DBMS, but has been adapted to the changing needs of data management. It has become a multi-model database, offering NoSQL capabilities with many traditional relational benefits. PostgreSQL is also object-relational, meaning that it can add new complex data types and the operators required to handle them and allow it to extend and accommodate new capabilities like JSON support. For the EDB Postgres Platform, EnterpriseDB (EDB) extends PostgreSQL with enterprise-class performance, security, and management enhancements.
Relational data helps you to see relations between data. When having different records about one particular user or process, a relational database makes it easy to identify those relationships to help you gain more insight into behaviour or processes than just collecting data.
Due to EDB Postgres’ relational capabilities, you can add check constraints on JSON nodes to validate data or make sure that some nodes must not be null.
EDB Postgres also offers ACID compliance. This means that NoSQL can now be used in database transactions where data modifications have to either be guaranteed or rolled back. ACID guarantees that the database is at all times in a consistent state or can be recovered to a consistent state. This is not the case with all NoSQL database vendors.
EDB Postgres also has reliable multi-version concurrency control (MVCC), which allows every single query to see a consistent point-in-time snapshot of the data, instead of seeing data that has been added or modified after the query was started. This functionality is crucial to pull valid data from a database in a multi-user environment.
While I think that NoSQL is great for flexibility, I see that many enterprises do not want to fully trade the benefits of the relational data model for horizontal scalability, especially when horizontal scalability is not even required by the application.
We see the advantages of NoSQL—including an accelerated time to market—but we also see that over time data structures evolve. With JSON, EDB Postgres allows you to start developing using a flexible data model. Once data patterns emerge, you can implement those structures as relational data types without the effort of migrating to another database.
NoSQL is a great opportunity to flexibly develop applications and to get them out to your staff and customers sooner, allowing you to manage your digital transformation staying ahead in competitive markets.
Relational databases stand firm and have not lost in importance. Instead of replacing relational databases, I believe that NoSQL is a valuable addition to them.
EDB Postgres offers NoSQL as a capability embedded in its relational framework for data integrity, reliability and better insight into how data relates to other data giving you the best of both worlds.
When horizontal scalability is paramount, you can leverage the capabilities of NoSQL-only data stores with EDB Postgres. EDB Postgres allows you to eliminate data silos by integrating NoSQL only databases into your data platform to make best use of all your enterprise data.
In any case, it makes sense to be clear about the requirements and the desired outcome of your project. Make sure to talk to us about finding the best data management solution.
Sandra Wiecki is Director, Product Marketing at EnterpriseDB.