SlideShare a Scribd company logo
PHP,
The X DevAPI,
and the
MySQL Document Store
Dave Stokes
@Stoker
David.Stokes@Oracle.com
https://elephantdolphin.blogspot.com/
https://slideshare.net/davidmstokes
Safe Harbor Agreement
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.
2
Small History Lesson Here
3
Programmers Tasks
● 20 years ago
○ Editor - vi, vim, emacs
○ Compiler - 1 or two
languages
○ Debugger
○ Browser (maybe)
○ XML (maybe)
○ HTML (growing need)
○ Source Control System
○ IDE (you wish!)
○ Documentation (low priority)
4
Programmers Tasks
● 20 years ago
○ Editor - vi, vim, emacs
○ Compiler - 1 or two
languages
○ Debugger
○ Browser (maybe)
○ XML (maybe)
○ HTML (growing need)
○ Source Control System
○ IDE (you wish!)
○ Documentation (low priority)
● Today
○ GIT
○ Tests
○ CI
○ Small(er) stuff
■ Containers, VMs, micro
services, etc.
○ Main language &
Framework
○ 7 or 8 JavaScript
Frameworks
○ Data Store (SQL & NoSQL) 5
Programmers Tasks
● 20 years ago
○ Editor - vi, vim, emacs
○ Compiler - 1 or two
languages
○ Debugger
○ Browser (maybe)
○ XML (maybe)
○ HTML (growing need)
○ Source Control System
○ IDE (you wish!)
○ Documentation (low priority)
● Today
○ GIT
○ Tests
○ CI
○ Small(er) stuff
■ Containers, VMs, micro services,
etc.
○ Main language & Framework
○ 7 or 8 JavaScript Frameworks
○ Data Store (SQL & NoSQL)
○ JSON
○ SSH/TLS
○ Encryption
○ Bash & Powershell
○ Markdown
○ Cloud
6
Programmers Tasks
● 20 years ago
○ Editor - vi, vim, emacs
○ Compiler - 1 or two
languages
○ Debugger
○ Browser (maybe)
○ XML (maybe)
○ HTML (growing need)
○ Source Control System
○ IDE (you wish!)
○ Documentation (low priority)
● Today
○ GIT
○ Tests
○ CI
○ Small(er) stuff
■ Containers, VMs, micro services, etc.
○ Main language & Framework
○ 7 or 8 JavaScript Frameworks
○ Data Store (SQL & NoSQL)
○ JSON
○ SSH/TLS
○ Encryption
○ Bash & Powershell
○ Markdown
○ Cloud
○ Debugger
○ Multiple Browsers
○ Multiple IDEs
○ Documentation (still low priority)
○ Mentoring (giving or receiving)
○ More frameworks
○ More third party libraries
○ Embedded, Android, IOS, etc.
○ Key management
○ Slack
○ Repository tools
○ * as a Service (*aaS)
○ Whatever the latest craze is from The Register, Inforworld, Slashdot
7
Programmers Tasks
● 20 years ago
○ Editor - vi, vim, emacs
○ Compiler - 1 or two
languages
○ Debugger
○ Browser (maybe)
○ XML (maybe)
○ HTML (growing need)
○ Source Control System
○ IDE (you wish!)
○ Documentation (low priority)
● Today
○ GIT
○ Tests
○ CI
○ Small(er) stuff
■ Containers, VMs, micro services, etc.
○ Main language & Framework
○ 7 or 8 JavaScript Frameworks
○ Data Store (SQL & NoSQL)
○ JSON
○ SSH/TLS
○ Encryption
○ Bash & Powershell
○ Markdown
○ Cloud
○ Debugger
○ Multiple Browsers
○ Multiple IDEs
○ Documentation (still low priority)
○ Mentoring (giving or receiving)
○ More frameworks
○ More third party libraries
○ Embedded, Android, IOS, etc.
○ Key management
○ Slack
○ Repository tools
○ * as a Service (*aaS)
○ Whatever the latest craze is from The Register, Inforworld, Slashdot
○ YAML and other markup file syntax
○ The newest Google tool
○ etc
8
9
BTW This was the big concern of 1999!
Constantly Increasing Learning Curve
10
2%
In my not so scientific study over the past eight years using informal informational
gathering techniques, roughly TWO PERCENT of developers receive any formal
training in Structured Query Language (SQL), Relational Calculus, Data
Normalization, or other database technologies.
And 100% of that 2% wonder why their queries stink! 11
Impedance Mismatch
12
Declarative Language Buried in a OO/Procedural
A big problem for many
developers is that they
are used to Object
Oriented and/or
Procedural programming
languages.
SQL is declarative
programming language
and embedding SQL in
PHP is an object-
relational impedance
mismatch.
// Formulate Query
// This is the best way to perform an SQL query
// For more examples, see mysql_real_escape_string()
$query = sprintf("SELECT firstname, lastname, address, age FROM
friends
WHERE firstname='%s' AND lastname='%s'",
mysql_real_escape_string($firstname),
mysql_real_escape_string($lastname));
// Perform Query
$result = mysql_query($query);
http://us1.php.net/manual/en/function.mysql-query.php
13
Note: the ‘mysql’ connector has
been deprecated and is not
supported in PHP 7 and was
replaced by ‘mysqli’ but there is still
a lot of code with ‘mysql’ around
Other Issues
1. UGLY
2. Hard to have help from your IDE
3. Extra level of complexity / opportunity to fail
4. Badly organized data & queries
And Yet More Issues
● Relational tables need to be set up
● Indexes
● Data mutability
● Need to rely on a DBA (or someone who has that role)
● Can’t start coding much of project before data format is know
● ORMs -- more complexity and another layer to maintain
15
X DevAPI &
The MySQL Document Store
16
So what if there was a way to ...
● Use schemaless JSON documents so you do not have to normalize data and
code before you know the complete schema
● Not have to embed SQL strings in your code
● Use a modern programming style API
● Be able to use the JSON data from SQL or NoSQL -
○ Best of both worlds
17
18
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 via CRUD operations.
→Modern practices and syntax styles are used to get away from traditional SQL-String-Building.
19
Scale from Single Server to Cluster w/o Code Change
The code that is needed to connect to a MySQL document store looks a lot like
the traditional MySQL connection code, but now applications can establish logical
sessions to MySQL server instances running the X Plugin. Sessions are produced
by the mysqlx factory, and the returned Sessions can encapsulate access to one
or more MySQL server instances running X Plugin. Applications that use Session
objects by default can be deployed on both single server setups and database
clusters with no code changes.
20
var mysqlx = require('mysqlx');
// Connect to server on localhost
var mySession = mysqlx.getSession( {
host: 'localhost', port: 33060,
user: 'user', password: 'password' } );
var myDb = mySession.getSchema('test');
// Use the collection 'my_collection'
var myColl = myDb.getCollection('my_collection');
// Specify which document to find with Collection.find() and
// fetch it from the database with .execute()
var myDocs = myColl.find('name like :param').limit(1).
bind('param', 'S%').execute();
// Print document
print(myDocs.fetchOne());
mySession.close();
21
PECL MySQl X DevAPI
http://php.net/manual/en/book.mysql-xdevapi.php
22
Installation (Ubuntu 18.04 & PHP 7.2)
Note: The MySQL X DevAPI PECL extension is not bundled with PHP.
// Dependencies
$ apt install build-essential libprotobuf-dev libboost-dev openssl protobuf-
compiler
// PHP with the desired extensions; php7.2-dev is required to compile
$ apt install php7.2-cli php7.2-dev php7.2-mysql php7.2-pdo php7.2-xml
// Compile the extension
$ pecl install mysql_xdevapi
// Use the 'phpenmod' command
$ phpenmod -v 7.2 -s ALL mysql_xdevapi 23
A JAON document is a data structure composed of
key-value pairs and is the fundamental structure for using
MySQL as document store.
This document shows that the values of keys can be
simple data types, such as integers or strings, but can also
contain other documents, arrays, and lists of documents.
For example, the geography key's value consists of
multiple key-value pairs. A JSON document is represented
internally using the MySQL binary JSON object, through
the JSON MySQL datatype.
The most important differences between a document and
the tables known from traditional relational databases are
that the structure of a document does not have to be
defined in advance, and a collection can contain multiple
documents with different structures. Relational tables on
the other hand require that their structure be defined, and
all rows in the table must contain the same columns.
{
"GNP": .6,
"IndepYear": 1967,
"Name": "Sealand",
"_id": "SEA",
"demographics": {
"LifeExpectancy": 79,
"Population": 27
},
"geography": {
"Continent": "Europe",
"Region": "British Islands",
"SurfaceArea": 193
},
"government": {
"GovernmentForm": "Monarchy",
"HeadOfState": "Michael Bates"
}
}
24
#!/bin/php
<?php
$session = mysql_xdevapigetSession("mysqlx://myuser:mypass@localhost:33060");
if ($session === NULL) {
die("Connection could not be established");
}
$marco = [
"name" => "Marco",
"age" => 19,
"job" => "Programmer"
];
$mike = [
"name" => "Mike",
"age" => 39,
"job" => "Manager"
];
$schema = $session->getSchema("testxx");
$collection = $schema->createCollection("example1");
$collection = $schema->getCollection("example1");
$collection->add($marco, $mike)->execute();
var_dump($collection->find("name = 'Mike'")->execute()->fetchOne()); 25
An Example
#!/bin/php
<?php
$session = mysql_xdevapigetSession("mysqlx://myuser:mypass@localhost:33060");
if ($session === NULL) {
die("Connection could not be established");
}
$marco = [
"name" => "Marco",
"age" => 19,
"job" => "Programmer"
];
$mike = [
"name" => "Mike",
"age" => 39,
"job" => "Manager"
];
$schema = $session->getSchema("testxx");
$collection = $schema->createCollection("example1");
$collection = $schema->getCollection("example1");
$collection->add($marco, $mike)->execute();
var_dump($collection->find("name = 'Mike'")->execute()->fetchOne()); 26
The URI specifies the details of the connection
- Protocol
- Username
- Authentication String
- Lost
- Port
The X Plugin listens at port 33060
#!/bin/php
<?php
$session = mysql_xdevapigetSession("mysqlx://myuser:mypass@localhost:33060");
if ($session === NULL) {
die("Connection could not be established");
}
$marco = [
"name" => "Marco",
"age" => 19,
"job" => "Programmer"
];
$mike = [
"name" => "Mike",
"age" => 39,
"job" => "Manager"
];
$schema = $session->getSchema("testxx");
$collection = $schema->createCollection("example1");
$collection = $schema->getCollection("example1");
$collection->add($marco, $mike)->execute();
var_dump($collection->find("name = 'Mike'")->execute()->fetchOne()); 27
1. Connect to the schema ‘testxx’
2. Create a collection for JSON documents
named ‘example1’
3. Use the collection ‘example1’
#!/bin/php
<?php
$session = mysql_xdevapigetSession("mysqlx://myuser:mypass@localhost:33060");
if ($session === NULL) {
die("Connection could not be established");
}
$marco = [
"name" => "Marco",
"age" => 19,
"job" => "Programmer"
];
$mike = [
"name" => "Mike",
"age" => 39,
"job" => "Manager"
];
$schema = $session->getSchema("testxx");
$collection = $schema->createCollection("example1");
$collection = $schema->getCollection("example1");
$collection->add($marco, $mike)->execute();
var_dump($collection->find("name = 'Mike'")->execute()->fetchOne()); 28
Add records to the collection
#!/bin/php
<?php
$session = mysql_xdevapigetSession("mysqlx://myuser:mypass@localhost:33060");
if ($session === NULL) {
die("Connection could not be established");
}
$marco = [
"name" => "Marco",
"age" => 19,
"job" => "Programmer"
];
$mike = [
"name" => "Mike",
"age" => 39,
"job" => "Manager"
];
$schema = $session->getSchema("testxx");
$collection = $schema->createCollection("example1");
$collection = $schema->getCollection("example1");
$collection->add($marco, $mike)->execute();
var_dump($collection->find("name = 'Mike'")->execute()->fetchOne()); 29
Find the record where the name = ‘Mike’
The Emphasis is on CRUD
30
Operation form Description
db.name.add()
The add() method inserts one document or more documents into the named
collection.
db.name.find() The find() method returns some or all documents in the named collection.
db.name.modify() The modify() method updates documents in the named collection.
db.name.remove()
The remove() method deletes one document or a list of documents from the
named collection.
CRUD EBNF Definitions - https://dev.mysql.com/doc/x-devapi-userguide/en/mysql-x-
crud-ebnf-definitions.html
find()
31
No more messy strings
$SQLQuery = “SELECT * FROM people WHERE job
LIKE “ . $job . “AND age > $age”;
Versus
$collection = $schema-
>getCollection("people");
$result = $collection
->find('job like :job and age > :age')
->bind(['job' => 'Butler', 'age' => 16])
->execute(); 32
Easier to read/comprehend than SQL
$result = $collection
->remove('age > :age_from and age < :age_to')
->bind(['age_from' => 20, 'age_to' => 50])
->limit(2)
->execute();
33
Easy to add filters like SORT, LIMIT, HAVING GROUP BY
Indexes on collections
$collection->createIndex(
'myindex1',
'{"fields": [{
"field": "$.name",
"type": "TEXT(25)",
"required": true}],
"unique": false}'
);
34
Got Tables?
You can also use the MySQL Document Store with Relational Tables
35
Quick Example using a table
#!/bin/php
<?php
$session = mysql_xdevapigetSession("mysqlx://root:hidave@localhost:33060");
if ($session === NULL) {
die("Connection could not be established");
}
$schema = $session->getSchema("world");
$table = $schema->getTable("city");
$row = $table->select('Name','District')
->where('District like :district')
->bind(['district' => 'Texas'])
->limit(25)
->execute()->fetchAll();
print_r($row);
36
The URI Connection for a Session
#!/bin/php
<?php
$session = mysql_xdevapigetSession("mysqlx://root:hidave@localhost:33060");
if ($session === NULL) {
die("Connection could not be established");
}
$schema = $session->getSchema("world");
$table = $schema->getTable("city");
$row = $table->select('Name','District')
->where('District like :district')
->bind(['district' => 'Texas'])
->limit(25)
->execute()->fetchAll();
$row = $result->fetchAll();
print_r($row);
37
Get schema and table
#!/bin/php
<?php
$session = mysql_xdevapigetSession("mysqlx://root:hidave@localhost:33060");
if ($session === NULL) {
die("Connection could not be established");
}
$schema = $session->getSchema("world");
$table = $schema->getTable("city");
$row = $table->select('Name','District')
->where('District like :district')
->bind(['district' => 'Texas'])
->limit(25)
->execute()->fetchAll();
print_r($row);
38
The Query
#!/bin/php
<?php
$session = mysql_xdevapigetSession("mysqlx://root:hidave@localhost:33060");
if ($session === NULL) {
die("Connection could not be established");
}
$schema = $session->getSchema("world");
$table = $schema->getTable("city");
$row = $table->select('Name','District')
->where('District like :district')
->bind(['district' => 'Texas'])
->limit(25)
->execute()->fetchAll();
;
print_r($row);
39
What if I Don’t Want to Rewrite old queries?
$session->sql("CREATE DATABASE addressbook")->execute();
40
Okay I can use Collections and Tables
BUT WHAT
ABOUT
BOTH!?!?!?! 41
You can also use a Collection as a table!
$collection = $schema->getCollection("people");
$table = $schema->getCollectionAsTable("people");
42
#!/bin/php
<?php
$session = mysql_xdevapigetSession("mysqlx://myuser:mypass@localhost:33060");
if ($session === NULL) {
die("Connection could not be established");
}
$schema = $session->getSchema("nyeats");
$table = $schema->getTable("restaurants");
$sqlx =
"WITH cte1 AS (SELECT doc->>"$.name" AS 'name',
doc->>"$.cuisine" AS 'cuisine',
(SELECT AVG(score) FROM
JSON_TABLE(doc, "$.grades[*]"
COLUMNS (score INT PATH "$.score")) as r ) AS avg_score
FROM restaurants)
SELECT *, rank() OVER
(PARTITION BY cuisine ORDER BY avg_score) AS `rank`
FROM cte1
ORDER by `rank`, avg_score DESC limit 10";
$row->sql($sqlx)->execute()-fetchAll();
print_r($row);
43
You can also use
Windowing Functions
for Advanced
Analytics
One of the advantages
of using MySQL as a
NoSQL Document
store is that you can
use SQL analytics on
your data!
44
Combine CTEs, Windowing Functions, & JSON_TABLE
WITH cte1 AS (SELECT doc->>"$.name"
AS 'name',
doc->>"$.cuisine" AS 'cuisine',
(SELECT AVG(score) FROM
JSON_TABLE(doc, "$.grades[*]"
COLUMNS (score INT PATH
"$.score")) as r ) AS avg_score
FROM restaurants)
SELECT *, rank() OVER
(PARTITION BY cuisine ORDER BY
avg_score) AS `rank`
FROM cte1
ORDER by `rank`, avg_score DESC limit 10
JSON_TABLE turns unstructured
JSON documents in to temporary
relational tables that can be
processed with SQL
Windowing Function for analytics
Common Table Expression make it
easy to write sub-queries
45
46
The X Plugin
… is a shared object that is installed by default in MySQL 8.0 and must be loaded
in 5.7
mysqlsh -u user -h localhost --classic --dba enableXProtocol
Or
mysql> INSTALL PLUGIN mysqlx SONAME 'mysqlx.so';
It listens on port 33060 so make sure you open firewall for 3306 (old MySQL) and
33060 (X Plugin).
And it supports SSL/TLS!!!
47
The New MySQL Shell
48
Built In JavaScript and
Python interpreters let
you work with you data
in the MySQL Shell.
Plus you get command
completion, great help
facilities, the ability to
check for server
upgrades, and the
ability to administrate a
InnoDB Clusters.
And you can also use
SQL
Built in JSON Bulk Loader
49
50
InnoDB Cluster
MySQL InnoDB cluster provides a complete high availability
solution for MySQL. Each MySQL server instance runs MySQL
Group Replication, which provides the mechanism to replicate
data within InnoDB clusters, with built-in failover.
AdminAPI removes the need to work directly with Group
Replication in InnoDB clusters MySQL Router can automatically
configure itself based on the cluster you deploy, connecting client
applications transparently to the server instances.
Multiple secondary server instances are replicas of the primary. If
the primary fails, a secondary is automatically promoted to the
role of primary. MySQL Router detects this and forwards client
applications to the new primary. Advanced users can also
configure a cluster to have multiple-primaries.
Questions and Answers plus Additional Resources
● More Info on MySQL Document Store
○ PHP PECL Extension for X DevAPI
■ http://php.net/manual/en/book.mysql-xdevapi.php
○ MySQL Document Store
■ https://dev.mysql.com/doc/refman/8.0/en/document-store.html
○ X DevAPI User Guide
■ https://dev.mysql.com/doc/x-devapi-userguide/en/
○ Dev.MySQL.com for Downloads and Other Doces
○ X DevAPI Tutorial for Sunshine PHP
■ https://github.com/davidmstokes/PHP-X-DevAPI
● David.Stokes@Oracle.com
○ https://elephantdolphin.blogspot.com/
○ Slides at https://slideshare.net/davidmstokes
○ @Stoker
○ MySQL & JSON - A Practical Programming Guide
51
Ad

