Polyglot
Databases!
David.Stokes@Oracle.com
@Stoker
slideshare.net/davidmstokes
"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
DEVELOPMENT, RELEASE, AND TIMING OF ANY FEATURES OR
FUNCTIONALITY DESCRIBED FOR ORACLE'S PRODUCTS
REMAINS AT THE SOLE DISCRETION OF ORACLE."
Safe Harbor
21 Years Old
MySQL has been part of
Oracle’s family of databases
for six years.
MySQL 8
MySQl 5.7 is the current release
but the next version will be
MySQL 8. Big feature is real
time data dictionary
Group Replication
Active master-master
replication.
JSON
A new native JSON datatype to
store documents in a column of
a table
Document Store
Programmers not know SQL
but need a database? X Devapi
allows them to use RDMS from
language of choice
Encryption
Use Oracle Key Vault to
encrypt your data at rest.
pol·y·glot"one who can write or speak several languages."
Pol·y·glot
Database"A data who can write or speak structured query
language and more."
The relational database model has been established
for decades. Originally designed for efficient storage
of data of normalized data when disk drive space
was expensive, they now can consume un-
normalized data or bypass their own optimizers and
syntax checking restraints for previously unimagined
speed.
Why!What would force well behaving software of outstanding utility
To change …
To morph …
To take on new SuperPowers?????
1.
RElational Model
One size fits all,
One size fits small,
Or
One size gives all fits?
The relational model works well but not all
data fits easily into schemas.
Sometimes the data is too big (or messy) ,
ephemeral, the team lacks DBA skills, or
The programmer is #%*@ lazy and wants
To pile stuff like a teenager!!!
NoSQL -- Broad topic made
up of many technologies
looped together like
indolent cattle and branded
NoSQL
× Graph Databases --relations, 6°of Kevin Bacon
× Map/Reduce -- Filter/Sort/Count
× Key/Value -- <attribute name/ value>
× Document store -- key/value with document data
× Most designed to scale horizontally
× Give up consistency
Adding NoSQL
The relational database vendors
have been busy adding NoSQL
features to SQL. ACID on NoSQL still
very hard.
Key/Value Pair
Document Store
JSON Data TypeMicrosoft, PostgreSQL, MySQL & more
Adding the ‘Poly’ to your data
The InnoDB memcached plugin provides an integrated memcached
daemon that automatically stores and retrieves data from InnoDB
tables, turning the MySQL server into a fast “key-value store”. Instead
of formulating queries in SQL, you can use simple get, set, and incr
operations that avoid the performance overhead associated with
SQL parsing and constructing a query optimization plan. You can also
access the same InnoDB tables through SQL for convenience,
complex queries, bulk operations, and other strengths of traditional
database software.
Plugin
One line command
to installed shared
object.
Script
Run a script to setup
example tables. Use
as a template to fit
your data, e.g.
column separator
character defaults
to ‘|’ (pipe).
Cache
You can now use
MySQL/Memcached
as a consistent
cache or customize
to your needs.
Java Script Object Notation or JSON is a
popular way of storing information in a
relatively easy for humans to consume fashion.
dON’T WANT TO NORMALIZE YOUR DATA?
tHEN STORE A
ENTIRE
DOCUMENT
IN A SINGLE
COLUMN!
CREATE TABLE json_example (JSON stuff);
INSERT INTO json_example (stuff) 
Values (‘{"k1": "value", "k2": 10}’);
You are breaking the first
rule of data normalization!
So you need new functions
to be able to take care of
the document in the column!
See JSONDATA TYPE http://slideshare.net/davidmstokes for details & examples
You can use GENERATED columns to
extract values from a JSON column
and those columns can be indexed
for fast SQL searches.
SQL skills == no?What if your programmers do not know
Structured Query Language???
Relational databases such as MySQL usually required a
document schema to be defined before documents can be
stored. You can use MySQL as a document store, which is a
schema-less, and therefore schema-flexible, storage system for
documents. When using MySQL as a document store, to create
documents describing products you do not need to know and
define all possible attributes of any products before storing
them and operating with them. This differs from working with a
relational database and storing products in a table, when all
columns of the table must be known and defined before adding
any products to the database.
New Shell & New
protocol
Developers can do CRUD
(create/read/update/delete)
From language of choice
(SQL hidden as to not frighten
them)
33060New port
mysqlshNew shell with Python, Javascript, and SQL modes
X DevapiNew protocol
The X DevAPI wraps powerful concepts in a
simple API.
● A new high-level session concept
enables you to write code that can
transparently scale from single
MySQL Server to a multiple server
environment.
● Read operations are simple and
easy to understand.
● Non-blocking, asynchronous calls
follow common host language
patterns.
The X DevAPI introduces a new, modern
and easy-to-learn way to work with your data.
● Documents are stored in
Collections and have their
dedicated CRUD operation set.
● Work with your existing domain
objects or generate code based on
structure definitions for strictly
typed languages.
● Focus is put on working with data
● Modern practices and syntax
styles are used to get away from
traditional SQL-String-Building
mysqlsh -u root --sql
Enter password: ****
mysql-py> db.createCollection("flags")
<Collection:flags>
mysql-py> db.getCollections()
[
<Collection:CountryInfo>,
<Collection:flags>
]
mysql-py> db.CountryInfo.find("GNP > 500000")
...[output removed]
10 documents in set (0.00 sec)
Connectors for
Javascript
Python
.NET
JAVA
Node.JS
(others in development)
Other Vendors
have similar
offerings of
NoSQL interfaces
for their
SQL databases
And to you!!
What does this mean
to your servers???
Databases do not
× Play Well With Others
× Always Want More
× Needs near constant
watching
× Always growing
× Demanding
Place your screenshot here
yOur
future
database
Server
More/faster memory for in memory DBs
Spill to disk, pin to memory
Durable to disk (ACID Compliant)
Gets cheaper every year (~40%)
Cache is the new RAM, RAM the new disk, disk the new tape, etc
No random writes leverage SSDs
NVRAM on the way, many be cheaper
Security
Communication
Backup
Scheduler
Smarter file systems/device drivers
THANKS!Any questions?
You can find me at @stoker or david.stokes@oracle.com
Slides -- http://slideshare.net.davidmstokes

