SlideShare a Scribd company logo
When and Why to Use MariaDB: New Features in 10.0 to 10.5
When and Why to Use MariaDB:
Key Features in 10.0 to 10.5
Ian Gilfillan
MariaDB Foundation
Percona Live Online 2021
MariaDB versions
3
When and why to use MariaDB: Key features in 10.0 to 10.5
mariadb.org
What this presentation is not
● In-depth
● Complete
4
When and why to use MariaDB: Key features in 10.0 to 10.5
mariadb.org
What this presentation aims to cover
● Interesting features you may not have heard about
● Features that differentiate MariaDB
5
When and why to use MariaDB: Key features in 10.0 to 10.5
Storage Engines
● InnoDB (default)
● MyRocks (10.2)
● Spider (10.0)
● CONNECT (10.0)
● ColumnStore (10.5)
● S3 (10.5)
● https://mariadb.com/kb/en/choosing-the-right-storage-engine/
6
When and why to use MariaDB: Key features in 10.0 to 10.5
MyRocks
● Mike Benshoof “MyRocks - The 30,000 Foot View”
7
When and why to use MariaDB: Key features in 10.0 to 10.5
MyRocks
● Mike Benshoof “MyRocks - The 30,000 Foot View”
● Compression!
8
When and why to use MariaDB: Key features in 10.0 to 10.5
MyRocks
● Mike Benshoof “MyRocks - The 30,000 Foot View”
● Compression!
● https://mariadb.com/kb/en/myrocks/
9
When and why to use MariaDB: Key features in 10.0 to 10.5
InnoDB Compression
3 types of compression
● Compressed Row Format
10
When and why to use MariaDB: Key features in 10.0 to 10.5
CREATE TABLE tab (
id int,
str varchar(50)
) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED;
11
InnoDB Compressed Row Format
When and why to use MariaDB: Key features in 10.0 to 10.5
InnoDB Compression
3 types of compression
● Compressed Row Format
● InnoDB Page Compression (10.1)
12
When and why to use MariaDB: Key features in 10.0 to 10.5
CREATE TABLE tab (
id int,
str varchar(50)
) ENGINE=InnoDB
PAGE_COMPRESSED=1;
13
InnoDB Page Compression
When and why to use MariaDB: Key features in 10.0 to 10.5
CREATE TABLE tab (
id int,
str varchar(50)
) ENGINE=InnoDB
PAGE_COMPRESSED=1;
[mariadb]
...
innodb_compression_default=ON
14
InnoDB Page Compression
When and why to use MariaDB: Key features in 10.0 to 10.5
Page Compression vs
Compressed Row Format
● Move towards deprecating Compressed Row Format
● Buffer pool storage (uncompressed vs compressed &
uncompressed)
● When compressed (only before writing to tablespace vs
compressed after every change)
15
When and why to use MariaDB: Key features in 10.0 to 10.5
InnoDB Compression
3 types of compression
● Compressed Row Format
● InnoDB Page Compression (10.1)
● Storage-engine Independent Column Compression (10.3)
16
When and why to use MariaDB: Key features in 10.0 to 10.5
SE independent Compression vs
Compressed Row Format
● Specific to a column, less decompression overhead
● BLOB/TEXT vs general usage
● zlib vs alternative compression algorithms
● Indexes not permitted vs usual indexing
17
When and why to use MariaDB: Key features in 10.0 to 10.5
InnoDB Compression
3 types of compression
● Compressed Row Format
● InnoDB Page Compression (10.1)
● Storage-engine Independent Column Compression (10.3)
● https://mariadb.com/kb/en/optimization-and-tuning-compression/
18
When and why to use MariaDB: Key features in 10.0 to 10.5
Spider
● Partitioning and XA transactions
● Tables of different MariaDB instances can be handled as if
they were on the same instance.
● From MariaDB 10.0
● https://mariadb.com/kb/en/spider/
19
When and why to use MariaDB: Key features in 10.0 to 10.5
CONNECT
● Storage engine for handling a wide variety of formats
● BIN, CSV, DBF, DOS, DIR, FIX, FMT, INI, MAC, JDBC, JSON,
MONGO, MYSQL, OCCUR, ODBC, OEM, PIVOT, PROXY, TBL,
VEC, VIR, WMI, XCOL, XML, ZIP
20
When and why to use MariaDB: Key features in 10.0 to 10.5
CREATE TABLE cust ENGINE=CONNECT
TABLE_TYPE=DBF
FILE_NAME='cust.dbf';
21
CONNECT - DBF
When and why to use MariaDB: Key features in 10.0 to 10.5
A single .csv file
CREATE TABLE emp
... optional column definition
ENGINE=connect TABLE_TYPE=CSV
FILE_NAME='E:/Data/employee.csv'
SEP_CHAR=';' HEADER=1;
22
CONNECT - CSV/ZIP
When and why to use MariaDB: Key features in 10.0 to 10.5
A single .csv file
CREATE TABLE emp
... optional column definition
ENGINE=connect TABLE_TYPE=CSV
FILE_NAME='E:/Data/employee.csv'
SEP_CHAR=';' HEADER=1;
A single .csv in a .zip
CREATE TABLE empzip
... optional column definition
ENGINE=connect TABLE_TYPE=CSV
FILE_NAME='E:/Data/employee.zip'
SEP_CHAR=';' HEADER=1; ZIPPED=1
OPTION_LIST='Entry=emp.csv';
23
CONNECT - CSV/ZIP
When and why to use MariaDB: Key features in 10.0 to 10.5
A single .csv file
CREATE TABLE emp
... optional column definition
ENGINE=connect TABLE_TYPE=CSV
FILE_NAME='E:/Data/employee.csv'
SEP_CHAR=';' HEADER=1;
A single .csv in a .zip
CREATE TABLE empzip
... optional column definition
ENGINE=connect TABLE_TYPE=CSV
FILE_NAME='E:/Data/employee.zip'
SEP_CHAR=';' HEADER=1; ZIPPED=1
OPTION_LIST='Entry=emp.csv';
Multiple .csvs in a single .zip
CREATE TABLE empzmul
... required column definition
ENGINE=connect TABLE_TYPE=CSV
FILE_NAME='E:/Data/emp.zip'
SEP_CHAR=';' HEADER=1; ZIPPED=1
OPTION_LIST='Entry=emp*.csv';
24
CONNECT - CSV/ZIP
When and why to use MariaDB: Key features in 10.0 to 10.5
CONNECT
● Storage engine for handling a wide variety of formats
● BIN, CSV, DBF, DOS, DIR, FIX, FMT, INI, MAC, JDBC, JSON,
MONGO, MYSQL, OCCUR, ODBC, OEM, PIVOT, PROXY, TBL,
VEC, VIR, WMI, XCOL, XML, ZIP
● https://mariadb.com/kb/en/connect/
25
When and why to use MariaDB: Key features in 10.0 to 10.5
S3 Storage Engine
● Read only
● Archive MariaDB tables in Amazon S3, or any third-party
public or private cloud implementing S3 API
● Added in 10.5
● https://mariadb.com/kb/en/s3-storage-engine/
26
When and why to use MariaDB: Key features in 10.0 to 10.5
Galera
● Part of MariaDB Server from MariaDB 10.1
● https://mariadb.com/kb/en/galera-cluster/
● https://www.youtube.com/c/MariaDBFoundation
27
When and why to use MariaDB: Key features in 10.0 to 10.5
Temporal Tables
● System-versioned tables - query historic data (10.3).
● Application-time periods - query on a temporal range (10.4)
● Bitemporal - combines both (10.4)
28
When and why to use MariaDB: Key features in 10.0 to 10.5
CREATE TABLE t(
x INT,
start_timestamp TIMESTAMP(6) GENERATED ALWAYS AS ROW START,
end_timestamp TIMESTAMP(6) GENERATED ALWAYS AS ROW END,
PERIOD FOR SYSTEM_TIME(start_timestamp, end_timestamp)
) WITH SYSTEM VERSIONING;
29
Temporal Tables - System versioning
When and why to use MariaDB: Key features in 10.0 to 10.5
CREATE TABLE t(
x INT,
start_timestamp TIMESTAMP(6) GENERATED ALWAYS AS ROW START,
end_timestamp TIMESTAMP(6) GENERATED ALWAYS AS ROW END,
PERIOD FOR SYSTEM_TIME(start_timestamp, end_timestamp)
) WITH SYSTEM VERSIONING;
CREATE TABLE t (
x INT
) WITH SYSTEM VERSIONING;
30
Temporal Tables - System versioning
When and why to use MariaDB: Key features in 10.0 to 10.5
SELECT * FROM t FOR SYSTEM_TIME
AS OF TIMESTAMP'2021-05-11 23:58:06';
31
Temporal Tables - System versioning
When and why to use MariaDB: Key features in 10.0 to 10.5
SELECT * FROM t FOR SYSTEM_TIME
AS OF TIMESTAMP'2021-05-11 23:58:06';
SELECT * FROM t FOR SYSTEM_TIME
BETWEEN (NOW() - INTERVAL 1 YEAR) AND NOW();
32
Temporal Tables - System versioning
When and why to use MariaDB: Key features in 10.0 to 10.5
CREATE TABLE t1(
name VARCHAR(50),
date_1 DATE,
date_2 DATE,
PERIOD FOR date_period(date_1, date_2));
SELECT * FROM t1;
+------+------------+------------+
| name | date_1 | date_2 |
+------+------------+------------+
| a | 1999-01-01 | 2000-01-01 |
| b | 1999-01-01 | 2018-12-12 |
| c | 1999-01-01 | 2017-01-01 |
| d | 2017-01-01 | 2019-01-01 |
+------+------------+------------+
33
Temporal Tables - Application-time periods
When and why to use MariaDB: Key features in 10.0 to 10.5
SELECT * FROM t1;
+------+------------+------------+
| name | date_1 | date_2 |
+------+------------+------------+
| a | 1999-01-01 | 2000-01-01 |
| b | 1999-01-01 | 2018-12-12 |
| c | 1999-01-01 | 2017-01-01 |
| d | 2017-01-01 | 2019-01-01 |
+------+------------+------------+
34
Temporal Tables - Application-time periods
When and why to use MariaDB: Key features in 10.0 to 10.5
SELECT * FROM t1;
+------+------------+------------+
| name | date_1 | date_2 |
+------+------------+------------+
| a | 1999-01-01 | 2000-01-01 |
| b | 1999-01-01 | 2018-12-12 |
| c | 1999-01-01 | 2017-01-01 |
| d | 2017-01-01 | 2019-01-01 |
+------+------------+------------+
DELETE FROM t1
FOR PORTION OF date_period
FROM '2001-01-01' TO
'2018-01-01';
SELECT * FROM t1 ORDER BY name;
+------+------------+------------+
| name | date_1 | date_2 |
+------+------------+------------+
| a | 1999-01-01 | 2000-01-01 |
| b | 1999-01-01 | 2001-01-01 |
| b | 2018-01-01 | 2018-12-12 |
| c | 1999-01-01 | 2001-01-01 |
| d | 2018-01-01 | 2019-01-01 |
+------+------------+------------+
35
Temporal Tables - Application-time periods
When and why to use MariaDB: Key features in 10.0 to 10.5
CREATE TABLE rooms (
room_number INT,
guest_name VARCHAR(255),
checkin DATE,
checkout DATE,
PERIOD FOR p(checkin,checkout)
);
36
Temporal Tables - Application-time periods
When and why to use MariaDB: Key features in 10.0 to 10.5
CREATE TABLE rooms (
room_number INT,
guest_name VARCHAR(255),
checkin DATE,
checkout DATE,
PERIOD FOR p(checkin,checkout)
);
INSERT INTO rooms VALUES
(1,'Regina','2020-10-01','2020-10-03'),
(2,'Cochise','2020-10-02','2020-10-05'),
(1,'Nowell','2020-10-03','2020-10-07'),
(2,'Eusebius','2020-10-04','2020-10-06')
;
37
Temporal Tables - Application-time periods
When and why to use MariaDB: Key features in 10.0 to 10.5
CREATE TABLE rooms (
room_number INT,
guest_name VARCHAR(255),
checkin DATE,
checkout DATE,
PERIOD FOR p(checkin,checkout),
UNIQUE (room_number, p WITHOUT
OVERLAPS)
);
INSERT INTO rooms VALUES
(1,'Regina','2020-10-01','2020-10-03'),
(2,'Cochise','2020-10-02','2020-10-05'),
(1,'Nowell','2020-10-03','2020-10-07'),
(2,'Eusebius','2020-10-04','2020-10-06')
;
ERROR 1062 (23000): Duplicate entry
'2-2020-10-06-2020-10-04' for key
'room_number'
38
Temporal Tables - Application-time periods
When and why to use MariaDB: Key features in 10.0 to 10.5
Temporal Tables
● System-versioned tables - query historic data (10.3).
● Application-time periods - query on a temporal range (10.4)
● Bitemporal - combines both (10.4)
● https://mariadb.com/kb/en/temporal-tables/
39
When and why to use MariaDB: Key features in 10.0 to 10.5
Flashback
● Allows instances, databases or tables to be rolled back to a
previous snapshot based on the binary log
● DML-only
● From 10.2
40
When and why to use MariaDB: Key features in 10.0 to 10.5
[mariadb]
...
binlog_format=ROW
binlog_row_image=FULL
mariadb-binlog /var/lib/mysql/mysql-bin.000001
-d test
-T mytable
--start-datetime="2021-05-11 14:54:00"
--flashback
> flashback.sql
41
Flashback
When and why to use MariaDB: Key features in 10.0 to 10.5
IF [NOT] EXISTS
● IF [NOT] EXISTS gives a warning instead of an error
● From MariaDB 10.1
42
When and why to use MariaDB: Key features in 10.0 to 10.5
DROP USER bob;
ERROR 1396 (HY000): Operation DROP USER failed for 'bob'@'%'
DROP USER IF EXISTS bob;
Query OK, 0 rows affected, 1 warning (0.00 sec)
SHOW WARNINGS;
+-------+------+---------------------------------------------+
| Level | Code | Message |
+-------+------+---------------------------------------------+
| Note | 1974 | Can't drop user 'bob'@'%'; it doesn't exist |
+-------+------+---------------------------------------------+
43
IF [NOT] EXISTS
When and why to use MariaDB: Key features in 10.0 to 10.5
CREATE TABLE t2 (id INT);
ERROR 1050 (42S01): Table 't2' already exists
CREATE TABLE IF NOT EXISTS t2 (id INT);
Query OK, 0 rows affected, 1 warning (0.000 sec)
SHOW WARNINGS;
+-------+------+---------------------------+
| Level | Code | Message |
+-------+------+---------------------------+
| Note | 1050 | Table 't2' already exists |
+-------+------+---------------------------+
1 row in set (0.000 sec)
44
IF [NOT] EXISTS
When and why to use MariaDB: Key features in 10.0 to 10.5
OR REPLACE
● OR REPLACE drops and creates instead of giving an error
● From MariaDB 10.1
45
When and why to use MariaDB: Key features in 10.0 to 10.5
CREATE TABLE t2 (id INT);
ERROR 1050 (42S01): Table 't2' already exists
CREATE OR REPLACE TABLE t2 (id INT);
Query OK, 0 rows affected (0.059 sec)
46
OR REPLACE
When and why to use MariaDB: Key features in 10.0 to 10.5
IF [NOT] EXISTS / OR REPLACE
● OR REPLACE drops and creates instead of giving an error
● From MariaDB 10.1
● https://mariadb.com/kb/en/create-database/
47
When and why to use MariaDB: Key features in 10.0 to 10.5
RETURNING
● DELETE … RETURNING (from 10.0)
● INSERT … RETURNING (from 10.5)
● REPLACE … RETURNING (from 10.5)
● Returns a resultset of the deleted/created/replaced data
48
When and why to use MariaDB: Key features in 10.0 to 10.5
CREATE OR REPLACE TABLE t2 (
id INT,
animal VARCHAR(20),
t TIMESTAMP
);
INSERT INTO t2 (id) VALUES (2),(3)
RETURNING id,t;
+------+---------------------+
| id | t |
+------+---------------------+
| 2 | 2021-04-30 01:16:31 |
| 3 | 2021-04-30 01:16:31 |
+------+---------------------+
49
RETURNING clause
When and why to use MariaDB: Key features in 10.0 to 10.5
DELETE FROM t2 RETURNING id, t;
+------+---------------------+
| id | t |
+------+---------------------+
| 2 | 2021-04-30 01:16:31 |
| 3 | 2021-04-30 01:16:31 |
+------+---------------------+
50
RETURNING clause
When and why to use MariaDB: Key features in 10.0 to 10.5
RETURNING
● DELETE … RETURNING (from 10.0)
● https://mariadb.com/kb/en/delete/#returning
● INSERT … RETURNING (from 10.5)
● https://mariadb.com/kb/en/insertreturning/
● REPLACE … RETURNING (from 10.5)
● https://mariadb.com/kb/en/replacereturning/
51
When and why to use MariaDB: Key features in 10.0 to 10.5
Oracle mode
● a subset of Oracle's PL/SQL
● Oracle syntax / functionality
● Functionality that only works in Oracle mode
● Functionality that works in default MariaDB mode as well
52
When and why to use MariaDB: Key features in 10.0 to 10.5
Oracle mode
● a subset of Oracle's PL/SQL
● Oracle syntax / functionality
● Functionality that only works in Oracle mode
● Functionality that works in default MariaDB mode as well
[mariadb]
sql_mode = ORACLE
53
When and why to use MariaDB: Key features in 10.0 to 10.5
Oracle mode
● a subset of Oracle's PL/SQL
● Oracle syntax / functionality
● Functionality that only works in Oracle mode
● Functionality that works in default MariaDB mode as well
[mariadb]
sql_mode = ORACLE
54
When and why to use MariaDB: Key features in 10.0 to 10.5
Oracle mode - synonyms
55
When and why to use MariaDB: Key features in 10.0 to 10.5
Oracle mode - different behaviour
56
When and why to use MariaDB: Key features in 10.0 to 10.5
● Sequences - generate sequence of numeric values
CREATE SEQUENCE s START WITH 100 INCREMENT BY 10;
SELECT NEXTVAL(s);
+------------+
| NEXTVAL(s) |
+------------+
| 100 |
+------------+
SELECT NEXT VALUE FOR s
SELECT s.nextval;
57
Oracle compatibility - additional
When and why to use MariaDB: Key features in 10.0 to 10.5
Oracle mode
● Migrating from Oracle to MariaDB
● New functionality for MariaDB
● https://mariadb.com/kb/en/sql_modeoracle/
58
When and why to use MariaDB: Key features in 10.0 to 10.5
Find out more
● https://mariadb.com/kb/
● https://www.youtube.com/c/MariaDBFoundation
● https://mariadb.zulipchat.com/
59
When and why to use MariaDB: Key features in 10.0 to 10.5