More Related Content

What's hot (20)

Pluggable Databases: What they will break and why you should use them anyway!
Pluggable Databases: What they will break and why you should use them anyway!Pluggable Databases: What they will break and why you should use them anyway!
Pluggable Databases: What they will break and why you should use them anyway!
Guatemala User Group
 
Best Features of Multitenant 12c
Best Features of Multitenant 12cBest Features of Multitenant 12c
Best Features of Multitenant 12c
Guatemala User Group
 
MySQL Replication Update - DEbconf 2020 presentation
MySQL Replication Update - DEbconf 2020 presentationMySQL Replication Update - DEbconf 2020 presentation
MySQL Replication Update - DEbconf 2020 presentation
Dave Stokes
 
MySQL's NoSQL -- Texas Linuxfest August 22nd 2015
MySQL's NoSQL  -- Texas Linuxfest August 22nd 2015MySQL's NoSQL  -- Texas Linuxfest August 22nd 2015
MySQL's NoSQL -- Texas Linuxfest August 22nd 2015
Dave Stokes
 
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScriptJavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
Dave Stokes
 
MySQL Utilities -- PyTexas 2015
MySQL Utilities -- PyTexas 2015MySQL Utilities -- PyTexas 2015
MySQL Utilities -- PyTexas 2015
Dave Stokes
 
