JSON Relational Duality is a landmark capability in Oracle Database 23c that provides game-changing flexibility and simplicity for Oracle Database developers. This breakthrough innovation overcomes the historical challenges that developers have faced when building applications, either when using the relational model or when using the document model.
JSON Relational Duality delivers a solution that provides the benefits of both relational tables and JSON documents, without the tradeoffs of either model.
The relational model is very powerful and efficient since it uses data normalization to ensure data integrity while avoiding data duplication. Relational operations make modeling and accessing data very flexible, however, in some cases, it is not always the easiest for developers:
The relational model is therefore a very efficient data storage format but sometimes poses challenges for developers when used as a data access format and ORMs introduce inefficiencies and other trade-offs.
Document databases are popular with developers because they make it easy to retrieve and store hierarchically organized data corresponding to app-tier language objects. The JSON document model allows apps to directly map objects into a hierarchical JSON format, avoiding the need for decomposition or reconstitution, and the associated complexities. However, the JSON document model is far from ideal as a storage format because:
Documents/JSON are therefore a developer-friendly data access format and make it easy for developers to get started, but have significant limitations as a data storage format, especially as the complexity of an app increases.
Oracle Database 23c JSON Relational Duality unifies the benefits of the Relational and Document worlds within a single database without any of the tradeoffs discussed earlier. The new feature in Oracle Database 23c that enables this capability is referred to as a JSON Relational Duality View.
Using Duality Views, data is still stored in relational tables in a highly efficient normalized format but is accessed by apps in the form of JSON documents (figure 2). Developers can thus think in terms of JSON documents for data access while using the highly efficient relational model for data storage, without having to compromise simplicity or efficiency. In addition to this, Duality Views hide all the complexities of database level concurrency control from the user, providing document level serializability.
Duality Views can be declared over any number of tables using intuitive GraphQL syntax. For example, the following Duality View renders the relational data available in the order, orderitem and customer tables as a JSON document corresponding to an app-tier Order object:
Developers can easily define different Duality Views on the same or overlapping set of relational tables, making it easy to support multiple use cases on the same data (such as OrderObj and ShipmentObj Duality views that share common tables such as orderitem and customer).
Using Duality Views, developers now have much greater flexibility:
Developers can manipulate JSON documents produced by Duality Views in ways they are used to, using their usual drivers, frameworks, tools, and development methods.
Developers greatly benefit from the simplicity of being able to retrieve and store all the data needed for a single app-tier object in a single database operation. Applications using Duality Views can now simply read a document from the view, make any changes they need, and write the document back without having to worry about the underlying relational structure. You can manipulate documents realized by Duality Views in the ways you're used to, using your usual drivers, frameworks, tools, and development methods:
JSON Relational Duality therefore provides the storage, consistency and efficiency benefits of the relational model while also providing the simplicity and flexibility of the JSON document model.
Duality Views also benefit from a novel lock-free or optimistic concurrency control architecture in Oracle Database 23c that enables developers to manage their data consistently across stateless operations.
Oracle Database 23c Free—Developer Release allows developers to start building apps using 23c features like JSON Relational Duality. We are making it easy for you to experience the power and flexibility of Duality View in building apps. We are providing well-documented and easy-to-learn tutorials on GitHub. You can download the tutorials and use them with Oracle Database 23c Free—Developer Release. In the tutorials, developers can use SQL, REST and Oracle Database API for MongoDB to try features, capabilities and examples related to Duality Views. We will also be providing LiveLabs to play with Duality Views in a ready-to-run environment - stay tuned.
Note: Oracle Database 23c Free–Developer Release is the first release of the next-generation Oracle Database, allowing developers a head-start on building applications with innovative 23c features that simplify the development of modern data-driven apps. The entire feature set of Oracle Database 23c is planned to be generally available within the next 12 months.
Ranjan is a Product Management leader passionate about using strategy and innovation to address customer needs and solving business problems. He has 22 years of experience working in the Data and Analytics industry, especially with large enterprise customers. He joined Oracle in December 2020, where he works as Senior Director Product Management and manages Data and In-Memory products. In the past, he has built several Data and Analytics products and releases at Teradata. Ranjan has a Computer Science degree and an MBA degree from UCLA Anderson.