JSON Relational Duality is a landmark capability in Oracle Database 23ai (formerly 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. For more information on the Oracle Database 23ai general availability and its key capabilities, please refer to the Oracle Database 23ai announcement blog.
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 23ai 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 23ai 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 23ai that enables developers to manage their data consistently across stateless operations.
Developers can start building apps using Oracle Database 23ai features like JSON Relational Duality using one of the several available free options of Oracle Database 23ai. 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 your choice of free Oracle Database 23ai. In the tutorials, developers can use SQL, REST and Oracle Database API for MongoDB to try features, capabilities and examples related to Duality Views.
Additional resources:
At Oracle, Ranjan is the Product Management Leader for the Mission-Critical Data and AI Engines team, where he manages several Oracle Database features, including AI Vector Search, JSON Relational Duality, Database In-Memory, and Advanced Compression. In addition, Ranjan supports Oracle TimesTen and Oracle NoSQL.
Twitter: https://twitter.com/ranjanpriya (@ranjanpriya)
LinkedIn: https://www.linkedin.com/in/ranjan-priyadarshi/
Email: ranjan.priyadarshi@oracle.com
Previous Post
Next Post