Datacon LA - MySQL without the SQL - Oh my!
Datacon LA - MySQL without the SQL - Oh my! Datacon LA - MySQL without the SQL - Oh my!
Datacon LA - MySQL without the SQL - Oh my!
Dave Stokes
 
Json within a relational database
Json within a relational databaseJson within a relational database
Json within a relational database
Dave Stokes
 
Ohio Linux Fest -- MySQL's NoSQL
Ohio Linux Fest -- MySQL's NoSQLOhio Linux Fest -- MySQL's NoSQL
Ohio Linux Fest -- MySQL's NoSQL
Dave Stokes
 
common_schema 2.0: DBA's Framework for MySQL
common_schema 2.0: DBA's Framework for MySQLcommon_schema 2.0: DBA's Framework for MySQL
common_schema 2.0: DBA's Framework for MySQL
Shlomi Noach
 
MySQL JSON Functions
MySQL JSON FunctionsMySQL JSON Functions
MySQL JSON Functions
Sveta Smirnova
 
Oracle Essentials Oracle Database 11g
Oracle Essentials   Oracle Database 11gOracle Essentials   Oracle Database 11g
Oracle Essentials Oracle Database 11g
Paola Andrea Gonzalez Montoya
 
MySQL 8.0 Operational Changes
MySQL 8.0 Operational ChangesMySQL 8.0 Operational Changes
MySQL 8.0 Operational Changes
Dave Stokes
 
DPC2007 MySQL Stored Routines for PHP Developers (Roland Bouman)
DPC2007 MySQL Stored Routines for PHP Developers (Roland Bouman)DPC2007 MySQL Stored Routines for PHP Developers (Roland Bouman)
DPC2007 MySQL Stored Routines for PHP Developers (Roland Bouman)
dpc
 
MySQL 8.0 New Features -- September 27th presentation for Open Source Summit
MySQL 8.0 New Features -- September 27th presentation for Open Source SummitMySQL 8.0 New Features -- September 27th presentation for Open Source Summit
MySQL 8.0 New Features -- September 27th presentation for Open Source Summit
Dave Stokes
 
Undelete (and more) rows from the binary log
Undelete (and more) rows from the binary logUndelete (and more) rows from the binary log
Undelete (and more) rows from the binary log
Frederic Descamps
 
Scaling php applications with redis
Scaling php applications with redisScaling php applications with redis
Scaling php applications with redis
jimbojsb
 
Create a Database Application Development Environment with Docker
Create a Database Application Development Environment with DockerCreate a Database Application Development Environment with Docker
Create a Database Application Development Environment with Docker
Blaine Carter
 
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Marco Gralike
 
MySQL Without the SQL -- Oh My! Longhorn PHP Conference
MySQL Without the SQL -- Oh My!  Longhorn PHP ConferenceMySQL Without the SQL -- Oh My!  Longhorn PHP Conference
MySQL Without the SQL -- Oh My! Longhorn PHP Conference
Dave Stokes
 
Pluggable Databases: What they will break and why you should use them anyway!
Pluggable Databases: What they will break and why you should use them anyway!Pluggable Databases: What they will break and why you should use them anyway!
Pluggable Databases: What they will break and why you should use them anyway!
Guatemala User Group
 
MySQL Replication Update - DEbconf 2020 presentation
MySQL Replication Update - DEbconf 2020 presentationMySQL Replication Update - DEbconf 2020 presentation
MySQL Replication Update - DEbconf 2020 presentation
Dave Stokes
 
MySQL's NoSQL -- Texas Linuxfest August 22nd 2015
MySQL's NoSQL  -- Texas Linuxfest August 22nd 2015MySQL's NoSQL  -- Texas Linuxfest August 22nd 2015
MySQL's NoSQL -- Texas Linuxfest August 22nd 2015
Dave Stokes
 
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScriptJavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
Dave Stokes
 
MySQL Utilities -- PyTexas 2015
MySQL Utilities -- PyTexas 2015MySQL Utilities -- PyTexas 2015
MySQL Utilities -- PyTexas 2015
Dave Stokes
 
Datacon LA - MySQL without the SQL - Oh my!
Datacon LA - MySQL without the SQL - Oh my! Datacon LA - MySQL without the SQL - Oh my!
Datacon LA - MySQL without the SQL - Oh my!
Dave Stokes
 
Json within a relational database
Json within a relational databaseJson within a relational database
Json within a relational database
Dave Stokes
 
Ohio Linux Fest -- MySQL's NoSQL
Ohio Linux Fest -- MySQL's NoSQLOhio Linux Fest -- MySQL's NoSQL
Ohio Linux Fest -- MySQL's NoSQL
Dave Stokes
 
