SlideShare a Scribd company logo
MariaDB 10.3
Colin Charles, Chief Evangelist, Percona Inc.

colin.charles@percona.com / byte@bytebot.net 

http://bytebot.net/blog/ | @bytebot on Twitter

Percona Webinar

26 June 2018
whoami
• Chief Evangelist, Percona Inc

• Focusing on the MySQL ecosystem (MySQL, Percona Server, MariaDB Server),
as well as the MongoDB ecosystem (Percona Server for MongoDB) + 100%
open source tools from Percona like Percona Monitoring & Management,
Percona xtrabackup, Percona Toolkit, etc. Now supporting PostgreSQL too!
“To champion unbiased open source database solutions”

• Founding team of MariaDB Server (2009-2016) [Monty Program Ab, merged with
SkySQL Ab, now MariaDB Corporation]

• Formerly MySQL AB (exit: Sun Microsystems)

• Past lives include The Fedora Project (FESCO), OpenOffice.org

• MySQL Community Contributor of the Year Award winner 2014
License
• Creative Commons BY-NC-SA 4.0

• https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode 

What is MariaDB Server?
• https://mariadb.org/about/
What is MariaDB Server 10.3?
What is MariaDB TX 3.0?
• A combination of all the offerings MariaDB Corporation & MariaDB
Foundation work on

• MariaDB Foundation: MariaDB Server (GPLv2), MariaDB Connectors for C/
Java/ODBC (LGPL)

• MariaDB Corporation: services (remote DBA, migration, consulting,
technical support) + MariaDB MaxScale proxy (Business Source License) +
MariaDB Backup (fork of Percona XtraBackup), MariaDB Admin (SQLYog) +
Monitor (Monyog) + Notifications (security alerts through a portal)

• TX Cluster includes support for Galera Cluster; AX for MariaDB
ColumnStore
Key focus points for MariaDB 10.3
• Oracle compatibility

• More storage engines

• Temporal data (system versioned tables)

• Plus some of the features from 10.2+10.1+10.0+5.5+5.3+5.2+5.1
that may not be in stock MySQL
Release dates (and a basis for comparison)
MySQL MariaDB
10.1: 17 October 2015
5.7: 21 October 2015
10.2: 23 May 2017
8.0: 19 April 2018
10.3: 25 May 2018
Let’s talk storage engines
• Storage: how the data is stored on disk

• Or in NDB (memory+disk), CassandraSE
(access a Cassandra Cluster), SphinxSE
(access the Sphinx daemon) 

• Indexes: improves search operations

• Memory usage: improves data access for
speed

• Transactions: protects the integrity of
your data (Atomic-Consistent-Isolated-
Durable - ACID)

• Locking level: MyISAM (table locks),
InnoDB (row locks), old BDB (page locks)

• Data types: Data types may be
converted, MEMORY doesn’t support
TEXT, etc.

• Caching: InnoDB caches data & indexes,
MyISAM caches indexes only (relying on
OS disk cache for data)

• Full-text search capability: MyISAM has
this, InnoDB 5.6 got this

• GIS: MyISAM & Aria work (R-tree indexes
exist), InnoDB 5.7 has this

• Backups

• Foreign Keys
MariaDB storage engine offerings
• MyRocks: for write-intensive
workloads

• SPIDER: for scalability and
sharding

• InnoDB: default for read/write
operations (no longer Percona
XtraDB since MariaDB 10.2)

• ColumnStore: analytical purposes
(not included in MariaDB Server
10.3 — still a separate download)

• OQGRAPH: leaves algorithm

• note: requires libJudy

• PARTITION: updates to make
SPIDER work better

• Cassandra: still around, requires
libthrift

• CONNECT: for ETL operations

• TokuDB: requires jemalloc and
transparent hugepages to be
never (not always)
MariaDB storage engine aims
• To be a general purpose database, with purpose-built storage
engines

• Great focus on use cases

• Maximise strengths, minimise weaknesses

• InnoDB: good general purpose, balance B+-tree based engine

