SlideShare a Scribd company logo
1 / 124
2 / 124
MySQL 8.0
a Document Store with all the benefits of a transactional RDBMS
 
 
Frédéric Descamps - MySQL Community Manager - Oracle
3 / 124
Save the date !
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
4 / 124
 
Safe Harbor Statement
The following is intended to outline our general product direction. It is intended for
information purpose 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 up in
making purchasing decisions. The development, release and timing of any features or
functionality described for Oracle´s product remains at the sole discretion of Oracle.
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
5 / 124
about me - http://about.me/lefred
Who am I ?
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
6 / 124
Frédéric Descamps
@lefred
MySQL Evangelist
Hacking MySQL since 3.23
devops believer
living in Belgium 🇧🇪
http://lefred.be
 
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
7 / 124
RDBMS & MySQL
Relational Databases
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
8 / 124
Relational Databases
Data Integrity
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
9 / 124
Relational Databases
Data Integrity
normalization
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
10 / 124
Relational Databases
Data Integrity
normalization
constraints (foreign keys, ...)
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
11 / 124
Relational Databases
Data Integrity
normalization
constraints (foreign keys, ...)
Atomicity, Consistency, Isolation, Durability
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
12 / 124
Relational Databases
Data Integrity
normalization
constraints (foreign keys, ...)
Atomicity, Consistency, Isolation, Durability
ACID compliant
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
13 / 124
Relational Databases
Data Integrity
normalization
constraints (foreign keys, ...)
Atomicity, Consistency, Isolation, Durability
ACID compliant
transactions
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
14 / 124
Relational Databases
Data Integrity
normalization
constraints (foreign keys, ...)
Atomicity, Consistency, Isolation, Durability
ACID compliant
transactions
SQL
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
15 / 124
Relational Databases
Data Integrity
normalization
constraints (foreign keys, ...)
Atomicity, Consistency, Isolation, Durability
ACID compliant
transactions
SQL
powerfull query language
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
16 / 124
NoSQL & MySQL
NoSQL Databases
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
17 / 124
NoSQL or Document Store
Schemaless
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
18 / 124
NoSQL or Document Store
Schemaless
no schema design, no normalization, no foreign keys, no data types, ...
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
19 / 124
NoSQL or Document Store
Schemaless
no schema design, no normalization, no foreign keys, no data types, ...
very quick initial development
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
20 / 124
NoSQL or Document Store
Schemaless
no schema design, no normalization, no foreign keys, no data types, ...
very quick initial development
Flexible data structure
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
21 / 124
NoSQL or Document Store
Schemaless
no schema design, no normalization, no foreign keys, no data types, ...
very quick initial development
Flexible data structure
embedded arrays or objects
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
22 / 124
NoSQL or Document Store
Schemaless
no schema design, no normalization, no 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 @ 2018 Oracle and/or its affiliates. All rights reserved.
23 / 124
NoSQL or Document Store
Schemaless
no schema design, no normalization, no 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 oobject-oriented
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
24 / 124
NoSQL or Document Store
Schemaless
no schema design, no normalization, no 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 oobject-oriented
JSON
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
25 / 124
NoSQL or Document Store
Schemaless
no schema design, no normalization, no 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 oobject-oriented
JSON
close to frontend
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
26 / 124
NoSQL or Document Store
Schemaless
no schema design, no normalization, no 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 oobject-oriented
JSON
close to frontend
native in JS
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
27 / 124
NoSQL or Document Store
Schemaless
no schema design, no normalization, no 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 oobject-oriented
JSON
close to frontend
native in JS
easy to learn
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
28 / 124
How DBAs see data
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
29 / 124
How DBAs see data How Developers see data
{
"GNP" : 249704,
"Name" : "Belgium",
"government" : {
"GovernmentForm" :
"Constitutional Monarchy, Federation",
"HeadOfState" : "Philippe I"
},
"_id" : "BEL",
"IndepYear" : 1830,
"demographics" : {
"Population" : 10239000,
"LifeExpectancy" : 77.8000030517578
},
"geography" : {
"Region" : "Western Europe",
"SurfaceArea" : 30518,
"Continent" : "Europe"
}
}
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
30 / 124
What if there was a way to provide both SQL
and NoSQL on one stable platform that has
proven stability on well know technology with
a large Community and a diverse ecosystem ?
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
31 / 124
DBMS or NoSQL ?
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
32 / 124
DBMS or NoSQL ?
Why not both ?
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
33 / 124
The MySQL Document Store !
SQL is now optional !
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
34 / 124
Developers:
[x] schemaless
[x] rapid prototying/simpler APIs
[x] document model
[x] transactions
Operations:
[x] performance
management/visibility
[x] robust replication, backup,
restore
[x] comprehensive tooling
ecosystem
[x] simpler application schema
upgrades
Business Owner:
[x] don't lose my data == ACID trx
[x] capture all my data =
extensible/schemaless
[x] product on schedule/time to
market = rapid developement
A solution for all
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
35 / 124
MySQL Document Store
the Solution
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
36 / 124
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
37 / 124
Built on
the MySQL
JSON Data
type and
Proven
MySQL
Server
Technology
Provides a schema flexible JSON Document Store
No SQL required
No need to define all possible attributes, 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
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
38 / 124
X DevAPI Connectors for
C++, Java, .Net, Node.js, Python, PHP
working with Communities to help them supporting
it too
New MySQL Shell
Command Completion
Python, JavaScrips & SQL modes
Admin functions
New Util object
A new high-level session concept that can scale from
single MySQL Server to a multiple server environment
Non-blocking, asynchronous calls follow common
language patterns
Supports CRUD operations
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
39 / 124
Starting using MySQL DS in few minutes
 
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
40 / 124
MySQL Shell Info
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
41 / 124
Migration from MongoDB to MySQL DS
For this example, I will use the well known restaurants collection:
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
42 / 124
Migration from MongoDB to MySQL DS
For this example, I will use the well known restaurants collection:
We need to dump the data to a file and we will use MySQL Shell with the Python
interpreter to load the data.
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
43 / 124
Migration from MongoDB to MySQL DS
For this example, I will use the well known restaurants collection:
We need to dump the data to a file and we will use MySQL Shell with the Python
interpreter to load the data.
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
44 / 124
Dump and load using MySQL Shell & Python
this example is inspired by @datacharmer's work:
https://www.slideshare.net/datacharmer/mysql-documentstore
$ mongo --quiet --eval 'DBQuery.shellBatchSize=30000;
db.restaurants. nd().shellPrint()' 
| perl -pe 's/(?:ObjectId|ISODate)(("[^"]+"))/ $1/g' > all_recs.json
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
45 / 124
Dump and load using MySQL Shell & Python
this example is inspired by @datacharmer's work:
https://www.slideshare.net/datacharmer/mysql-documentstore
$ mongo --quiet --eval 'DBQuery.shellBatchSize=30000;
db.restaurants. nd().shellPrint()' 
| perl -pe 's/(?:ObjectId|ISODate)(("[^"]+"))/ $1/g' > all_recs.json
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
46 / 124
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
47 / 124
Even better in MySQL Shell 8.0.13 [preview]
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
48 / 124
Even better in MySQL Shell 8.0.13 [preview]
Dump from MongoDB:
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
49 / 124
Even better in MySQL Shell 8.0.13 [preview]
Dump from MongoDB:
And import with the new util function in the Shell:
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
50 / 124
Let´s query
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
51 / 124
Let´s query
That´s too much records to show it here... let´s limit it
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
52 / 124
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
53 / 124
Some more examples
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
54 / 124
Some more examples
Let´s add a selection criteria:
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
55 / 124
Using IN...
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
56 / 124
Syntax slightly different than MongoDB
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
57 / 124
Syntax slightly different than MongoDB
> db.restaurants. nd({"cuisine": "French",
"borough": { $not: /^Manhattan/} },
{"_id":0, "name": 1,"cuisine": 1, "borough": 1}).limit(2)
{ "borough" : "Queens", "cuisine" : "French",
"name" : "La Baraka Restaurant" }
{ "borough" : "Queens", "cuisine" : "French",
"name" : "Air France Lounge" }
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
58 / 124
CRUD operations
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
59 / 124
CRUD operations for collections
Add a document
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
60 / 124
CRUD operations for collections
Modify a document
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
61 / 124
CRUD operations for collections
Remove a document
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
62 / 124
MySQL Document Store Objects Summary
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
63 / 124
Document Store Full ACID !
It relies on the proven MySQL InnoDB´s strength & robustness:
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
64 / 124
Document Store Full ACID !
It relies on the proven MySQL InnoDB´s strength & robustness:
innodb_ ush_log_at_trx_commit = 1
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
65 / 124
Document Store Full ACID !
It relies on the proven MySQL InnoDB´s strength & robustness:
innodb_ ush_log_at_trx_commit = 1
innodb_doublewrite = ON
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
66 / 124
Document Store Full ACID !
It relies on the proven MySQL InnoDB´s strength & robustness:
innodb_ ush_log_at_trx_commit = 1
innodb_doublewrite = ON
sync_binlog = 1
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
67 / 124
Document Store Full ACID !
It relies on the proven MySQL InnoDB´s strength & robustness:
innodb_ ush_log_at_trx_commit = 1
innodb_doublewrite = ON
sync_binlog = 1
transaction_isolation = REPEATABLE-READ|READ-
COMMITTED|...
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
68 / 124
Document Store Full ACID !
It relies on the proven MySQL InnoDB´s strength & robustness:
innodb_ ush_log_at_trx_commit = 1
innodb_doublewrite = ON
sync_binlog = 1
transaction_isolation = REPEATABLE-READ|READ-
COMMITTED|...
We do care about your data !
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
69 / 124
Document Store Full ACID !
MySQL Document Store supports transactions
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
70 / 124
Document Store Full ACID !
MySQL Document Store supports transactions
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
71 / 124
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
72 / 124
what about my old SQL ?
The hidden part of the iceberg
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
73 / 124
JSON datatype is behind the scene
native datatype (since 5.7.8)
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
74 / 124
JSON datatype is behind the scene
native datatype (since 5.7.8)
JSON values are stored in MySQL tables using UTF8MB4
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
75 / 124
JSON datatype is behind the scene
native datatype (since 5.7.8)
JSON values are stored in MySQL tables using UTF8MB4
Conversion from "native" SQL types to JSON values
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
76 / 124
JSON datatype is behind the scene
native datatype (since 5.7.8)
JSON values are stored in MySQL tables using UTF8MB4
Conversion from "native" SQL types to JSON values
JSON manipulation functions (JSON_EXTRACT, JSON_KEYS, JSON_SEARCH,
JSON_TABLES, ...)
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
77 / 124
JSON datatype is behind the scene
native datatype (since 5.7.8)
JSON values are stored in MySQL tables using UTF8MB4
Conversion from "native" SQL types to JSON values
JSON manipulation functions (JSON_EXTRACT, JSON_KEYS, JSON_SEARCH,
JSON_TABLES, ...)
Generated/virtual columns
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
78 / 124
JSON datatype is behind the scene
native datatype (since 5.7.8)
JSON values are stored in MySQL tables using UTF8MB4
Conversion from "native" SQL types to JSON values
JSON manipulation functions (JSON_EXTRACT, JSON_KEYS, JSON_SEARCH,
JSON_TABLES, ...)
Generated/virtual columns
Indexing JSON data
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
79 / 124
JSON datatype is behind the scene
native datatype (since 5.7.8)
JSON values are stored in MySQL tables using UTF8MB4
Conversion from "native" SQL types to JSON values
JSON manipulation functions (JSON_EXTRACT, JSON_KEYS, JSON_SEARCH,
JSON_TABLES, ...)
Generated/virtual columns
Indexing JSON data
Foreign Keys to JSON data
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
80 / 124
JSON datatype is behind the scene
native datatype (since 5.7.8)
JSON values are stored in MySQL tables using UTF8MB4
Conversion from "native" SQL types to JSON values
JSON manipulation functions (JSON_EXTRACT, JSON_KEYS, JSON_SEARCH,
JSON_TABLES, ...)
Generated/virtual columns
Indexing JSON data
Foreign Keys to JSON data
SQL Views to JSON data
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
81 / 124
How does the MySQL Document Store work ?
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
82 / 124
What does a collection look like on the server ?
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
83 / 124
_id Every document has a unique identifier called the document
ID, which can be thought of as the equivalent of a table´s
primary key. The document ID value can be manually assigned
when adding a document. If no value is assigned, a document
ID is generated and assigned to the document automatically !
Use getDocumentId() or getDocumentIds() to
get _ids(s)
   
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
84 / 124
Mapping to SQL examples
createCollection('mycollection')
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
85 / 124
Mapping to SQL examples
createCollection('mycollection')
CREATE TABLE `test`.`mycoll` (
doc JSON,
_id VARCHAR(32)
GENERATED ALWAYS AS (doc->>'$._id') STORED
PRIMARY KEY
) CHARSET utf8mb4;
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
86 / 124
Mapping to SQL examples
createCollection('mycollection')
CREATE TABLE `test`.`mycoll` (
doc JSON,
_id VARCHAR(32)
GENERATED ALWAYS AS (doc->>'$._id') STORED
PRIMARY KEY
) CHARSET utf8mb4;
mycollection.add({'test': 1234})
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
87 / 124
Mapping to SQL examples
createCollection('mycollection')
CREATE TABLE `test`.`mycoll` (
doc JSON,
_id VARCHAR(32)
GENERATED ALWAYS AS (doc->>'$._id') STORED
PRIMARY KEY
) CHARSET utf8mb4;
mycollection.add({'test': 1234})
INSERT INTO `test`.`mycoll` (doc)
VALUES (
JSON_OBJECT('_id','663807fe367ee6114e0e5458bdac28bf',
'test',1234)
);
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
88 / 124
Mapping to SQL examples (2)
mycollection.find("test > 100")
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
89 / 124
Mapping to SQL examples (2)
mycollection.find("test > 100")
SELECT doc
FROM `test`.`mycoll`
WHERE (JSON_EXTRACT(doc,'$.test') > 100);
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
90 / 124
SQL and JSON Example
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
91 / 124
SQL and JSON Example
same as:
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
92 / 124
SQL and JSON Example
same as:
we can use it in SQL:
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
93 / 124
SQL and JSON Example (2): validation
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
94 / 124
SQL and JSON Example (2): validation
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
95 / 124
SQL and JSON Example (2): validation
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
96 / 124
SQL and JSON Example (3): explain
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
97 / 124
SQL and JSON Example (3): explain
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
98 / 124
SQL and JSON Example (4): add index
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
99 / 124
SQL and JSON Example (4): add index
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
100 / 124
Indexes in Document Store
It's also possible to create indexes without using SQL syntax:
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
101 / 124
Indexes in Document Store
It's also possible to create indexes without using SQL syntax:
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
102 / 124
SQL and JSON Example (5): arrays
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
103 / 124
SQL and JSON Example (5): arrays
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
104 / 124
SQL and JSON Example (5): arrays
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
105 / 124
SQL and JSON Example (5): arrays
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
106 / 124
NoSQL as SQL
JSON_TABLE
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
107 / 124
NoSQL as SQL (2)
JSON_TABLE
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
108 / 124
NoSQL as SQL - aggregation
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
109 / 124
NoSQL as SQL - aggregation (2)
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
110 / 124
SQL and NoSQL - JOINS
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
111 / 124
SQL and NoSQL - JOINS
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
112 / 124
SQL and NoSQL - JOINS
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
113 / 124
SQL and NoSQL - JOINS (2)
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
114 / 124
SQL and NoSQL - JOINS (2)
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
115 / 124
SQL and NoSQL - JOINS (2)
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
116 / 124
SQL and NoSQL - and back to JSON Document
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
117 / 124
NoSQL or SQL
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
118 / 124
what do I gain ?
Conclusion
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
119 / 124
schemaless
flexible data structure
easy to start (CRUD)
Conclusion
This is the best of the two worlds in one product !
Data integrity
ACID Compliant
Transactions
SQL
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
120 / 124
121 / 124
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
122 / 124
http://lefred.be/content/top-10-reasons-for-
nosql-with-mysql/
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
123 / 124
Thank you !
Any Questions ?
share your 💕 for MySQL on social media using @mysql #MySQL8isGreat
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
124 / 124