common_schema 2.0: DBA's Framework for MySQL
common_schema 2.0: DBA's Framework for MySQLcommon_schema 2.0: DBA's Framework for MySQL
common_schema 2.0: DBA's Framework for MySQL
Shlomi Noach
 
MySQL 8.0 Operational Changes
MySQL 8.0 Operational ChangesMySQL 8.0 Operational Changes
MySQL 8.0 Operational Changes
Dave Stokes
 
DPC2007 MySQL Stored Routines for PHP Developers (Roland Bouman)
DPC2007 MySQL Stored Routines for PHP Developers (Roland Bouman)DPC2007 MySQL Stored Routines for PHP Developers (Roland Bouman)
DPC2007 MySQL Stored Routines for PHP Developers (Roland Bouman)
dpc
 
MySQL 8.0 New Features -- September 27th presentation for Open Source Summit
MySQL 8.0 New Features -- September 27th presentation for Open Source SummitMySQL 8.0 New Features -- September 27th presentation for Open Source Summit
MySQL 8.0 New Features -- September 27th presentation for Open Source Summit
Dave Stokes
 
Undelete (and more) rows from the binary log
Undelete (and more) rows from the binary logUndelete (and more) rows from the binary log
Undelete (and more) rows from the binary log
Frederic Descamps
 
Scaling php applications with redis
Scaling php applications with redisScaling php applications with redis
Scaling php applications with redis
jimbojsb
 
Create a Database Application Development Environment with Docker
Create a Database Application Development Environment with DockerCreate a Database Application Development Environment with Docker
Create a Database Application Development Environment with Docker
Blaine Carter
 
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Marco Gralike
 
MySQL Without the SQL -- Oh My! Longhorn PHP Conference
MySQL Without the SQL -- Oh My!  Longhorn PHP ConferenceMySQL Without the SQL -- Oh My!  Longhorn PHP Conference
MySQL Without the SQL -- Oh My! Longhorn PHP Conference
Dave Stokes
 

Similar to PHP, The X DevAPI, and the MySQL Document Store Presented January 23rd, 2019 at Benelux PHP Conference (20)

Python And The MySQL X DevAPI - PyCaribbean 2019
Python And The MySQL X DevAPI - PyCaribbean 2019Python And The MySQL X DevAPI - PyCaribbean 2019
Python And The MySQL X DevAPI - PyCaribbean 2019
Dave Stokes
 
Develop PHP Applications with MySQL X DevAPI
Develop PHP Applications with MySQL X DevAPIDevelop PHP Applications with MySQL X DevAPI
Develop PHP Applications with MySQL X DevAPI
Dave Stokes
 
Polyglot Database - Linuxcon North America 2016
Polyglot Database - Linuxcon North America 2016Polyglot Database - Linuxcon North America 2016
Polyglot Database - Linuxcon North America 2016
Dave Stokes
 
20171104 hk-py con-mysql-documentstore_v1
20171104 hk-py con-mysql-documentstore_v120171104 hk-py con-mysql-documentstore_v1
20171104 hk-py con-mysql-documentstore_v1
Ivan Ma
 
MySQL Connector/Node.js and the X DevAPI
MySQL Connector/Node.js and the X DevAPIMySQL Connector/Node.js and the X DevAPI
MySQL Connector/Node.js and the X DevAPI
Rui Quelhas
 
MySQL Document Store for Modern Applications
MySQL Document Store for Modern ApplicationsMySQL Document Store for Modern Applications
MySQL Document Store for Modern Applications
Olivier DASINI
 
Discover The Power of NoSQL + MySQL with MySQL
Discover The Power of NoSQL + MySQL with MySQLDiscover The Power of NoSQL + MySQL with MySQL
Discover The Power of NoSQL + MySQL with MySQL
Dave Stokes
 
MySQL Document Store - A Document Store with all the benefts of a Transactona...
MySQL Document Store - A Document Store with all the benefts of a Transactona...MySQL Document Store - A Document Store with all the benefts of a Transactona...
MySQL Document Store - A Document Store with all the benefts of a Transactona...
Olivier DASINI
 
MySQL Without the SQL - Oh My! August 2nd presentation at Mid Atlantic Develo...
MySQL Without the SQL - Oh My! August 2nd presentation at Mid Atlantic Develo...MySQL Without the SQL - Oh My! August 2nd presentation at Mid Atlantic Develo...
MySQL Without the SQL - Oh My! August 2nd presentation at Mid Atlantic Develo...
Dave Stokes
 
Advanced SQL - Database Access from Programming Languages
Advanced SQL - Database Access  from Programming LanguagesAdvanced SQL - Database Access  from Programming Languages
Advanced SQL - Database Access from Programming Languages
S.Shayan Daneshvar
 
MySQL Without the SQL -- Oh My!
MySQL Without the SQL -- Oh My!MySQL Without the SQL -- Oh My!
MySQL Without the SQL -- Oh My!
Data Con LA
 
Normalizing x pages web development
Normalizing x pages web development Normalizing x pages web development
Normalizing x pages web development
Shean McManus
 
Making MySQL Agile-ish
Making MySQL Agile-ishMaking MySQL Agile-ish
Making MySQL Agile-ish
Dave Stokes
 
MySQL Tech Café #8: MySQL 8.0 for Python Developers
MySQL Tech Café #8: MySQL 8.0 for Python DevelopersMySQL Tech Café #8: MySQL 8.0 for Python Developers
MySQL Tech Café #8: MySQL 8.0 for Python Developers
Frederic Descamps
 
Node.js and Oracle Database: New Development Techniques
Node.js and Oracle Database: New Development TechniquesNode.js and Oracle Database: New Development Techniques
Node.js and Oracle Database: New Development Techniques
Christopher Jones
 
MySQL Day Paris 2018 - MySQL JSON Document Store
MySQL Day Paris 2018 - MySQL JSON Document StoreMySQL Day Paris 2018 - MySQL JSON Document Store
MySQL Day Paris 2018 - MySQL JSON Document Store
Olivier DASINI
 
MySQL Document Store -- SCaLE 17x Presentation
MySQL Document Store -- SCaLE 17x PresentationMySQL Document Store -- SCaLE 17x Presentation
MySQL Document Store -- SCaLE 17x Presentation
Dave Stokes
 
Crash Course HTML/Rails Slides
Crash Course HTML/Rails SlidesCrash Course HTML/Rails Slides
Crash Course HTML/Rails Slides
Udita Plaha
 
What should or not be programmed on the web
What should or not be programmed on the  webWhat should or not be programmed on the  web
What should or not be programmed on the web
Mohammad Kamrul Hasan
 
MySQL Without the MySQL -- Oh My!
MySQL Without the MySQL -- Oh My!MySQL Without the MySQL -- Oh My!
MySQL Without the MySQL -- Oh My!
Dave Stokes
 
Python And The MySQL X DevAPI - PyCaribbean 2019
Python And The MySQL X DevAPI - PyCaribbean 2019Python And The MySQL X DevAPI - PyCaribbean 2019
Python And The MySQL X DevAPI - PyCaribbean 2019
Dave Stokes
 
Develop PHP Applications with MySQL X DevAPI
Develop PHP Applications with MySQL X DevAPIDevelop PHP Applications with MySQL X DevAPI
Develop PHP Applications with MySQL X DevAPI
Dave Stokes
 
Polyglot Database - Linuxcon North America 2016
Polyglot Database - Linuxcon North America 2016Polyglot Database - Linuxcon North America 2016
Polyglot Database - Linuxcon North America 2016
Dave Stokes
 
20171104 hk-py con-mysql-documentstore_v1
20171104 hk-py con-mysql-documentstore_v120171104 hk-py con-mysql-documentstore_v1
20171104 hk-py con-mysql-documentstore_v1
Ivan Ma
 
MySQL Connector/Node.js and the X DevAPI
MySQL Connector/Node.js and the X DevAPIMySQL Connector/Node.js and the X DevAPI
MySQL Connector/Node.js and the X DevAPI
Rui Quelhas
 
MySQL Document Store for Modern Applications
MySQL Document Store for Modern ApplicationsMySQL Document Store for Modern Applications
MySQL Document Store for Modern Applications
Olivier DASINI
 
Discover The Power of NoSQL + MySQL with MySQL
Discover The Power of NoSQL + MySQL with MySQLDiscover The Power of NoSQL + MySQL with MySQL
Discover The Power of NoSQL + MySQL with MySQL
Dave Stokes
 
MySQL Document Store - A Document Store with all the benefts of a Transactona...
MySQL Document Store - A Document Store with all the benefts of a Transactona...MySQL Document Store - A Document Store with all the benefts of a Transactona...
MySQL Document Store - A Document Store with all the benefts of a Transactona...
Olivier DASINI
 