• MyRocks: LSM-based, fast writes, great compression

• SPIDER: sharding purposes
MyRocks
• RocksDB (Facebook) is a fork of LevelDB (Google). MyRocks is the interface to it
from MySQL/MariaDB

• Write optimised

• Focus on the endurance of flash devices to gain better lifetime (10x less write
amplification)

• Better compression than InnoDB (at least 2x)

• Ability to load data fast, avoiding compaction overheads

• Read-free replication (no random reads for updating secondary keys, only for
unique indexes; RFR does away with it all, with row-based binlog)

• Recommended read: https://mariadb.com/kb/en/library/differences-between-
myrocks-variants/
SPIDER
• Transparent sharding and re-sharding via SQL

• Partition by range/key/hash/list

• vertical partitioning engine, allows partition by columns

• Condition pushdown to the storage engine layer 

• JOIN, GROUP BY done internally (on the data nodes/shards)

• direct updates/deletes (pushdown to data nodes)

• direct aggregates (sums, min, max, avg through partition engine)

• Partition improvements: full-text support, multi-range read (MRR)

• Read the docs, please! https://mariadb.com/kb/en/library/spider-storage-
engine-overview/
What is MariaDB Server 10.3?
So the benefit of storage engines…
• mixing and matching

• sure, there are limitations…

• e.g. Galera Cluster only works with the InnoDB backend

• Feel free to mix InnoDB and MyRocks. Or get data from CONNECT
and load it into InnoDB. And so on…
Compression
• Row compression (ROW_FORMAT=COMPRESSED), to page
compression (PAGE_COMPRESSED=1), now to column compression

• Bonus? Storage engine independent

