Some characteristics of mariadb (<=10.4)

Posted by Crystal Dragon on Sat, 11 May 2019 22:26:21 +0200

Recently, I read MariaDB's official website to introduce MariaDB's functions and characteristics, and outlined a few places that I feel it necessary to understand:


Supporting column-level compression

CREATE TABLE `cmp2` (
`id` bigint(20) NOT NULL,
`name` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`));

https://mariadb.com/kb/en/library/storage-engine-independent-column-compression/


Supporting column-level compression

CREATE SEQUENCE s1 START WITH 50;

SHOW CREATE SEQUENCE s1\G;
*************************** 1. row ***************************
       Table: t1
Create Table: CREATE SEQUENCE `s1` start with 50 minvalue 1 maxvalue 9223372036854775806
increment by 1 cache 1000 nocycle ENGINE=Aria
CREATE SEQUENCE A sequence will be created to use NEXT VALUE FOR sequence_name Generate new values when invoked. When people want more control over the generation of numbers, it is AUTO INCREMENT Alternatives. Because SEQUENCE Cached values (up to CACHE),So it can be compared in some cases. AUTO INCREMENT Much faster. Another advantage is that you can access the last value generated by all used sequences, which solves the problem LAST_INSERT_ID()A limitation.

https://mariadb.com/kb/en/library/create-sequence/



Semisync is built into server, and plugins are no longer installed in install plugin mode

mysql [localhost:10404] {root} (test) > show global variables like '%semi%';
+---------------------------------------+--------------+
| Variable_name                         | Value        |
+---------------------------------------+--------------+
| rpl_semi_sync_master_enabled          | OFF          |
| rpl_semi_sync_master_timeout          | 10000        |
| rpl_semi_sync_master_trace_level      | 32           |
| rpl_semi_sync_master_wait_no_slave    | ON           |
| rpl_semi_sync_master_wait_point       | AFTER_COMMIT |
| rpl_semi_sync_slave_delay_master      | OFF          |
| rpl_semi_sync_slave_enabled           | OFF          |
| rpl_semi_sync_slave_kill_conn_timeout | 5            |
| rpl_semi_sync_slave_trace_level       | 32           |
+---------------------------------------+--------------+
9 rows in set (0.001 sec)


You can set up automatic termination of connections to idle transactions

Through idle_transaction_timeout, idle_readonly_transaction_timeout and idle_write_transaction_timeout system variables,
Connections with idle transactions can be automatically terminated after a specified period of time.

mysql [localhost:10404] {root} (test) > show global variables like '%idle%transaction%';
+-----------------------------------+-------+
| Variable_name                     | Value |
+-----------------------------------+-------+
| idle_readonly_transaction_timeout | 0     |
| idle_transaction_timeout          | 0     |
| idle_write_transaction_timeout    | 0     |
+-----------------------------------+-------+
3 rows in set (0.001 sec)


Support system-version table

You can view the historical version of the data, Mr. He Chunyan introduced it.

https://blog.51cto.com/hcymysql/2121248
https://mariadb.com/kb/en/library/system-versioned-tables/


MariaDB 10.3 supports update multitable ORDER BY and LIMIT

Bring it. mariabackup Backup tool

mariadb10.3 Up, Some unique functions, such as innodb Page compression, static data encryption capabilities.  This is in xtrabackup It's not supported. It can only be used. mariabackup
//The specific differences are as follows:
* MariaDB 10.1: With uncompressed and unencrypted MariaDB data, you can use XtraBackup. 
If encryption or compression is used, or when innodb_page_size is set to some value other than 16K it will not work.

* MariaDB 10.2: You might also want to try to use XtraBackup, but be aware that problems are likely due to the MySQL 5.7 
undo log format incompatibility bug that was fixed in MariaDB 10.2.2. Due to this bug, backups prepared with 
XtraBackup may fail to recover some transactions. Only if you run the server with the setting innodb_undo_logs=1 
this would not be a problem.

* MariaDB 10.3 and later: This case is more simple. XtraBackup is not compatible.

https://mariadb.com/kb/en/library/mariabackup-overview/
https://blog.51cto.com/hcymysql/2373581?source=dra
https://severalnines.com/blog/database-backups-comparing-mariadb-mariabackup-and-percona-xtrabackup


DDL Fast Failure

DDL WAIT and NOWAIT
DDL When you can't get the lock, you can quickly return to failure.

https://mariadb.com/kb/en/library/wait-and-nowait/


Added password expiration policy

CREATE USER 'monty'@'localhost' PASSWORD EXPIRE INTERVAL 120 DAY;
CREATE USER 'monty'@'localhost' PASSWORD EXPIRE NEVER;

https://mariadb.com/kb/en/library/user-password-expiry/


Hidden columns

CREATE TABLE t (x INT, y INT INVISIBLE, z INT INVISIBLE NOT NULL DEFAULT 4);
INSERT INTO t VALUES (1),(2);
INSERT INTO t (x,y) VALUES (3,33);

SELECT * FROM t;
+------+
| x    |
+------+
|    1 |
|    2 |
|    3 |
+------+

SELECT x,y,z FROM t;
+------+------+---+
| x    | y    | z |
+------+------+---+
|    1 | NULL | 4 |
|    2 | NULL | 4 |
|    3 |   33 | 4 |
+------+------+—+

https://mariadb.com/kb/en/library/invisible-columns/


Window function support

https://mariadb.com/kb/en/window-functions/


Support for WITH Expressions (CTE)


BLOB and text fields also support setting default values


By default, atomic writes will be attempted, and double-write buffers will be used if not supported (currently seen as SSD s that support treasure storage) https://mariadb.com/kb/en/library/atomic-write-support/


Support for MyRocks Engine


Tokudb is split into separate packages mariadb-plugin-tokudb https://mariadb.com/kb/en/library/tokudb/


mysqlbinlog supports flash back parameters and implements flash back of DML. https://mariadb.com/kb/en/library/flashback/


AUTO_INCERMENT Persistence


Supporting compressed events to reduce the size of binary logs

Compression is completely transparent. Events are compressed on the primary server before they are written to the binary log, and decompressed by I/O threads on the slave server before they are written to the relay log. The mysqlbinlog command also decompresses events for its output.
Compression has the greatest impact when events have non-negligible sizes, because each event is compressed separately. For example, insert many rows or large batch INSERT statements, or touch multiple row-based events in a query.
https://mariadb.com/kb/en/library/compressing-events-to-reduce-size-of-the-binary-log/



Bilog_format is mixed by default after 10.2.4. It's better that we change to row format.


Increase support for JSON data types


New parameter read_binlog_speed_limit

Allow slave to read binlog from master (Tencent game provides code)
In some cases, binlog reading from master is very fast, especially when creating a new slave, which can bring a lot of traffic to master.
https://jira.mariadb.org/browse/MDEV-11064





Topics: Linux MariaDB MySQL mysqlbinlog Database