MySQL Without the SQL - Oh My! August 2nd presentation at Mid Atlantic Develo...
MySQL Without the SQL - Oh My! August 2nd presentation at Mid Atlantic Develo...MySQL Without the SQL - Oh My! August 2nd presentation at Mid Atlantic Develo...
MySQL Without the SQL - Oh My! August 2nd presentation at Mid Atlantic Develo...
Dave Stokes
 
Advanced SQL - Database Access from Programming Languages
Advanced SQL - Database Access  from Programming LanguagesAdvanced SQL - Database Access  from Programming Languages
Advanced SQL - Database Access from Programming Languages
S.Shayan Daneshvar
 
MySQL Without the SQL -- Oh My!
MySQL Without the SQL -- Oh My!MySQL Without the SQL -- Oh My!
MySQL Without the SQL -- Oh My!
Data Con LA
 
Normalizing x pages web development
Normalizing x pages web development Normalizing x pages web development
Normalizing x pages web development
Shean McManus
 
Making MySQL Agile-ish
Making MySQL Agile-ishMaking MySQL Agile-ish
Making MySQL Agile-ish
Dave Stokes
 
MySQL Tech Café #8: MySQL 8.0 for Python Developers
MySQL Tech Café #8: MySQL 8.0 for Python DevelopersMySQL Tech Café #8: MySQL 8.0 for Python Developers
MySQL Tech Café #8: MySQL 8.0 for Python Developers
Frederic Descamps
 
Node.js and Oracle Database: New Development Techniques
Node.js and Oracle Database: New Development TechniquesNode.js and Oracle Database: New Development Techniques
Node.js and Oracle Database: New Development Techniques
Christopher Jones
 
MySQL Day Paris 2018 - MySQL JSON Document Store
MySQL Day Paris 2018 - MySQL JSON Document StoreMySQL Day Paris 2018 - MySQL JSON Document Store
MySQL Day Paris 2018 - MySQL JSON Document Store
Olivier DASINI
 
MySQL Document Store -- SCaLE 17x Presentation
MySQL Document Store -- SCaLE 17x PresentationMySQL Document Store -- SCaLE 17x Presentation
MySQL Document Store -- SCaLE 17x Presentation
Dave Stokes
 
Crash Course HTML/Rails Slides
Crash Course HTML/Rails SlidesCrash Course HTML/Rails Slides
Crash Course HTML/Rails Slides
Udita Plaha
 
What should or not be programmed on the web
What should or not be programmed on the  webWhat should or not be programmed on the  web
What should or not be programmed on the web
Mohammad Kamrul Hasan
 
MySQL Without the MySQL -- Oh My!
MySQL Without the MySQL -- Oh My!MySQL Without the MySQL -- Oh My!
MySQL Without the MySQL -- Oh My!
Dave Stokes
 
Ad

More from Dave Stokes (18)

Database basics for new-ish developers -- All Things Open October 18th 2021
Database basics for new-ish developers  -- All Things Open October 18th 2021Database basics for new-ish developers  -- All Things Open October 18th 2021
Database basics for new-ish developers -- All Things Open October 18th 2021
Dave Stokes
 
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...
Dave Stokes
 
Dutch PHP Conference 2021 - MySQL Indexes and Histograms
Dutch PHP Conference 2021 - MySQL Indexes and HistogramsDutch PHP Conference 2021 - MySQL Indexes and Histograms
Dutch PHP Conference 2021 - MySQL Indexes and Histograms
Dave Stokes
 
Validating JSON -- Percona Live 2021 presentation
Validating JSON -- Percona Live 2021 presentationValidating JSON -- Percona Live 2021 presentation
Validating JSON -- Percona Live 2021 presentation
Dave Stokes
 
Midwest PHP Presentation - New MSQL Features
Midwest PHP Presentation - New MSQL FeaturesMidwest PHP Presentation - New MSQL Features
Midwest PHP Presentation - New MSQL Features
Dave Stokes
 
Data Love Conference - Window Functions for Database Analytics
Data Love Conference - Window Functions for Database AnalyticsData Love Conference - Window Functions for Database Analytics
Data Love Conference - Window Functions for Database Analytics
Dave Stokes
 
Confoo 2021 -- MySQL New Features
Confoo 2021 -- MySQL New FeaturesConfoo 2021 -- MySQL New Features
Confoo 2021 -- MySQL New Features
Dave Stokes
 
Confoo 2021 - MySQL Indexes & Histograms
Confoo 2021 - MySQL Indexes & HistogramsConfoo 2021 - MySQL Indexes & Histograms
Confoo 2021 - MySQL Indexes & Histograms
Dave Stokes
 
cPanel now supports MySQL 8.0 - My Top Seven Features
cPanel now supports MySQL 8.0 - My Top Seven FeaturescPanel now supports MySQL 8.0 - My Top Seven Features
cPanel now supports MySQL 8.0 - My Top Seven Features
Dave Stokes
 
A Step by Step Introduction to the MySQL Document Store
A Step by Step Introduction to the MySQL Document StoreA Step by Step Introduction to the MySQL Document Store
A Step by Step Introduction to the MySQL Document Store
Dave Stokes
 
Confoo 202 - MySQL Group Replication and ReplicaSet
Confoo 202 - MySQL Group Replication and ReplicaSetConfoo 202 - MySQL Group Replication and ReplicaSet
Confoo 202 - MySQL Group Replication and ReplicaSet
Dave Stokes
 
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...
Dave Stokes
 
MySQL New Features -- Sunshine PHP 2020 Presentation
MySQL New Features -- Sunshine PHP 2020 PresentationMySQL New Features -- Sunshine PHP 2020 Presentation
MySQL New Features -- Sunshine PHP 2020 Presentation
Dave Stokes
 
MySQL 8.0 from December London Open Source Database Meetup
MySQL 8.0 from December London Open Source Database MeetupMySQL 8.0 from December London Open Source Database Meetup
MySQL 8.0 from December London Open Source Database Meetup
Dave Stokes
 
MySQL 8 - UKOUG Techfest Brighton December 2nd, 2019
MySQL 8 - UKOUG Techfest Brighton December 2nd, 2019MySQL 8 - UKOUG Techfest Brighton December 2nd, 2019
MySQL 8 - UKOUG Techfest Brighton December 2nd, 2019
Dave Stokes
 
Upgrading to MySQL 8.0 webinar slides November 27th, 2019
Upgrading to MySQL 8.0 webinar slides November 27th, 2019Upgrading to MySQL 8.0 webinar slides November 27th, 2019
Upgrading to MySQL 8.0 webinar slides November 27th, 2019
Dave Stokes
 
Windowing Functions - Little Rock Tech Fest 2019
Windowing Functions - Little Rock Tech Fest 2019Windowing Functions - Little Rock Tech Fest 2019
Windowing Functions - Little Rock Tech Fest 2019
Dave Stokes
 
Oracle CodeOne Foreign Keys Support in MySQL 8.0
Oracle CodeOne Foreign Keys Support in MySQL 8.0Oracle CodeOne Foreign Keys Support in MySQL 8.0
Oracle CodeOne Foreign Keys Support in MySQL 8.0
Dave Stokes
 
Database basics for new-ish developers -- All Things Open October 18th 2021
Database basics for new-ish developers  -- All Things Open October 18th 2021Database basics for new-ish developers  -- All Things Open October 18th 2021
Database basics for new-ish developers -- All Things Open October 18th 2021
Dave Stokes
 
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...
Dave Stokes
 
Dutch PHP Conference 2021 - MySQL Indexes and Histograms
Dutch PHP Conference 2021 - MySQL Indexes and HistogramsDutch PHP Conference 2021 - MySQL Indexes and Histograms
Dutch PHP Conference 2021 - MySQL Indexes and Histograms
Dave Stokes
 
Validating JSON -- Percona Live 2021 presentation
Validating JSON -- Percona Live 2021 presentationValidating JSON -- Percona Live 2021 presentation
Validating JSON -- Percona Live 2021 presentation
Dave Stokes
 
Midwest PHP Presentation - New MSQL Features
Midwest PHP Presentation - New MSQL FeaturesMidwest PHP Presentation - New MSQL Features
Midwest PHP Presentation - New MSQL Features
Dave Stokes
 
Data Love Conference - Window Functions for Database Analytics
Data Love Conference - Window Functions for Database AnalyticsData Love Conference - Window Functions for Database Analytics
Data Love Conference - Window Functions for Database Analytics
Dave Stokes
 