CREATE TABLE `users` (
`id` int(11) NOT NULL,
`name` varchar(100) DEFAULT NULL,
`blurb` text /*!100301 COMPRESSED*/ DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
Compression
show status like 'column_%';
+-----------------------+-------+
| Variable_name | Value |
+-----------------------+-------+
| Column_compressions | 1 |
| Column_decompressions | 0 |
+-----------------------+-------+
Invisible columns
CREATE TABLE `user` (
`id` int(11) NOT NULL,
`name` varchar(100) DEFAULT NULL,
`secret` varchar(10) INVISIBLE DEFAULT
NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
insert into user (id,name,secret) values
("1","colin","yes");
select * from user;
+----+-------+
| id | name |
+----+-------+
| 1 | colin |
+——+-------+
select id,name,secret from user;
+----+-------+--------+
| id | name | secret |
+----+-------+--------+
| 1 | colin | yes |
+----+-------+--------+
INSTANT ADD COLUMN
• contributed by Tencent to both MariaDB and MySQL

• https://mysqlserverteam.com/mysql-8-0-innodb-now-supports-
instant-add-column/ + https://mariadb.com/kb/en/instant-add-
column-for-innodb/ 

• inserts a hidden row in the table, updates the data dictionary, only
works with the last column
System versioned tables
• SQL 2011 standard. Stores history of all changes.

• Can alter a table to enable/disable/remove system versioned data

• Queries? 

• AS OF to select data as of a point in time

• BETWEEN .. AND to select data between two points in time

• Partition data BY SYSTEM_TIME

• Just ALTER .. ADD SYSTEM VERSIONING or create a table WITH
SYSTEM VERSIONING
System versioned tables
create table employees (name varchar(10), salary int,
department varchar(10)) with system versioning;
insert into employees values ("colin", 1000, “mktg");
update employees set salary=10000 where name=“colin";
update employees set department="eng" where
name=“colin"
select * from employees where name="colin";
+-------+--------+------+
| name | salary | dept |
+-------+--------+------+
| colin | 10000 | eng |
+———+--------+------+
select *, ROW_START, ROW_END from employees for
SYSTEM_TIME ALL;
+-------+--------+------------
+----------------------------
+----------------------------+
| name | salary | department | ROW_START
| ROW_END |
+-------+--------+------------
+----------------------------
+----------------------------+
| colin | 10000 | eng | 2018-06-26
13:00:53.772241 | 2038-01-19 03:14:07.999999 |
| colin | 1000 | mktg | 2018-06-26
13:00:03.656662 | 2018-06-26 13:00:24.251594 |
| colin | 10000 | mktg | 2018-06-26
13:00:24.251594 | 2018-06-26 13:00:53.772241 |
+-------+--------+------------
+----------------------------
+----------------------------+
AS OF example
SELECT * FROM employees FOR SYSTEM_TIME AS OF
TIMESTAMP'2018-06-26 13:00:24';
+-------+--------+------------+
| name | salary | department |
+-------+--------+------------+
| colin | 1000 | mktg |
+-------+--------+------------+
Oracle compatibility - Sequences
• Sequences to create a sequence of numeric values

• Not to be confused with replacing AUTO_INCREMENT, is an
alternative to creating unique identifiers

• With a sequence, you can compute the last number created by all
existing sequences, whereas AUTO_INCREMENT can only compute
its own last number created
Sequences
create sequence seq start
with 10 increment by 10;

select nextval(seq);

+--------------+

| nextval(seq) |

+--------------+

| 10 |

+--------------+

select nextval(seq);

+--------------+

| nextval(seq) |

+--------------+

| 20 |

+--------------+

select nextval(seq);

+--------------+

| nextval(seq) |

+--------------+

| 30 |

+--------------+

select lastval(seq);

+--------------+

| lastval(seq) |

+--------------+

| 30 |

+--------------+

select previous value for
seq;

+------------------------+

| previous value for seq |

+------------------------+

| 30 |

+------------------------+
Oracle PL/SQL
• PL/SQL compatibility parser added for easier migration from Oracle to MariaDB

• sql_mode=‘oracle’

• Data types (have synonyms in MariaDB): VARCHAR2 (VARCHAR), NUMBER (DECIMAL),
DATE (DATETIME), RAW (VARBINARY), BLOB (LONGBLOB), CLOB (LONGTEXT)

• CURRVAL, NEXTVAL

• EXECUTE IMMEDIATE

• Existing stored procedures, triggers

• ROW datatype for stored routines

• Cursors with parameters

• Packages

• https://mariadb.com/kb/en/library/sql_modeoracle-from-mariadb-103/
Proxy support
• Client can connect to MariaDB 10.3 via a proxy without the need to
define user privileges based on the host of the proxy

• Proxy protocol allows the proxy to provide the client IP to the server

• With audit plugin, logged client IP is now real client IP not proxy IP
Let’s not forget the goodness of MariaDB
10.2, 10.1
• Window Functions

• Recursive Common Table
Expressions

• JSON, GeoJSON functions

• Time delayed replication

• Restrict speed of reading binlog
from master

• Compressed binlog

• CHECK CONSTRAINT

• DECIMAL increased to 38 digits

• EXECUTE IMMEDIATE

• New user management functions
(SHOW CREATE USER)

• Information schema supports
user defined variables

• Binary log based Flashback for
DML statements

• Indexes for virtual columns
Other bits
• INTERSECT and EXCEPT to UNION

• Stored aggregate functions - functions that are computed over a
sequence of rows and return one result for the sequence of rows

• Idle transaction timeouts

• idle_transaction_timeout, idle_readonly_transaction_timeout,
idle_write_transaction_timeout
Some gotchas if you’re coming from MySQL
8
• JSON is not stored as a binary data type

• GTIDs are different in MariaDB (e.g. no
GTID in OK packet)

• No X Protocol, mysqlsh support

• No group replication

• PERFORMANCE_SCHEMA from MySQL
5.6

• No caching_sha256_password (ed25519)

• mysql.user.password now is
mysql.user.authentication_string

• No password expiry, last changed, etc.
however there is cracklib_password_check

• No optimiser hints, optimiser trace

• Threadpool in MariaDB!

• PAM/GSSAPI/SSPI authentication

• AWS Key Management Plugin

• Table elimination! 

• User statistics

• Dynamic columns

• No SET PERSIST

• InnoDB comes from MySQL 5.7
Thank you! Please rate in the app!
Colin Charles
colin.charles@percona.com / byte@bytebot.net
http://bytebot.net/blog | @bytebot on twitter
slides: slideshare.net/bytebot

More Related Content

PDF
Databases in the hosted cloud
PDF
Differences between MariaDB 10.3 & MySQL 8.0
PDF
MySQL features missing in MariaDB Server
PPTX
Maria db vs mysql
PDF
MariaDB - a MySQL Replacement #SELF2014
PDF
Introduction to MariaDB
PDF
MariaDB 10 Tutorial - 13.11.11 - Percona Live London
PDF
MariaDB 10.1 what's new and what's coming in 10.2 - Tokyo MariaDB Meetup
Databases in the hosted cloud
Differences between MariaDB 10.3 & MySQL 8.0
MySQL features missing in MariaDB Server
Maria db vs mysql
MariaDB - a MySQL Replacement #SELF2014
Introduction to MariaDB
MariaDB 10 Tutorial - 13.11.11 - Percona Live London
MariaDB 10.1 what's new and what's coming in 10.2 - Tokyo MariaDB Meetup

What's hot (20)

PPT
Maria db the new mysql (Colin Charles)
PDF
MariaDB 10.0 - SkySQL Paris Meetup
PDF
The MySQL ecosystem - understanding it, not running away from it!
PDF
The Complete MariaDB Server tutorial
PDF
Why MariaDB?
PDF
MariaDB 10: A MySQL Replacement - HKOSC
PDF
The MySQL Server ecosystem in 2016
PDF
MariaDB 10: The Complete Tutorial
PDF
MariaDB: in-depth (hands on training in Seoul)
PDF
Lessons from database failures
PDF
A beginners guide to MariaDB
PDF
Securing your MySQL / MariaDB Server data
PDF
Meet MariaDB 10.1 at the Bulgaria Web Summit
PDF
MariaDB: The 2012 Edition
PDF
Meet MariaDB Server 10.1 London MySQL meetup December 2015
PDF
MariaDB Server & MySQL Security Essentials 2016
PDF
MariaDB - the "new" MySQL is 5 years old and everywhere (LinuxCon Europe 2015)
PDF
My first moments with MongoDB
PDF
MariaDB Server Compatibility with MySQL
PDF
MariaDB 10 and what's new with the project
Maria db the new mysql (Colin Charles)
MariaDB 10.0 - SkySQL Paris Meetup
The MySQL ecosystem - understanding it, not running away from it!
The Complete MariaDB Server tutorial
Why MariaDB?
MariaDB 10: A MySQL Replacement - HKOSC
The MySQL Server ecosystem in 2016
MariaDB 10: The Complete Tutorial
MariaDB: in-depth (hands on training in Seoul)
Lessons from database failures
A beginners guide to MariaDB
Securing your MySQL / MariaDB Server data
Meet MariaDB 10.1 at the Bulgaria Web Summit
MariaDB: The 2012 Edition
Meet MariaDB Server 10.1 London MySQL meetup December 2015
MariaDB Server & MySQL Security Essentials 2016
MariaDB - the "new" MySQL is 5 years old and everywhere (LinuxCon Europe 2015)
My first moments with MongoDB
MariaDB Server Compatibility with MySQL
MariaDB 10 and what's new with the project
Ad

Similar to What is MariaDB Server 10.3? (20)

PDF
[B14] A MySQL Replacement by Colin Charles
PDF
MySQL Ecosystem in 2023 - FOSSASIA'23 - Alkin.pptx.pdf
PDF
Maria db 10 and the mariadb foundation(colin)
PDF
OSMC 2016 - Monitor your infrastructure with Elastic Beats by Monica Sarbu
PDF
OSMC 2016 | Monitor your Infrastructure with Elastic Beats by Monica Sarbu
PDF
MariaDB ColumnStore
PDF
MySQL 开发
PDF
MySQL Ecosystem in 2020
PDF
MariaDB with SphinxSE
PDF
[db tech showcase Tokyo 2014] B15: Scalability with MariaDB and MaxScale by ...
PDF
Streaming ETL - from RDBMS to Dashboard with KSQL
PDF
Lessons learned while building Omroep.nl
PPTX
NoSQL on MySQL - MySQL Document Store by Vadim Tkachenko
PDF
Databases in the hosted cloud
PDF
Lessons learned while building Omroep.nl
PPT
Fudcon talk.ppt
PDF
Your backend architecture is what matters slideshare
PPTX
Migration to ClickHouse. Practical guide, by Alexander Zaitsev
PDF
MySQL in the Hosted Cloud
PDF
Mariadb10 和新项目中有什么
[B14] A MySQL Replacement by Colin Charles
MySQL Ecosystem in 2023 - FOSSASIA'23 - Alkin.pptx.pdf
Maria db 10 and the mariadb foundation(colin)
OSMC 2016 - Monitor your infrastructure with Elastic Beats by Monica Sarbu
OSMC 2016 | Monitor your Infrastructure with Elastic Beats by Monica Sarbu
MariaDB ColumnStore
MySQL 开发
MySQL Ecosystem in 2020
MariaDB with SphinxSE
[db tech showcase Tokyo 2014] B15: Scalability with MariaDB and MaxScale by ...
Streaming ETL - from RDBMS to Dashboard with KSQL
Lessons learned while building Omroep.nl
NoSQL on MySQL - MySQL Document Store by Vadim Tkachenko
Databases in the hosted cloud
Lessons learned while building Omroep.nl
Fudcon talk.ppt
Your backend architecture is what matters slideshare
Migration to ClickHouse. Practical guide, by Alexander Zaitsev
MySQL in the Hosted Cloud
Mariadb10 和新项目中有什么
Ad

More from Colin Charles (15)

PDF
Databases in the Hosted Cloud
PDF
Best practices for MySQL High Availability Tutorial
PDF
Percona ServerをMySQL 5.6と5.7用に作るエンジニアリング(そしてMongoDBのヒント)
PDF
Capacity planning for your data stores
PDF
The Proxy Wars - MySQL Router, ProxySQL, MariaDB MaxScale
PDF
Lessons from {distributed,remote,virtual} communities and companies
PDF
Forking Successfully - or is a branch better?
PDF
The MySQL Server Ecosystem in 2016
PDF
Best practices for MySQL/MariaDB Server/Percona Server High Availability
PDF
Lessons from database failures
PDF
Lessons from database failures
PDF
Tuning Linux for your database FLOSSUK 2016
PDF
Distributions from the view a package
PDF
Cool MariaDB Plugins
PDF
Better encryption & security with MariaDB 10.1 & MySQL 5.7
Databases in the Hosted Cloud
Best practices for MySQL High Availability Tutorial
Percona ServerをMySQL 5.6と5.7用に作るエンジニアリング(そしてMongoDBのヒント)
Capacity planning for your data stores
The Proxy Wars - MySQL Router, ProxySQL, MariaDB MaxScale
Lessons from {distributed,remote,virtual} communities and companies
Forking Successfully - or is a branch better?
The MySQL Server Ecosystem in 2016
Best practices for MySQL/MariaDB Server/Percona Server High Availability
Lessons from database failures
Lessons from database failures
Tuning Linux for your database FLOSSUK 2016
Distributions from the view a package
Cool MariaDB Plugins
Better encryption & security with MariaDB 10.1 & MySQL 5.7

Recently uploaded (20)

PDF
Approach and Philosophy of On baking technology
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPT
Teaching material agriculture food technology
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Spectral efficient network and resource selection model in 5G networks
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
Cloud computing and distributed systems.
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Machine learning based COVID-19 study performance prediction
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
Approach and Philosophy of On baking technology
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Teaching material agriculture food technology
Programs and apps: productivity, graphics, security and other tools
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
20250228 LYD VKU AI Blended-Learning.pptx
sap open course for s4hana steps from ECC to s4
Spectral efficient network and resource selection model in 5G networks
The AUB Centre for AI in Media Proposal.docx
Cloud computing and distributed systems.
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Machine learning based COVID-19 study performance prediction
Mobile App Security Testing_ A Comprehensive Guide.pdf

What is MariaDB Server 10.3?

  • 1. MariaDB 10.3 Colin Charles, Chief Evangelist, Percona Inc. colin.charles@percona.com / byte@bytebot.net http://bytebot.net/blog/ | @bytebot on Twitter Percona Webinar 26 June 2018
  • 2. whoami • Chief Evangelist, Percona Inc • Focusing on the MySQL ecosystem (MySQL, Percona Server, MariaDB Server), as well as the MongoDB ecosystem (Percona Server for MongoDB) + 100% open source tools from Percona like Percona Monitoring & Management, Percona xtrabackup, Percona Toolkit, etc. Now supporting PostgreSQL too! “To champion unbiased open source database solutions” • Founding team of MariaDB Server (2009-2016) [Monty Program Ab, merged with SkySQL Ab, now MariaDB Corporation] • Formerly MySQL AB (exit: Sun Microsystems) • Past lives include The Fedora Project (FESCO), OpenOffice.org • MySQL Community Contributor of the Year Award winner 2014
  • 3. License • Creative Commons BY-NC-SA 4.0 • https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode 

  • 4. What is MariaDB Server? • https://mariadb.org/about/
  • 6. What is MariaDB TX 3.0? • A combination of all the offerings MariaDB Corporation & MariaDB Foundation work on • MariaDB Foundation: MariaDB Server (GPLv2), MariaDB Connectors for C/ Java/ODBC (LGPL) • MariaDB Corporation: services (remote DBA, migration, consulting, technical support) + MariaDB MaxScale proxy (Business Source License) + MariaDB Backup (fork of Percona XtraBackup), MariaDB Admin (SQLYog) + Monitor (Monyog) + Notifications (security alerts through a portal) • TX Cluster includes support for Galera Cluster; AX for MariaDB ColumnStore
  • 7. Key focus points for MariaDB 10.3 • Oracle compatibility • More storage engines • Temporal data (system versioned tables) • Plus some of the features from 10.2+10.1+10.0+5.5+5.3+5.2+5.1 that may not be in stock MySQL
  • 8. Release dates (and a basis for comparison) MySQL MariaDB 10.1: 17 October 2015 5.7: 21 October 2015 10.2: 23 May 2017 8.0: 19 April 2018 10.3: 25 May 2018
  • 9. Let’s talk storage engines • Storage: how the data is stored on disk • Or in NDB (memory+disk), CassandraSE (access a Cassandra Cluster), SphinxSE (access the Sphinx daemon) • Indexes: improves search operations • Memory usage: improves data access for speed • Transactions: protects the integrity of your data (Atomic-Consistent-Isolated- Durable - ACID) • Locking level: MyISAM (table locks), InnoDB (row locks), old BDB (page locks) • Data types: Data types may be converted, MEMORY doesn’t support TEXT, etc. • Caching: InnoDB caches data & indexes, MyISAM caches indexes only (relying on OS disk cache for data) • Full-text search capability: MyISAM has this, InnoDB 5.6 got this • GIS: MyISAM & Aria work (R-tree indexes exist), InnoDB 5.7 has this • Backups • Foreign Keys
  • 10. MariaDB storage engine offerings • MyRocks: for write-intensive workloads • SPIDER: for scalability and sharding • InnoDB: default for read/write operations (no longer Percona XtraDB since MariaDB 10.2) • ColumnStore: analytical purposes (not included in MariaDB Server 10.3 — still a separate download) • OQGRAPH: leaves algorithm • note: requires libJudy • PARTITION: updates to make SPIDER work better • Cassandra: still around, requires libthrift • CONNECT: for ETL operations • TokuDB: requires jemalloc and transparent hugepages to be never (not always)
  • 11. MariaDB storage engine aims • To be a general purpose database, with purpose-built storage engines • Great focus on use cases • Maximise strengths, minimise weaknesses • InnoDB: good general purpose, balance B+-tree based engine • MyRocks: LSM-based, fast writes, great compression • SPIDER: sharding purposes
  • 12. MyRocks • RocksDB (Facebook) is a fork of LevelDB (Google). MyRocks is the interface to it from MySQL/MariaDB • Write optimised • Focus on the endurance of flash devices to gain better lifetime (10x less write amplification) • Better compression than InnoDB (at least 2x) • Ability to load data fast, avoiding compaction overheads • Read-free replication (no random reads for updating secondary keys, only for unique indexes; RFR does away with it all, with row-based binlog) • Recommended read: https://mariadb.com/kb/en/library/differences-between- myrocks-variants/
  • 13. SPIDER • Transparent sharding and re-sharding via SQL • Partition by range/key/hash/list • vertical partitioning engine, allows partition by columns • Condition pushdown to the storage engine layer • JOIN, GROUP BY done internally (on the data nodes/shards) • direct updates/deletes (pushdown to data nodes) • direct aggregates (sums, min, max, avg through partition engine) • Partition improvements: full-text support, multi-range read (MRR) • Read the docs, please! https://mariadb.com/kb/en/library/spider-storage- engine-overview/
  • 15. So the benefit of storage engines… • mixing and matching • sure, there are limitations… • e.g. Galera Cluster only works with the InnoDB backend • Feel free to mix InnoDB and MyRocks. Or get data from CONNECT and load it into InnoDB. And so on…
  • 16. Compression • Row compression (ROW_FORMAT=COMPRESSED), to page compression (PAGE_COMPRESSED=1), now to column compression • Bonus? Storage engine independent CREATE TABLE `users` ( `id` int(11) NOT NULL, `name` varchar(100) DEFAULT NULL, `blurb` text /*!100301 COMPRESSED*/ DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
  • 17. Compression show status like 'column_%'; +-----------------------+-------+ | Variable_name | Value | +-----------------------+-------+ | Column_compressions | 1 | | Column_decompressions | 0 | +-----------------------+-------+
  • 18. Invisible columns CREATE TABLE `user` ( `id` int(11) NOT NULL, `name` varchar(100) DEFAULT NULL, `secret` varchar(10) INVISIBLE DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into user (id,name,secret) values ("1","colin","yes"); select * from user; +----+-------+ | id | name | +----+-------+ | 1 | colin | +——+-------+ select id,name,secret from user; +----+-------+--------+ | id | name | secret | +----+-------+--------+ | 1 | colin | yes | +----+-------+--------+
  • 19. INSTANT ADD COLUMN • contributed by Tencent to both MariaDB and MySQL • https://mysqlserverteam.com/mysql-8-0-innodb-now-supports- instant-add-column/ + https://mariadb.com/kb/en/instant-add- column-for-innodb/ • inserts a hidden row in the table, updates the data dictionary, only works with the last column
  • 20. System versioned tables • SQL 2011 standard. Stores history of all changes. • Can alter a table to enable/disable/remove system versioned data • Queries? • AS OF to select data as of a point in time • BETWEEN .. AND to select data between two points in time • Partition data BY SYSTEM_TIME • Just ALTER .. ADD SYSTEM VERSIONING or create a table WITH SYSTEM VERSIONING
  • 21. System versioned tables create table employees (name varchar(10), salary int, department varchar(10)) with system versioning; insert into employees values ("colin", 1000, “mktg"); update employees set salary=10000 where name=“colin"; update employees set department="eng" where name=“colin" select * from employees where name="colin"; +-------+--------+------+ | name | salary | dept | +-------+--------+------+ | colin | 10000 | eng | +———+--------+------+ select *, ROW_START, ROW_END from employees for SYSTEM_TIME ALL; +-------+--------+------------ +---------------------------- +----------------------------+ | name | salary | department | ROW_START | ROW_END | +-------+--------+------------ +---------------------------- +----------------------------+ | colin | 10000 | eng | 2018-06-26 13:00:53.772241 | 2038-01-19 03:14:07.999999 | | colin | 1000 | mktg | 2018-06-26 13:00:03.656662 | 2018-06-26 13:00:24.251594 | | colin | 10000 | mktg | 2018-06-26 13:00:24.251594 | 2018-06-26 13:00:53.772241 | +-------+--------+------------ +---------------------------- +----------------------------+
  • 22. AS OF example SELECT * FROM employees FOR SYSTEM_TIME AS OF TIMESTAMP'2018-06-26 13:00:24'; +-------+--------+------------+ | name | salary | department | +-------+--------+------------+ | colin | 1000 | mktg | +-------+--------+------------+
  • 23. Oracle compatibility - Sequences • Sequences to create a sequence of numeric values • Not to be confused with replacing AUTO_INCREMENT, is an alternative to creating unique identifiers • With a sequence, you can compute the last number created by all existing sequences, whereas AUTO_INCREMENT can only compute its own last number created
  • 24. Sequences create sequence seq start with 10 increment by 10; select nextval(seq); +--------------+ | nextval(seq) | +--------------+ | 10 | +--------------+ select nextval(seq); +--------------+ | nextval(seq) | +--------------+ | 20 | +--------------+ select nextval(seq); +--------------+ | nextval(seq) | +--------------+ | 30 | +--------------+ select lastval(seq); +--------------+ | lastval(seq) | +--------------+ | 30 | +--------------+ select previous value for seq; +------------------------+ | previous value for seq | +------------------------+ | 30 | +------------------------+
  • 25. Oracle PL/SQL • PL/SQL compatibility parser added for easier migration from Oracle to MariaDB • sql_mode=‘oracle’ • Data types (have synonyms in MariaDB): VARCHAR2 (VARCHAR), NUMBER (DECIMAL), DATE (DATETIME), RAW (VARBINARY), BLOB (LONGBLOB), CLOB (LONGTEXT) • CURRVAL, NEXTVAL • EXECUTE IMMEDIATE • Existing stored procedures, triggers • ROW datatype for stored routines • Cursors with parameters • Packages • https://mariadb.com/kb/en/library/sql_modeoracle-from-mariadb-103/
  • 26. Proxy support • Client can connect to MariaDB 10.3 via a proxy without the need to define user privileges based on the host of the proxy • Proxy protocol allows the proxy to provide the client IP to the server • With audit plugin, logged client IP is now real client IP not proxy IP
  • 27. Let’s not forget the goodness of MariaDB 10.2, 10.1 • Window Functions • Recursive Common Table Expressions • JSON, GeoJSON functions • Time delayed replication • Restrict speed of reading binlog from master • Compressed binlog • CHECK CONSTRAINT • DECIMAL increased to 38 digits • EXECUTE IMMEDIATE • New user management functions (SHOW CREATE USER) • Information schema supports user defined variables • Binary log based Flashback for DML statements • Indexes for virtual columns
  • 28. Other bits • INTERSECT and EXCEPT to UNION • Stored aggregate functions - functions that are computed over a sequence of rows and return one result for the sequence of rows • Idle transaction timeouts • idle_transaction_timeout, idle_readonly_transaction_timeout, idle_write_transaction_timeout
  • 29. Some gotchas if you’re coming from MySQL 8 • JSON is not stored as a binary data type • GTIDs are different in MariaDB (e.g. no GTID in OK packet) • No X Protocol, mysqlsh support • No group replication • PERFORMANCE_SCHEMA from MySQL 5.6 • No caching_sha256_password (ed25519) • mysql.user.password now is mysql.user.authentication_string • No password expiry, last changed, etc. however there is cracklib_password_check • No optimiser hints, optimiser trace • Threadpool in MariaDB! • PAM/GSSAPI/SSPI authentication • AWS Key Management Plugin • Table elimination! • User statistics • Dynamic columns • No SET PERSIST • InnoDB comes from MySQL 5.7
  • 30. Thank you! Please rate in the app! Colin Charles colin.charles@percona.com / byte@bytebot.net http://bytebot.net/blog | @bytebot on twitter slides: slideshare.net/bytebot