Polyglot Database - Linuxcon North America 2016

  • 1.
  • 2.
    "THE FOLLOWING ISINTENDED 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 DEVELOPMENT, RELEASE, AND TIMING OF ANY FEATURES OR FUNCTIONALITY DESCRIBED FOR ORACLE'S PRODUCTS REMAINS AT THE SOLE DISCRETION OF ORACLE." Safe Harbor
  • 3.
    21 Years Old MySQLhas been part of Oracle’s family of databases for six years. MySQL 8 MySQl 5.7 is the current release but the next version will be MySQL 8. Big feature is real time data dictionary Group Replication Active master-master replication. JSON A new native JSON datatype to store documents in a column of a table Document Store Programmers not know SQL but need a database? X Devapi allows them to use RDMS from language of choice Encryption Use Oracle Key Vault to encrypt your data at rest.
  • 4.
    pol·y·glot"one who canwrite or speak several languages."
  • 5.
    Pol·y·glot Database"A data whocan write or speak structured query language and more."
  • 7.
    The relational databasemodel has been established for decades. Originally designed for efficient storage of data of normalized data when disk drive space was expensive, they now can consume un- normalized data or bypass their own optimizers and syntax checking restraints for previously unimagined speed.
  • 8.
    Why!What would forcewell behaving software of outstanding utility To change … To morph … To take on new SuperPowers?????
  • 9.
    1. RElational Model One sizefits all, One size fits small, Or One size gives all fits?
  • 10.
    The relational modelworks well but not all data fits easily into schemas. Sometimes the data is too big (or messy) , ephemeral, the team lacks DBA skills, or The programmer is #%*@ lazy and wants To pile stuff like a teenager!!!
  • 11.
    NoSQL -- Broadtopic made up of many technologies looped together like indolent cattle and branded NoSQL
  • 12.
    × Graph Databases--relations, 6°of Kevin Bacon × Map/Reduce -- Filter/Sort/Count × Key/Value -- <attribute name/ value> × Document store -- key/value with document data × Most designed to scale horizontally × Give up consistency
  • 13.
    Adding NoSQL The relationaldatabase vendors have been busy adding NoSQL features to SQL. ACID on NoSQL still very hard.
  • 14.
    Key/Value Pair Document Store JSONData TypeMicrosoft, PostgreSQL, MySQL & more Adding the ‘Poly’ to your data
  • 15.
    The InnoDB memcachedplugin provides an integrated memcached daemon that automatically stores and retrieves data from InnoDB tables, turning the MySQL server into a fast “key-value store”. Instead of formulating queries in SQL, you can use simple get, set, and incr operations that avoid the performance overhead associated with SQL parsing and constructing a query optimization plan. You can also access the same InnoDB tables through SQL for convenience, complex queries, bulk operations, and other strengths of traditional database software.
  • 17.
    Plugin One line command toinstalled shared object. Script Run a script to setup example tables. Use as a template to fit your data, e.g. column separator character defaults to ‘|’ (pipe). Cache You can now use MySQL/Memcached as a consistent cache or customize to your needs.
  • 18.
    Java Script ObjectNotation or JSON is a popular way of storing information in a relatively easy for humans to consume fashion.
  • 20.
    dON’T WANT TONORMALIZE YOUR DATA? tHEN STORE A ENTIRE DOCUMENT IN A SINGLE COLUMN!
  • 21.
    CREATE TABLE json_example(JSON stuff); INSERT INTO json_example (stuff) Values (‘{"k1": "value", "k2": 10}’);
  • 22.
    You are breakingthe first rule of data normalization! So you need new functions to be able to take care of the document in the column!
  • 23.
    See JSONDATA TYPEhttp://slideshare.net/davidmstokes for details & examples
  • 24.
    You can useGENERATED columns to extract values from a JSON column and those columns can be indexed for fast SQL searches.
  • 25.
    SQL skills ==no?What if your programmers do not know Structured Query Language???
  • 26.
    Relational databases suchas MySQL usually required a document schema to be defined before documents can be stored. You can use MySQL as a document store, which is a schema-less, and therefore schema-flexible, storage system for documents. When using MySQL as a document store, to create documents describing products you do not need to know and define all possible attributes of any products before storing them and operating with them. This differs from working with a relational database and storing products in a table, when all columns of the table must be known and defined before adding any products to the database.
  • 27.
    New Shell &New protocol Developers can do CRUD (create/read/update/delete) From language of choice (SQL hidden as to not frighten them)
  • 28.
    33060New port mysqlshNew shellwith Python, Javascript, and SQL modes X DevapiNew protocol
  • 29.
    The X DevAPIwraps powerful concepts in a simple API. ● A new high-level session concept enables you to write code that can transparently scale from single MySQL Server to a multiple server environment. ● Read operations are simple and easy to understand. ● Non-blocking, asynchronous calls follow common host language patterns. The X DevAPI introduces a new, modern and easy-to-learn way to work with your data. ● Documents are stored in Collections and have their dedicated CRUD operation set. ● Work with your existing domain objects or generate code based on structure definitions for strictly typed languages. ● Focus is put on working with data ● Modern practices and syntax styles are used to get away from traditional SQL-String-Building
  • 30.
    mysqlsh -u root--sql Enter password: **** mysql-py> db.createCollection("flags") <Collection:flags> mysql-py> db.getCollections() [ <Collection:CountryInfo>, <Collection:flags> ] mysql-py> db.CountryInfo.find("GNP > 500000") ...[output removed] 10 documents in set (0.00 sec)
  • 31.
  • 32.
    Other Vendors have similar offeringsof NoSQL interfaces for their SQL databases
  • 33.
    And to you!! Whatdoes this mean to your servers???
  • 34.
    Databases do not ×Play Well With Others × Always Want More × Needs near constant watching × Always growing × Demanding
  • 36.
    Place your screenshothere yOur future database Server
  • 37.
    More/faster memory forin memory DBs Spill to disk, pin to memory Durable to disk (ACID Compliant) Gets cheaper every year (~40%) Cache is the new RAM, RAM the new disk, disk the new tape, etc No random writes leverage SSDs NVRAM on the way, many be cheaper
  • 38.
  • 39.
    THANKS!Any questions? You canfind me at @stoker or david.stokes@oracle.com Slides -- http://slideshare.net.davidmstokes