More Related Content

PDF
MariaDB Optimizer
PDF
What's new in MariaDB Platform X3
PDF
What’s new in MariaDB ColumnStore
PDF
What to expect from MariaDB Platform X5, part 1
PDF
2012 09 MariaDB Boston Meetup - MariaDB 是 Mysql 的替代者吗
PDF
IT Tage 2019 MariaDB 10.4 New Features
PDF
MariaDB 10.2 New Features
PDF
MariaDB 10.0 - SkySQL Paris Meetup
MariaDB Optimizer
What's new in MariaDB Platform X3
What’s new in MariaDB ColumnStore
What to expect from MariaDB Platform X5, part 1
2012 09 MariaDB Boston Meetup - MariaDB 是 Mysql 的替代者吗
IT Tage 2019 MariaDB 10.4 New Features
MariaDB 10.2 New Features
MariaDB 10.0 - SkySQL Paris Meetup

Similar to When and Why to Use MariaDB: New Features in 10.0 to 10.5 (20)

PDF
Instant add column for inno db in mariadb 10.3+ (fosdem 2018, second draft)
PDF
Query optimization: from 0 to 10 (and up to 5.7)
PDF
MariaDB 10.4 New Features
PDF
介绍 Percona 服务器 XtraDB 和 Xtrabackup
PDF
MariaDB Amsterdam Roadshow: 19 September, 2024
PPT
Star schema my sql
PDF
PostgreSQL 9.5 - Major Features
PPTX
MariaDB pres at LeMUG
PDF
[db tech showcase Tokyo 2014] B15: Scalability with MariaDB and MaxScale by ...
PDF
MySQL 5.7 in a Nutshell
PDF
Migrations from PLSQL and Transact-SQL - m18
PDF
M|18 Migrating from Oracle and Handling PL/SQL Stored Procedures
PDF
MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)
PDF
MariaDB Tech und Business Update Hamburg 2023 - MariaDB Enterprise Server
PDF
MariaDB for Developers and Operators (DevOps)
PDF
Playing with the CONNECT storage engine
PDF
MySQL 8.0.1 DMR
PDF
Die Neuheiten in MariaDB Enterprise Server
PPTX
SAP BO and Teradata best practices
PDF
How to migrate from Oracle Database with ease
Instant add column for inno db in mariadb 10.3+ (fosdem 2018, second draft)
Query optimization: from 0 to 10 (and up to 5.7)
MariaDB 10.4 New Features
介绍 Percona 服务器 XtraDB 和 Xtrabackup
MariaDB Amsterdam Roadshow: 19 September, 2024
Star schema my sql
PostgreSQL 9.5 - Major Features
MariaDB pres at LeMUG
[db tech showcase Tokyo 2014] B15: Scalability with MariaDB and MaxScale by ...
MySQL 5.7 in a Nutshell
Migrations from PLSQL and Transact-SQL - m18
M|18 Migrating from Oracle and Handling PL/SQL Stored Procedures
MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)
MariaDB Tech und Business Update Hamburg 2023 - MariaDB Enterprise Server
MariaDB for Developers and Operators (DevOps)
Playing with the CONNECT storage engine
MySQL 8.0.1 DMR
Die Neuheiten in MariaDB Enterprise Server
SAP BO and Teradata best practices
How to migrate from Oracle Database with ease
Ad