More Related Content

PDF
DataOps barcelona - MySQL 8.0 document store: NoSQL with all the benefits of ...
PDF
DataOps Barcelona - MySQL HA so easy... that's insane !
PDF
FOSDEM MySQL & Friends Devroom, February 2018 MySQL Point-in-Time Recovery l...
PDF
Oracle Open World 2018 / Code One : MySQL 8.0 Document Store
PDF
MySQL Innovation Day Chicago - MySQL HA So Easy : That's insane !!
PDF
Oracle Open World 2018 / Code One : MySQL 8.0 High Availability with MySQL I...
PDF
pre-FOSDEM MySQL day, February 2018 - MySQL Document Store
PDF
MySQL InnoDB Cluster and Group Replication in a nutshell hands-on tutorial
DataOps barcelona - MySQL 8.0 document store: NoSQL with all the benefits of ...
DataOps Barcelona - MySQL HA so easy... that's insane !
FOSDEM MySQL & Friends Devroom, February 2018 MySQL Point-in-Time Recovery l...
Oracle Open World 2018 / Code One : MySQL 8.0 Document Store
MySQL Innovation Day Chicago - MySQL HA So Easy : That's insane !!
Oracle Open World 2018 / Code One : MySQL 8.0 High Availability with MySQL I...
pre-FOSDEM MySQL day, February 2018 - MySQL Document Store
MySQL InnoDB Cluster and Group Replication in a nutshell hands-on tutorial

