Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
Copyright	©	2015,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
Mark	Swarbrick		
MySQL	Principle	Presales	Consultant	
Mark.Swarbrick@Oracle.com	
	
Oracle	Code	London	2018	
	
MySQL 8.0
a Document Store with all the benefits of a
transactional RDBMS
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.
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
Agenda
•  Relational vs NoSQL databases
•  MySQL	Document Store: the solution
•  Takeaways
•  Demo
RDBMS & MySQL
Relational vs NoSQL databases
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
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.
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
modeled optimally into a relational model
objects persistence without the use of any ORM - mapping	object-oriented	
JSON
close to frontend
native in JS
easy to learn
NoSQL or Document Store
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
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.
DMBS or NoSQL ?
Why not both ?
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
The MySQL Document Store !
SQL is now optional !
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
A solution for all
34 / 112
Developers:	
[✔]	Schemaless	or/and	Schema	
[✔]	Rapid	Prototyping/Simpler	APIs	
[✔]	Document	Model	
[✔]	Transactions	
	
Operations:	
[✔]	Performance	Management/Visibility	
[✔]	Robust	Replication,	Backup,	Restore	
[✔]	Comprehensive	Tooling	Ecosystem	
[✔]	Simpler	application	schema	upgrades	
Business	Owner:	
[✔]	Don’t	lose	my	data	=		ACID	transactions	
[✔]	Capture	all	my	data	=	Extensible/Schemaless	
[✔]	Products	On	Schedule/Time	to	Market	=	Rapid	Development	
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
MySQL Document Store
the Solution
35 / 112
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
35 / 112
	MySQL	Document	Store	
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
X DevAPI Connectors for
C++, Java, .Net, Node.js, Python, PHP
working with Communities
New MySQL Shell
Command Completion
Python, JavaScript & 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 pat erns
Supports CRUD operations
37 / 112
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
	MySQL	Documents	and	Collections	
•  Collections	are	containers	for	documents		
– These	documents	share	a	purpose		
– Possibly	share	one	or	more	indexes		
– Each	collection	has	a	unique	name	
– Exists	within	a	single	schema	
•  Within	a	Collection	you	can			
– Add(),	Find(),	Modify(),	and	Remove()	-	JSON	documents	
•  Collections	can	be	
– Create(),	List(),	Drop()
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
Operation Document Relational
Create Collection.add() Table.insert()
Read Collection.find() Table.select()
Update Collection.modify() Table.update()
Delete Collection.remove() Table.delete()
•  Use	SQL,	CRUD	APIs	–	Document	(NoSQL)	and	Relational	(SQL),	or	“All	of	the	Above”	
–  All	of	this	is	in	addition	to	the	Classic	APIs	
MySQL	X	DevAPI	included	in	Shell	and	Connectors
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
It	relies	on	the	proven	MySQL	InnoDB’s	strength	&	robustness:	
	
•  innodb_flush_log_at_trx_commit = 1	
•  innodb_doublewrite = ON	
•  sync_binlog = 1	
•  transaction_isolation = REPEATABLE-READ | READ-COMMITTED | ...	
We	do	care	about	your	data!	
MySQL	Document	Store	is	Full	ACID		
ACID	transactions	=	Don’t	lose	my	data
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
MySQL	Shell	8.0.11+	
	
	
MySQL	
Server	5.7	
MySQL	8.0	
Upgrade	Checker	
Prompt	Themes	
Auto	Completion	
&	
Command	History	
MySQL	
Server	8.0	
Document	Store	
X	DevAPI	
InnoDB	Cluster	
	
SQL	CLI	
	
Output	Formats	
(Table,	JSON,	Tabbed)	
Batch	Execution	
	
JavaScript	
Python	
SQL
MySQL	Document	Store:	Architecture	
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
MySQL	X	devAPI	connector	for:	
	