Confoo 2021 -- MySQL New Features
Confoo 2021 -- MySQL New FeaturesConfoo 2021 -- MySQL New Features
Confoo 2021 -- MySQL New Features
Dave Stokes
 
Confoo 2021 - MySQL Indexes & Histograms
Confoo 2021 - MySQL Indexes & HistogramsConfoo 2021 - MySQL Indexes & Histograms
Confoo 2021 - MySQL Indexes & Histograms
Dave Stokes
 
cPanel now supports MySQL 8.0 - My Top Seven Features
cPanel now supports MySQL 8.0 - My Top Seven FeaturescPanel now supports MySQL 8.0 - My Top Seven Features
cPanel now supports MySQL 8.0 - My Top Seven Features
Dave Stokes
 
A Step by Step Introduction to the MySQL Document Store
A Step by Step Introduction to the MySQL Document StoreA Step by Step Introduction to the MySQL Document Store
A Step by Step Introduction to the MySQL Document Store
Dave Stokes
 
Confoo 202 - MySQL Group Replication and ReplicaSet
Confoo 202 - MySQL Group Replication and ReplicaSetConfoo 202 - MySQL Group Replication and ReplicaSet
Confoo 202 - MySQL Group Replication and ReplicaSet
Dave Stokes
 
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...
Dave Stokes
 
MySQL New Features -- Sunshine PHP 2020 Presentation
MySQL New Features -- Sunshine PHP 2020 PresentationMySQL New Features -- Sunshine PHP 2020 Presentation
MySQL New Features -- Sunshine PHP 2020 Presentation
Dave Stokes
 
MySQL 8.0 from December London Open Source Database Meetup
MySQL 8.0 from December London Open Source Database MeetupMySQL 8.0 from December London Open Source Database Meetup
MySQL 8.0 from December London Open Source Database Meetup
Dave Stokes
 
MySQL 8 - UKOUG Techfest Brighton December 2nd, 2019
MySQL 8 - UKOUG Techfest Brighton December 2nd, 2019MySQL 8 - UKOUG Techfest Brighton December 2nd, 2019
MySQL 8 - UKOUG Techfest Brighton December 2nd, 2019
Dave Stokes
 
Upgrading to MySQL 8.0 webinar slides November 27th, 2019
Upgrading to MySQL 8.0 webinar slides November 27th, 2019Upgrading to MySQL 8.0 webinar slides November 27th, 2019
Upgrading to MySQL 8.0 webinar slides November 27th, 2019
Dave Stokes
 
Windowing Functions - Little Rock Tech Fest 2019
Windowing Functions - Little Rock Tech Fest 2019Windowing Functions - Little Rock Tech Fest 2019
Windowing Functions - Little Rock Tech Fest 2019
Dave Stokes
 
Oracle CodeOne Foreign Keys Support in MySQL 8.0
Oracle CodeOne Foreign Keys Support in MySQL 8.0Oracle CodeOne Foreign Keys Support in MySQL 8.0
Oracle CodeOne Foreign Keys Support in MySQL 8.0
Dave Stokes
 
Ad

Recently uploaded (20)

Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
Agentic AI Use Cases using GenAI LLM models
Agentic AI Use Cases using GenAI LLM modelsAgentic AI Use Cases using GenAI LLM models
Agentic AI Use Cases using GenAI LLM models
Manish Chopra
 
Sales Deck SentinelOne Singularity Platform.pptx
Sales Deck SentinelOne Singularity Platform.pptxSales Deck SentinelOne Singularity Platform.pptx
Sales Deck SentinelOne Singularity Platform.pptx
EliandoLawnote
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
Adobe Photoshop Lightroom CC 2025 Crack Latest Version
Adobe Photoshop Lightroom CC 2025 Crack Latest VersionAdobe Photoshop Lightroom CC 2025 Crack Latest Version
Adobe Photoshop Lightroom CC 2025 Crack Latest Version
usmanhidray
 
Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025
kashifyounis067
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
University of Hawai‘i at Mānoa
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
Xforce Keygen 64-bit AutoCAD 2025 Crack
Xforce Keygen 64-bit AutoCAD 2025  CrackXforce Keygen 64-bit AutoCAD 2025  Crack
Xforce Keygen 64-bit AutoCAD 2025 Crack
usmanhidray
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
Adobe Photoshop CC 2025 Crack Full Serial Key With Latest
Adobe Photoshop CC 2025 Crack Full Serial Key  With LatestAdobe Photoshop CC 2025 Crack Full Serial Key  With Latest
Adobe Photoshop CC 2025 Crack Full Serial Key With Latest
usmanhidray
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
Agentic AI Use Cases using GenAI LLM models
Agentic AI Use Cases using GenAI LLM modelsAgentic AI Use Cases using GenAI LLM models
Agentic AI Use Cases using GenAI LLM models
Manish Chopra
 
Sales Deck SentinelOne Singularity Platform.pptx
Sales Deck SentinelOne Singularity Platform.pptxSales Deck SentinelOne Singularity Platform.pptx
Sales Deck SentinelOne Singularity Platform.pptx
EliandoLawnote
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
Adobe Photoshop Lightroom CC 2025 Crack Latest Version
Adobe Photoshop Lightroom CC 2025 Crack Latest VersionAdobe Photoshop Lightroom CC 2025 Crack Latest Version
Adobe Photoshop Lightroom CC 2025 Crack Latest Version
usmanhidray
 
Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025
kashifyounis067
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
University of Hawai‘i at Mānoa
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
Xforce Keygen 64-bit AutoCAD 2025 Crack
Xforce Keygen 64-bit AutoCAD 2025  CrackXforce Keygen 64-bit AutoCAD 2025  Crack
Xforce Keygen 64-bit AutoCAD 2025 Crack
usmanhidray
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
Adobe Photoshop CC 2025 Crack Full Serial Key With Latest
Adobe Photoshop CC 2025 Crack Full Serial Key  With LatestAdobe Photoshop CC 2025 Crack Full Serial Key  With Latest
Adobe Photoshop CC 2025 Crack Full Serial Key With Latest
usmanhidray
 