What's hot (20)

PDF
MySQL Document Store - How to replace a NoSQL database by MySQL without effor...
PDF
MySQL InnoDB Cluster in a Nutshell - Hands-on Lab
PDF
Introduction to MySQL InnoDB Cluster
PDF
MySQL Document Store - when SQL & NoSQL live together... in peace!
PDF
Percona Live Europe 2018 MySQL Group Replication... the magic explained
PDF
MySQL InnoDB Cluster and Group Replication in a Nutshell
PDF
Introduction to MySQL InnoDB Cluster
PDF
Introduction to MySQL Document Store
PDF
How to operate MySQL InnoDB Cluster with MySQL Shell
PDF
MySQL Group Replication: Handling Network Glitches - Best Practices
PDF
MySQL innodb cluster and Group Replication in a nutshell - hands-on tutorial ...
PDF
OpenExpo Virtual Experience 2020: MySQL 8.0 Document Store - Discovery of a n...
PDF
High Availability in MySQL 8 using InnoDB Cluster
PDF
Python and MySQL 8.0 Document Store
PDF
Introduction to MySQL InnoDB Cluster
PDF
MySQL InnoDB Cluster - Advanced Configuration & Operations
PDF
MySQL Shell - the best DBA tool ?
PDF
MySQL 8.0 InnoDB Cluster - Easiest Tutorial
PDF
Unlocking Big Data Insights with MySQL
PDF
replic8 - Replication in MySQL 8
MySQL Document Store - How to replace a NoSQL database by MySQL without effor...
MySQL InnoDB Cluster in a Nutshell - Hands-on Lab
Introduction to MySQL InnoDB Cluster
MySQL Document Store - when SQL & NoSQL live together... in peace!
Percona Live Europe 2018 MySQL Group Replication... the magic explained
MySQL InnoDB Cluster and Group Replication in a Nutshell
Introduction to MySQL InnoDB Cluster
Introduction to MySQL Document Store
How to operate MySQL InnoDB Cluster with MySQL Shell
MySQL Group Replication: Handling Network Glitches - Best Practices
MySQL innodb cluster and Group Replication in a nutshell - hands-on tutorial ...
OpenExpo Virtual Experience 2020: MySQL 8.0 Document Store - Discovery of a n...
High Availability in MySQL 8 using InnoDB Cluster
Python and MySQL 8.0 Document Store
Introduction to MySQL InnoDB Cluster
MySQL InnoDB Cluster - Advanced Configuration & Operations
MySQL Shell - the best DBA tool ?
MySQL 8.0 InnoDB Cluster - Easiest Tutorial
Unlocking Big Data Insights with MySQL
replic8 - Replication in MySQL 8
Ad

