foreign keys, no data types, ... very quick initial development Flexible data structure embedded arrays or objects Copyright @ 2024 Oracle and/or its affiliates. 6
foreign keys, no data types, ... very quick initial development Flexible data structure embedded arrays or objects valid solution when natural data can't be modelized optimaly into a relational model Copyright @ 2024 Oracle and/or its affiliates. 6
foreign keys, no data types, ... very quick initial development Flexible data structure embedded arrays or objects valid solution when natural data can't be modelized optimaly into a relational model objects persistance without the use of any ORM - mapping object-oriented Copyright @ 2024 Oracle and/or its affiliates. 6
foreign keys, no data types, ... very quick initial development Flexible data structure embedded arrays or objects valid solution when natural data can't be modelized optimaly into a relational model objects persistance without the use of any ORM - mapping object-oriented JSON Copyright @ 2024 Oracle and/or its affiliates. 6
foreign keys, no data types, ... very quick initial development Flexible data structure embedded arrays or objects valid solution when natural data can't be modelized optimaly into a relational model objects persistance without the use of any ORM - mapping object-oriented JSON close to frontend Copyright @ 2024 Oracle and/or its affiliates. 6
foreign keys, no data types, ... very quick initial development Flexible data structure embedded arrays or objects valid solution when natural data can't be modelized optimaly into a relational model objects persistance without the use of any ORM - mapping object-oriented JSON close to frontend easy to learn Copyright @ 2024 Oracle and/or its affiliates. 6
and NoSQL on one platform that has proven stability on well know technology with a large Community and a diverse ecosystem ? Copyright @ 2024 Oracle and/or its affiliates. 11
Server Technology Provides a schema exible JSON Document Store No SQL required No need to de ne all possible a ributes, tables, etc. Uses new X DevAPI Can leverage generated column to extract JSON values into materialized columns that can be indexed for fast SQL searches. Document can be ~1GB It's a column in a row of a table It cannot exceed max_allowed_packet Allows use of modern programming styles No more embedded strings of SQL in your code Easy to read Also works with relational Tables Proven MySQL Technology Compatible with all existing MySQL solutions Copyright @ 2024 Oracle and/or its affiliates. 17
if you add indexes Schema Schema - database Collection Table Document Row in table a Record Anatomy of MySQL Document Store Copyright @ 2024 Oracle and/or its affiliates. 18
install MySQL Shell install MySQL Connector for your programming language Connector/J for Java php-pecl-mysql-xdevapi for PHP mysql-connector-python for Python, ... Copyright @ 2024 Oracle and/or its affiliates. 21
install MySQL Shell install MySQL Connector for your programming language Connector/J for Java php-pecl-mysql-xdevapi for PHP mysql-connector-python for Python, ... Simply ensure that your rewall se ings permit connections via port 33060 (X Protocol); no additional installations or plugins are required. Copyright @ 2024 Oracle and/or its affiliates. 21
am using the well known restaurants collection: $ mongoexport $ mongoexport -c -c restaurants restaurants > > restaurants.json restaurants.json connected to: connected to: 127.0 127.0.0.1 .0.1 exported exported 25359 25359 records records Copyright @ 2024 Oracle and/or its affiliates. 23
"lib/*" -d -d bin src/Resto.java bin src/Resto.java $ $ java java -classpath -classpath "bin:lib/*" "bin:lib/*" Resto Resto Connecting to database Connecting to database.. ... . Enter a string to search Enter a string to search in in the database: fred the database: fred Searching Searching for for 'fred' 'fred' in in the database the database.. ... . Name: Name: | | Borough: Borough: Cafe Cafe 212 212/Columbia Catering Kitchen - Alfred Lerner Hall /Columbia Catering Kitchen - Alfred Lerner Hall | | Manhattan Manhattan Ferris Booth Commons - Alfred Lerner Hall Ferris Booth Commons - Alfred Lerner Hall | | Manhattan Manhattan Cafe East - Alfred Lerner Hall Cafe East - Alfred Lerner Hall | | Manhattan Manhattan Alfredo Alfredo 100 100 | | Manhattan Manhattan Copyright @ 2024 Oracle and/or its affiliates. 37
Delete) designates the four basic operations for data persistence, in particular the storage of information in a database. Copyright @ 2024 Oracle and/or its affiliates. 38
proven MySQL InnoDB strength & robustness: innodb_ ush_log_at_trx_commit = 1 innodb_doublewrite = ON sync_binlog = 1 transaction_isolation = REPEATABLE-READ|READ-COMMITTED|... Durability is important. We do care about your data ! Copyright @ 2024 Oracle and/or its affiliates. 45
and show the top 10, with the best one rst ! don't forget that all these restaurants are just JSON documents Copyright @ 2024 Oracle and/or its affiliates. 49
and neat code: $results $results = = $collection $collection-> ->find find( ('cuisine like "italian"' 'cuisine like "italian"') )-> ->execute execute( () )-> ->fetchAll fetchAll( () ); ; And use SQL only when it's necessary: $results $results = = $session $session-> ->sql sql( (' select * from (with cte1 as (select doc->>"$.name" as name, ' select * from (with cte1 as (select doc->>"$.name" as name, doc->>"$.cuisine" as cuisine, ( select avg(score) from json_table(doc, "$.grades[*]" doc->>"$.cuisine" as cuisine, ( select avg(score) from json_table(doc, "$.grades[*]" columns (score int path "$.score")) as r) as avg_score from restaurants) columns (score int path "$.score")) as r) as avg_score from restaurants) select *, row_number() over ( partition by cuisine order by avg_score desc) as `rank` select *, row_number() over ( partition by cuisine order by avg_score desc) as `rank` from cte1 order by `rank`, avg_score desc) b where `rank`=1' from cte1 order by `rank`, avg_score desc) b where `rank`=1') )-> ->execute execute( () ); ; Copyright @ 2024 Oracle and/or its affiliates. 55
Dev X API allowing the X Protocol, but if you want to also bene t from HeatWave Cluster, query accelerator, you need to make a change to your collection: MySQL MySQL > > ALTER ALTER TABLE TABLE restaurants restaurants MODIFY MODIFY _id _id CHAR CHAR( (28 28) ) CHARSET CHARSET latin1 latin1 GENERATED ALWAYS GENERATED ALWAYS AS AS ( (JSON_UNQUOTE JSON_UNQUOTE( (JSON_EXTRACT JSON_EXTRACT( (` `doc doc` `, ,_utf8mb4 _utf8mb4'$._id' '$._id') )) )) ) STORED STORED NOT NOT NULL NULL; ; Copyright @ 2024 Oracle and/or its affiliates. 72
we go from 1.1713 seconds to 0.1922 seconds when using HeatWeave Cluster. . .. .. .. . 10 10 rows rows in in set set ( (0.1922 0.1922 sec sec) ) Copyright @ 2024 Oracle and/or its affiliates. 76
full support for JSON/Relational Duality by enabling fast and secure HTTPS access for your MySQL data. Copyright @ 2024 Oracle and/or its affiliates. 79