In this week's New Tech Forum, VoltDB CTO Ryan Betts looks at relational databases and JSON data structures and shows how and why they can be combined to offer the best of both worlds. -- Paul Venezia
JSON's benefits and challenges: Agility, structure, and interactivity
JSON is the data structure of the Web. It's a simple data format that allows programmers to store and communicate sets of values, lists, and key-value mappings across systems.
As JSON adoption has grown, database vendors have sprung up offering JSON-centric document databases. Now, increasingly, traditional relational-style databases are integrating JSON features, resulting in a best-of-both worlds benefit to developers and database administrators.
Application developers must manage both code and data. Code is verbs, or the instructions and descriptions of how to perform a task. Code is the recipe. Data are the nouns: users, locations, recordings, amounts -- the ingredients the recipe combines. As more application developers adopt JSON as their preferred data format, the need is growing for JSON-friendly databases. Few coding tasks are more annoying or more bug prone than mechanically translating information between formats.
As a consequence, several NoSQL document store database vendors have chosen JSON as their primary data representation in a stark break from traditional relational schemes used by MySQL, PostgreSQL, VoltDB, MS SQL Server, Oracle and others. This is a natural fit for developers who use JSON as the data interchange format in their applications.
Additionally, the relative agility of JSON (JSON records are well structured but easily extended) has attracted developers looking to avoid painful database schema migrations in agile environments. Data and schema, in volume, can be hard to change. Rewriting a large dataset stored on disk while keeping the associated applications online can be time consuming. It can take days of background processing, in moderate to large examples, to upgrade data.
In contrast, JSON's lack of a predefined schema makes upgrades easy. Developers can store and update documents without restrictions.
Document vs. relational databases
Of course, eliminating restrictions and allowing arbitrary data in your database can have its downsides, too. Giving up the relational database model has drawbacks for developers, enterprise architects, and the businesses they serve. In fact, relational databases originally came to popularity displacing systems similar in structure to today's JSON document stores.