Similar to MySQL User Group NL: MySQL 8.0 Document Store- NoSQL with all the benefits of a transactional RDBMS (20)

PDF
Looking Inside the MySQL 8.0 Document Store
PDF
Oracle Code Roma: NoSQL + SQL = MySQL
PDF
MySQL JSON Document Store - A Document Store with all the benefits of a Trans...
PDF
MySQL 8.0 Document Store - Discovery of a New World
PDF
MySQL Day Paris 2018 - MySQL JSON Document Store
PDF
MySQL Document Store (Oracle Code Warsaw 2018)
PPTX
A Step by Step Introduction to the MySQL Document Store
PDF
Oracle Code Event - MySQL JSON Document Store
PDF
MySQL Document Store - A Document Store with all the benefts of a Transactona...
PDF
MySQL 8.0, what's new ? - Forum PHP 2018
PDF
MySQL Day Paris 2016 - MySQL as a Document Store
PDF
MySQL Document Store -- SCaLE 17x Presentation
PDF
MySQL Document Store for Modern Applications
PDF
Connector/J Beyond JDBC: the X DevAPI for Java and MySQL as a Document Store
PDF
Open Source World June '21 -- JSON Within a Relational Database
PDF
Json within a relational database
PDF
MySQL 8.0 - What's New ?
PDF
MySQL without the SQL -- Cascadia PHP
PDF
MySQL Without the SQL - Oh My! August 2nd presentation at Mid Atlantic Develo...
PDF
Node.js and the MySQL Document Store
Looking Inside the MySQL 8.0 Document Store
Oracle Code Roma: NoSQL + SQL = MySQL
MySQL JSON Document Store - A Document Store with all the benefits of a Trans...
MySQL 8.0 Document Store - Discovery of a New World
MySQL Day Paris 2018 - MySQL JSON Document Store
MySQL Document Store (Oracle Code Warsaw 2018)
A Step by Step Introduction to the MySQL Document Store
Oracle Code Event - MySQL JSON Document Store
MySQL Document Store - A Document Store with all the benefts of a Transactona...
MySQL 8.0, what's new ? - Forum PHP 2018
MySQL Day Paris 2016 - MySQL as a Document Store
MySQL Document Store -- SCaLE 17x Presentation
MySQL Document Store for Modern Applications
Connector/J Beyond JDBC: the X DevAPI for Java and MySQL as a Document Store
Open Source World June '21 -- JSON Within a Relational Database
Json within a relational database
MySQL 8.0 - What's New ?
MySQL without the SQL -- Cascadia PHP
MySQL Without the SQL - Oh My! August 2nd presentation at Mid Atlantic Develo...
Node.js and the MySQL Document Store
Ad

