This session will cover loading large JSON datasets into Oracle Database 19c, indexing the content and providing a RESTful search interface - all using Oracle Cloud features.
8. Oracle Database with SQL/JSON Support
– bridges the gap between SQL and NoSQL
Database
• JSON Documents are storable, queryable, searchable, updatable,
generatable in Oracle Database
• as varchar, clob, blob Datatype since 12c
• as JSON DataType with efficient binary format in next major release
• Combine schema flexibility of JSON with strengths of the relational model
in one Database System
• Support SQL/JSON Standard – Extension of SQL to query JSON
• Support Partial Update of JSON
• ACID Transaction Model applied to JSON – No Data Loss
Confidential – Oracle Internal/Restricted/Highly Restricted 8
9. Public9
Oracle as a Document Store
{ "doctype" : "JSON", "count" : 100 }
Oracle Database
Document Collections
Text and JSON Documents
Stored and Managed
Using Oracle DatabaseJSON Data
10. Public
1
0
All the power of SQL. All the flexibility of schemaless development.
Oracle Database - JSON document store
JSON
Applications
developed
using SODA
APIs
JSON Documents
Stored and Managed
Using Oracle Database
SQL based reporting
and analytical operations
on JSON Documents
Oracle Database 20c
SQL
12. JSON Query – SQL/JSON
SQL/JSON standard
• Joint standard with IBM
• SQL extended with new operators for json e.g. JSON_VALUE
• All operators use JSON Path language for intra document navigation
Confidential – Oracle Internal/Restricted/Highly Restricted
SQL> select JSON_VALUE(PO_DOCUMENT, ‘$.LineItems[0].Part.UnitPrice’
2 returning NUMBER(5,3))
3 from J_PURCHASEORDER p
4 where JSON_VALUE(PO_DOCUMENT, ‘$.PONumber’
5 returning NUMBER(10)) = 1600
13. JSON Generation - Embedding arrays in documents
Oracle Confidential – Internal/Restricted/Highly Restricted 13
select JSON_OBJECT(
'departmentId' is d.DEPARTMENT_ID,
'name' is d. DEPARTMENT_NAME,
'employees' is (
select JSON_ARRAYAGG(
JSON_OBJECT(
'employeeId' is EMPLOYEE_ID,
'firstName' is FIRST_NAME,
'lastName' is LAST_NAME,
'emailAddress' is EMAIL
)
)
from HR.EMPLOYEES e
where e.DEPARTMENT_ID = d.DEPARTMENT_ID
)
) DEPT_WITH_EMPLOYEES
from HR.DEPARTMENTS d
where DEPARTMENT_NAME = 'Executive'
/
DEPT_WITH_EMPLOYEES
---------------------------------------------------------
-----------------------
{
"departmentId": 90,
"name": "Executive",
"employees": [
{
"employeeId": 100,
"firstName": "Steven",
"lastName": "King",
"emailAddress": "SKING"
}, {
"employeeId": 101,
"firstName": "Neena",
"lastName": "Kochhar",
"emailAddress": "NKOCHHAR"
}, {
"employeeId": 102,
"firstName": "Lex",
"lastName": "De Haan",
"emailAddress": "LDEHAAN"
}
]
}
select JSON_OBJECT(*)
from EMP;
14. JSON Indexes
• Functional Index
• Index specific fields within a JSON
document
• Search Index
• Universal Index for all fields
• Supports value, range and full
text
• GeoSpatial Index
• JSON_VALUE returns GeoJSON
as SDO_GEOMETRY object
Oracle Confidential – Internal/Restricted/Highly Restricted 14
CREATE SEARCH INDEX po_search_index
ON j_purchaseorder (po_document)
FOR JSON
CREATE UNIQUE INDEX po_ponum_index
ON j_purchaseorder po
(po.po_document.PONumber);
15. Discover metadata for JSON
• Generate JSON Schema or
• Generate relational schema
Derived relational views
• Declarative procedures to construct
a relational view over a JSON
fragment
Derived virtual columns
• Generated for singleton JSON keys
• Automatically generated for new
keys
Can be used with external data
JSON Dataguide - Schema Discovery
• SQL> select
dbms_json.get_index_DataGuide("REVIEWS',
• 2 'JTEXT',
• 3 dbms_json.FORMAT_HIERARCHICAL,
• 4 dbms_json.PRETTY)
• 5 from dual
{
"type" : "object",
"o:length" : 8192,
"properties" :
{
"text" :
{
"type" : "string",
"o:length" : 1024,
"o:preferred_column_name" : "JTEXT$text"
},
"stars" :
{
"type" : "number",
"o:length" : 4,
"o:preferred_column_name" : "JTEXT$stars"
},
}
}
16. MongoDB
• data pipelines to move out data for
OLTP, analytics, search, …
• Multiple databases to maintain, patch
• Multiple datasets to backup, administer
• Integration soaks up 30% of project costs
Oracle Database
• Converged Architecture
• All your data managed together
Oracle Database – Converged Data
Relational Full Text
OracleDBmongoDB ElasticSearch …….
…
Oracle
Database
20c
Relation
al
Full Text ….
17. Microservices with Multitenant
• Multitenant allows creating PDB
for each microservice
• Each PDB offers isolation and
can be scaled independently
• But still preserve unified
administration at the CDB level
Multimodel AND Polyglot
• Each PDB can be used as a
multimodel or specialized store
Oracle Database - Converged Data
Oracle Database
20c
RelationalMultimodel
Micro-
service
Micro-
service
Micro-
service