Recently uploaded (20)

PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Approach and Philosophy of On baking technology
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
KodekX | Application Modernization Development
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Encapsulation theory and applications.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Empathic Computing: Creating Shared Understanding
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Mobile App Security Testing_ A Comprehensive Guide.pdf
Understanding_Digital_Forensics_Presentation.pptx
Programs and apps: productivity, graphics, security and other tools
Approach and Philosophy of On baking technology
Unlocking AI with Model Context Protocol (MCP)
KodekX | Application Modernization Development
Building Integrated photovoltaic BIPV_UPV.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Encapsulation theory and applications.pdf
MYSQL Presentation for SQL database connectivity
Reach Out and Touch Someone: Haptics and Empathic Computing
sap open course for s4hana steps from ECC to s4
Empathic Computing: Creating Shared Understanding
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Advanced methodologies resolving dimensionality complications for autism neur...
Network Security Unit 5.pdf for BCA BBA.
20250228 LYD VKU AI Blended-Learning.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Ad

When and Why to Use MariaDB: New Features in 10.0 to 10.5

  • 2. When and Why to Use MariaDB: Key Features in 10.0 to 10.5 Ian Gilfillan MariaDB Foundation Percona Live Online 2021
  • 3. MariaDB versions 3 When and why to use MariaDB: Key features in 10.0 to 10.5 mariadb.org
  • 4. What this presentation is not ● In-depth ● Complete 4 When and why to use MariaDB: Key features in 10.0 to 10.5 mariadb.org
  • 5. What this presentation aims to cover ● Interesting features you may not have heard about ● Features that differentiate MariaDB 5 When and why to use MariaDB: Key features in 10.0 to 10.5
  • 6. Storage Engines ● InnoDB (default) ● MyRocks (10.2) ● Spider (10.0) ● CONNECT (10.0) ● ColumnStore (10.5) ● S3 (10.5) ● https://mariadb.com/kb/en/choosing-the-right-storage-engine/ 6 When and why to use MariaDB: Key features in 10.0 to 10.5
  • 7. MyRocks ● Mike Benshoof “MyRocks - The 30,000 Foot View” 7 When and why to use MariaDB: Key features in 10.0 to 10.5
  • 8. MyRocks ● Mike Benshoof “MyRocks - The 30,000 Foot View” ● Compression! 8 When and why to use MariaDB: Key features in 10.0 to 10.5
  • 9. MyRocks ● Mike Benshoof “MyRocks - The 30,000 Foot View” ● Compression! ● https://mariadb.com/kb/en/myrocks/ 9 When and why to use MariaDB: Key features in 10.0 to 10.5
  • 10. InnoDB Compression 3 types of compression ● Compressed Row Format 10 When and why to use MariaDB: Key features in 10.0 to 10.5
  • 11. CREATE TABLE tab ( id int, str varchar(50) ) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; 11 InnoDB Compressed Row Format When and why to use MariaDB: Key features in 10.0 to 10.5
  • 12. InnoDB Compression 3 types of compression ● Compressed Row Format ● InnoDB Page Compression (10.1) 12 When and why to use MariaDB: Key features in 10.0 to 10.5
  • 13. CREATE TABLE tab ( id int, str varchar(50) ) ENGINE=InnoDB PAGE_COMPRESSED=1; 13 InnoDB Page Compression When and why to use MariaDB: Key features in 10.0 to 10.5
  • 14. CREATE TABLE tab ( id int, str varchar(50) ) ENGINE=InnoDB PAGE_COMPRESSED=1; [mariadb] ... innodb_compression_default=ON 14 InnoDB Page Compression When and why to use MariaDB: Key features in 10.0 to 10.5
  • 15. Page Compression vs Compressed Row Format ● Move towards deprecating Compressed Row Format ● Buffer pool storage (uncompressed vs compressed & uncompressed) ● When compressed (only before writing to tablespace vs compressed after every change) 15 When and why to use MariaDB: Key features in 10.0 to 10.5
  • 16. InnoDB Compression 3 types of compression ● Compressed Row Format ● InnoDB Page Compression (10.1) ● Storage-engine Independent Column Compression (10.3) 16 When and why to use MariaDB: Key features in 10.0 to 10.5
  • 17. SE independent Compression vs Compressed Row Format ● Specific to a column, less decompression overhead ● BLOB/TEXT vs general usage ● zlib vs alternative compression algorithms ● Indexes not permitted vs usual indexing 17 When and why to use MariaDB: Key features in 10.0 to 10.5
  • 18. InnoDB Compression 3 types of compression ● Compressed Row Format ● InnoDB Page Compression (10.1) ● Storage-engine Independent Column Compression (10.3) ● https://mariadb.com/kb/en/optimization-and-tuning-compression/ 18 When and why to use MariaDB: Key features in 10.0 to 10.5
  • 19. Spider ● Partitioning and XA transactions ● Tables of different MariaDB instances can be handled as if they were on the same instance. ● From MariaDB 10.0 ● https://mariadb.com/kb/en/spider/ 19 When and why to use MariaDB: Key features in 10.0 to 10.5
  • 20. CONNECT ● Storage engine for handling a wide variety of formats ● BIN, CSV, DBF, DOS, DIR, FIX, FMT, INI, MAC, JDBC, JSON, MONGO, MYSQL, OCCUR, ODBC, OEM, PIVOT, PROXY, TBL, VEC, VIR, WMI, XCOL, XML, ZIP 20 When and why to use MariaDB: Key features in 10.0 to 10.5
  • 21. CREATE TABLE cust ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='cust.dbf'; 21 CONNECT - DBF When and why to use MariaDB: Key features in 10.0 to 10.5
  • 22. A single .csv file CREATE TABLE emp ... optional column definition ENGINE=connect TABLE_TYPE=CSV FILE_NAME='E:/Data/employee.csv' SEP_CHAR=';' HEADER=1; 22 CONNECT - CSV/ZIP When and why to use MariaDB: Key features in 10.0 to 10.5
  • 23. A single .csv file CREATE TABLE emp ... optional column definition ENGINE=connect TABLE_TYPE=CSV FILE_NAME='E:/Data/employee.csv' SEP_CHAR=';' HEADER=1; A single .csv in a .zip CREATE TABLE empzip ... optional column definition ENGINE=connect TABLE_TYPE=CSV FILE_NAME='E:/Data/employee.zip' SEP_CHAR=';' HEADER=1; ZIPPED=1 OPTION_LIST='Entry=emp.csv'; 23 CONNECT - CSV/ZIP When and why to use MariaDB: Key features in 10.0 to 10.5
  • 24. A single .csv file CREATE TABLE emp ... optional column definition ENGINE=connect TABLE_TYPE=CSV FILE_NAME='E:/Data/employee.csv' SEP_CHAR=';' HEADER=1; A single .csv in a .zip CREATE TABLE empzip ... optional column definition ENGINE=connect TABLE_TYPE=CSV FILE_NAME='E:/Data/employee.zip' SEP_CHAR=';' HEADER=1; ZIPPED=1 OPTION_LIST='Entry=emp.csv'; Multiple .csvs in a single .zip CREATE TABLE empzmul ... required column definition ENGINE=connect TABLE_TYPE=CSV FILE_NAME='E:/Data/emp.zip' SEP_CHAR=';' HEADER=1; ZIPPED=1 OPTION_LIST='Entry=emp*.csv'; 24 CONNECT - CSV/ZIP When and why to use MariaDB: Key features in 10.0 to 10.5
  • 25. CONNECT ● Storage engine for handling a wide variety of formats ● BIN, CSV, DBF, DOS, DIR, FIX, FMT, INI, MAC, JDBC, JSON, MONGO, MYSQL, OCCUR, ODBC, OEM, PIVOT, PROXY, TBL, VEC, VIR, WMI, XCOL, XML, ZIP ● https://mariadb.com/kb/en/connect/ 25 When and why to use MariaDB: Key features in 10.0 to 10.5
  • 26. S3 Storage Engine ● Read only ● Archive MariaDB tables in Amazon S3, or any third-party public or private cloud implementing S3 API ● Added in 10.5 ● https://mariadb.com/kb/en/s3-storage-engine/ 26 When and why to use MariaDB: Key features in 10.0 to 10.5
  • 27. Galera ● Part of MariaDB Server from MariaDB 10.1 ● https://mariadb.com/kb/en/galera-cluster/ ● https://www.youtube.com/c/MariaDBFoundation 27 When and why to use MariaDB: Key features in 10.0 to 10.5
  • 28. Temporal Tables ● System-versioned tables - query historic data (10.3). ● Application-time periods - query on a temporal range (10.4) ● Bitemporal - combines both (10.4) 28 When and why to use MariaDB: Key features in 10.0 to 10.5
  • 29. CREATE TABLE t( x INT, start_timestamp TIMESTAMP(6) GENERATED ALWAYS AS ROW START, end_timestamp TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME(start_timestamp, end_timestamp) ) WITH SYSTEM VERSIONING; 29 Temporal Tables - System versioning When and why to use MariaDB: Key features in 10.0 to 10.5
  • 30. CREATE TABLE t( x INT, start_timestamp TIMESTAMP(6) GENERATED ALWAYS AS ROW START, end_timestamp TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME(start_timestamp, end_timestamp) ) WITH SYSTEM VERSIONING; CREATE TABLE t ( x INT ) WITH SYSTEM VERSIONING; 30 Temporal Tables - System versioning When and why to use MariaDB: Key features in 10.0 to 10.5
  • 31. SELECT * FROM t FOR SYSTEM_TIME AS OF TIMESTAMP'2021-05-11 23:58:06'; 31 Temporal Tables - System versioning When and why to use MariaDB: Key features in 10.0 to 10.5
  • 32. SELECT * FROM t FOR SYSTEM_TIME AS OF TIMESTAMP'2021-05-11 23:58:06'; SELECT * FROM t FOR SYSTEM_TIME BETWEEN (NOW() - INTERVAL 1 YEAR) AND NOW(); 32 Temporal Tables - System versioning When and why to use MariaDB: Key features in 10.0 to 10.5
  • 33. CREATE TABLE t1( name VARCHAR(50), date_1 DATE, date_2 DATE, PERIOD FOR date_period(date_1, date_2)); SELECT * FROM t1; +------+------------+------------+ | name | date_1 | date_2 | +------+------------+------------+ | a | 1999-01-01 | 2000-01-01 | | b | 1999-01-01 | 2018-12-12 | | c | 1999-01-01 | 2017-01-01 | | d | 2017-01-01 | 2019-01-01 | +------+------------+------------+ 33 Temporal Tables - Application-time periods When and why to use MariaDB: Key features in 10.0 to 10.5
  • 34. SELECT * FROM t1; +------+------------+------------+ | name | date_1 | date_2 | +------+------------+------------+ | a | 1999-01-01 | 2000-01-01 | | b | 1999-01-01 | 2018-12-12 | | c | 1999-01-01 | 2017-01-01 | | d | 2017-01-01 | 2019-01-01 | +------+------------+------------+ 34 Temporal Tables - Application-time periods When and why to use MariaDB: Key features in 10.0 to 10.5
  • 35. SELECT * FROM t1; +------+------------+------------+ | name | date_1 | date_2 | +------+------------+------------+ | a | 1999-01-01 | 2000-01-01 | | b | 1999-01-01 | 2018-12-12 | | c | 1999-01-01 | 2017-01-01 | | d | 2017-01-01 | 2019-01-01 | +------+------------+------------+ DELETE FROM t1 FOR PORTION OF date_period FROM '2001-01-01' TO '2018-01-01'; SELECT * FROM t1 ORDER BY name; +------+------------+------------+ | name | date_1 | date_2 | +------+------------+------------+ | a | 1999-01-01 | 2000-01-01 | | b | 1999-01-01 | 2001-01-01 | | b | 2018-01-01 | 2018-12-12 | | c | 1999-01-01 | 2001-01-01 | | d | 2018-01-01 | 2019-01-01 | +------+------------+------------+ 35 Temporal Tables - Application-time periods When and why to use MariaDB: Key features in 10.0 to 10.5
  • 36. CREATE TABLE rooms ( room_number INT, guest_name VARCHAR(255), checkin DATE, checkout DATE, PERIOD FOR p(checkin,checkout) ); 36 Temporal Tables - Application-time periods When and why to use MariaDB: Key features in 10.0 to 10.5
  • 37. CREATE TABLE rooms ( room_number INT, guest_name VARCHAR(255), checkin DATE, checkout DATE, PERIOD FOR p(checkin,checkout) ); INSERT INTO rooms VALUES (1,'Regina','2020-10-01','2020-10-03'), (2,'Cochise','2020-10-02','2020-10-05'), (1,'Nowell','2020-10-03','2020-10-07'), (2,'Eusebius','2020-10-04','2020-10-06') ; 37 Temporal Tables - Application-time periods When and why to use MariaDB: Key features in 10.0 to 10.5
  • 38. CREATE TABLE rooms ( room_number INT, guest_name VARCHAR(255), checkin DATE, checkout DATE, PERIOD FOR p(checkin,checkout), UNIQUE (room_number, p WITHOUT OVERLAPS) ); INSERT INTO rooms VALUES (1,'Regina','2020-10-01','2020-10-03'), (2,'Cochise','2020-10-02','2020-10-05'), (1,'Nowell','2020-10-03','2020-10-07'), (2,'Eusebius','2020-10-04','2020-10-06') ; ERROR 1062 (23000): Duplicate entry '2-2020-10-06-2020-10-04' for key 'room_number' 38 Temporal Tables - Application-time periods When and why to use MariaDB: Key features in 10.0 to 10.5
  • 39. Temporal Tables ● System-versioned tables - query historic data (10.3). ● Application-time periods - query on a temporal range (10.4) ● Bitemporal - combines both (10.4) ● https://mariadb.com/kb/en/temporal-tables/ 39 When and why to use MariaDB: Key features in 10.0 to 10.5
  • 40. Flashback ● Allows instances, databases or tables to be rolled back to a previous snapshot based on the binary log ● DML-only ● From 10.2 40 When and why to use MariaDB: Key features in 10.0 to 10.5
  • 41. [mariadb] ... binlog_format=ROW binlog_row_image=FULL mariadb-binlog /var/lib/mysql/mysql-bin.000001 -d test -T mytable --start-datetime="2021-05-11 14:54:00" --flashback > flashback.sql 41 Flashback When and why to use MariaDB: Key features in 10.0 to 10.5
  • 42. IF [NOT] EXISTS ● IF [NOT] EXISTS gives a warning instead of an error ● From MariaDB 10.1 42 When and why to use MariaDB: Key features in 10.0 to 10.5
  • 43. DROP USER bob; ERROR 1396 (HY000): Operation DROP USER failed for 'bob'@'%' DROP USER IF EXISTS bob; Query OK, 0 rows affected, 1 warning (0.00 sec) SHOW WARNINGS; +-------+------+---------------------------------------------+ | Level | Code | Message | +-------+------+---------------------------------------------+ | Note | 1974 | Can't drop user 'bob'@'%'; it doesn't exist | +-------+------+---------------------------------------------+ 43 IF [NOT] EXISTS When and why to use MariaDB: Key features in 10.0 to 10.5
  • 44. CREATE TABLE t2 (id INT); ERROR 1050 (42S01): Table 't2' already exists CREATE TABLE IF NOT EXISTS t2 (id INT); Query OK, 0 rows affected, 1 warning (0.000 sec) SHOW WARNINGS; +-------+------+---------------------------+ | Level | Code | Message | +-------+------+---------------------------+ | Note | 1050 | Table 't2' already exists | +-------+------+---------------------------+ 1 row in set (0.000 sec) 44 IF [NOT] EXISTS When and why to use MariaDB: Key features in 10.0 to 10.5
  • 45. OR REPLACE ● OR REPLACE drops and creates instead of giving an error ● From MariaDB 10.1 45 When and why to use MariaDB: Key features in 10.0 to 10.5
  • 46. CREATE TABLE t2 (id INT); ERROR 1050 (42S01): Table 't2' already exists CREATE OR REPLACE TABLE t2 (id INT); Query OK, 0 rows affected (0.059 sec) 46 OR REPLACE When and why to use MariaDB: Key features in 10.0 to 10.5
  • 47. IF [NOT] EXISTS / OR REPLACE ● OR REPLACE drops and creates instead of giving an error ● From MariaDB 10.1 ● https://mariadb.com/kb/en/create-database/ 47 When and why to use MariaDB: Key features in 10.0 to 10.5
  • 48. RETURNING ● DELETE … RETURNING (from 10.0) ● INSERT … RETURNING (from 10.5) ● REPLACE … RETURNING (from 10.5) ● Returns a resultset of the deleted/created/replaced data 48 When and why to use MariaDB: Key features in 10.0 to 10.5
  • 49. CREATE OR REPLACE TABLE t2 ( id INT, animal VARCHAR(20), t TIMESTAMP ); INSERT INTO t2 (id) VALUES (2),(3) RETURNING id,t; +------+---------------------+ | id | t | +------+---------------------+ | 2 | 2021-04-30 01:16:31 | | 3 | 2021-04-30 01:16:31 | +------+---------------------+ 49 RETURNING clause When and why to use MariaDB: Key features in 10.0 to 10.5
  • 50. DELETE FROM t2 RETURNING id, t; +------+---------------------+ | id | t | +------+---------------------+ | 2 | 2021-04-30 01:16:31 | | 3 | 2021-04-30 01:16:31 | +------+---------------------+ 50 RETURNING clause When and why to use MariaDB: Key features in 10.0 to 10.5
  • 51. RETURNING ● DELETE … RETURNING (from 10.0) ● https://mariadb.com/kb/en/delete/#returning ● INSERT … RETURNING (from 10.5) ● https://mariadb.com/kb/en/insertreturning/ ● REPLACE … RETURNING (from 10.5) ● https://mariadb.com/kb/en/replacereturning/ 51 When and why to use MariaDB: Key features in 10.0 to 10.5
  • 52. Oracle mode ● a subset of Oracle's PL/SQL ● Oracle syntax / functionality ● Functionality that only works in Oracle mode ● Functionality that works in default MariaDB mode as well 52 When and why to use MariaDB: Key features in 10.0 to 10.5
  • 53. Oracle mode ● a subset of Oracle's PL/SQL ● Oracle syntax / functionality ● Functionality that only works in Oracle mode ● Functionality that works in default MariaDB mode as well [mariadb] sql_mode = ORACLE 53 When and why to use MariaDB: Key features in 10.0 to 10.5
  • 54. Oracle mode ● a subset of Oracle's PL/SQL ● Oracle syntax / functionality ● Functionality that only works in Oracle mode ● Functionality that works in default MariaDB mode as well [mariadb] sql_mode = ORACLE 54 When and why to use MariaDB: Key features in 10.0 to 10.5
  • 55. Oracle mode - synonyms 55 When and why to use MariaDB: Key features in 10.0 to 10.5
  • 56. Oracle mode - different behaviour 56 When and why to use MariaDB: Key features in 10.0 to 10.5
  • 57. ● Sequences - generate sequence of numeric values CREATE SEQUENCE s START WITH 100 INCREMENT BY 10; SELECT NEXTVAL(s); +------------+ | NEXTVAL(s) | +------------+ | 100 | +------------+ SELECT NEXT VALUE FOR s SELECT s.nextval; 57 Oracle compatibility - additional When and why to use MariaDB: Key features in 10.0 to 10.5
  • 58. Oracle mode ● Migrating from Oracle to MariaDB ● New functionality for MariaDB ● https://mariadb.com/kb/en/sql_modeoracle/ 58 When and why to use MariaDB: Key features in 10.0 to 10.5
  • 59. Find out more ● https://mariadb.com/kb/ ● https://www.youtube.com/c/MariaDBFoundation ● https://mariadb.zulipchat.com/ 59 When and why to use MariaDB: Key features in 10.0 to 10.5