More from Frederic Descamps (20)

PDF
MySQL Innovation & Cloud Day - Document Store avec MySQL HeatWave Database Se...
PDF
MySQL Day Roma - MySQL Shell and Visual Studio Code Extension
PDF
RivieraJUG - MySQL Indexes and Histograms
PDF
RivieraJUG - MySQL 8.0 - What's new for developers.pdf
PDF
MySQL User Group NL - MySQL 8
PDF
State of the Dolphin - May 2022
PDF
Percona Live 2022 - MySQL Shell for Visual Studio Code
PDF
Percona Live 2022 - The Evolution of a MySQL Database System
PDF
Percona Live 2022 - MySQL Architectures
PDF
LinuxFest Northwest 2022 - The Evolution of a MySQL Database System
PDF
Open Source 101 2022 - MySQL Indexes and Histograms
PDF
Pi Day 2022 - from IoT to MySQL HeatWave Database Service
PDF
Confoo 2022 - le cycle d'une instance MySQL
PDF
FOSDEM 2022 MySQL Devroom: MySQL 8.0 - Logical Backups, Snapshots and Point-...
PDF
Les nouveautés de MySQL 8.0
PDF
Les nouveautés de MySQL 8.0
PDF
State of The Dolphin - May 2021
PDF
MySQL Shell for DBAs
PDF
Deploying Magento on OCI with MDS
PDF
MySQL Router REST API
MySQL Innovation & Cloud Day - Document Store avec MySQL HeatWave Database Se...
MySQL Day Roma - MySQL Shell and Visual Studio Code Extension
RivieraJUG - MySQL Indexes and Histograms
RivieraJUG - MySQL 8.0 - What's new for developers.pdf
MySQL User Group NL - MySQL 8
State of the Dolphin - May 2022
Percona Live 2022 - MySQL Shell for Visual Studio Code
Percona Live 2022 - The Evolution of a MySQL Database System
Percona Live 2022 - MySQL Architectures
LinuxFest Northwest 2022 - The Evolution of a MySQL Database System
Open Source 101 2022 - MySQL Indexes and Histograms
Pi Day 2022 - from IoT to MySQL HeatWave Database Service
Confoo 2022 - le cycle d'une instance MySQL
FOSDEM 2022 MySQL Devroom: MySQL 8.0 - Logical Backups, Snapshots and Point-...
Les nouveautés de MySQL 8.0
Les nouveautés de MySQL 8.0
State of The Dolphin - May 2021
MySQL Shell for DBAs
Deploying Magento on OCI with MDS
MySQL Router REST API

Recently uploaded (20)

PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
KodekX | Application Modernization Development
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Electronic commerce courselecture one. Pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Network Security Unit 5.pdf for BCA BBA.
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Cloud computing and distributed systems.
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
KodekX | Application Modernization Development
Mobile App Security Testing_ A Comprehensive Guide.pdf
Understanding_Digital_Forensics_Presentation.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Electronic commerce courselecture one. Pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Programs and apps: productivity, graphics, security and other tools
Advanced methodologies resolving dimensionality complications for autism neur...
Network Security Unit 5.pdf for BCA BBA.
The AUB Centre for AI in Media Proposal.docx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Cloud computing and distributed systems.
Spectral efficient network and resource selection model in 5G networks
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”