•  Java	
-  https://insidemysql.com/connector-j-8-0-11-the-face-for-your-brand-new-document-oriented-database/	
•  .NET	
-  https://insidemysql.com/introducing-connector-net-with-full-support-for-mysql-8-0/	
•  Node.JS	
-  https://insidemysql.com/introducing-connector-node-js-for-mysql-8-0/	
•  C++	
-  https://insidemysql.com/what-is-new-in-connector-c-8-0/	
•  Python	
-  https://insidemysql.com/using-mysql-connector-python-8-0-with-mysql-8-0/	
•  PHP	
-  https://insidemysql.com/introducing-the-mysql-x-devapi-php-extension-for-mysql-8-0/	
•  ODBC	
-  https://insidemysql.com/what-is-new-in-connector-odbc-8-0/	
https://insidemysql.com/mysql-8-0-welcome-to-the-devapi/	
Write	application	using														X	DevAPI
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
what do I gain ?
Takeaways
This is the best of the two worlds in one product !
Data integrity
ACID Compliant
Transactions
SQL
schemaless
flexible data structure
easy to start (CRUD)
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
Resources	
Topic Link(s)
MySQL	as	a	Document	Store https://dev.mysql.com/doc/refman/8.0/en/document-store.html
MySQL	Shell	User	Guide https://dev.mysql.com/doc/mysql-shell-excerpt/8.0/en/index.html
MySQL	Shell	Documentation https://dev.mysql.com/doc/dev/mysqlsh-api-javascript/8.0/
https://dev.mysql.com/doc/dev/mysqlsh-api-python/8.0/
X	Dev	API	User	Guide https://dev.mysql.com/doc/x-devapi-userguide/en/
X	Plugin https://dev.mysql.com/doc/refman/8.0/en/x-plugin.html
MySQL	Engineering	Blog https://insidemysql.com/mysql-8-0-welcome-to-the-devapi/
https://insidemysql.com/mysql-document-store-crud-quick-start/
MySQL	JSON	Data	Type https://dev.mysql.com/doc/refman/8.0/en/json.html
Blogs http://dasini.net/blog/2015/11/17/30-mins-avec-json-en-mysql/
http://dasini.net/blog/2015/11/30/json-et-colonnes-generees-avec-mysql
http://mysqlserverteam.com/tag/json/
http://mysqlserverteam.com/category/docstore/	
22
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
MySQL Document Store
Demo
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
js> session.createSchema('name')	
js> use doc	
js> db.getCollections()	
js> db.createCollection(‘myCollection')	
js> db.getCollections()
js> db.myCollection.add({“param1":“value1", “param2":“value2”})	
	
	
js> db.myCollection.find()
js> db.myCollection.find().limit(1)
js> db.myCollection.find("_id = '00005af018430000000000000002'")
js> db.myCollection.modify("_id = '1234'").set(“param",“value")
js> db.myCollection.remove("_id = '1234'")
js> session.startTransaction()
js> …
js> session.rollback()
	
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
MySQL	Document	Store	demo	“cheat	sheet”	
Create	
Read	
Update	
Delete	
Sessions

More Related Content

Oracle Code Event - MySQL JSON Document Store

  • 2. 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.
  • 3. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. Agenda •  Relational vs NoSQL databases •  MySQL Document Store: the solution •  Takeaways •  Demo
  • 4. RDBMS & MySQL Relational vs NoSQL databases Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
  • 5. 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.
  • 6. 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 modeled optimally into a relational model objects persistence without the use of any ORM - mapping object-oriented JSON close to frontend native in JS easy to learn NoSQL or Document Store Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
  • 7. 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.
  • 8. DMBS or NoSQL ? Why not both ? Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
  • 9. The MySQL Document Store ! SQL is now optional ! Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
  • 10. A solution for all 34 / 112 Developers: [✔] Schemaless or/and Schema [✔] Rapid Prototyping/Simpler APIs [✔] Document Model [✔] Transactions Operations: [✔] Performance Management/Visibility [✔] Robust Replication, Backup, Restore [✔] Comprehensive Tooling Ecosystem [✔] Simpler application schema upgrades Business Owner: [✔] Don’t lose my data = ACID transactions [✔] Capture all my data = Extensible/Schemaless [✔] Products On Schedule/Time to Market = Rapid Development Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
  • 11. MySQL Document Store the Solution 35 / 112 Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
  • 12. 35 / 112 MySQL Document Store Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
  • 13. X DevAPI Connectors for C++, Java, .Net, Node.js, Python, PHP working with Communities New MySQL Shell Command Completion Python, JavaScript & 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 pat erns Supports CRUD operations 37 / 112 Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
  • 14. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. MySQL Documents and Collections •  Collections are containers for documents – These documents share a purpose – Possibly share one or more indexes – Each collection has a unique name – Exists within a single schema •  Within a Collection you can – Add(), Find(), Modify(), and Remove() - JSON documents •  Collections can be – Create(), List(), Drop()
  • 15. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. Operation Document Relational Create Collection.add() Table.insert() Read Collection.find() Table.select() Update Collection.modify() Table.update() Delete Collection.remove() Table.delete() •  Use SQL, CRUD APIs – Document (NoSQL) and Relational (SQL), or “All of the Above” –  All of this is in addition to the Classic APIs MySQL X DevAPI included in Shell and Connectors
  • 16. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. It relies on the proven MySQL InnoDB’s strength & robustness: •  innodb_flush_log_at_trx_commit = 1 •  innodb_doublewrite = ON •  sync_binlog = 1 •  transaction_isolation = REPEATABLE-READ | READ-COMMITTED | ... We do care about your data! MySQL Document Store is Full ACID ACID transactions = Don’t lose my data
  • 17. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. MySQL Shell 8.0.11+ MySQL Server 5.7 MySQL 8.0 Upgrade Checker Prompt Themes Auto Completion & Command History MySQL Server 8.0 Document Store X DevAPI InnoDB Cluster SQL CLI Output Formats (Table, JSON, Tabbed) Batch Execution JavaScript Python SQL
  • 18. MySQL Document Store: Architecture Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
  • 19. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. MySQL X devAPI connector for: •  Java -  https://insidemysql.com/connector-j-8-0-11-the-face-for-your-brand-new-document-oriented-database/ •  .NET -  https://insidemysql.com/introducing-connector-net-with-full-support-for-mysql-8-0/ •  Node.JS -  https://insidemysql.com/introducing-connector-node-js-for-mysql-8-0/ •  C++ -  https://insidemysql.com/what-is-new-in-connector-c-8-0/ •  Python -  https://insidemysql.com/using-mysql-connector-python-8-0-with-mysql-8-0/ •  PHP -  https://insidemysql.com/introducing-the-mysql-x-devapi-php-extension-for-mysql-8-0/ •  ODBC -  https://insidemysql.com/what-is-new-in-connector-odbc-8-0/ https://insidemysql.com/mysql-8-0-welcome-to-the-devapi/ Write application using X DevAPI
  • 20. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. what do I gain ? Takeaways
  • 21. This is the best of the two worlds in one product ! Data integrity ACID Compliant Transactions SQL schemaless flexible data structure easy to start (CRUD) Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
  • 22. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. Resources Topic Link(s) MySQL as a Document Store https://dev.mysql.com/doc/refman/8.0/en/document-store.html MySQL Shell User Guide https://dev.mysql.com/doc/mysql-shell-excerpt/8.0/en/index.html MySQL Shell Documentation https://dev.mysql.com/doc/dev/mysqlsh-api-javascript/8.0/ https://dev.mysql.com/doc/dev/mysqlsh-api-python/8.0/ X Dev API User Guide https://dev.mysql.com/doc/x-devapi-userguide/en/ X Plugin https://dev.mysql.com/doc/refman/8.0/en/x-plugin.html MySQL Engineering Blog https://insidemysql.com/mysql-8-0-welcome-to-the-devapi/ https://insidemysql.com/mysql-document-store-crud-quick-start/ MySQL JSON Data Type https://dev.mysql.com/doc/refman/8.0/en/json.html Blogs http://dasini.net/blog/2015/11/17/30-mins-avec-json-en-mysql/ http://dasini.net/blog/2015/11/30/json-et-colonnes-generees-avec-mysql http://mysqlserverteam.com/tag/json/ http://mysqlserverteam.com/category/docstore/ 22
  • 23. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
  • 24. MySQL Document Store Demo Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
  • 25. js> session.createSchema('name') js> use doc js> db.getCollections() js> db.createCollection(‘myCollection') js> db.getCollections() js> db.myCollection.add({“param1":“value1", “param2":“value2”}) js> db.myCollection.find() js> db.myCollection.find().limit(1) js> db.myCollection.find("_id = '00005af018430000000000000002'") js> db.myCollection.modify("_id = '1234'").set(“param",“value") js> db.myCollection.remove("_id = '1234'") js> session.startTransaction() js> … js> session.rollback() Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. MySQL Document Store demo “cheat sheet” Create Read Update Delete Sessions