《JSON Relational Duality:Under the Hood [LRN3315].pdf》由會員分享,可在線閱讀,更多相關《JSON Relational Duality:Under the Hood [LRN3315].pdf(101頁珍藏版)》請在三個皮匠報告上搜索。
1、The following is intended to outline our general product direction.It is intended for information purposes only,and may not be incorporated into any contract.It is not a commitment to deliver any material,code,or functionality,and should not be relied upon in making purchasing decisions.The developm
2、ent,release,timing,and pricing of any features or functionality described for Oracles products may change and remains at the sole discretion of Oracle Corporation.The materials in this presentation pertain to Oracle Health,Oracle,Oracle Cerner,and Cerner Enviza which are all wholly owned subsidiarie
3、s of Oracle Corporation.Nothing in this presentation should be taken as indicating that any decisions regarding the integration of any EMEA Cerner and/or Enviza entities have been made where an integration has not already occurred.Oracle CloudWorld Copyright 2024,Oracle and/or its affiliates1Safe ha
4、rbor statementJSON Relational DualityOracle CloudWorld Copyright 2024,Oracle and/or its affiliates2Senior Vice President,Mission-Critical Data and AI enginesBeda HammerschmidtVice President,The Magic Kingdom of JSON,Text,XML,Tirthankar LahiriHeli HelskyahoCEO,Miracle Finland OyUnder the HoodRelation
5、al Zealot JSON RebelDuality CzarOracle CloudWorld Copyright 2024,Oracle and/or its affiliates3Introducing our cast members“Oracles JSON Relational Duality is perhaps one of the most important innovations in information science in 20 years.”Carl Olofson,Research VP,Data Management Software,IDCOracle
6、CloudWorld Copyright 2024,Oracle and/or its affiliates4Imagine weve been asked to build an app that manages a GenDev ConferenceApp Dev Example:GenDev Conference5Oracle CloudWorld Copyright 2024,Oracle and/or its affiliatesATTENDEESSESSIONSSPEAKERSThis App processes data in the form of hierarchical A
7、pplication Objects App Dev Example:GenDev ConferenceATTENDEE SCHEDULE FOR JILLTime 4:00 PMRoom B405Speaker AnitaTime 2:00 PMRoom A102Speaker Adam221 DUALITY225 DOMAINS6Oracle CloudWorld Copyright 2024,Oracle and/or its affiliatesApp Dev Example GenDev ConferenceThe data needed for this app is best s
8、tored in normalized tables inside a relational schema:No duplication each row is the only source of truth for its data Great for modularity,composability and independenceTrivially use same data for multiple use cases attendee schedule,speaker schedule,etc.7Oracle CloudWorld Copyright 2024,Oracle and
9、/or its affiliatesATTENDEEA_IDANAMEAFFILIATIONA211JillGen Soft.SESSIONS_IDSNAMERoomSP_ID221DualityA102SP05225DomainsB405SP11.ATTENDEE_SESSIONSA_IDS_IDA211S221A211S225.SPEAKERSPIDSPNAMESINFOSP05AdamAI ExpertSP11AnitaGenDev Czar.select.from attendee,session,attendee_sessions,speaker.The Relational Mod
10、el Returns Data as RowsOracle CloudWorld Copyright 2024,Oracle and/or its affiliates8The rows for an attendee schedule can be fetched in a single query by joining data from the four tablesA _ I DA N A M EA F F I L I A T I O NS E S S I O NT I M ER O O MS P E A K E RA211JillGen SoftDUALITY2:00 PMA102A
11、damA211JillGen SoftDOMAINS4:00 PMB405AnitaThe Relational Model Returns Data as RowsOracle CloudWorld Copyright 2024,Oracle and/or its affiliates9Relational result rows duplicate values in the upper levels of the hierarchyThe result set needs to be post-processed to convert it into a hierarchical app
12、lication object Object Relational MismatchA _ I DA N A M EA F F I L I A T I O NS E S S I O NT I M ER O O MS P E A K E RA211JillGen SoftDUALITY2:00 PMA102AdamA211JillGen SoftDOMAINS4:00 PMB405AnitaThe Object Relational Mismatch is even worse for updatesOracle CloudWorld Copyright 2024,Oracle and/or i
13、ts affiliates10Inserting or modifying an app object requires separate updates on the underlying tables There Have Been Many Attempts to Bridge this Mismatch Object DatabasesStore data natively in object format instead of tablesObject Relational DatabasesAdd user-defined types and inheritance to data
14、bases T A B L ECol1Col2Col3Object Relational Mapping Tools(ORMs)Generate code to map language objects to tables DocumentDatabasesStore data as JSON instead of relational tablesT A B L ECol1Col2Col3Oracle CloudWorld Copyright 2024,Oracle and/or its affiliates11There Have Been Many Attempts to Bridge
15、this Mismatch Object DatabasesStore data natively in object format instead of tablesObject Relational DatabasesAdd user-defined types and inheritance to databases T A B L ECol1Col2Col3Object Relational Mapping Tools(ORMs)Generate code to map language objects to tables DocumentDatabasesStore data as
16、JSON instead of relational tablesT A B L ECol1Col2Col3These achieve limited success because they only implement a specific use case Lose the relational models flexibility to implement any use caseOracle CloudWorld Copyright 2024,Oracle and/or its affiliates12Oracle CloudWorld Copyright 2024,Oracle a
17、nd/or its affiliatesRelational Data and DevelopersIdeally,the developer wants to build Jills schedule using a single simple database operationDatabaseOperation13ATTENDEE SCHEDULE FOR JILLTime 4:00 PMRoom B405Speaker AnitaTime 2:00 PMRoom A102Speaker Adam221 DUALITY225 DOMAINS14Can you help,JSON Rebe
18、l?Oracle CloudWorld Copyright 2024,Oracle and/or its affiliatesJSON Documents allows developers to simplify database accessOracle CloudWorld Copyright 2024,Oracle and/or its affiliates15JSON DocumentsJSON is popular as an access and interchange format because it is simple name1:String Value1,name2:n
19、ame3:14:00,name4:1234 Simple to transmitSelf-describing,self-contained format adapts to changes and is easy to transmit between systemsSimple for any data A JSON document can represent complex language objects as a simple hierarchy of name value pairsOracle CloudWorld Copyright 2024,Oracle and/or it
20、s affiliates16JSON is a Widely Used StandardOracle CloudWorld Copyright 2024,Oracle and/or its affiliates17Web AppsRESTDev ToolsJavaScriptJills session Schedule is Simple to Represent in JSONOracle CloudWorld Copyright 2024,Oracle and/or its affiliates18 attendee :A211,name :Jill,affiliation:Gen Sof
21、t,schedule :time :14:00,session:Duality,room :A102,Speaker:Adam ,time :16:00,session:Domains,room :B405,Speaker:Anita ATTENDEE SCHEDULE FOR JILLTime 4:00 PMRoom B405Speaker AnitaTime 2:00 PMRoom A102Speaker Adam221 DUALITY225 DOMAINSJills session Schedule is Simple to Represent in JSONOracle CloudWo
22、rld Copyright 2024,Oracle and/or its affiliates19 attendee :A211,name :Jill,affiliation:Gen Soft,schedule :time :14:00,session:Duality,room :A102,Speaker:Adam ,time :16:00,session:Domains,room :B405,Speaker:Anita ATTENDEE SCHEDULE FOR JILLTime 4:00 PMRoom B405Speaker AnitaTime 2:00 PMRoom A102Speake
23、r Adam221 DUALITY225 DOMAINSThe data for each of Jills sessions is embedded in Jills JSON Schedule documentDocument Databases Make Operating on JSON SimpleOracle CloudWorld Copyright 2024,Oracle and/or its affiliates20Document Databases are popular because they allow JSON documents to be easily acce
24、ssed and stored Using simple GET/PUT APIsDatabasePUTGET attendee :A211,name :Jill,affiliation:Gen Soft,schedule :time :14:00,session:Duality,room :A102,Speaker:Adam ,time :16:00,session:Domains,room :B405,Speaker:Anita Oracle CloudWorld Copyright 2024,Oracle and/or its affiliates21Oracle database is
25、 already a great document databaseOracle Database is a Great Document DatabaseOracle CloudWorld Copyright 2024,Oracle and/or its affiliates22Oracle provides more and better document functionality than pure Document Databases Supports XML documents since 1998 Supports JSON documents since 2014Continu
26、ously enhanced in every release name1:String Value1,name2:name3:14:00,name4:1234 Oracle Database is a Great Document DatabaseOracle CloudWorld Copyright 2024,Oracle and/or its affiliates23Documents are easy to store,retrieve,analyze,and manipulate using document or SQL APIs Oracle regularly contribu
27、tes SQL enhancements for documents to the open SQL standardsCREATE TABLEattendee_schedule(attendee_id number),schedule_doc JSON);SELECT schedule_doc FROMattendee_schedule aWHERE a.schedule_doc.attendee=Jill;Oracle Documents are Better than Document DatabasesFull document APIsSODA:Simple Oracle Docum
28、ent Access API-MongoDB compatible1Oracle CloudWorld Copyright 2024,Oracle and/or its affiliates24Oracle Documents are Better than Document DatabasesBetter than Document DatabasesFull document APIsSODA:Simple Oracle Document Access API-MongoDB compatible12Provide standards-based SQL access to documen
29、tsStored Procedures written in JavaScript,Java,or PL/SQLOracle CloudWorld Copyright 2024,Oracle and/or its affiliates25Oracle Documents are Better than Document DatabasesFull document APIsSODA:Simple Oracle Document Access API-MongoDB compatible1Full ACID consistency across documentsAnalytics,Spatia
30、l,Graph,ML,Parallelization on documents23Provide standards-based SQL access to documentsStored Procedures written in JavaScript,Java,or PL/SQLBetter than Document DatabasesBetter than Document DatabasesOracle CloudWorld Copyright 2024,Oracle and/or its affiliates26Oracle Documents are Better than Do
31、cument DatabasesFull document APIsSODA:Simple Oracle Document Access API-MongoDB compatible1Full ACID consistency across documentsAnalytics,Spatial,Graph,ML,Parallelization on documents23Provide standards-based SQL access to documentsStored Procedures written in JavaScript,Java,or PL/SQLPlus,a serve
32、rless Autonomous JSON DatabaseOracle CloudWorld Copyright 2024,Oracle and/or its affiliates27Oracle CloudWorld Copyright 2024,Oracle and/or its affiliates28Relational Zealot,Problem Solved?Store Everything as JSON!Can we end this session early?Get some coffee(or something better?)Oracle CloudWorld C
33、opyright 2024,Oracle and/or its affiliates29Not so fast,JSON Rebel!JSON has limitations as a storage formatLimitations of Document DatabasesJSON Documents are simple for apps to use as a data access formatWhen used as a storage format,they create issues with data duplication and data consistencyOrac
34、le CloudWorld Copyright 2024,Oracle and/or its affiliates30ATTENDEE SCHEDULE FOR JILLGEN SOFTTime 4:00 PMRoom B405Speaker AnitaTime 2:00 PMRoom A102Speaker Adam221 Duality225 DomainsATTENDEE SCHEDULE FOR JACKGEN INCTime 6:00 PMRoom A115Speaker AlexTime 2:00 PMRoom A102Speaker Adam221 Duality240 Anno
35、tationsLimitations of Document DatabasesOracle CloudWorld Copyright 2024,Oracle and/or its affiliates31ATENDEE SCHEDULE FOR JILLGEN SOFTTime 4:00 PMRoom B405Speaker AnitaTime 2:00 PMRoom A102Speaker Adam221 Duality225 DomainsATTENDEE SCHEDULE FOR JACKGEN INCTime 6:00 PMRoom A115Speaker AlexTime 2:00
36、 PMRoom A102Speaker Adam221 Duality230 AnnotationsWhen JSON is used to store attendee schedules,the session and speaker information is redundantly stored in each attendees scheduleDuplicate data is Inefficient to storeExpensive to updateDifficult to keep consistentLimitations of Document DatabasesA
37、T T E N DE E SC HE DU L E FO R:J IL LA T T E N DE E SC HE DU L E FO R:J A CKWhen JSON is used to store attendee schedules,the session and speaker information is redundantly stored in each attendees scheduleDuplicate data is Inefficient to storeExpensive to updateDifficult to keep consistent attendee
38、 :A362,name :Jack,affiliation:Gen Engg schedule :time :14:00,session:Duality,room :A102,Speaker:Adam ,time :18:00,session :230 Annotations,room :A115,Speaker:Alex attendee :A211,name :Jill,affiliation:Gen Soft,schedule :time :14:00,session:Duality,room :A102,Speaker:Adam ,time :16:00,session :225 Do
39、mains,room :B405,Speaker:Anita Oracle CloudWorld Copyright 2024,Oracle and/or its affiliates32Same Data for Multiple Use CasesSuccessful apps inevitably add more use cases over timeData duplication increases as the same data is used in new use casesFor example,when adding a speaker schedule use case
40、Oracle CloudWorld Copyright 2024,Oracle and/or its affiliates33ATTENDEE SCHEDULE FOR JILLGEN SOFTTime 4:00 PMRoom B405Speaker AnitaTime 2:00 PMRoom A102Speaker Adam221 Duality225 DomainsSPEAKER SCHEDULE FOR ANITAGENDEV CZARTime 4:00 PM Room B405 225 DomainsTime 6:00 PM Room D614 400 JSON Schema Same
41、 Data for Multiple Use CasesThe Speaker schedule use case requires a new document shape with the Speaker as the rootBut shares some of the same session data as the attendee documentOracle CloudWorld Copyright 2024,Oracle and/or its affiliates34ATTENDEE SCHEDULE FOR JILLGEN SOFTTime 4:00 PMRoom B405S
42、peaker AnitaTime 2:00 PMRoom A102Speaker Adam221 Duality225 DomainsSPEAKER SCHEDULE FOR ANITAGENDEV CZARTime 4:00 PM Room B405 225 DomainsTime 6:00 PM Room D614 400 JSON Schema Same Data for Multiple Use CasesOracle CloudWorld Copyright 2024,Oracle and/or its affiliates35The Speaker schedule use cas
43、e requires a new document shape with the Speaker as the rootBut shares some of the same session data as the attendee document attendee :A211,name :Jill,affiliation:Gen Soft,schedule :time :14:00,session:Duality,room :A102,Speaker:Adam ,time :16:00,session:Domains,room :B405,Speaker:Anita S PE A K ER
44、 S CHE D UL E F O R:A N IT AA T T E N DE E SC HE DU L E FO R:J IL L”Speaker :SP11,name :”Anita,info :GenDev Czar,schedule :time :16:00,session:Domains,room :B405,time :18:00,session:JSON Schema,room :”D614,Same Data for Multiple Use CasesOracle CloudWorld Copyright 2024,Oracle and/or its affiliates3
45、6Since data is stored redundantly,changing the classroom for a session requires atomically updating many attendee schedule documents AND many Speaker schedule documents attendee :A211,name :Jill,affiliation:Gen Soft,schedule :time :14:00,session:Duality,room :A102,Speaker:Adam ,time :16:00,session:D
46、omains,room :B405,Speaker:Anita S PE A K ER S CHE D UL E F O R:A N IT AA T T E N DE E SC HE DU L E FO R:J IL L”Speaker :SP11,name :”Anita,info :GenDev Czar,schedule :time :16:00,session:Domains,room :B405,time :18:00,session:JSON Schema,room :”D614,Big Picture-Documents JSONBenefitsUse Case Complexi
47、tyDocuments are great for simple appsOracle CloudWorld Copyright 2024,Oracle and/or its affiliates46Big Picture-Documents JSONBenefitsUse Case ComplexityBecome hazardous as apps get more complexBecause of this,many data experts consider pure Document Databases an anti-patternOracle CloudWorld Copyri
48、ght 2024,Oracle and/or its affiliates47Big Picture RelationalBenefitsUse Case ComplexityRelationalRelational may appear less easy for simple apps Its power becomes vital as app complexity increasesOracle CloudWorld Copyright 2024,Oracle and/or its affiliates48BenefitsUse Case ComplexityJSONOracle En
49、ables Developers to Deliver the Best of Both With Oracle,developers can already choose the data format that maximizes the benefits for each use caseRelationalOracle CloudWorld Copyright 2024,Oracle and/or its affiliates49This is great Can we do even better?Oracle CloudWorld Copyright 2024,Oracle and
50、/or its affiliates50Instead of choosingRelational OR Documents Can we get the benefits of Relational PLUS Documents?Oracle CloudWorld Copyright 2024,Oracle and/or its affiliates51BenefitsUse Case ComplexityJSONRelationalCan We Get All the Benefits of Both,for Every Use Case?PLUSJSON PLUS RelationalR
51、elational Use Case Flexibility Queryability Consistency Space EfficiencyDocument Easy mapping to language types Agile schema-less development Hierarchical data format Standard interchange formatOracle CloudWorld Copyright 2024,Oracle and/or its affiliatesOracle CloudWorld Copyright 2024,Oracle and/o
52、r its affiliates53Duality Czar,What do you think?JSON Document Relational DualityOracle Database 23aiINTRODUCINGO nowOracle CloudWorld Copyright 2024,Oracle and/or its affiliates54Architecturally providesthe use-case simplicity of JSONwith the multi-use case power of relationalOracle CloudWorld Copy
53、right 2024,Oracle and/or its affiliates55JSON Document Relational DualityData is stored as rows in tables to provide the benefits of the relational model and SQL accessStorage FormatTABLEColumn 1Column 2Column 3TABLEColumn 1Column 2Column 3TABLEColumn 1Column 2Column 3Oracle CloudWorld Copyright 202
54、4,Oracle and/or its affiliates56JSON Document Relational DualityData is stored as rows in tables to provide the benefits of the relational model and SQL accessStorage FormatData can be accessed as JSON documents to deliver the application simplicity of documentsAccess Formats label1:String Anita,lab
55、el2:5678 label3:”240 Annotations 201,label1:”attendee Jill,label2:5678 label3:”225 Domains,name1:String Value1,name2:name3:14:00,name4:1234 TABLEColumn 1Column 2Column 3TABLEColumn 1Column 2Column 3TABLEColumn 1Column 2Column 3Oracle CloudWorld Copyright 2024,Oracle and/or its affiliates57CREATE JSO
56、N DUALITY VIEW attendee_schedule AS attendee attendee :a_id name :anamne affiliation:affiliation schedule :attendee_sessions session time :time session :sname sessionId:s_id room :room Speaker spkr_name:spname ;attendee :A211,name :Jill,affiliation :Math,schedule :time :14:00,session :221 Duality,ro
57、om :A102,Speaker:Adam ,The structure of the view mirrors the structure of the desired JSON,making it simple to defineUses familiarGraphQL syntaxA TTE ND E E S C H E D UL E F O R:J IL LOracle CloudWorld Copyright 2024,Oracle and/or its affiliates58CREATE JSON DUALITY VIEW attendee_schedule AS attende
58、e attendee :a_id name :anamne affiliation:affiliation schedule :attendee_sessions session time :time session :sname sessionId:s_id room :room speaker spkr_name:spname ;The view specifies the tables that contain the data to include in the JSON documentS P E A K E RS E S S I O NA T T E N D E EA T T E
59、N D E ES E S S I O N SOracle CloudWorld Copyright 2024,Oracle and/or its affiliates59JSON Duality Views declare the recipe for assembling normalized rows into a JSON documentCREATE JSON DUALITY VIEW attendee_schedule AS attendee attendee :a_id name :aname affiliation:affiliation schedule :attendee_s
60、essions session time :time session :sname sessionId:s_id room :room Speaker spkr_name:spname ;And specifies the table columns that hold the valuesA TT EN D EEA_IDANAMEAFFILIATIONA211JillMathJSON Duality Views declare the recipe for assembling normalized rows into a JSON documentOracle CloudWorld Cop
61、yright 2024,Oracle and/or its affiliates60CREATE JSON DUALITY VIEW attendee_schedule AS attendee attendee :a_id name :aname affiliation:affiliation schedule :attendee_sessions delete insert update session time :time session :sname sessionId:s_id room :room Speaker spkr_name:spname ;And specifies the
62、 updatability rulesAttendees can update their own schedulesOracle CloudWorld Copyright 2024,Oracle and/or its affiliates61CREATE JSON DUALITY VIEW attendee_schedule AS attendee attendee :a_id name :aname affiliation:affiliation schedule :attendee_sessions delete insert update session nodelete noinse
63、rt noupdate time :time session :sname sessionId:s_id room :room Speaker nodelete noinsert noupdate spkr_name:spname ;And specifies the updatability rulesAttendees can update their own schedules,but not sessions or speakersOracle CloudWorld Copyright 2024,Oracle and/or its affiliates62CREATE JSON DUA
64、LITY VIEW attendee_schedule AS attendee attendee :a_id name :aname affiliation:affiliation schedule :attendee_sessions session time :time session :sname sessionId:s_id room :room Speaker unnest spkr_name:spname ;Also specifies when properties in a nested object should be unnested into the parentOrac
65、le CloudWorld Copyright 2024,Oracle and/or its affiliates63Speaker name should appear along with other session informationExample of Using Duality ViewsSelecting from the attendee schedule Duality View accesses the underlying tables and returns Jills schedule as a JSON document This document has all
66、 the data needed by the use case And the IDs needed to update the data attendee :A211,name :Jill,affiliation:Gen Soft,schedule :time :14:00,session:Duality,room :A102,Speaker:Adam ,time :16:00,session:Domains,room :B405,Speaker:Anita A T T E N DE E SC HE DU L E FO R:J IL LOracle CloudWorld Copyright
67、 2024,Oracle and/or its affiliates64Example of Using Duality ViewsYou can access the view using SQL or document APIsSELECT dataFROM attendee_schedule sWHERE s.data.name=Jill;attendee_schedule.find(name:Jill)Oracle CloudWorld Copyright 2024,Oracle and/or its affiliates65 attendee :A211,name :Jill,aff
68、iliation:Gen Soft,schedule :time :14:00,session:Duality,room :A102,Speaker:Adam ,time :16:00,session:Domains,room :B405,Speaker:Anita A T T E N DE E SC HE DU L E FO R:J IL LExtreme Simplicity for DevelopersDatabaseAppGET DocPUT DocChange DocJSON Duality Views are extremely simple to access using RES
69、T:GET a document from the ViewMake any changes needed to the documentPUT the document back into the ViewOracle CloudWorld Copyright 2024,Oracle and/or its affiliates66Extreme Simplicity for DevelopersOracle CloudWorld Copyright 2024,Oracle and/or its affiliates67DatabaseAppGET DocPUT DocChange DocTh
70、e database automatically detects the changes in the new document and modifies the underlying rowsAll duality views that share the same data immediately reflect this changeDevelopers no longer worry about inconsistenciesExtreme Simplicity for DevelopersOracle CloudWorld Copyright 2024,Oracle and/or i
71、ts affiliates68DatabaseAppGET DocPUT DocChange DocApps that prefer an API instead of REST can use:Simple Oracle Document Access API(SODA)Oracle MongoDB compatible APIExtreme Flexibility for DevelopersOracle CloudWorld Copyright 2024,Oracle and/or its affiliates69 Developers can easily build document
72、-centric apps That store new documents as relational dataOperate on existing relational data as documentsCreate JSON microservice on top of a relational database And benefit from all the capabilities of Oracles Converged databaseDatabaseDocument Centric AppDeclarative document definitionsDeclarative
73、 Document DefinitionOracle CloudWorld Copyright 2024,Oracle and/or its affiliates71Say What,Not HowA key benefit of SQL and the relational model is declarative programming Allows developers to tell the database what they want The database automatically determines how best to do itJSON Duality Views
74、extend declarative programming to JSON to enable:Reads and Writes of JSON from and to tables Powerful JSON queries and analytics Hiding the underlying table schema from appsDeclarative Document DefinitionOracle CloudWorld Copyright 2024,Oracle and/or its affiliates72Say What,Not HowA key benefit of
75、SQL and the relational model is declarative programming Allows developers to tell the database what they want The database automatically determines how best to do itJSON Duality Views extend declarative programming to JSON to enable:Reads and Writes of JSON from and to tables Powerful JSON queries a
76、nd analytics Hiding the underlying table schema from appsDuality Views are more powerful than Object Relational Mapping(ORM)Language independent Optimized by the database Get all use-case data in one round trip Consolidate object mapping in the DB Provide better concurrency control Enable DB-side JS
77、ON operations Declarative Document DefinitionOracle CloudWorld Copyright 2024,Oracle and/or its affiliates73Say What,Not HowA key benefit of SQL and the relational model is declarative programming Allows developers to tell the database what they want The database automatically determines how best to
78、 do itGame Changing Document Specialization by Use CaseOracle CloudWorld Copyright 2024,Oracle and/or its affiliates74A T TE ND EESP E A KE RSE SS IO NA T T E N DE E S E SS IO N SDocument Relational Duality enables game-changing specialization of DocumentsA Duality View can be created for each app u
79、se-case that produces a specialized JSON doc for that caseMakes it easy to add new use-cases for the same data,without creating duplication or consistency issuesE.g.,The same underlying row data can be used to create Attendee and Speaker Schedule documentsOracle CloudWorld Copyright 2024,Oracle and/
80、or its affiliates75Relational Zealot Remind me again,pleaseWe understand how reads work.How do we write data using Duality Views?Oracle CloudWorld Copyright 2024,Oracle and/or its affiliates76Game-changing lock-free concurrency control for documents and tablesGame Changing Lock-Free Concurrency Cont
81、rolOracle CloudWorld Copyright 2024,Oracle and/or its affiliates77Conventional locking does not work when REST GET and PUT APIs are used GET and PUT are stateless APIs Transactions and locks cannot be held between stateless callsJSON Document Relational Duality implements a new and game-changing loc
82、k-free concurrency control protocol for documentsThe database automatically detects when the database data underlying a document has changed between the initial document read and the subsequent writeIf a change occurred,the write operation is automatically rejected and returns an errorThe app can th
83、en reissue the write based on the changed dataGame Changing Lock-Free Concurrency ControlOracle CloudWorld Copyright 2024,Oracle and/or its affiliates78DatabaseAppGET DocPUT DocChange DocReject if Stored Data ChangedCalled Optimistic Concurrency ControlOracle CloudWorld Copyright 2024,Oracle and/or
84、its affiliates79Oracles unique value-basedconcurrency control architectureLock-Free Concurrency Control How it WorksOracle CloudWorld Copyright 2024,Oracle and/or its affiliates80In the HTTP protocol,an ETAG is a signature or fingerprint for the contents of a web page Oracle uniquely extends HTTP ET
85、AGs into the core database to implement lock-free concurrency controlA database GET automatically computes the ETAG and inserts it into the returned documentDatabaseAppGET DocChange DocLock-Free Concurrency Control How it WorksOracle CloudWorld Copyright 2024,Oracle and/or its affiliates81When the m
86、odified document is PUT back into the database The database verifies that the underlying document rows still match the ETAG computed by the GET If the rows match the ETAG,the rows are atomically updated If not,another user has changed the data,and the PUT operation is rejected The PUT can be retried
87、 using the new data DatabaseAppPUT DocChange DocReject if Stored Data ChangedValue-Based Concurrency ControlOracle CloudWorld Copyright 2024,Oracle and/or its affiliates82ETAG concurrency control is value-basedConflicting updates are detected by examining the data values themselvesNot by adding lock
88、s or versions to the dataDatabaseAppPUT DocChange DocReject if Stored Data ChangedValue-Based Works Across Different Views of the Same DataOracle CloudWorld Copyright 2024,Oracle and/or its affiliates83Because they are value-based,ETAGs automatically synchronize updates to data that is shared by man
89、y different documentsFor example,when session data is shared by many attendee documentsOr is shared by documents with different document roots,such as Speaker and Attendee documentsTraditional lock or version-based concurrency control works poorly for these casesATTENDEE SCHEDULE FOR JILLGEN SOFTTim
90、e 4:00 PMRoom B405Speaker AnitaTime 2:00 PMRoom A102Speaker Adam221 Duality225 DomainsSPEAKER SCHEDULE FOR ANITAGENDEV CZARTime 4:00 PM Room B405 225 DomainsTime 6:00 PM Room D614 400 JSON Schema Value-Based Works Across Documents and TablesOracle CloudWorld Copyright 2024,Oracle and/or its affiliat
91、es84Value based ETAGs also automatically ensure consistency between direct row updates and document updatesEnables any SQL application to update rows while apps using document APIs update the same dataUPDATE session SET room =A113 WHERE sname=Duality;PUT school.edu/attendee_schedule?q=attendee:JillV
92、alue-Based Enables Ignoring Unimportant ChangesOracle CloudWorld Copyright 2024,Oracle and/or its affiliates85An ETAG signature can exclude data whose update should not cause a PUT to be rejectedThis is like having column locking in a table,or element locking in a document A long-desired feature of
93、relational and document databasesExcluding the room from the ETAG avoids attendee app failing if the location of a session changesCREATE JSON DUALITY VIEW attendee_schedule AS attendee attendee :a_id name :anamne affiliation:affiliation schedule :attendee_sessions session time :time session :sname s
94、essionId:s_id room :room nocheck Speaker spkr_name:spname ;Value-Based Works for Pure Relational DataETAGs are not just for documentsETAGs can also now be used on pure relational data for lock-free row updates using SQL Great for interactive or mobile applications that directly access tables-Select
95、the ETAG along with data columnsSELECT a_id,aname,affiliation,SYS_ROW_ETAG(a_id,affilation)FROM attendee WHERE name=JILL;Human think time-Validate the ETAG before updating UDPATE attendee SET affiliation=New Company WHERE name=JILL AND SYS_ROW_ETAG(a_id,affiliation)=xxxx;86Oracle CloudWorld Copyrigh
96、t 2024,Oracle and/or its affiliatesOracle CloudWorld Copyright 2024,Oracle and/or its affiliates87Duality Czar,What are some of the benefits ofpersisting App Objects in the Database?Oracle CloudWorld Copyright 2024,Oracle and/or its affiliates88Duality Benefits forApp ObjectsSimple App Object Persis
97、tenceOracle CloudWorld Copyright 2024,Oracle and/or its affiliates89To store App Objects,developers can now simply:Convert the language-specific object representation to JSON Then let the database automatically persist the JSON into tables using JSON Duality ViewsConversion to JSON is familiar and e
98、asy for developers since it is often used when coding REST,JavaScript,etc.Speaker OBJECTSpeaker Name:AnitaInfo:GenDev Czarsessions:225 Domains,400 JSON SchemaJSON PUTDuality ViewDuality Benefits for App ObjectsOracle CloudWorld Copyright 2024,Oracle and/or its affiliates90Declaring the persistence f
99、ormat of App Objects in the database has many advantages Bridges the Object Relational mismatch Makes it easy for apps to operate on objects using JSON APIs Centralizes the persistence format of app objects Regardless of the client language or frameworkJSON PUTDuality ViewSpeaker OBJECTSpeaker Name:
100、AnitaInfo:GenDev Czarsessions:225 Domains,400 JSON SchemaDuality Benefits for App ObjectsOracle CloudWorld Copyright 2024,Oracle and/or its affiliates91Beyond simplicity and standardization,databases can now implement rich operations on app objects instead of rowsAnalyticsETL(extract,transform,load)
101、ReplicationText indexingAugmentationValidationSecurity rulesChange NotificationJSON PUTDuality ViewSpeaker OBJECTSpeaker Name:AnitaInfo:GenDev Czarsessions:225 Domains,400 JSON SchemaTransparent Schema-EvolutionOracle CloudWorld Copyright 2024,Oracle and/or its affiliates92The abstraction provided b
102、y Duality Views enables transparent app object evolution Changes to the table schema of an app object can be hidden from the application by updating the view Changes to the JSON format needed by new apps can be hidden from existing apps by creating a new viewJSON PUTDuality ViewSpeaker OBJECTSpeaker
103、 Name:AnitaInfo:GenDev Czarsessions:225 Domains,400 JSON Schema93JSON Rebel,I think Relational Zealot is happy now!Are you also happy?Oracle CloudWorld Copyright 2024,Oracle and/or its affiliatesOracle CloudWorld Copyright 2024,Oracle and/or its affiliates94JSON Relational Duality completes Oracles
104、support for all use cases of in-database documentsAll Use-Cases of In-Database DocumentsGreat when the data schema is knownDevelopers can store data as RelationalTABLEColumn 1Column 2Column 3TABLEColumn 1Column 2Column 3TABLEColumn 1Column 2Column 395Oracle CloudWorld Copyright 2024,Oracle and/or it
105、s affiliatesAll Use-Cases of In-Database DocumentsDevelopers can store data as Relational Access as Relational using standard SQLSQLAPISQLAPITABLEColumn 1Column 2Column 3TABLEColumn 1Column 2Column 3TABLEColumn 1Column 2Column 396Oracle CloudWorld Copyright 2024,Oracle and/or its affiliatesAll Use-C
106、ases of In-Database DocumentsDevelopers can store data as Relational Access as Relational using standard SQL Access as Documents using JSON Duality ViewsSQLAPIDocumentAPISQLAPITABLEColumn 1Column 2Column 3TABLEColumn 1Column 2Column 3TABLEColumn 1Column 2Column 397Oracle CloudWorld Copyright 2024,Or
107、acle and/or its affiliatesAll Use-Cases of In-Database DocumentsDevelopers can store data as RelationalGreat for collections or table columns whose schema is dynamic or evolvingSQLAPIDocumentAPISQLAPI name1:String Value1,name2:name3:14:00,name4:1234 TABLEColumn 1Column 2Column 3TABLEColumn 1Column 2
108、Column 3TABLEColumn 1Column 2Column 3Developers can store data as Documents98Oracle CloudWorld Copyright 2024,Oracle and/or its affiliatesAll Use-Cases of In-Database DocumentsSQLAPIDocumentAPIDevelopers can store data as RelationalSQLAPI name1:String Value1,name2:name3:14:00,name4:1234 TABLEColumn
109、1Column 2Column 3TABLEColumn 1Column 2Column 3TABLEColumn 1Column 2Column 3Developers can store data as Documents Access as Relational using JSON Data Guide to create relational views on JSON99Oracle CloudWorld Copyright 2024,Oracle and/or its affiliatesAll Use-Cases of In-Database DocumentsSQLAPIDo
110、cumentAPIDevelopers can store data as RelationalSQLAPIDevelopers can store data as Documents Access as Relational using JSON Data Guide to create relational views on JSON Access as Documents using ANSII JSON extensions to SQL,SODA,or the MongoDB API name1:String Value1,name2:name3:14:00,name4:1234 T
111、ABLEColumn 1Column 2Column 3TABLEColumn 1Column 2Column 3TABLEColumn 1Column 2Column 3100Oracle CloudWorld Copyright 2024,Oracle and/or its affiliatesAll Use-Cases of In-Database DocumentsCan start development using dynamic JSON storage and transition to relational if or when parts of the schema sta
112、bilize name1:String Value1,name2:name3:14:00,name4:1234 TABLEColumn 1Column 2Column 3TABLEColumn 1Column 2Column 3TABLEColumn 1Column 2Column 3Developers can store data as RelationalDevelopers can store data as Documents101Oracle CloudWorld Copyright 2024,Oracle and/or its affiliatesAll Use-Cases of
113、 In-Database Documents name1:String Value1,name2:name3:14:00,name4:1234 You pick the best storage format and access format for each use caseNot forced into a poor format or access method by database limitationsTABLEColumn 1Column 2Column 3TABLEColumn 1Column 2Column 3TABLEColumn 1Column 2Column 3Dev
114、elopers can store data as RelationalDevelopers can store data as DocumentsOracle CloudWorld Copyright 2024,Oracle and/or its affiliates102103Key Take AwaysDocuments and Relational are Now Fully UnifiedYou Get all the Benefits of Relational Plus All the Benefits of JSONDocument DB 2.0+Relational DB 2
115、.0Document DBRelational DBDocument Relational DualityParadigm ShiftOracle CloudWorld Copyright 2024,Oracle and/or its affiliatesJSON Relational Duality architecturally providesthe use-case simplicity of JSONwith the multi-use case power of relational104Key Take AwaysOracle CloudWorld Copyright 2024,
116、Oracle and/or its affiliates105Oracle CloudWorld Copyright 2024,Oracle and/or its affiliatesJSON Duality makes it easy to persist and operate on app objects as JSON,bridging the object relational mismatchJSON Duality Views enable data to be transparently read and written as documents or as tablesVal
117、ue Based concurrency control ensures consistency across documents and tables Enables stateless APIs,interactive use cases,and mobile disconnected clientsKey Take Aways106Oracle CloudWorld Copyright 2024,Oracle and/or its affiliatesKey Take Aways for Document DevelopersJSON Duality delivers the devel
118、opment simplicity of JSON plus the use-case scalability of relationalDevelopers can easily build document-centric apps on existing relational data and use all the advanced features of Oracles Converged DatabaseJSON Duality Views enable data to be transparently read and written as documents or as tab
119、les107Oracle CloudWorld Copyright 2024,Oracle and/or its affiliatesKey Take Aways for Relational DevelopersJSON Duality is more efficient,centralized,and consistent than an ORMDevelopers can easily create SQL-centric apps or analytics on data created by document-oriented appsEnables simple access to
120、 all the rows needed for an app use case in one call and one round tripRelational Zealot JSON RebelDuality CzarOracle CloudWorld Copyright 2024,Oracle and/or its affiliates108United by Duality 109Marc Staimer,Senior Analyst,Wikibon,says:”Oracle Database 23c definitively ends the long-running relational vs.document debate with JSON Relational Duality delivering the best of both worlds”Oracle CloudWorld Copyright 2024,Oracle and/or its affiliatesOracle CloudWorld Copyright 2024,Oracle and/or its affiliates110Try it today with Oracle Database 23c Free Developer R now