MySQL User Group NL: MySQL 8.0 Document Store- NoSQL with all the benefits of a transactional RDBMS

  • 3. MySQL 8.0 a Document Store with all the benefits of a transactional RDBMS     Frédéric Descamps - MySQL Community Manager - Oracle 3 / 124
  • 4. Save the date ! Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 4 / 124
  • 5.   Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purpose 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 up in making purchasing decisions. The development, release and timing of any features or functionality described for Oracle´s product remains at the sole discretion of Oracle. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 5 / 124
  • 6. about me - http://about.me/lefred Who am I ? Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 6 / 124
  • 7. Frédéric Descamps @lefred MySQL Evangelist Hacking MySQL since 3.23 devops believer living in Belgium 🇧🇪 http://lefred.be   Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 7 / 124
  • 8. RDBMS & MySQL Relational Databases Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 8 / 124
  • 9. Relational Databases Data Integrity Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 9 / 124
  • 10. Relational Databases Data Integrity normalization Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 10 / 124
  • 11. Relational Databases Data Integrity normalization constraints (foreign keys, ...) Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 11 / 124
  • 12. Relational Databases Data Integrity normalization constraints (foreign keys, ...) Atomicity, Consistency, Isolation, Durability Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 12 / 124
  • 13. Relational Databases Data Integrity normalization constraints (foreign keys, ...) Atomicity, Consistency, Isolation, Durability ACID compliant Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 13 / 124
  • 14. Relational Databases Data Integrity normalization constraints (foreign keys, ...) Atomicity, Consistency, Isolation, Durability ACID compliant transactions Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 14 / 124
  • 15. Relational Databases Data Integrity normalization constraints (foreign keys, ...) Atomicity, Consistency, Isolation, Durability ACID compliant transactions SQL Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 15 / 124
  • 16. Relational Databases Data Integrity normalization constraints (foreign keys, ...) Atomicity, Consistency, Isolation, Durability ACID compliant transactions SQL powerfull query language Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 16 / 124
  • 17. NoSQL & MySQL NoSQL Databases Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 17 / 124
  • 18. NoSQL or Document Store Schemaless Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 18 / 124
  • 19. NoSQL or Document Store Schemaless no schema design, no normalization, no foreign keys, no data types, ... Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 19 / 124
  • 20. NoSQL or Document Store Schemaless no schema design, no normalization, no foreign keys, no data types, ... very quick initial development Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 20 / 124
  • 21. NoSQL or Document Store Schemaless no schema design, no normalization, no foreign keys, no data types, ... very quick initial development Flexible data structure Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 21 / 124
  • 22. NoSQL or Document Store Schemaless no schema design, no normalization, no foreign keys, no data types, ... very quick initial development Flexible data structure embedded arrays or objects Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 22 / 124
  • 23. NoSQL or Document Store Schemaless no schema design, no normalization, no 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 @ 2018 Oracle and/or its affiliates. All rights reserved. 23 / 124
  • 24. NoSQL or Document Store Schemaless no schema design, no normalization, no 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 oobject-oriented Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 24 / 124
  • 25. NoSQL or Document Store Schemaless no schema design, no normalization, no 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 oobject-oriented JSON Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 25 / 124
  • 26. NoSQL or Document Store Schemaless no schema design, no normalization, no 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 oobject-oriented JSON close to frontend Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 26 / 124
  • 27. NoSQL or Document Store Schemaless no schema design, no normalization, no 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 oobject-oriented JSON close to frontend native in JS Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 27 / 124
  • 28. NoSQL or Document Store Schemaless no schema design, no normalization, no 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 oobject-oriented JSON close to frontend native in JS easy to learn Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 28 / 124
  • 29. How DBAs see data Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 29 / 124
  • 30. How DBAs see data How Developers see data { "GNP" : 249704, "Name" : "Belgium", "government" : { "GovernmentForm" : "Constitutional Monarchy, Federation", "HeadOfState" : "Philippe I" }, "_id" : "BEL", "IndepYear" : 1830, "demographics" : { "Population" : 10239000, "LifeExpectancy" : 77.8000030517578 }, "geography" : { "Region" : "Western Europe", "SurfaceArea" : 30518, "Continent" : "Europe" } } Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 30 / 124
  • 31. What if there was a way to provide both SQL and NoSQL on one stable platform that has proven stability on well know technology with a large Community and a diverse ecosystem ? Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 31 / 124
  • 32. DBMS or NoSQL ? Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 32 / 124
  • 33. DBMS or NoSQL ? Why not both ? Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 33 / 124
  • 34. The MySQL Document Store ! SQL is now optional ! Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 34 / 124
  • 35. Developers: [x] schemaless [x] rapid prototying/simpler APIs [x] document model [x] transactions Operations: [x] performance management/visibility [x] robust replication, backup, restore [x] comprehensive tooling ecosystem [x] simpler application schema upgrades Business Owner: [x] don't lose my data == ACID trx [x] capture all my data = extensible/schemaless [x] product on schedule/time to market = rapid developement A solution for all Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 35 / 124
  • 36. MySQL Document Store the Solution Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 36 / 124
  • 37. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 37 / 124
  • 38. Built on the MySQL JSON Data type and Proven MySQL Server Technology Provides a schema flexible JSON Document Store No SQL required No need to define all possible attributes, 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 Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 38 / 124
  • 39. X DevAPI Connectors for C++, Java, .Net, Node.js, Python, PHP working with Communities to help them supporting it too New MySQL Shell Command Completion Python, JavaScrips & SQL modes Admin functions New Util object A new high-level session concept that can scale from single MySQL Server to a multiple server environment Non-blocking, asynchronous calls follow common language patterns Supports CRUD operations Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 39 / 124
  • 40. Starting using MySQL DS in few minutes   Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 40 / 124
  • 41. MySQL Shell Info Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 41 / 124
  • 42. Migration from MongoDB to MySQL DS For this example, I will use the well known restaurants collection: Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 42 / 124
  • 43. Migration from MongoDB to MySQL DS For this example, I will use the well known restaurants collection: We need to dump the data to a file and we will use MySQL Shell with the Python interpreter to load the data. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 43 / 124
  • 44. Migration from MongoDB to MySQL DS For this example, I will use the well known restaurants collection: We need to dump the data to a file and we will use MySQL Shell with the Python interpreter to load the data. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 44 / 124
  • 45. Dump and load using MySQL Shell & Python this example is inspired by @datacharmer's work: https://www.slideshare.net/datacharmer/mysql-documentstore $ mongo --quiet --eval 'DBQuery.shellBatchSize=30000; db.restaurants. nd().shellPrint()' | perl -pe 's/(?:ObjectId|ISODate)(("[^"]+"))/ $1/g' > all_recs.json Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 45 / 124
  • 46. Dump and load using MySQL Shell & Python this example is inspired by @datacharmer's work: https://www.slideshare.net/datacharmer/mysql-documentstore $ mongo --quiet --eval 'DBQuery.shellBatchSize=30000; db.restaurants. nd().shellPrint()' | perl -pe 's/(?:ObjectId|ISODate)(("[^"]+"))/ $1/g' > all_recs.json Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 46 / 124
  • 47. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 47 / 124
  • 48. Even better in MySQL Shell 8.0.13 [preview] Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 48 / 124
  • 49. Even better in MySQL Shell 8.0.13 [preview] Dump from MongoDB: Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 49 / 124
  • 50. Even better in MySQL Shell 8.0.13 [preview] Dump from MongoDB: And import with the new util function in the Shell: Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 50 / 124
  • 51. Let´s query Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 51 / 124
  • 52. Let´s query That´s too much records to show it here... let´s limit it Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 52 / 124
  • 53. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 53 / 124
  • 54. Some more examples Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 54 / 124
  • 55. Some more examples Let´s add a selection criteria: Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 55 / 124
  • 56. Using IN... Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 56 / 124
  • 57. Syntax slightly different than MongoDB Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 57 / 124
  • 58. Syntax slightly different than MongoDB > db.restaurants. nd({"cuisine": "French", "borough": { $not: /^Manhattan/} }, {"_id":0, "name": 1,"cuisine": 1, "borough": 1}).limit(2) { "borough" : "Queens", "cuisine" : "French", "name" : "La Baraka Restaurant" } { "borough" : "Queens", "cuisine" : "French", "name" : "Air France Lounge" } Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 58 / 124
  • 59. CRUD operations Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 59 / 124
  • 60. CRUD operations for collections Add a document Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 60 / 124
  • 61. CRUD operations for collections Modify a document Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 61 / 124
  • 62. CRUD operations for collections Remove a document Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 62 / 124
  • 63. MySQL Document Store Objects Summary Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 63 / 124
  • 64. Document Store Full ACID ! It relies on the proven MySQL InnoDB´s strength & robustness: Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 64 / 124
  • 65. Document Store Full ACID ! It relies on the proven MySQL InnoDB´s strength & robustness: innodb_ ush_log_at_trx_commit = 1 Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 65 / 124
  • 66. Document Store Full ACID ! It relies on the proven MySQL InnoDB´s strength & robustness: innodb_ ush_log_at_trx_commit = 1 innodb_doublewrite = ON Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 66 / 124
  • 67. Document Store Full ACID ! It relies on the proven MySQL InnoDB´s strength & robustness: innodb_ ush_log_at_trx_commit = 1 innodb_doublewrite = ON sync_binlog = 1 Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 67 / 124
  • 68. Document Store Full ACID ! It relies on the proven MySQL InnoDB´s strength & robustness: innodb_ ush_log_at_trx_commit = 1 innodb_doublewrite = ON sync_binlog = 1 transaction_isolation = REPEATABLE-READ|READ- COMMITTED|... Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 68 / 124
  • 69. Document Store Full ACID ! It relies on the proven MySQL InnoDB´s strength & robustness: innodb_ ush_log_at_trx_commit = 1 innodb_doublewrite = ON sync_binlog = 1 transaction_isolation = REPEATABLE-READ|READ- COMMITTED|... We do care about your data ! Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 69 / 124
  • 70. Document Store Full ACID ! MySQL Document Store supports transactions Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 70 / 124
  • 71. Document Store Full ACID ! MySQL Document Store supports transactions Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 71 / 124
  • 72. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 72 / 124
  • 73. what about my old SQL ? The hidden part of the iceberg Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 73 / 124
  • 74. JSON datatype is behind the scene native datatype (since 5.7.8) Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 74 / 124
  • 75. JSON datatype is behind the scene native datatype (since 5.7.8) JSON values are stored in MySQL tables using UTF8MB4 Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 75 / 124
  • 76. JSON datatype is behind the scene native datatype (since 5.7.8) JSON values are stored in MySQL tables using UTF8MB4 Conversion from "native" SQL types to JSON values Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 76 / 124
  • 77. JSON datatype is behind the scene native datatype (since 5.7.8) JSON values are stored in MySQL tables using UTF8MB4 Conversion from "native" SQL types to JSON values JSON manipulation functions (JSON_EXTRACT, JSON_KEYS, JSON_SEARCH, JSON_TABLES, ...) Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 77 / 124
  • 78. JSON datatype is behind the scene native datatype (since 5.7.8) JSON values are stored in MySQL tables using UTF8MB4 Conversion from "native" SQL types to JSON values JSON manipulation functions (JSON_EXTRACT, JSON_KEYS, JSON_SEARCH, JSON_TABLES, ...) Generated/virtual columns Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 78 / 124
  • 79. JSON datatype is behind the scene native datatype (since 5.7.8) JSON values are stored in MySQL tables using UTF8MB4 Conversion from "native" SQL types to JSON values JSON manipulation functions (JSON_EXTRACT, JSON_KEYS, JSON_SEARCH, JSON_TABLES, ...) Generated/virtual columns Indexing JSON data Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 79 / 124
  • 80. JSON datatype is behind the scene native datatype (since 5.7.8) JSON values are stored in MySQL tables using UTF8MB4 Conversion from "native" SQL types to JSON values JSON manipulation functions (JSON_EXTRACT, JSON_KEYS, JSON_SEARCH, JSON_TABLES, ...) Generated/virtual columns Indexing JSON data Foreign Keys to JSON data Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 80 / 124
  • 81. JSON datatype is behind the scene native datatype (since 5.7.8) JSON values are stored in MySQL tables using UTF8MB4 Conversion from "native" SQL types to JSON values JSON manipulation functions (JSON_EXTRACT, JSON_KEYS, JSON_SEARCH, JSON_TABLES, ...) Generated/virtual columns Indexing JSON data Foreign Keys to JSON data SQL Views to JSON data Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 81 / 124
  • 82. How does the MySQL Document Store work ? Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 82 / 124
  • 83. What does a collection look like on the server ? Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 83 / 124
  • 84. _id Every document has a unique identifier called the document ID, which can be thought of as the equivalent of a table´s primary key. The document ID value can be manually assigned when adding a document. If no value is assigned, a document ID is generated and assigned to the document automatically ! Use getDocumentId() or getDocumentIds() to get _ids(s)     Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 84 / 124
  • 85. Mapping to SQL examples createCollection('mycollection') Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 85 / 124
  • 86. Mapping to SQL examples createCollection('mycollection') CREATE TABLE `test`.`mycoll` ( doc JSON, _id VARCHAR(32) GENERATED ALWAYS AS (doc->>'$._id') STORED PRIMARY KEY ) CHARSET utf8mb4; Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 86 / 124
  • 87. Mapping to SQL examples createCollection('mycollection') CREATE TABLE `test`.`mycoll` ( doc JSON, _id VARCHAR(32) GENERATED ALWAYS AS (doc->>'$._id') STORED PRIMARY KEY ) CHARSET utf8mb4; mycollection.add({'test': 1234}) Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 87 / 124
  • 88. Mapping to SQL examples createCollection('mycollection') CREATE TABLE `test`.`mycoll` ( doc JSON, _id VARCHAR(32) GENERATED ALWAYS AS (doc->>'$._id') STORED PRIMARY KEY ) CHARSET utf8mb4; mycollection.add({'test': 1234}) INSERT INTO `test`.`mycoll` (doc) VALUES ( JSON_OBJECT('_id','663807fe367ee6114e0e5458bdac28bf', 'test',1234) ); Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 88 / 124
  • 89. Mapping to SQL examples (2) mycollection.find("test > 100") Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 89 / 124
  • 90. Mapping to SQL examples (2) mycollection.find("test > 100") SELECT doc FROM `test`.`mycoll` WHERE (JSON_EXTRACT(doc,'$.test') > 100); Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 90 / 124
  • 91. SQL and JSON Example Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 91 / 124
  • 92. SQL and JSON Example same as: Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 92 / 124
  • 93. SQL and JSON Example same as: we can use it in SQL: Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 93 / 124
  • 94. SQL and JSON Example (2): validation Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 94 / 124
  • 95. SQL and JSON Example (2): validation Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 95 / 124
  • 96. SQL and JSON Example (2): validation Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 96 / 124
  • 97. SQL and JSON Example (3): explain Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 97 / 124
  • 98. SQL and JSON Example (3): explain Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 98 / 124
  • 99. SQL and JSON Example (4): add index Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 99 / 124
  • 100. SQL and JSON Example (4): add index Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 100 / 124
  • 101. Indexes in Document Store It's also possible to create indexes without using SQL syntax: Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 101 / 124
  • 102. Indexes in Document Store It's also possible to create indexes without using SQL syntax: Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 102 / 124
  • 103. SQL and JSON Example (5): arrays Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 103 / 124
  • 104. SQL and JSON Example (5): arrays Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 104 / 124
  • 105. SQL and JSON Example (5): arrays Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 105 / 124
  • 106. SQL and JSON Example (5): arrays Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 106 / 124
  • 107. NoSQL as SQL JSON_TABLE Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 107 / 124
  • 108. NoSQL as SQL (2) JSON_TABLE Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 108 / 124
  • 109. NoSQL as SQL - aggregation Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 109 / 124
  • 110. NoSQL as SQL - aggregation (2) Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 110 / 124
  • 111. SQL and NoSQL - JOINS Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 111 / 124
  • 112. SQL and NoSQL - JOINS Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 112 / 124
  • 113. SQL and NoSQL - JOINS Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 113 / 124
  • 114. SQL and NoSQL - JOINS (2) Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 114 / 124
  • 115. SQL and NoSQL - JOINS (2) Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 115 / 124
  • 116. SQL and NoSQL - JOINS (2) Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 116 / 124
  • 117. SQL and NoSQL - and back to JSON Document Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 117 / 124
  • 118. NoSQL or SQL Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 118 / 124
  • 119. what do I gain ? Conclusion Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 119 / 124
  • 120. schemaless flexible data structure easy to start (CRUD) Conclusion This is the best of the two worlds in one product ! Data integrity ACID Compliant Transactions SQL Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 120 / 124
  • 122. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 122 / 124
  • 123. http://lefred.be/content/top-10-reasons-for- nosql-with-mysql/ Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 123 / 124
  • 124. Thank you ! Any Questions ? share your 💕 for MySQL on social media using @mysql #MySQL8isGreat Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 124 / 124