PHP, The X DevAPI, and the MySQL Document Store Presented January 23rd, 2019 at Benelux PHP Conference

  • 1. PHP, The X DevAPI, and the MySQL Document Store Dave Stokes @Stoker [email protected] https://elephantdolphin.blogspot.com/ https://slideshare.net/davidmstokes
  • 2. Safe Harbor Agreement 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. 2
  • 4. Programmers Tasks ● 20 years ago ○ Editor - vi, vim, emacs ○ Compiler - 1 or two languages ○ Debugger ○ Browser (maybe) ○ XML (maybe) ○ HTML (growing need) ○ Source Control System ○ IDE (you wish!) ○ Documentation (low priority) 4
  • 5. Programmers Tasks ● 20 years ago ○ Editor - vi, vim, emacs ○ Compiler - 1 or two languages ○ Debugger ○ Browser (maybe) ○ XML (maybe) ○ HTML (growing need) ○ Source Control System ○ IDE (you wish!) ○ Documentation (low priority) ● Today ○ GIT ○ Tests ○ CI ○ Small(er) stuff ■ Containers, VMs, micro services, etc. ○ Main language & Framework ○ 7 or 8 JavaScript Frameworks ○ Data Store (SQL & NoSQL) 5
  • 6. Programmers Tasks ● 20 years ago ○ Editor - vi, vim, emacs ○ Compiler - 1 or two languages ○ Debugger ○ Browser (maybe) ○ XML (maybe) ○ HTML (growing need) ○ Source Control System ○ IDE (you wish!) ○ Documentation (low priority) ● Today ○ GIT ○ Tests ○ CI ○ Small(er) stuff ■ Containers, VMs, micro services, etc. ○ Main language & Framework ○ 7 or 8 JavaScript Frameworks ○ Data Store (SQL & NoSQL) ○ JSON ○ SSH/TLS ○ Encryption ○ Bash & Powershell ○ Markdown ○ Cloud 6
  • 7. Programmers Tasks ● 20 years ago ○ Editor - vi, vim, emacs ○ Compiler - 1 or two languages ○ Debugger ○ Browser (maybe) ○ XML (maybe) ○ HTML (growing need) ○ Source Control System ○ IDE (you wish!) ○ Documentation (low priority) ● Today ○ GIT ○ Tests ○ CI ○ Small(er) stuff ■ Containers, VMs, micro services, etc. ○ Main language & Framework ○ 7 or 8 JavaScript Frameworks ○ Data Store (SQL & NoSQL) ○ JSON ○ SSH/TLS ○ Encryption ○ Bash & Powershell ○ Markdown ○ Cloud ○ Debugger ○ Multiple Browsers ○ Multiple IDEs ○ Documentation (still low priority) ○ Mentoring (giving or receiving) ○ More frameworks ○ More third party libraries ○ Embedded, Android, IOS, etc. ○ Key management ○ Slack ○ Repository tools ○ * as a Service (*aaS) ○ Whatever the latest craze is from The Register, Inforworld, Slashdot 7
  • 8. Programmers Tasks ● 20 years ago ○ Editor - vi, vim, emacs ○ Compiler - 1 or two languages ○ Debugger ○ Browser (maybe) ○ XML (maybe) ○ HTML (growing need) ○ Source Control System ○ IDE (you wish!) ○ Documentation (low priority) ● Today ○ GIT ○ Tests ○ CI ○ Small(er) stuff ■ Containers, VMs, micro services, etc. ○ Main language & Framework ○ 7 or 8 JavaScript Frameworks ○ Data Store (SQL & NoSQL) ○ JSON ○ SSH/TLS ○ Encryption ○ Bash & Powershell ○ Markdown ○ Cloud ○ Debugger ○ Multiple Browsers ○ Multiple IDEs ○ Documentation (still low priority) ○ Mentoring (giving or receiving) ○ More frameworks ○ More third party libraries ○ Embedded, Android, IOS, etc. ○ Key management ○ Slack ○ Repository tools ○ * as a Service (*aaS) ○ Whatever the latest craze is from The Register, Inforworld, Slashdot ○ YAML and other markup file syntax ○ The newest Google tool ○ etc 8
  • 9. 9 BTW This was the big concern of 1999!
  • 11. 2% In my not so scientific study over the past eight years using informal informational gathering techniques, roughly TWO PERCENT of developers receive any formal training in Structured Query Language (SQL), Relational Calculus, Data Normalization, or other database technologies. And 100% of that 2% wonder why their queries stink! 11
  • 13. Declarative Language Buried in a OO/Procedural A big problem for many developers is that they are used to Object Oriented and/or Procedural programming languages. SQL is declarative programming language and embedding SQL in PHP is an object- relational impedance mismatch. // Formulate Query // This is the best way to perform an SQL query // For more examples, see mysql_real_escape_string() $query = sprintf("SELECT firstname, lastname, address, age FROM friends WHERE firstname='%s' AND lastname='%s'", mysql_real_escape_string($firstname), mysql_real_escape_string($lastname)); // Perform Query $result = mysql_query($query); http://us1.php.net/manual/en/function.mysql-query.php 13 Note: the ‘mysql’ connector has been deprecated and is not supported in PHP 7 and was replaced by ‘mysqli’ but there is still a lot of code with ‘mysql’ around
  • 14. Other Issues 1. UGLY 2. Hard to have help from your IDE 3. Extra level of complexity / opportunity to fail 4. Badly organized data & queries
  • 15. And Yet More Issues ● Relational tables need to be set up ● Indexes ● Data mutability ● Need to rely on a DBA (or someone who has that role) ● Can’t start coding much of project before data format is know ● ORMs -- more complexity and another layer to maintain 15
  • 16. X DevAPI & The MySQL Document Store 16
  • 17. So what if there was a way to ... ● Use schemaless JSON documents so you do not have to normalize data and code before you know the complete schema ● Not have to embed SQL strings in your code ● Use a modern programming style API ● Be able to use the JSON data from SQL or NoSQL - ○ Best of both worlds 17
  • 18. 18
  • 19. 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 via CRUD operations. →Modern practices and syntax styles are used to get away from traditional SQL-String-Building. 19
  • 20. Scale from Single Server to Cluster w/o Code Change The code that is needed to connect to a MySQL document store looks a lot like the traditional MySQL connection code, but now applications can establish logical sessions to MySQL server instances running the X Plugin. Sessions are produced by the mysqlx factory, and the returned Sessions can encapsulate access to one or more MySQL server instances running X Plugin. Applications that use Session objects by default can be deployed on both single server setups and database clusters with no code changes. 20
  • 21. var mysqlx = require('mysqlx'); // Connect to server on localhost var mySession = mysqlx.getSession( { host: 'localhost', port: 33060, user: 'user', password: 'password' } ); var myDb = mySession.getSchema('test'); // Use the collection 'my_collection' var myColl = myDb.getCollection('my_collection'); // Specify which document to find with Collection.find() and // fetch it from the database with .execute() var myDocs = myColl.find('name like :param').limit(1). bind('param', 'S%').execute(); // Print document print(myDocs.fetchOne()); mySession.close(); 21
  • 22. PECL MySQl X DevAPI http://php.net/manual/en/book.mysql-xdevapi.php 22
  • 23. Installation (Ubuntu 18.04 & PHP 7.2) Note: The MySQL X DevAPI PECL extension is not bundled with PHP. // Dependencies $ apt install build-essential libprotobuf-dev libboost-dev openssl protobuf- compiler // PHP with the desired extensions; php7.2-dev is required to compile $ apt install php7.2-cli php7.2-dev php7.2-mysql php7.2-pdo php7.2-xml // Compile the extension $ pecl install mysql_xdevapi // Use the 'phpenmod' command $ phpenmod -v 7.2 -s ALL mysql_xdevapi 23
  • 24. A JAON document is a data structure composed of key-value pairs and is the fundamental structure for using MySQL as document store. This document shows that the values of keys can be simple data types, such as integers or strings, but can also contain other documents, arrays, and lists of documents. For example, the geography key's value consists of multiple key-value pairs. A JSON document is represented internally using the MySQL binary JSON object, through the JSON MySQL datatype. The most important differences between a document and the tables known from traditional relational databases are that the structure of a document does not have to be defined in advance, and a collection can contain multiple documents with different structures. Relational tables on the other hand require that their structure be defined, and all rows in the table must contain the same columns. { "GNP": .6, "IndepYear": 1967, "Name": "Sealand", "_id": "SEA", "demographics": { "LifeExpectancy": 79, "Population": 27 }, "geography": { "Continent": "Europe", "Region": "British Islands", "SurfaceArea": 193 }, "government": { "GovernmentForm": "Monarchy", "HeadOfState": "Michael Bates" } } 24
  • 25. #!/bin/php <?php $session = mysql_xdevapigetSession("mysqlx://myuser:mypass@localhost:33060"); if ($session === NULL) { die("Connection could not be established"); } $marco = [ "name" => "Marco", "age" => 19, "job" => "Programmer" ]; $mike = [ "name" => "Mike", "age" => 39, "job" => "Manager" ]; $schema = $session->getSchema("testxx"); $collection = $schema->createCollection("example1"); $collection = $schema->getCollection("example1"); $collection->add($marco, $mike)->execute(); var_dump($collection->find("name = 'Mike'")->execute()->fetchOne()); 25 An Example
  • 26. #!/bin/php <?php $session = mysql_xdevapigetSession("mysqlx://myuser:mypass@localhost:33060"); if ($session === NULL) { die("Connection could not be established"); } $marco = [ "name" => "Marco", "age" => 19, "job" => "Programmer" ]; $mike = [ "name" => "Mike", "age" => 39, "job" => "Manager" ]; $schema = $session->getSchema("testxx"); $collection = $schema->createCollection("example1"); $collection = $schema->getCollection("example1"); $collection->add($marco, $mike)->execute(); var_dump($collection->find("name = 'Mike'")->execute()->fetchOne()); 26 The URI specifies the details of the connection - Protocol - Username - Authentication String - Lost - Port The X Plugin listens at port 33060
  • 27. #!/bin/php <?php $session = mysql_xdevapigetSession("mysqlx://myuser:mypass@localhost:33060"); if ($session === NULL) { die("Connection could not be established"); } $marco = [ "name" => "Marco", "age" => 19, "job" => "Programmer" ]; $mike = [ "name" => "Mike", "age" => 39, "job" => "Manager" ]; $schema = $session->getSchema("testxx"); $collection = $schema->createCollection("example1"); $collection = $schema->getCollection("example1"); $collection->add($marco, $mike)->execute(); var_dump($collection->find("name = 'Mike'")->execute()->fetchOne()); 27 1. Connect to the schema ‘testxx’ 2. Create a collection for JSON documents named ‘example1’ 3. Use the collection ‘example1’
  • 28. #!/bin/php <?php $session = mysql_xdevapigetSession("mysqlx://myuser:mypass@localhost:33060"); if ($session === NULL) { die("Connection could not be established"); } $marco = [ "name" => "Marco", "age" => 19, "job" => "Programmer" ]; $mike = [ "name" => "Mike", "age" => 39, "job" => "Manager" ]; $schema = $session->getSchema("testxx"); $collection = $schema->createCollection("example1"); $collection = $schema->getCollection("example1"); $collection->add($marco, $mike)->execute(); var_dump($collection->find("name = 'Mike'")->execute()->fetchOne()); 28 Add records to the collection
  • 29. #!/bin/php <?php $session = mysql_xdevapigetSession("mysqlx://myuser:mypass@localhost:33060"); if ($session === NULL) { die("Connection could not be established"); } $marco = [ "name" => "Marco", "age" => 19, "job" => "Programmer" ]; $mike = [ "name" => "Mike", "age" => 39, "job" => "Manager" ]; $schema = $session->getSchema("testxx"); $collection = $schema->createCollection("example1"); $collection = $schema->getCollection("example1"); $collection->add($marco, $mike)->execute(); var_dump($collection->find("name = 'Mike'")->execute()->fetchOne()); 29 Find the record where the name = ‘Mike’
  • 30. The Emphasis is on CRUD 30 Operation form Description db.name.add() The add() method inserts one document or more documents into the named collection. db.name.find() The find() method returns some or all documents in the named collection. db.name.modify() The modify() method updates documents in the named collection. db.name.remove() The remove() method deletes one document or a list of documents from the named collection. CRUD EBNF Definitions - https://dev.mysql.com/doc/x-devapi-userguide/en/mysql-x- crud-ebnf-definitions.html
  • 32. No more messy strings $SQLQuery = “SELECT * FROM people WHERE job LIKE “ . $job . “AND age > $age”; Versus $collection = $schema- >getCollection("people"); $result = $collection ->find('job like :job and age > :age') ->bind(['job' => 'Butler', 'age' => 16]) ->execute(); 32
  • 33. Easier to read/comprehend than SQL $result = $collection ->remove('age > :age_from and age < :age_to') ->bind(['age_from' => 20, 'age_to' => 50]) ->limit(2) ->execute(); 33 Easy to add filters like SORT, LIMIT, HAVING GROUP BY
  • 34. Indexes on collections $collection->createIndex( 'myindex1', '{"fields": [{ "field": "$.name", "type": "TEXT(25)", "required": true}], "unique": false}' ); 34
  • 35. Got Tables? You can also use the MySQL Document Store with Relational Tables 35
  • 36. Quick Example using a table #!/bin/php <?php $session = mysql_xdevapigetSession("mysqlx://root:hidave@localhost:33060"); if ($session === NULL) { die("Connection could not be established"); } $schema = $session->getSchema("world"); $table = $schema->getTable("city"); $row = $table->select('Name','District') ->where('District like :district') ->bind(['district' => 'Texas']) ->limit(25) ->execute()->fetchAll(); print_r($row); 36
  • 37. The URI Connection for a Session #!/bin/php <?php $session = mysql_xdevapigetSession("mysqlx://root:hidave@localhost:33060"); if ($session === NULL) { die("Connection could not be established"); } $schema = $session->getSchema("world"); $table = $schema->getTable("city"); $row = $table->select('Name','District') ->where('District like :district') ->bind(['district' => 'Texas']) ->limit(25) ->execute()->fetchAll(); $row = $result->fetchAll(); print_r($row); 37
  • 38. Get schema and table #!/bin/php <?php $session = mysql_xdevapigetSession("mysqlx://root:hidave@localhost:33060"); if ($session === NULL) { die("Connection could not be established"); } $schema = $session->getSchema("world"); $table = $schema->getTable("city"); $row = $table->select('Name','District') ->where('District like :district') ->bind(['district' => 'Texas']) ->limit(25) ->execute()->fetchAll(); print_r($row); 38
  • 39. The Query #!/bin/php <?php $session = mysql_xdevapigetSession("mysqlx://root:hidave@localhost:33060"); if ($session === NULL) { die("Connection could not be established"); } $schema = $session->getSchema("world"); $table = $schema->getTable("city"); $row = $table->select('Name','District') ->where('District like :district') ->bind(['district' => 'Texas']) ->limit(25) ->execute()->fetchAll(); ; print_r($row); 39
  • 40. What if I Don’t Want to Rewrite old queries? $session->sql("CREATE DATABASE addressbook")->execute(); 40
  • 41. Okay I can use Collections and Tables BUT WHAT ABOUT BOTH!?!?!?! 41
  • 42. You can also use a Collection as a table! $collection = $schema->getCollection("people"); $table = $schema->getCollectionAsTable("people"); 42
  • 43. #!/bin/php <?php $session = mysql_xdevapigetSession("mysqlx://myuser:mypass@localhost:33060"); if ($session === NULL) { die("Connection could not be established"); } $schema = $session->getSchema("nyeats"); $table = $schema->getTable("restaurants"); $sqlx = "WITH cte1 AS (SELECT doc->>"$.name" AS 'name', doc->>"$.cuisine" AS 'cuisine', (SELECT AVG(score) FROM JSON_TABLE(doc, "$.grades[*]" COLUMNS (score INT PATH "$.score")) as r ) AS avg_score FROM restaurants) SELECT *, rank() OVER (PARTITION BY cuisine ORDER BY avg_score) AS `rank` FROM cte1 ORDER by `rank`, avg_score DESC limit 10"; $row->sql($sqlx)->execute()-fetchAll(); print_r($row); 43 You can also use Windowing Functions for Advanced Analytics
  • 44. One of the advantages of using MySQL as a NoSQL Document store is that you can use SQL analytics on your data! 44
  • 45. Combine CTEs, Windowing Functions, & JSON_TABLE WITH cte1 AS (SELECT doc->>"$.name" AS 'name', doc->>"$.cuisine" AS 'cuisine', (SELECT AVG(score) FROM JSON_TABLE(doc, "$.grades[*]" COLUMNS (score INT PATH "$.score")) as r ) AS avg_score FROM restaurants) SELECT *, rank() OVER (PARTITION BY cuisine ORDER BY avg_score) AS `rank` FROM cte1 ORDER by `rank`, avg_score DESC limit 10 JSON_TABLE turns unstructured JSON documents in to temporary relational tables that can be processed with SQL Windowing Function for analytics Common Table Expression make it easy to write sub-queries 45
  • 46. 46
  • 47. The X Plugin … is a shared object that is installed by default in MySQL 8.0 and must be loaded in 5.7 mysqlsh -u user -h localhost --classic --dba enableXProtocol Or mysql> INSTALL PLUGIN mysqlx SONAME 'mysqlx.so'; It listens on port 33060 so make sure you open firewall for 3306 (old MySQL) and 33060 (X Plugin). And it supports SSL/TLS!!! 47
  • 48. The New MySQL Shell 48 Built In JavaScript and Python interpreters let you work with you data in the MySQL Shell. Plus you get command completion, great help facilities, the ability to check for server upgrades, and the ability to administrate a InnoDB Clusters. And you can also use SQL
  • 49. Built in JSON Bulk Loader 49
  • 50. 50 InnoDB Cluster MySQL InnoDB cluster provides a complete high availability solution for MySQL. Each MySQL server instance runs MySQL Group Replication, which provides the mechanism to replicate data within InnoDB clusters, with built-in failover. AdminAPI removes the need to work directly with Group Replication in InnoDB clusters MySQL Router can automatically configure itself based on the cluster you deploy, connecting client applications transparently to the server instances. Multiple secondary server instances are replicas of the primary. If the primary fails, a secondary is automatically promoted to the role of primary. MySQL Router detects this and forwards client applications to the new primary. Advanced users can also configure a cluster to have multiple-primaries.
  • 51. Questions and Answers plus Additional Resources ● More Info on MySQL Document Store ○ PHP PECL Extension for X DevAPI ■ http://php.net/manual/en/book.mysql-xdevapi.php ○ MySQL Document Store ■ https://dev.mysql.com/doc/refman/8.0/en/document-store.html ○ X DevAPI User Guide ■ https://dev.mysql.com/doc/x-devapi-userguide/en/ ○ Dev.MySQL.com for Downloads and Other Doces ○ X DevAPI Tutorial for Sunshine PHP ■ https://github.com/davidmstokes/PHP-X-DevAPI ● [email protected] ○ https://elephantdolphin.blogspot.com/ ○ Slides at https://slideshare.net/davidmstokes ○ @Stoker ○ MySQL & JSON - A Practical Programming Guide 51