0% found this document useful (0 votes)
378 views3,812 pages

MariaDB Server Documentation Guide

MariaDB Server es un sistema de gestión de bases de datos relacionales, de código abierto y de uso general, optimizado para rendimiento y facilidad de uso; tiene sus raíces en MySQL Server y es una alternativa a Postgres, Oracle Database y otras bases de datos relacionales y NoSQL.

Uploaded by

diezv17
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
378 views3,812 pages

MariaDB Server Documentation Guide

MariaDB Server es un sistema de gestión de bases de datos relacionales, de código abierto y de uso general, optimizado para rendimiento y facilidad de uso; tiene sus raíces en MySQL Server y es una alternativa a Postgres, Oracle Database y otras bases de datos relacionales y NoSQL.

Uploaded by

diezv17
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

20

From the MariaDB Knowledge Base

22
-1
0
MariaDB
Server
Documentation
Ian Gilfillan (Editor)
Dedicated to bazaar builders everywhere.

Licence
The Knowledge Base content from which this pdf is generated is either licensed under the terms of the GPL, version 2,
originally generated from the server fill_help_tables.sql file, or both of the following two licenses:
The Creative Commons Attribution/ShareAlike 3.0 Unported license (CC-BY-SA).
The Gnu FDL license (GFDL or FDL).
Please see the source page on the Knowledge Base for the definitive licence, and seek proper legal advice if you are in any
doubt about what you are and are not allowed to do with material released under these licenses.
If you find any errors, please see Reporting Documentation Bugs
Generated from the MariaDB Knowledge Base on 2022-10-19

2/3812
Preface
If you’re contemplating whether to devote some time to this book, read this:
MariaDB Server is a general-purpose, open source, relational database management system, optimised for
performance and easy usabiility; it has its roots in MySQL Server, and is an alternative to Postgres, Oracle Database
and other relational and NoSQL databases
This book is the full documentation on MariaDB Server, a “Reference Manual Plus” which includes aspects of a User’s
Guide; it is based on the contents of the MariaDB Knowledge base (https://mariadb.com/kb/ ), an open, community-
edited site contributed to since the inception of MariaDB in 2009
This edition is not specific to any version of MariaDB Server, but includes functionality up to the latest version of
MariaDB at the time of generation
This preface describes the goals, structure and contents of the documentation. Reading it is intended as a helpful step in
understanding how to best use the manual to improve productivity in using MariaDB Server.

This Book’s “Prehistory”


As noted, MariaDB Server has its roots in MySQL Server. It started as a fork of MySQL Server, using the same GPLv2
license. However, although the MySQL Server documentation was always publicly available, it was never released using a
free documentation license. This means that the documentation of MariaDB Server was created from scratch. Or rather, from
the online help texts, which had a compatible open licence that made them usable as a starting point.
The place to which documentation was written was labelled the “Knowledge Base”, by MySQL and MariaDB creator Michael
“Monty” Widenius. The Knowledge Base was – and remains – a community effort. As with many community efforts, there are
core contributors around whom the work is centered. This is where Daniel Bartholomew loaded the online help text, as a first
seed. For roughly the last ten years, the core editor of the MariaDB Knowledge Base has been Ian Gilfillan, working for
MariaDB Foundation and based in South Africa. Hence, his name is on the cover of the book. However, there are a large
number of other contributors, many of whom come from MariaDB Corporation – both as developers of code and as
documentation writers. They are listed on https://mariadb.com/kb/stats/users/ .
With now some 3000 pages in this book, most of the initial holes in the documentation have been filled. There should now be
no reason to do as in the very early days of MariaDB Server – namely look up MariaDB features in the MySQL
documentation. On the contrary, the functionality of the two databases have diverged considerably, so you would be ill
advised not to use this MariaDB Server specific documentation.

The First Edition


The first edition of the MariaDB Server Documentation as a PDF file was released in April 2022. Prior to this, the contents
were accessible as individual Knowledge Base (KB) articles. But already in 2014 – over seven years before – the user base
requested a PDF version, as seen by MariaDB’s Jira entry https://jira.mariadb.org/browse/MDEV-6881 MariaDB
Documentation improvements. There, user Stoykov pointed out that MariaDB documentation already had search capabilities
and a way to mirror the KB in an offline version – but lacked downloadable PDF and EPUB versions,
Fast forward some seven years and a number of upvotes and watchers, we decided to devote resources to it. Creating a
PDF from an HTML file is something Python is good at, and Dorje Gilfillan did all the tweaking necessary to merge the
individual KB pages into one huge HTML file for PDF conversion.

This Book’s Structure


We had to impose a chapter structure on the book which is only indirectly visible from a collection of KB articles on the web.
This means that the work in compiling the PDF isn’t just about merging many KB pages in an order that could be derived from
the hierarchical pointers between the articles. It also involves cleaning up that structure.
As a result, you will see two tables of contents. One is a one-pager overview with just the two top levels of hierarchy. The
other is over 30 pages long. True to the Open Source mantra of “release early, release often”, we believe that the structure
can still be improved upon – but it is a good starting point. We have seven overall chapters, and the structures below them all
make sense at some level.
To get the most out of the book, we recommend you to spend time making yourself familiar with the table of contents. It will
give you an idea of existing functionality. Just browsing it through may give you ideas of commands you didn't know existed.

This Book’s Format


There is currently just one version of the book. It’s delivered in the PDF format, and in the Golden Ratio aspect ratio –
meaning, A4. As we envision it to be read mostly on-screen anyway, we wanted to avoid the additional complexity of also
providing a US Letter format. If we meet demand for further versions, doing US Letter is of course an option; however, given
there are many ways to improve the documentation, we would also like to understand how adding another aspect ratio of the
PDF would benefit the users in practice.
We don’t yet provide the ePub format. Again, if you desire ePub, please educate us as to what added benefits you expect of
ePub on top of PDF.

3/3812
Use Cases For This Book
We expect the main use case for the PDF version of the book to be offline access. Offline may be imposed by a flaky or non-
existent internet, but also by self-imposed abstinence from the many distractions of being online.
We expect that browsing the PDF will enable concentrated time to be spent on learning about MariaDB Server. The search
functionality of PDF browsers helps in finding out about commands and syntax you already know of; browsing through a PDF
– in particular the clickable Table of Contents – will hopefully provide you with an educational overview better than the online
KB does.
We expect downloading the manual into laptops, tablets and phones will make sense. If you have the MariaDB Server
Documentation on your phone, you can turn waiting time into something productive, perhaps even fun.

What we should work on


We have lots of room for improvement. That said, our foremost goal now is to get the book out, to get it used. User feedback
will help us determine the right priority for our already existing ideas for improvements. We will likely get other requests
beyond what we currently have in mind.
In the area of basic usability, an index has been spoken about. Looking up commands through searches or through browsing
the table of contents is ok, but an index also has use cases. Our plan here starts from automatic indexing based on keywords
of the headers of individual articles.
In the area of layout, we are looking at finding icons that make the PDF look more like a book, and less like a web page. We
already solved the first issue, which was to find a clearer visual distinction between links within the PDF and links to the web.
In the area of structure, the length of individual chapters varies a lot. It may make sense to move around chapters in the TOC
tree, to be more balanced. It may be that the reader expects another ordering based on experiences from other databases. It
may even be that we lack entire topics. For instance, we eliminated the Release Notes for unsupported versions of MariaDB,
even though these are still accessible on the KB.
In the area of accessibility, there may be places we should publish the PDF to make it easier to find, download, and use.
The common denominator for all of the above is that we need your feedback on what makes sense for you as a user of
MariaDB Server.

Give Us Feedback
We would like to pick the brains of individual users. At conferences, asking open-ended questions is easy and feels
productive for both parties, when meeting in the corridors between talks. Replicating the same productive discussion on-line
is much harder. It takes effort from both parties. It feels like work.
We are still looking for the best way for you to give us meaningful feedback. Feel free to approach us over Zulip
(https://mariadb.zulipchat.com/ – the Documentation topic). Also email to [email protected] will find its way to us.
When you find individual bugs, please enter them into Jira using the guidelines mentioned in the KB article
https://mariadb.com/kb/en/reporting-documentation-bugs/.

Acknowledgements
Compiling any book requires more effort than expected by the authors, and more than visible to the readers. This book is no
exception. It has been over ten years in the making.
The primary thanks go to Ian Gilfillan, as the overall editor of the book and as the individually most productive author.
Close to Ian, we have Daniel Bartholomew. Daniel even beats Ian when it comes to articles created, and comes second on
articles edited.
Among the community contributors, we want to highlight Federico Razzoli. He has two accounts, totalling 4488, at the time of
writing – making him rank third amongst personal contributors.
When it comes to organisational contributors, the largest one is MariaDB Corporation. With them coding most of the features,
they also stand for the lion’s share of their documentation. As writers, besides Daniel Bartholomew whom we already
mentioned several times, we want to highlight Russell Dyer, Kenneth Dyer, Geoff Montee, and Jacob Moorman.
As the developer of the KB software itself, Bryan Alsdorf deserves special acknowledgement.
A special thanks goes to Michael “Monty” Widenius, the creator of MariaDB. Monty has always understood the importance of
documentation. He is leading by example, with a large number of personal edits. In fact, Monty has the second highest
number of edits amongst developers, after Sergei Golubchik and followed by Sergey Petrunia – all of which have over a
thousand edits.
Amongst the prolific contributors within the MariaDB Corporation Engineering team, the Connectors team stands out, with
Diego Dupin, Georg Richter, and Lawrin Novitzky ranking near the top. However, we have decided not to include Connectors
documentation in this first edition; we are contemplating whether it should be a separate PDF manual.
Other past and present Engineering team members, in decreasing order of number of edits, are David Hill, Dipti Joshi, David
Thompson, Massimiliano Pinto, Kolbe Kegel, Vladislav Vaintroub, Ralf Gebhardt, Markus Mäkelä, Sunanda Menon, the late
Rasmus Johansson, Todd Stoffel, Elena Stepanova, Julien Fritsch, and Alexander Barkov. They all have more than one
hundred edits, which is a lot.
As a true Open Source project, MariaDB Server documentation attracts attention and plentiful contributions also from outside
4/3812
the MariaDB Corporation Documentation and Engineering teams. We want to highlight those with over a hundred edits: Colin
Charles and Stephane Varoqui, both of MariaDB Corporation, and Daniel Black, of MariaDB Foundation.
Amongst community contributors in the over-a-hundred-edits category, we want to mention especially Alena Subotina, with
edits related to the dbforge documentation tool, and Juan Telleria, with edits often related to R Statistical Programming.
Prolific contributors whose contributions are not visible in this English manual are Esper Ecyan (Japanese) and Hector
Stredel (French); Federico Razzoli (Italian) has many edits also in English.
We also want to extend a thank you to the code developers who make work easy for the documentation team through
thoroughly prepared, reusable texts in Jira; in this category, Marko Mäkelä and Oleksandr Byelkin come to mind.
As for the PDF manual, it has been teamwork between Ian and his son Dorje Gilfillan. Ian has done what editors do, Dorje
has coded the Python code that compiles the KB pages into one.
All in all, thank you to everyone who has contributed to this book! We hope compiling it into one volume is of use for you, and
we would love to hear what you think about the end result.
Munich, Germany, October 2022
Kaj Arnö, CEO, MariaDB Foundation

5/3812
Chapter Contents
Chapter 1 Using MariaDB Server 45
1.1 SQL Statements & Structure 45
1.2 Built-in Functions 878
1.3 Clients & Utilities 1236
Chapter 2 MariaDB Administration 1375
2.1 Getting, Installing, and Upgrading MariaDB 1376
2.2 User & Server Security 1833
2.3 Backing Up and Restoring Databases 1893
2.4 Server Monitoring & Logs 1954
2.5 Partitioning Tables 1980
2.6 MariaDB Audit Plugin 1991
2.7 Variables and Modes 1991
2.8 Copying Tables Between Different MariaDB Databases and MariaDB Servers 2115
Chapter 3 High Availability & Performance Tuning 2117
3.1 MariaDB Replication 2117
3.2 MariaDB Galera Cluster 2223
3.3 Optimization and Tuning 2299
Chapter 4 Programming & Customizing MariaDB 2574
4.1 Programmatic & Compound Statements 2574
4.2 Stored Routines 2574
4.3 Triggers & Events 2595
4.4 Views 2604
4.5 User-Defined Functions 2608
Chapter 5 Columns, Storage Engines, and Plugins 2612
5.1 Data Types 2612
5.2 Character Sets and Collations 2692
5.3 Storage Engines 2703
5.4 Plugins 3303
Chapter 6 Training & Tutorials 3445
6.1 Beginner MariaDB Articles 3446
6.2 Basic MariaDB Articles 3488
6.3 Intermediate MariaDB Articles 3503
6.4 Advanced MariaDB Articles 3537
Chapter 7 MariaDB Server Releases 3557
7.1 Release Notes 3558
Chapter 8 The Community 3785
8.1 Bug Tracking 3786
8.2 Contributing & Participating 3799
8.3 Legal Matters 3809

6/3812
Table of Contents
Chapter 1 Using MariaDB Server 45
1.1 SQL Statements & Structure 45
1.1.1 SQL Statements 45
1.1.1.1 Account Management SQL Commands 46
1.1.1.1.1 CREATE USER 47
1.1.1.1.2 ALTER USER 54
1.1.1.1.3 DROP USER 58
1.1.1.1.4 GRANT 60
1.1.1.1.5 RENAME USER 74
1.1.1.1.6 REVOKE 74
1.1.1.1.7 SET PASSWORD 75
1.1.1.1.8 CREATE ROLE 77
1.1.1.1.9 DROP ROLE 78
1.1.1.1.10 SET ROLE 79
1.1.1.1.11 SET DEFAULT ROLE 80
1.1.1.1.12 SHOW GRANTS 81
1.1.1.1.13 SHOW CREATE USER 82
1.1.1.2 Administrative SQL Statements 83
1.1.1.2.1 Table Statements 84
1.1.1.2.1.1 ALTER 85
1.1.1.2.1.1.1 ALTER TABLE 86
1.1.1.2.1.1.2 ALTER DATABASE 99
1.1.1.2.1.1.3 ALTER EVENT 100
1.1.1.2.1.1.4 ALTER FUNCTION 101
1.1.1.2.1.1.5 ALTER LOGFILE GROUP 101
1.1.1.2.1.1.6 ALTER PROCEDURE 101
1.1.1.2.1.1.7 ALTER SEQUENCE 102
1.1.1.2.1.1.8 ALTER SERVER 102
1.1.1.2.1.1.9 ALTER TABLESPACE 103
1.1.1.2.1.1.10 ALTER USER 103
1.1.1.2.1.1.11 ALTER VIEW 103
1.1.1.2.1.2 ANALYZE TABLE 103
1.1.1.2.1.3 CHECK TABLE 104
1.1.1.2.1.4 CHECK VIEW 105
1.1.1.2.1.5 CHECKSUM TABLE 105
1.1.1.2.1.6 CREATE TABLE 107
1.1.1.2.1.7 DELETE 121
1.1.1.2.1.8 DROP TABLE 124
1.1.1.2.1.9 Installing System Tables (mysql_install_db) 126
1.1.1.2.1.10 mysqlcheck 126
1.1.1.2.1.11 OPTIMIZE TABLE 130
1.1.1.2.1.12 RENAME TABLE 132
1.1.1.2.1.13 REPAIR TABLE 133
1.1.1.2.1.14 REPAIR VIEW 134
1.1.1.2.1.15 REPLACE 134
1.1.1.2.1.16 SHOW COLUMNS 137
1.1.1.2.1.17 SHOW CREATE TABLE 139
1.1.1.2.1.18 SHOW INDEX 141
1.1.1.2.1.19 TRUNCATE TABLE 143
1.1.1.2.1.20 UPDATE 145
1.1.1.2.1.21 IGNORE 146
1.1.1.2.1.22 System-Versioned Tables 147
1.1.1.2.2 ANALYZE and EXPLAIN Statements 147
1.1.1.2.2.1 ANALYZE FORMAT=JSON 148
1.1.1.2.2.2 ANALYZE FORMAT=JSON Examples 149
1.1.1.2.2.3 ANALYZE Statement 150
1.1.1.2.2.4 EXPLAIN 152
1.1.1.2.2.5 EXPLAIN ANALYZE 157
1.1.1.2.2.6 EXPLAIN FORMAT=JSON 157
1.1.1.2.2.7 SHOW EXPLAIN 158
1.1.1.2.2.8 Using Buffer UPDATE Algorithm 160
1.1.1.2.3 BACKUP Commands 160
1.1.1.2.3.1 BACKUP STAGE 160
1.1.1.2.3.2 BACKUP LOCK 163
1.1.1.2.3.3 Mariabackup and BACKUP STAGE Commands 164

7/3812
1.1.1.2.3.4 Storage Snapshots and BACKUP STAGE Commands 164
1.1.1.2.4 FLUSH Commands 164
1.1.1.2.4.1 FLUSH 164
1.1.1.2.4.2 FLUSH QUERY CACHE 169
1.1.1.2.4.3 FLUSH TABLES FOR EXPORT 169
1.1.1.2.5 Replication Commands 170
1.1.1.2.5.1 CHANGE MASTER TO 172
1.1.1.2.5.2 START SLAVE 184
1.1.1.2.5.3 STOP SLAVE 185
1.1.1.2.5.4 RESET REPLICA/SLAVE 186
1.1.1.2.5.5 SET GLOBAL SQL_SLAVE_SKIP_COUNTER 187
1.1.1.2.5.6 SHOW RELAYLOG EVENTS 188
1.1.1.2.5.7 SHOW SLAVE STATUS 188
1.1.1.2.5.8 SHOW MASTER STATUS 194
1.1.1.2.5.9 SHOW SLAVE HOSTS 194
1.1.1.2.5.10 RESET MASTER 195
1.1.1.2.6 Plugin SQL Statements 195
1.1.1.2.6.1 SHOW PLUGINS 196
1.1.1.2.6.2 SHOW PLUGINS SONAME 197
1.1.1.2.6.3 INSTALL PLUGIN 197
1.1.1.2.6.4 UNINSTALL PLUGIN 198
1.1.1.2.6.5 INSTALL SONAME 199
1.1.1.2.6.6 UNINSTALL SONAME 200
1.1.1.2.6.7 mysql_plugin 201
1.1.1.2.7 SET Commands 201
1.1.1.2.7.1 SET 202
1.1.1.2.7.2 SET CHARACTER SET 204
1.1.1.2.7.3 SET GLOBAL SQL_SLAVE_SKIP_COUNTER 205
1.1.1.2.7.4 SET NAMES 205
1.1.1.2.7.5 SET PASSWORD 207
1.1.1.2.7.6 SET ROLE 207
1.1.1.2.7.7 SET SQL_LOG_BIN 207
1.1.1.2.7.8 SET STATEMENT 207
1.1.1.2.7.9 SET TRANSACTION 208
1.1.1.2.7.10 SET Variable 210
1.1.1.2.8 SHOW 211
1.1.1.2.8.1 About SHOW 214
1.1.1.2.8.2 Extended Show 215
1.1.1.2.8.3 SHOW AUTHORS 216
1.1.1.2.8.4 SHOW BINARY LOGS 218
1.1.1.2.8.5 SHOW BINLOG EVENTS 219
1.1.1.2.8.6 SHOW CHARACTER SET 219
1.1.1.2.8.7 SHOW CLIENT_STATISTICS 220
1.1.1.2.8.8 SHOW COLLATION 221
1.1.1.2.8.9 SHOW COLUMNS 221
1.1.1.2.8.10 SHOW CONTRIBUTORS 221
1.1.1.2.8.11 SHOW CREATE DATABASE 222
1.1.1.2.8.12 SHOW CREATE EVENT 223
1.1.1.2.8.13 SHOW CREATE FUNCTION 224
1.1.1.2.8.14 SHOW CREATE PACKAGE 224
1.1.1.2.8.15 SHOW CREATE PACKAGE BODY 225
1.1.1.2.8.16 SHOW CREATE PROCEDURE 227
1.1.1.2.8.17 SHOW CREATE SEQUENCE 228
1.1.1.2.8.18 SHOW CREATE TABLE 229
1.1.1.2.8.19 SHOW CREATE TRIGGER 229
1.1.1.2.8.20 SHOW CREATE USER 230
1.1.1.2.8.21 SHOW CREATE VIEW 230
1.1.1.2.8.22 SHOW DATABASES 231
1.1.1.2.8.23 SHOW ENGINE 232
1.1.1.2.8.24 SHOW ENGINE INNODB STATUS 233
1.1.1.2.8.25 SHOW ENGINES 235
1.1.1.2.8.26 SHOW ERRORS 236
1.1.1.2.8.27 SHOW EVENTS 237
1.1.1.2.8.28 SHOW FUNCTION CODE 238
1.1.1.2.8.29 SHOW FUNCTION STATUS 238
1.1.1.2.8.30 SHOW GRANTS 239
1.1.1.2.8.31 SHOW INDEX 239
1.1.1.2.8.32 SHOW INDEX_STATISTICS 239
1.1.1.2.8.34 SHOW LOCALES 240
1.1.1.2.8.35 SHOW BINLOG STATUS 240
1.1.1.2.8.36 SHOW OPEN TABLES 240

8/3812
1.1.1.2.8.37 SHOW PACKAGE BODY STATUS 241
1.1.1.2.8.38 SHOW PACKAGE STATUS 242
1.1.1.2.8.39 SHOW PLUGINS 242
1.1.1.2.8.40 SHOW PLUGINS SONAME 242
1.1.1.2.8.41 SHOW PRIVILEGES 242
1.1.1.2.8.42 SHOW PROCEDURE CODE 244
1.1.1.2.8.43 SHOW PROCEDURE STATUS 245
1.1.1.2.8.44 SHOW PROCESSLIST 246
1.1.1.2.8.45 SHOW PROFILE 247
1.1.1.2.8.46 SHOW PROFILES 249
1.1.1.2.8.47 SHOW QUERY_RESPONSE_TIME 250
1.1.1.2.8.48 SHOW RELAYLOG EVENTS 250
1.1.1.2.8.49 SHOW REPLICA HOSTS 250
1.1.1.2.8.50 SHOW REPLICA STATUS 250
1.1.1.2.8.51 SHOW STATUS 250
1.1.1.2.8.52 SHOW TABLE STATUS 263
1.1.1.2.8.53 SHOW TABLES 265
1.1.1.2.8.54 SHOW TABLE_STATISTICS 266
1.1.1.2.8.55 SHOW TRIGGERS 267
1.1.1.2.8.56 SHOW USER_STATISTICS 269
1.1.1.2.8.57 SHOW VARIABLES 269
1.1.1.2.8.58 SHOW WARNINGS 271
1.1.1.2.8.59 SHOW WSREP_MEMBERSHIP 273
1.1.1.2.8.60 SHOW WSREP_STATUS 273
1.1.1.2.9 System Tables 274
1.1.1.2.9.1 Information Schema 274
1.1.1.2.9.1.1 Information Schema Tables 274
1.1.1.2.9.1.1.1 Information Schema InnoDB Tables 277
1.1.1.2.9.1.1.1.1 Information Schema INNODB_BUFFER_PAGE Table 279
1.1.1.2.9.1.1.1.2 Information Schema INNODB_BUFFER_PAGE_LRU Table 280
1.1.1.2.9.1.1.1.3 Information Schema INNODB_BUFFER_POOL_PAGES Table 282
1.1.1.2.9.1.1.1.4 Information Schema INNODB_BUFFER_POOL_PAGES_BLOB Table 283
1.1.1.2.9.1.1.1.5 Information Schema INNODB_BUFFER_POOL_PAGES_INDEX Table 283
1.1.1.2.9.1.1.1.6 Information Schema INNODB_BUFFER_POOL_STATS Table 283
1.1.1.2.9.1.1.1.7 Information Schema INNODB_CHANGED_PAGES Table 285
1.1.1.2.9.1.1.1.8 Information Schema INNODB_CMP and INNODB_CMP_RESET Tables 285
1.1.1.2.9.1.1.1.9 Information Schema INNODB_CMPMEM and INNODB_CMPMEM_RESET Tables 286
1.1.1.2.9.1.1.1.10 Information Schema INNODB_CMP_PER_INDEX and INNODB_CMP_PER_INDEX_RESET Tables 287
1.1.1.2.9.1.1.1.11 Information Schema INNODB_FT_BEING_DELETED Table 288
1.1.1.2.9.1.1.1.12 Information Schema INNODB_FT_CONFIG Table 288
1.1.1.2.9.1.1.1.13 Information Schema INNODB_FT_DEFAULT_STOPWORD Table 289
1.1.1.2.9.1.1.1.14 Information Schema INNODB_FT_DELETED Table 289
1.1.1.2.9.1.1.1.15 Information Schema INNODB_FT_INDEX_CACHE Table 290
1.1.1.2.9.1.1.1.16 Information Schema INNODB_FT_INDEX_TABLE Table 292
1.1.1.2.9.1.1.1.17 Information Schema INNODB_LOCK_WAITS Table 293
1.1.1.2.9.1.1.1.18 Information Schema INNODB_LOCKS Table 293
1.1.1.2.9.1.1.1.19 Information Schema INNODB_METRICS Table 294
1.1.1.2.9.1.1.1.20 Information Schema INNODB_MUTEXES Table 297
1.1.1.2.9.1.1.1.21 Information Schema INNODB_SYS_COLUMNS Table 298
1.1.1.2.9.1.1.1.22 Information Schema INNODB_SYS_DATAFILES Table 299
1.1.1.2.9.1.1.1.23 Information Schema INNODB_SYS_FIELDS Table 300
1.1.1.2.9.1.1.1.24 Information Schema INNODB_SYS_FOREIGN Table 300
1.1.1.2.9.1.1.1.25 Information Schema INNODB_SYS_FOREIGN_COLS Table 301
1.1.1.2.9.1.1.1.26 Information Schema INNODB_SYS_INDEXES Table 301
1.1.1.2.9.1.1.1.27 Information Schema INNODB_SYS_SEMAPHORE_WAITS Table 302
1.1.1.2.9.1.1.1.28 Information Schema INNODB_SYS_TABLES Table 303
1.1.1.2.9.1.1.1.29 Information Schema INNODB_SYS_TABLESPACES Table 304
1.1.1.2.9.1.1.1.30 Information Schema INNODB_SYS_TABLESTATS Table 305
1.1.1.2.9.1.1.1.31 Information Schema INNODB_SYS_VIRTUAL Table 306
1.1.1.2.9.1.1.1.32 Information Schema INNODB_TABLESPACES_ENCRYPTION Table 306
1.1.1.2.9.1.1.1.33 Information Schema INNODB_TABLESPACES_SCRUBBING Table 307
1.1.1.2.9.1.1.1.34 Information Schema INNODB_TRX Table 308
1.1.1.2.9.1.1.1.35 Information Schema TEMP_TABLES_INFO Table 310
1.1.1.2.9.1.1.2 Information Schema MyRocks Tables 310
1.1.1.2.9.1.1.2.1 Information Schema ROCKSDB_CFSTATS Table 311
1.1.1.2.9.1.1.2.2 Information Schema ROCKSDB_CF_OPTIONS Table 311
1.1.1.2.9.1.1.2.3 Information Schema ROCKSDB_COMPACTION_STATS Table 312
1.1.1.2.9.1.1.2.4 Information Schema ROCKSDB_DBSTATS Table 312
1.1.1.2.9.1.1.2.5 Information Schema ROCKSDB_DDL Table 312
1.1.1.2.9.1.1.2.6 Information Schema ROCKSDB_DEADLOCK Table 312
1.1.1.2.9.1.1.2.7 Information Schema ROCKSDB_GLOBAL_INFO Table 313

9/3812
1.1.1.2.9.1.1.2.8 Information Schema ROCKSDB_INDEX_FILE_MAP Table 313
1.1.1.2.9.1.1.2.9 Information Schema ROCKSDB_LOCKS Table 313
1.1.1.2.9.1.1.2.10 Information Schema ROCKSDB_PERF_CONTEXT Table 314
1.1.1.2.9.1.1.2.11 Information Schema ROCKSDB_PERF_CONTEXT_GLOBAL Table 314
1.1.1.2.9.1.1.2.12 Information Schema ROCKSDB_SST_PROPS Table 314
1.1.1.2.9.1.1.2.13 Information Schema ROCKSDB_TRX Table 315
1.1.1.2.9.1.1.3 ColumnStore Information Schema Tables 315
1.1.1.2.9.1.1.4 Information Schema ALL_PLUGINS Table 318
1.1.1.2.9.1.1.5 Information Schema APPLICABLE_ROLES Table 319
1.1.1.2.9.1.1.6 Information Schema CHARACTER_SETS Table 320
1.1.1.2.9.1.1.7 Information Schema CHECK_CONSTRAINTS Table 320
1.1.1.2.9.1.1.8 Information Schema CLIENT_STATISTICS Table 323
1.1.1.2.9.1.1.9 Information Schema COLLATION_CHARACTER_SET_APPLICABILITY Table 325
1.1.1.2.9.1.1.10 Information Schema COLLATIONS Table 325
1.1.1.2.9.1.1.11 Information Schema COLUMN_PRIVILEGES Table 326
1.1.1.2.9.1.1.12 Information Schema COLUMNS Table 327
1.1.1.2.9.1.1.13 Information Schema DISKS Table 329
1.1.1.2.9.1.1.14 Information Schema ENABLED_ROLES Table 330
1.1.1.2.9.1.1.15 Information Schema ENGINES Table 330
1.1.1.2.9.1.1.16 Information Schema EVENTS Table 333
1.1.1.2.9.1.1.17 Information Schema FEEDBACK Table 333
1.1.1.2.9.1.1.18 Information Schema FILES Table 334
1.1.1.2.9.1.1.19 Information Schema GEOMETRY_COLUMNS Table 334
1.1.1.2.9.1.1.20 Information Schema GLOBAL_STATUS and SESSION_STATUS Tables 336
1.1.1.2.9.1.1.21 Information Schema GLOBAL_VARIABLES and SESSION_VARIABLES Tables 336
1.1.1.2.9.1.1.22 Information Schema INDEX_STATISTICS Table 337
1.1.1.2.9.1.1.23 Information Schema KEY_CACHES Table 337
1.1.1.2.9.1.1.24 Information Schema KEY_COLUMN_USAGE Table 338
1.1.1.2.9.1.1.25 Information Schema KEYWORDS Table 339
1.1.1.2.9.1.1.26 Information Schema LOCALES Table 348
1.1.1.2.9.1.1.27 Information Schema METADATA_LOCK_INFO Table 349
1.1.1.2.9.1.1.28 Information Schema MROONGA_STATS Table 351
1.1.1.2.9.1.1.29 Information Schema OPTIMIZER_TRACE Table 351
1.1.1.2.9.1.1.30 Information Schema PARAMETERS Table 352
1.1.1.2.9.1.1.31 Information Schema PARTITIONS Table 353
1.1.1.2.9.1.1.32 Information Schema PLUGINS Table 354
1.1.1.2.9.1.1.33 Information Schema PROCESSLIST Table 357
1.1.1.2.9.1.1.34 Information Schema PROFILING Table 358
1.1.1.2.9.1.1.35 Information Schema QUERY_CACHE_INFO Table 359
1.1.1.2.9.1.1.36 Information Schema QUERY_RESPONSE_TIME Table 360
1.1.1.2.9.1.1.37 Information Schema REFERENTIAL_CONSTRAINTS Table 361
1.1.1.2.9.1.1.38 Information Schema ROUTINES Table 361
1.1.1.2.9.1.1.39 Information Schema SCHEMA_PRIVILEGES Table 362
1.1.1.2.9.1.1.40 Information Schema SCHEMATA Table 363
1.1.1.2.9.1.1.41 Information Schema SPATIAL_REF_SYS Table 364
1.1.1.2.9.1.1.42 Information Schema SPIDER_ALLOC_MEM Table 364
1.1.1.2.9.1.1.43 Information Schema SPIDER_WRAPPER_PROTOCOLS Table 364
1.1.1.2.9.1.1.44 Information Schema SQL_FUNCTIONS Table 365
1.1.1.2.9.1.1.45 Information Schema STATISTICS Table 368
1.1.1.2.9.1.1.46 Information Schema SYSTEM_VARIABLES Table 369
1.1.1.2.9.1.1.47 Information Schema TABLE_CONSTRAINTS Table 370
1.1.1.2.9.1.1.48 Information Schema TABLE_PRIVILEGES Table 370
1.1.1.2.9.1.1.49 Information Schema TABLE_STATISTICS Table 370
1.1.1.2.9.1.1.50 Information Schema TABLES Table 371
1.1.1.2.9.1.1.51 Information Schema TABLESPACES Table 373
1.1.1.2.9.1.1.52 Information Schema THREAD_POOL_GROUPS Table 374
1.1.1.2.9.1.1.53 Information Schema THREAD_POOL_QUEUES Table 374
1.1.1.2.9.1.1.54 Information Schema THREAD_POOL_STATS Table 374
1.1.1.2.9.1.1.55 Information Schema THREAD_POOL_WAITS Table 375
1.1.1.2.9.1.1.56 Information Schema TRIGGERS Table 375
1.1.1.2.9.1.1.57 Information Schema USER_PRIVILEGES Table 376
1.1.1.2.9.1.1.58 Information Schema USER_STATISTICS Table 376
1.1.1.2.9.1.1.59 Information Schema USER_VARIABLES Table 378
1.1.1.2.9.1.1.60 Information Schema VIEWS Table 378
1.1.1.2.9.1.1.61 Information Schema WSREP_MEMBERSHIP Table 379
1.1.1.2.9.1.1.62 Information Schema WSREP_STATUS Table 380
1.1.1.2.9.1.2 Extended SHOW 380
1.1.1.2.9.1.3 TIME_MS column in INFORMATION_SCHEMA.PROCESSLIST 380
1.1.1.2.9.2 Performance Schema 380
1.1.1.2.9.2.1 Performance Schema Tables 381
1.1.1.2.9.2.1.1 List of Performance Schema Tables 385

10/3812
1.1.1.2.9.2.1.2 Performance Schema accounts Table 387
1.1.1.2.9.2.1.3 Performance Schema cond_instances Table 387
1.1.1.2.9.2.1.4 Performance Schema events_stages_current Table 388
1.1.1.2.9.2.1.5 Performance Schema events_stages_history Table 388
1.1.1.2.9.2.1.6 Performance Schema events_stages_history_long Table 389
1.1.1.2.9.2.1.7 Performance Schema events_stages_summary_by_account_by_event_name Table 389
1.1.1.2.9.2.1.8 Performance Schema events_stages_summary_by_host_by_event_name Table 390
1.1.1.2.9.2.1.9 Performance Schema events_stages_summary_by_thread_by_event_name Table 391
1.1.1.2.9.2.1.10 Performance Schema events_stages_summary_by_user_by_event_name Table 392
1.1.1.2.9.2.1.11 Performance Schema events_stages_summary_global_by_event_name Table 393
1.1.1.2.9.2.1.12 Performance Schema events_statements_current Table 394
1.1.1.2.9.2.1.13 Performance Schema events_statements_history Table 395
1.1.1.2.9.2.1.14 Performance Schema events_statements_history_long Table 396
1.1.1.2.9.2.1.15 Performance Schema events_statements_summary_by_account_by_event_name Table 398
1.1.1.2.9.2.1.16 Performance Schema events_statements_summary_by_digest Table 399
1.1.1.2.9.2.1.17 Performance Schema events_statements_summary_by_host_by_event_name Table 400
1.1.1.2.9.2.1.18 Performance Schema events_statements_summary_by_program Table 402
1.1.1.2.9.2.1.19 Performance Schema events_statements_summary_by_thread_by_event_name Table 404
1.1.1.2.9.2.1.20 Performance Schema events_statements_summary_by_user_by_event_name Table 405
1.1.1.2.9.2.1.21 Performance Schema events_statements_summary_global_by_event_name Table 407
1.1.1.2.9.2.1.22 Performance Schema events_transactions_current Table 409
1.1.1.2.9.2.1.23 Performance Schema events_transactions_history Table 410
1.1.1.2.9.2.1.24 Performance Schema events_transactions_history_long Table 412
1.1.1.2.9.2.1.25 Performance Schema events_transactions_summary_by_account_by_event_name Table 413
1.1.1.2.9.2.1.26 Performance Schema events_transactions_summary_by_host_by_event_name Table 414
1.1.1.2.9.2.1.27 Performance Schema events_transactions_summary_by_thread_by_event_name Table 415
1.1.1.2.9.2.1.28 Performance Schema events_transactions_summary_by_user_by_event_name Table 415
1.1.1.2.9.2.1.29 Performance Schema events_transactions_summary_global_by_event_name Table 416
1.1.1.2.9.2.1.30 Performance Schema events_waits_current Table 416
1.1.1.2.9.2.1.31 Performance Schema events_waits_history Table 417
1.1.1.2.9.2.1.32 Performance Schema events_waits_history_long Table 418
1.1.1.2.9.2.1.33 Performance Schema events_waits_summary_by_account_by_event_name Table 419
1.1.1.2.9.2.1.34 Performance Schema events_waits_summary_by_host_by_event_name Table 420
1.1.1.2.9.2.1.35 Performance Schema events_waits_summary_by_instance Table 421
1.1.1.2.9.2.1.36 Performance Schema events_waits_summary_by_thread_by_event_name Table 422
1.1.1.2.9.2.1.37 Performance Schema events_waits_summary_by_user_by_event_name Table 423
1.1.1.2.9.2.1.38 Performance Schema events_waits_summary_global_by_event_name Table 424
1.1.1.2.9.2.1.39 Performance Schema file_instances Table 425
1.1.1.2.9.2.1.40 Performance Schema file_summary_by_event_name Table 426
1.1.1.2.9.2.1.41 Performance Schema file_summary_by_instance Table 427
1.1.1.2.9.2.1.42 Performance Schema global_status Table 429
1.1.1.2.9.2.1.43 Performance Schema hosts Table 430
1.1.1.2.9.2.1.44 Performance Schema host_cache Table 430
1.1.1.2.9.2.1.45 Performance Schema memory_summary_by_account_by_event_name Table 431
1.1.1.2.9.2.1.46 Performance Schema memory_summary_by_host_by_event_name Table 432
1.1.1.2.9.2.1.47 Performance Schema memory_summary_by_thread_by_event_name Table 433
1.1.1.2.9.2.1.48 Performance Schema memory_summary_by_user_by_event_name Table 434
1.1.1.2.9.2.1.49 Performance Schema memory_summary_global_by_event_name Table 434
1.1.1.2.9.2.1.50 Performance Schema metadata_locks Table 435
1.1.1.2.9.2.1.51 Performance Schema mutex_instances Table 436
1.1.1.2.9.2.1.52 Performance Schema objects_summary_global_by_type Table 437
1.1.1.2.9.2.1.53 Performance Schema performance_timers Table 437
1.1.1.2.9.2.1.54 Performance Schema prepared_statements_instances Table 438
1.1.1.2.9.2.1.55 Performance Schema replication_applier_configuration Table 440
1.1.1.2.9.2.1.56 Performance Schema replication_applier_status Table 440
1.1.1.2.9.2.1.57 Performance Schema replication_applier_status_by_coordinator Table 440
1.1.1.2.9.2.1.58 Performance Schema replication_applier_status_by_worker Table 441
1.1.1.2.9.2.1.59 Performance Schema replication_connection_configuration Table 441
1.1.1.2.9.2.1.60 Performance Schema rwlock_instances Table 442
1.1.1.2.9.2.1.61 Performance Schema session_account_connect_attrs Table 442
1.1.1.2.9.2.1.62 Performance Schema session_connect_attrs Table 443
1.1.1.2.9.2.1.63 Performance Schema session_status Table 444
1.1.1.2.9.2.1.64 Performance Schema setup_actors Table 444
1.1.1.2.9.2.1.65 Performance Schema setup_consumers Table 444
1.1.1.2.9.2.1.66 Performance Schema setup_instruments Table 445
1.1.1.2.9.2.1.67 Performance Schema setup_objects Table 457
1.1.1.2.9.2.1.68 Performance Schema setup_timers Table 458
1.1.1.2.9.2.1.69 Performance Schema socket_instances Table 458
1.1.1.2.9.2.1.70 Performance Schema socket_summary_by_event_name Table 459
1.1.1.2.9.2.1.71 Performance Schema socket_summary_by_instance Table 460
1.1.1.2.9.2.1.72 Performance Schema status_by_account Table 461

11/3812
1.1.1.2.9.2.1.73 Performance Schema status_by_host Table 461
1.1.1.2.9.2.1.74 Performance Schema status_by_thread Table 462
1.1.1.2.9.2.1.75 Performance Schema status_by_user Table 462
1.1.1.2.9.2.1.76 Performance Schema table_handles Table 462
1.1.1.2.9.2.1.77 Performance Schema table_io_waits_summary_by_index_usage Table 463
1.1.1.2.9.2.1.78 Performance Schema table_io_waits_summary_by_table Table 464
1.1.1.2.9.2.1.79 Performance Schema table_lock_waits_summary_by_table Table 465
1.1.1.2.9.2.1.80 Performance Schema threads Table 467
1.1.1.2.9.2.1.81 Performance Schema user_variables_by_thread Table 468
1.1.1.2.9.2.1.82 Performance Schema users Table 469
1.1.1.2.9.2.2 Performance Schema Overview 469
1.1.1.2.9.2.3 Performance Schema Status Variables 471
1.1.1.2.9.2.4 Performance Schema System Variables 475
1.1.1.2.9.2.5 Performance Schema Digests 483
1.1.1.2.9.2.6 PERFORMANCE_SCHEMA Storage Engine 484
1.1.1.2.9.3 The mysql Database Tables 484
1.1.1.2.9.3.1 mysql.column_stats Table 485
1.1.1.2.9.3.2 mysql.columns_priv Table 486
1.1.1.2.9.3.3 mysql.db Table 487
1.1.1.2.9.3.4 mysql.event Table 488
1.1.1.2.9.3.5 mysql.func Table 490
1.1.1.2.9.3.6 mysql.general_log Table 490
1.1.1.2.9.3.7 mysql.global_priv Table 491
1.1.1.2.9.3.8 mysql.gtid_slave_pos Table 493
1.1.1.2.9.3.9 mysql.help_category Table 494
1.1.1.2.9.3.10 mysql.help_keyword Table 495
1.1.1.2.9.3.11 mysql.help_relation Table 496
1.1.1.2.9.3.12 mysql.help_topic Table 496
1.1.1.2.9.3.13 mysql.index_stats Table 497
1.1.1.2.9.3.14 mysql.innodb_index_stats 498
1.1.1.2.9.3.15 mysql.innodb_table_stats 499
1.1.1.2.9.3.16 mysql.password_reuse_check_history Table 500
1.1.1.2.9.3.17 mysql.plugin Table 500
1.1.1.2.9.3.18 mysql.proc Table 501
1.1.1.2.9.3.19 mysql.procs_priv Table 503
1.1.1.2.9.3.20 mysql.roles_mapping Table 503
1.1.1.2.9.3.21 mysql.servers Table 504
1.1.1.2.9.3.22 mysql.slow_log Table 504
1.1.1.2.9.3.23 mysql.tables_priv Table 505
1.1.1.2.9.3.24 mysql.table_stats Table 506
1.1.1.2.9.3.25 mysql.time_zone Table 506
1.1.1.2.9.3.26 mysql.time_zone_leap_second Table 507
1.1.1.2.9.3.27 mysql.time_zone_name Table 508
1.1.1.2.9.3.28 mysql.time_zone_transition Table 508
1.1.1.2.9.3.29 mysql.time_zone_transition_type Table 509
1.1.1.2.9.3.30 mysql.transaction_registry Table 510
1.1.1.2.9.3.31 mysql.user Table 510
1.1.1.2.9.3.32 Spider mysql Database Tables 514
1.1.1.2.9.3.32.1 mysql.spider_link_failed_log Table 514
1.1.1.2.9.3.32.2 mysql.spider_link_mon_servers Table 515
1.1.1.2.9.3.32.3 mysql.spider_tables Table 515
1.1.1.2.9.3.32.4 mysql.spider_table_crd Table 516
1.1.1.2.9.3.32.5 mysql.spider_table_position_for_recovery Table 517
1.1.1.2.9.3.32.6 mysql.spider_table_sts Table 517
1.1.1.2.9.3.32.7 mysql.spider_xa Table 517
1.1.1.2.9.3.32.8 mysql.spider_xa_failed_log Table 518
1.1.1.2.9.3.32.9 mysql.spider_xa_member Table 519
1.1.1.2.9.4 Sys Schema 519
1.1.1.2.9.4.1 Sys Schema sys_config Table 520
1.1.1.2.9.4.2 Sys Schema Stored Functions 520
1.1.1.2.9.4.2.1 extract_schema_from_file_name 521
1.1.1.2.9.4.2.2 extract_table_from_file_name 522
1.1.1.2.9.4.2.3 format_bytes 522
1.1.1.2.9.4.2.4 format_path 523
1.1.1.2.9.4.2.5 format_statement 524
1.1.1.2.9.4.2.6 format_time 524
1.1.1.2.9.4.2.7 list_add 525
1.1.1.2.9.4.2.8 list_drop 526
1.1.1.2.9.4.2.9 ps_is_account_enabled 526
1.1.1.2.9.4.2.10 ps_is_consumer_enabled 526
1.1.1.2.9.4.2.11 ps_is_instrument_default_enabled 527

12/3812
1.1.1.2.9.4.2.12 ps_is_instrument_default_timed 528
1.1.1.2.9.4.2.13 ps_is_thread_instrumented 529
1.1.1.2.9.4.2.14 ps_thread_account 529
1.1.1.2.9.4.2.15 ps_thread_id 530
1.1.1.2.9.4.2.16 ps_thread_stack 531
1.1.1.2.9.4.2.17 ps_thread_trx_info 531
1.1.1.2.9.4.2.18 quote_identifier 532
1.1.1.2.9.4.2.19 sys_get_config 532
1.1.1.2.9.4.2.20 version_major 533
1.1.1.2.9.4.2.21 version_minor 533
1.1.1.2.9.4.2.22 version_patch 534
1.1.1.2.9.4.3 Sys Schema Stored Procedures 534
1.1.1.2.9.4.3.1 create_synonym_db 535
1.1.1.2.9.4.3.2 statement_performance_analyzer 536
1.1.1.2.9.4.3.3 table_exists 536
1.1.1.2.9.5 mariadb_schema 537
1.1.1.2.9.6 Writing Logs Into Tables 538
1.1.1.2.10 BINLOG 539
1.1.1.2.11 PURGE BINARY LOGS 539
1.1.1.2.12 CACHE INDEX 540
1.1.1.2.13 DESCRIBE 541
1.1.1.2.14 EXECUTE Statement 541
1.1.1.2.15 HELP Command 542
1.1.1.2.16 KILL [CONNECTION | QUERY] 543
1.1.1.2.17 LOAD INDEX 544
1.1.1.2.18 RESET 544
1.1.1.2.19 SHUTDOWN 545
1.1.1.2.20 USE 546
1.1.1.3 Data Definition 546
1.1.1.3.1 CREATE 547
1.1.1.3.1.1 CREATE DATABASE 548
1.1.1.3.1.2 CREATE EVENT 550
1.1.1.3.1.3 CREATE FUNCTION 553
1.1.1.3.1.4 CREATE FUNCTION UDF 557
1.1.1.3.1.5 CREATE INDEX 560
1.1.1.3.1.6 CREATE LOGFILE GROUP 562
1.1.1.3.1.7 CREATE PACKAGE 563
1.1.1.3.1.8 CREATE PACKAGE BODY 565
1.1.1.3.1.9 CREATE PROCEDURE 568
1.1.1.3.1.10 CREATE ROLE 571
1.1.1.3.1.11 CREATE SEQUENCE 571
1.1.1.3.1.12 CREATE SERVER 571
1.1.1.3.1.13 CREATE TABLE 573
1.1.1.3.1.14 CREATE TABLESPACE 573
1.1.1.3.1.15 CREATE TRIGGER 573
1.1.1.3.1.16 CREATE USER 575
1.1.1.3.1.17 CREATE VIEW 575
1.1.1.3.1.18 Silent Column Changes 579
1.1.1.3.1.19 Generated (Virtual and Persistent/Stored) Columns 580
1.1.1.3.1.20 Invisible Columns 587
1.1.1.3.2 ALTER 589
1.1.1.3.2.1 ALTER TABLE 589
1.1.1.3.2.2 ALTER DATABASE 589
1.1.1.3.2.3 ALTER EVENT 589
1.1.1.3.2.4 ALTER FUNCTION 589
1.1.1.3.2.5 ALTER LOGFILE GROUP 589
1.1.1.3.2.6 ALTER PROCEDURE 589
1.1.1.3.2.7 ALTER SEQUENCE 589
1.1.1.3.2.8 ALTER SERVER 589
1.1.1.3.2.9 ALTER TABLESPACE 589
1.1.1.3.2.10 ALTER USER 589
1.1.1.3.2.11 ALTER VIEW 589
1.1.1.3.3 DROP 589
1.1.1.3.3.1 DROP DATABASE 590
1.1.1.3.3.2 DROP EVENT 591
1.1.1.3.3.3 DROP FUNCTION 592
1.1.1.3.3.4 DROP FUNCTION UDF 593
1.1.1.3.3.5 DROP INDEX 594
1.1.1.3.3.6 DROP LOGFILE GROUP 595
1.1.1.3.3.7 DROP PACKAGE 595
1.1.1.3.3.8 DROP PACKAGE BODY 595

13/3812
1.1.1.3.3.9 DROP PROCEDURE 596
1.1.1.3.3.10 DROP ROLE 597
1.1.1.3.3.11 DROP SEQUENCE 597
1.1.1.3.3.12 DROP SERVER 597
1.1.1.3.3.13 DROP TABLE 598
1.1.1.3.3.14 DROP TABLESPACE 598
1.1.1.3.3.15 DROP TRIGGER 598
1.1.1.3.3.16 DROP USER 599
1.1.1.3.3.17 DROP VIEW 599
1.1.1.3.4 Atomic DDL 600
1.1.1.3.5 CONSTRAINT 602
1.1.1.3.6 MERGE 604
1.1.1.3.7 RENAME TABLE 604
1.1.1.3.8 TRUNCATE TABLE 604
1.1.1.4 Data Manipulation 605
1.1.1.4.1 Selecting Data 605
1.1.1.4.1.1 SELECT 607
1.1.1.4.1.2 Joins & Subqueries 609
1.1.1.4.1.2.1 Joins 610
1.1.1.4.1.2.1.1 Joining Tables with JOIN Clauses 610
1.1.1.4.1.2.1.2 More Advanced Joins 610
1.1.1.4.1.2.1.3 JOIN Syntax 613
1.1.1.4.1.2.1.4 Comma vs JOIN 615
1.1.1.4.1.2.2 Subqueries 615
1.1.1.4.1.2.2.1 Scalar Subqueries 616
1.1.1.4.1.2.2.2 Row Subqueries 617
1.1.1.4.1.2.2.3 Subqueries and ALL 617
1.1.1.4.1.2.2.4 Subqueries and ANY 618
1.1.1.4.1.2.2.5 Subqueries and EXISTS 619
1.1.1.4.1.2.2.6 Subqueries in a FROM Clause 620
1.1.1.4.1.2.2.7 Subquery Optimizations 621
1.1.1.4.1.2.2.7.1 Subquery Optimizations Map 621
1.1.1.4.1.2.2.7.2 Semi-join Subquery Optimizations 621
1.1.1.4.1.2.2.7.3 Table Pullout Optimization 621
1.1.1.4.1.2.2.7.4 Non-semi-join Subquery Optimizations 621
1.1.1.4.1.2.2.7.5 Subquery Cache 621
1.1.1.4.1.2.2.7.6 Condition Pushdown Into IN subqueries 621
1.1.1.4.1.2.2.7.7 Conversion of Big IN Predicates Into Subqueries 621
1.1.1.4.1.2.2.7.8 EXISTS-to-IN Optimization 621
1.1.1.4.1.2.2.7.9 Optimizing GROUP BY and DISTINCE Clauses in Subqueries 621
1.1.1.4.1.2.2.8 Subqueries and JOINs 621
1.1.1.4.1.2.2.9 Subquery Limitations 623
1.1.1.4.1.2.3 UNION 624
1.1.1.4.1.2.4 EXCEPT 628
1.1.1.4.1.2.5 INTERSECT 631
1.1.1.4.1.2.6 Precedence Control in Table Operations 634
1.1.1.4.1.2.7 MINUS 635
1.1.1.4.1.3 LIMIT 635
1.1.1.4.1.4 ORDER BY 638
1.1.1.4.1.5 GROUP BY 640
1.1.1.4.1.6 Common Table Expressions 642
1.1.1.4.1.6.1 WITH 642
1.1.1.4.1.6.2 Non-Recursive Common Table Expressions Overview 644
1.1.1.4.1.6.3 Recursive Common Table Expressions Overview 646
1.1.1.4.1.7 SELECT WITH ROLLUP 652
1.1.1.4.1.8 SELECT INTO OUTFILE 654
1.1.1.4.1.9 SELECT INTO DUMPFILE 655
1.1.1.4.1.10 FOR UPDATE 655
1.1.1.4.1.11 LOCK IN SHARE MODE 656
1.1.1.4.1.12 Optimizer Hints 656
1.1.1.4.1.13 PROCEDURE 657
1.1.1.4.1.14 HANDLER 657
1.1.1.4.1.15 DUAL 657
1.1.1.4.1.16 SELECT ... OFFSET ... FETCH 657
1.1.1.4.2 Inserting & Loading Data 659
1.1.1.4.2.1 INSERT 659
1.1.1.4.2.2 INSERT DELAYED 662
1.1.1.4.2.3 INSERT SELECT 663
1.1.1.4.2.4 LOAD Data into Tables or Index 664
1.1.1.4.2.4.1 LOAD DATA INFILE 665
1.1.1.4.2.4.2 LOAD INDEX 667

14/3812
1.1.1.4.2.4.3 LOAD XML 668
1.1.1.4.2.4.4 LOAD_FILE 669
1.1.1.4.2.5 Concurrent Inserts 669
1.1.1.4.2.6 HIGH_PRIORITY and LOW_PRIORITY 670
1.1.1.4.2.7 IGNORE 670
1.1.1.4.2.8 INSERT - Default & Duplicate Values 670
1.1.1.4.2.9 INSERT IGNORE 671
1.1.1.4.2.10 INSERT ON DUPLICATE KEY UPDATE 672
1.1.1.4.2.11 INSERT...RETURNING 675
1.1.1.4.3 Changing & Deleting Data 677
1.1.1.4.3.1 DELETE 677
1.1.1.4.3.2 HIGH_PRIORITY and LOW_PRIORITY 677
1.1.1.4.3.3 IGNORE 677
1.1.1.4.3.4 REPLACE 677
1.1.1.4.3.5 REPLACE...RETURNING 677
1.1.1.4.3.6 TRUNCATE TABLE 679
1.1.1.4.3.7 UPDATE 679
1.1.1.5 Prepared Statements 679
1.1.1.5.1 PREPARE Statement 680
1.1.1.5.2 Out Parameters in PREPARE 683
1.1.1.5.3 EXECUTE STATEMENT 683
1.1.1.5.4 DEALLOCATE / DROP PREPARE 683
1.1.1.5.5 EXECUTE IMMEDIATE 683
1.1.1.6 Programmatic & Compound Statements 686
1.1.1.6.1 Using Compound Statements Outside of Stored Programs 687
1.1.1.6.2 BEGIN END 688
1.1.1.6.3 CASE Statement 689
1.1.1.6.4 DECLARE CONDITION 690
1.1.1.6.5 DECLARE HANDLER 690
1.1.1.6.6 DECLARE Variable 692
1.1.1.6.7 FOR 693
1.1.1.6.8 GOTO 695
1.1.1.6.9 IF 696
1.1.1.6.10 ITERATE 696
1.1.1.6.11 Labels 697
1.1.1.6.12 LEAVE 697
1.1.1.6.13 LOOP 698
1.1.1.6.14 REPEAT LOOP 699
1.1.1.6.15 RESIGNAL 700
1.1.1.6.16 RETURN 701
1.1.1.6.17 SELECT INTO 702
1.1.1.6.18 SET Variable 702
1.1.1.6.19 SIGNAL 703
1.1.1.6.20 WHILE 705
1.1.1.6.21 Cursors 705
1.1.1.6.21.1 Cursor Overview 705
1.1.1.6.21.2 DECLARE CURSOR 708
1.1.1.6.21.3 OPEN 709
1.1.1.6.21.4 FETCH 710
1.1.1.6.21.5 CLOSE 710
1.1.1.7 Stored Routine Statements 711
1.1.1.7.1 CALL 711
1.1.1.7.2 DO 711
1.1.1.8 Table Statements 712
1.1.1.9 Transactions 712
1.1.1.9.1 START TRANSACTION 712
1.1.1.9.2 COMMIT 714
1.1.1.9.3 ROLLBACK 715
1.1.1.9.4 SET TRANSACTION 715
1.1.1.9.5 LOCK TABLES 715
1.1.1.9.6 SAVEPOINT 717
1.1.1.9.7 Metadata Locking 717
1.1.1.9.8 SQL statements That Cause an Implicit Commit 718
1.1.1.9.9 Transaction Timeouts 720
1.1.1.9.10 UNLOCK TABLES 720
1.1.1.9.11 WAIT and NOWAIT 722
1.1.1.9.12 XA Transactions 722
1.1.1.10 HELP Command 725
1.1.1.11 Comment Syntax 725
1.1.1.12 Built-in Functions 726
1.1.2 SQL Language Structure 726

15/3812
1.1.2.1 Identifier Names 727
1.1.2.2 Identifier Case-sensitivity 730
1.1.2.3 Binary Literals 730
1.1.2.4 Boolean Literals 731
1.1.2.5 Date and Time Literals 731
1.1.2.6 Hexadecimal Literals 733
1.1.2.7 Identifier Qualifiers 735
1.1.2.8 Identifier to File Name Mapping 735
1.1.2.9 MariaDB Error Codes 736
1.1.2.10 Numeric Literals 780
1.1.2.11 Reserved Words 780
1.1.2.12 SQLSTATE 787
1.1.2.13 String Literals 787
1.1.2.14 Table Value Constructors 788
1.1.2.15 User-Defined Variables 789
1.1.3 Geographic & Geometric Features 791
1.1.3.1 GIS Resources 792
1.1.3.2 GIS features in 5.3.3 792
1.1.3.3 Geometry Types 793
1.1.3.4 Geometry Hierarchy 795
1.1.3.5 Geometry Constructors 795
1.1.3.6 Geometry Properties 795
1.1.3.7 Geometry Relations 795
1.1.3.8 LineString Properties 795
1.1.3.9 MBR (Minimum Bounding Rectangle) 795
1.1.3.10 Point Properties 795
1.1.3.11 Polygon Properties 795
1.1.3.12 WKB 795
1.1.3.13 WKT 795
1.1.3.14 MySQL/MariaDB Spatial Support Matrix 795
1.1.3.15 SPATIAL INDEX 799
1.1.3.16 GeoJSON 800
1.1.3.16.1 ST_AsGeoJSON 800
1.1.3.16.2 ST_GeomFromGeoJSON 801
1.1.4 NoSQL 801
1.1.4.1 CONNECT 802
1.1.4.2 HANDLER 802
1.1.4.2.1 HANDLER Commands 803
1.1.4.2.2 HANDLER for MEMORY Tables 804
1.1.4.3 HandlerSocket 805
1.1.4.3.1 HandlerSocket Installation 805
1.1.4.3.2 HandlerSocket Configuration Options 806
1.1.4.3.3 HandlerSocket Client Libraries 809
1.1.4.3.4 Testing HandlerSocket in a Source Distribution 809
1.1.4.3.5 HandlerSocket External Resources 810
1.1.4.4 Dynamic Columns 810
1.1.4.5 Dynamic Columns from MariaDB 10 815
1.1.4.6 Dynamic Column API 817
1.1.4.7 Dynamic Columns from MariaDB 10 822
1.1.4.8 JSON Functions 824
1.1.4.9 LOAD_FILE 824
1.1.5 Operators 824
1.1.5.1 Arithmetic Operators 827
1.1.5.1.1 Addition Operator (+) 827
1.1.5.1.2 DIV 827
1.1.5.1.3 Division Operator (/) 828
1.1.5.1.4 MOD 829
1.1.5.1.5 Modulo Operator (%) 829
1.1.5.1.6 Multiplication Operator (*) 829
1.1.5.1.7 Subtraction Operator (-) 830
1.1.5.2 Assignment Operators 831
1.1.5.2.1 Assignment Operator (:=) 831
1.1.5.2.2 Assignment Operator (=) 832
1.1.5.3 Bit Functions and Operators 832
1.1.5.4 Comparison Operators 832
1.1.5.4.1 Not Equal Operator: != 833
1.1.5.4.2 < 834
1.1.5.4.3 <= 835
1.1.5.4.4 <=> 835
1.1.5.4.5 = 836
1.1.5.4.6 > 837

16/3812
1.1.5.4.7 >= 838
1.1.5.4.8 BETWEEN AND 839
1.1.5.4.9 COALESCE 840
1.1.5.4.10 GREATEST 841
1.1.5.4.11 IN 842
1.1.5.4.12 INTERVAL 843
1.1.5.4.13 IS 844
1.1.5.4.14 IS NOT 844
1.1.5.4.15 IS NOT NULL 845
1.1.5.4.16 IS NULL 845
1.1.5.4.17 ISNULL 846
1.1.5.4.18 LEAST 846
1.1.5.4.19 NOT BETWEEN 847
1.1.5.4.20 NOT IN 847
1.1.5.5 Logical Operators 848
1.1.5.5.1 ! 849
1.1.5.5.2 && 849
1.1.5.5.3 XOR 850
1.1.5.5.4 || 851
1.1.5.6 Operator Precedence 852
1.1.6 Sequences 853
1.1.6.1 Sequence Overview 853
1.1.6.2 CREATE SEQUENCE 857
1.1.6.3 SHOW CREATE SEQUENCE 859
1.1.6.4 ALTER SEQUENCE 859
1.1.6.5 DROP SEQUENCE 861
1.1.6.6 SEQUENCE Functions 862
1.1.6.6.1 LASTVAL 862
1.1.6.6.2 NEXT VALUE for sequence_name 862
1.1.6.6.3 NEXTVAL 863
1.1.6.6.4 PREVIOUS VALUE FOR sequence_name 863
1.1.6.6.5 SETVAL 865
1.1.6.7 SHOW TABLES 867
1.1.7 Temporal Tables 867
1.1.7.1 System-Versioned Tables 867
1.1.7.2 Application-Time Periods 874
1.1.7.3 Bitemporal Tables 878
1.2 Built-in Functions 878
1.2.1 Function and Operator Reference 879
1.2.2 String Functions 889
1.2.2.1 Regular Expressions Functions 892
1.2.2.1.1 Regular Expressions Overview 893
1.2.2.1.2 Perl Compatible Regular Expressions (PCRE) Documentation 902
1.2.2.1.3 NOT REGEXP 914
1.2.2.1.4 REGEXP 914
1.2.2.1.5 REGEXP_INSTR 915
1.2.2.1.6 REGEXP_REPLACE 916
1.2.2.1.7 REGEXP_SUBSTR 917
1.2.2.1.8 RLIKE 918
1.2.2.2 Dynamic Columns Functions 918
1.2.2.2.1 COLUMN_ADD 918
1.2.2.2.2 COLUMN_CHECK 919
1.2.2.2.3 COLUMN_CREATE 919
1.2.2.2.4 COLUMN_DELETE 919
1.2.2.2.5 COLUMN_EXISTS 920
1.2.2.2.6 COLUMN_GET 920
1.2.2.2.7 COLUMN_JSON 920
1.2.2.2.8 COLUMN_LIST 921
1.2.2.3 ASCII 921
1.2.2.4 BIN 922
1.2.2.5 BINARY Operator 922
1.2.2.6 BIT_LENGTH 923
1.2.2.7 CAST 924
1.2.2.8 CHAR Function 925
1.2.2.9 CHAR_LENGTH 926
1.2.2.10 CHARACTER_LENGTH 927
1.2.2.11 CHR 927
1.2.2.12 CONCAT 928
1.2.2.13 CONCAT_WS 929
1.2.2.14 CONVERT 930
1.2.2.15 ELT 931

17/3812
1.2.2.16 EXPORT_SET 932
1.2.2.17 EXTRACTVALUE 932
1.2.2.18 FIELD 934
1.2.2.19 FIND_IN_SET 935
1.2.2.20 FORMAT 936
1.2.2.21 FROM_BASE64 936
1.2.2.22 HEX 937
1.2.2.23 INSTR 938
1.2.2.24 LCASE 938
1.2.2.25 LEFT 938
1.2.2.26 INSERT Function 939
1.2.2.27 LENGTH 939
1.2.2.28 LENGTHB 940
1.2.2.29 LIKE 941
1.2.2.30 LOAD_FILE 943
1.2.2.31 LOCATE 943
1.2.2.32 LOWER 944
1.2.2.33 LPAD 944
1.2.2.34 LTRIM 945
1.2.2.35 MAKE_SET 946
1.2.2.36 MATCH AGAINST 947
1.2.2.37 Full-Text Index Stopwords 947
1.2.2.38 MID 948
1.2.2.39 NATURAL_SORT_KEY 948
1.2.2.40 NOT LIKE 952
1.2.2.41 NOT REGEXP 952
1.2.2.42 OCTET_LENGTH 952
1.2.2.43 ORD 952
1.2.2.44 POSITION 953
1.2.2.45 QUOTE 953
1.2.2.46 REPEAT Function 954
1.2.2.47 REPLACE Function 954
1.2.2.48 REVERSE 954
1.2.2.49 RIGHT 955
1.2.2.50 RPAD 955
1.2.2.51 RTRIM 956
1.2.2.52 SFORMAT 957
1.2.2.53 SOUNDEX 958
1.2.2.54 SOUNDS LIKE 958
1.2.2.55 SPACE 959
1.2.2.56 STRCMP 959
1.2.2.57 SUBSTR 960
1.2.2.58 SUBSTRING 960
1.2.2.59 SUBSTRING_INDEX 962
1.2.2.60 TO_BASE64 962
1.2.2.61 TO_CHAR 963
1.2.2.62 TRIM 964
1.2.2.63 TRIM_ORACLE 965
1.2.2.64 UCASE 965
1.2.2.65 UNCOMPRESS 965
1.2.2.66 UNCOMPRESSED_LENGTH 966
1.2.2.67 UNHEX 966
1.2.2.68 UPDATEXML 967
1.2.2.69 UPPER 968
1.2.2.70 WEIGHT_STRING 968
1.2.2.71 Type Conversion 969
1.2.3 Date & Time Functions 972
1.2.3.1 Microseconds in MariaDB 975
1.2.3.2 Date and Time Units 976
1.2.3.3 ADD_MONTHS 977
1.2.3.4 ADDDATE 978
1.2.3.5 ADDTIME 979
1.2.3.6 CONVERT_TZ 980
1.2.3.7 CURDATE 981
1.2.3.8 CURRENT_DATE 981
1.2.3.9 CURRENT_TIME 981
1.2.3.10 CURRENT_TIMESTAMP 982
1.2.3.11 CURTIME 982
1.2.3.12 DATE FUNCTION 983
1.2.3.13 DATEDIFF 983
1.2.3.14 DATE_ADD 984

18/3812
1.2.3.15 DATE_FORMAT 985
1.2.3.16 DATE_SUB 987
1.2.3.17 DAY 988
1.2.3.18 DAYNAME 988
1.2.3.19 DAYOFMONTH 989
1.2.3.20 DAYOFWEEK 989
1.2.3.21 DAYOFYEAR 990
1.2.3.22 EXTRACT 990
1.2.3.23 FROM_DAYS 991
1.2.3.24 FROM_UNIXTIME 992
1.2.3.25 GET_FORMAT 994
1.2.3.26 HOUR 995
1.2.3.27 LAST_DAY 996
1.2.3.28 LOCALTIME 996
1.2.3.29 LOCALTIMESTAMP 996
1.2.3.30 MAKEDATE 997
1.2.3.31 MAKETIME 997
1.2.3.32 MICROSECOND 998
1.2.3.33 MINUTE 999
1.2.3.34 MONTH 999
1.2.3.35 MONTHNAME 1000
1.2.3.36 NOW 1000
1.2.3.37 PERIOD_ADD 1002
1.2.3.38 PERIOD_DIFF 1002
1.2.3.39 QUARTER 1003
1.2.3.40 SECOND 1003
1.2.3.41 SEC_TO_TIME 1004
1.2.3.42 STR_TO_DATE 1004
1.2.3.43 SUBDATE 1006
1.2.3.44 SUBTIME 1007
1.2.3.45 SYSDATE 1008
1.2.3.46 TIME Function 1009
1.2.3.47 TIMEDIFF 1009
1.2.3.48 TIMESTAMP FUNCTION 1010
1.2.3.49 TIMESTAMPADD 1010
1.2.3.50 TIMESTAMPDIFF 1011
1.2.3.51 TIME_FORMAT 1012
1.2.3.52 TIME_TO_SEC 1012
1.2.3.53 TO_DAYS 1013
1.2.3.54 TO_SECONDS 1013
1.2.3.55 UNIX_TIMESTAMP 1014
1.2.3.56 UTC_DATE 1015
1.2.3.57 UTC_TIME 1016
1.2.3.58 UTC_TIMESTAMP 1016
1.2.3.59 WEEK 1017
1.2.3.60 WEEKDAY 1018
1.2.3.61 WEEKOFYEAR 1019
1.2.3.62 YEAR 1020
1.2.3.63 YEARWEEK 1021
1.2.4 Aggregate Functions 1021
1.2.4.1 Stored Aggregate Functions 1022
1.2.4.2 AVG 1025
1.2.4.3 BIT_AND 1026
1.2.4.4 BIT_OR 1027
1.2.4.5 BIT_XOR 1028
1.2.4.6 COUNT 1029
1.2.4.7 COUNT DISTINCT 1030
1.2.4.8 GROUP_CONCAT 1031
1.2.4.9 JSON_ARRAYAGG 1032
1.2.4.10 JSON_OBJECTAGG 1033
1.2.4.11 MAX 1034
1.2.4.12 MIN 1035
1.2.4.13 STD 1037
1.2.4.14 STDDEV 1038
1.2.4.15 STDDEV_POP 1039
1.2.4.16 STDDEV_SAMP 1040
1.2.4.17 SUM 1040
1.2.4.18 VARIANCE 1042
1.2.4.19 VAR_POP 1043
1.2.4.20 VAR_SAMP 1045
1.2.5 Numeric Functions 1046

19/3812
1.2.5.1 Addition Operator (+) 1048
1.2.5.2 Subtraction Operator (-) 1048
1.2.5.3 Division Operator (/) 1048
1.2.5.4 Multiplication Operator (*) 1048
1.2.5.5 Modulo Operator (%) 1048
1.2.5.6 DIV 1048
1.2.5.7 ABS 1048
1.2.5.8 ACOS 1049
1.2.5.9 ASIN 1050
1.2.5.10 ATAN 1050
1.2.5.11 ATAN2 1051
1.2.5.12 CEIL 1051
1.2.5.13 CEILING 1052
1.2.5.14 CONV 1052
1.2.5.15 COS 1053
1.2.5.16 COT 1053
1.2.5.17 CRC32 1054
1.2.5.18 CRC32C 1055
1.2.5.19 DEGREES 1055
1.2.5.20 EXP 1056
1.2.5.21 FLOOR 1056
1.2.5.22 GREATEST 1057
1.2.5.23 LEAST 1057
1.2.5.24 LN 1057
1.2.5.25 LOG 1057
1.2.5.26 LOG10 1058
1.2.5.27 LOG2 1059
1.2.5.28 MOD 1059
1.2.5.29 OCT 1060
1.2.5.30 PI 1061
1.2.5.31 POW 1061
1.2.5.32 POWER 1062
1.2.5.33 RADIANS 1062
1.2.5.34 RAND 1063
1.2.5.35 ROUND 1064
1.2.5.36 SIGN 1065
1.2.5.37 SIN 1066
1.2.5.38 SQRT 1066
1.2.5.39 TAN 1067
1.2.5.40 TRUNCATE 1068
1.2.6 Control Flow Functions 1069
1.2.6.1 CASE OPERATOR 1070
1.2.6.2 DECODE 1070
1.2.6.3 DECODE_ORACLE 1071
1.2.6.4 IF Function 1071
1.2.6.5 IFNULL 1072
1.2.6.6 NULLIF 1073
1.2.6.7 NVL 1074
1.2.6.8 NVL2 1074
1.2.7 Pseudo Columns 1074
1.2.7.1 _rowid 1075
1.2.8 Secondary Functions 1075
1.2.8.1 Bit Functions and Operators 1075
1.2.8.1.1 Operator Precedence 1076
1.2.8.1.2 & 1076
1.2.8.1.3 << 1076
1.2.8.1.4 >> 1077
1.2.8.1.5 BIT_COUNT 1077
1.2.8.1.6 ^ 1077
1.2.8.1.7 | 1078
1.2.8.1.8 ~ 1078
1.2.8.1.9 Parentheses 1079
1.2.8.1.10 TRUE FALSE 1080
1.2.8.2 Encryption, Hashing and Compression Functions 1080
1.2.8.2.1 AES_DECRYPT 1081
1.2.8.2.2 AES_ENCRYPT 1081
1.2.8.2.3 COMPRESS 1081
1.2.8.2.4 DECODE 1082
1.2.8.2.5 DES_DECRYPT 1082
1.2.8.2.6 DES_ENCRYPT 1083
1.2.8.2.7 ENCODE 1083

20/3812
1.2.8.2.8 ENCRYPT 1084
1.2.8.2.9 MD5 1084
1.2.8.2.10 OLD_PASSWORD 1085
1.2.8.2.11 PASSWORD 1085
1.2.8.2.12 RANDOM_BYTES 1086
1.2.8.2.13 SHA1 1087
1.2.8.2.14 SHA2 1087
1.2.8.2.15 UNCOMPRESS 1088
1.2.8.2.16 UNCOMPRESSED_LENGTH 1088
1.2.8.3 Information Functions 1088
1.2.8.3.1 BENCHMARK 1089
1.2.8.3.2 BINLOG_GTID_POS 1089
1.2.8.3.3 CHARSET 1089
1.2.8.3.4 COERCIBILITY 1090
1.2.8.3.5 COLLATION 1091
1.2.8.3.6 CONNECTION_ID 1091
1.2.8.3.7 CURRENT_ROLE 1092
1.2.8.3.8 CURRENT_USER 1092
1.2.8.3.9 DATABASE 1093
1.2.8.3.10 DECODE_HISTOGRAM 1094
1.2.8.3.11 DEFAULT 1095
1.2.8.3.12 FOUND_ROWS 1098
1.2.8.3.13 LAST_INSERT_ID 1099
1.2.8.3.14 LAST_VALUE 1101
1.2.8.3.15 PROCEDURE ANALYSE 1103
1.2.8.3.16 ROWNUM 1103
1.2.8.3.17 ROW_COUNT 1105
1.2.8.3.18 SCHEMA 1106
1.2.8.3.19 SESSION_USER 1106
1.2.8.3.20 SYSTEM_USER 1106
1.2.8.3.21 USER 1107
1.2.8.3.22 VERSION 1107
1.2.8.4 Miscellaneous Functions 1108
1.2.8.4.1 GET_LOCK 1109
1.2.8.4.2 INET6_ATON 1112
1.2.8.4.3 INET6_NTOA 1113
1.2.8.4.4 INET_ATON 1113
1.2.8.4.5 INET_NTOA 1114
1.2.8.4.6 IS_FREE_LOCK 1114
1.2.8.4.7 IS_IPV4 1115
1.2.8.4.8 IS_IPV4_COMPAT 1115
1.2.8.4.9 IS_IPV4_MAPPED 1116
1.2.8.4.10 IS_IPV6 1116
1.2.8.4.11 IS_USED_LOCK 1117
1.2.8.4.12 MASTER_GTID_WAIT 1117
1.2.8.4.13 MASTER_POS_WAIT 1118
1.2.8.4.14 NAME_CONST 1119
1.2.8.4.15 RELEASE_ALL_LOCKS 1119
1.2.8.4.16 RELEASE_LOCK 1120
1.2.8.4.17 SLEEP 1121
1.2.8.4.18 SYS_GUID 1122
1.2.8.4.19 UUID 1122
1.2.8.4.20 UUID_SHORT 1123
1.2.8.4.21 VALUES / VALUE 1124
1.2.9 Special Functions 1125
1.2.9.1 Dynamic Columns Functions 1125
1.2.9.2 Galera Functions 1125
1.2.9.2.1 WSREP_LAST_SEEN_GTID 1125
1.2.9.2.2 WSREP_LAST_WRITTEN_GTID 1126
1.2.9.2.3 WSREP_SYNC_WAIT_UPTO_GTID 1126
1.2.9.3 Geographic Functions 1126
1.2.9.3.1 Geometry Constructors 1127
1.2.9.3.1.1 BUFFER 1127
1.2.9.3.1.2 CONVEXHULL 1128
1.2.9.3.1.3 GEOMETRYCOLLECTION 1128
1.2.9.3.1.4 LINESTRING 1128
1.2.9.3.1.5 MULTILINESTRING 1128
1.2.9.3.1.6 MULTIPOINT 1129
1.2.9.3.1.7 MULTIPOLYGON 1129
1.2.9.3.1.8 POINT 1129
1.2.9.3.1.9 PointOnSurface 1130

21/3812
1.2.9.3.1.10 POLYGON 1130
1.2.9.3.1.11 ST_BUFFER 1130
1.2.9.3.1.12 ST_CONVEXHULL 1131
1.2.9.3.1.13 ST_INTERSECTION 1132
1.2.9.3.1.14 ST_POINTONSURFACE 1132
1.2.9.3.1.15 ST_SYMDIFFERENCE 1132
1.2.9.3.1.16 ST_UNION 1133
1.2.9.3.2 Geometry Properties 1134
1.2.9.3.2.1 BOUNDARY 1135
1.2.9.3.2.2 DIMENSION 1135
1.2.9.3.2.3 ENVELOPE 1135
1.2.9.3.2.4 GeometryN 1135
1.2.9.3.2.5 GeometryType 1135
1.2.9.3.2.6 IsClosed 1135
1.2.9.3.2.7 IsEmpty 1135
1.2.9.3.2.8 IsRing 1135
1.2.9.3.2.9 IsSimple 1135
1.2.9.3.2.10 NumGeometries 1135
1.2.9.3.2.11 SRID 1135
1.2.9.3.2.12 ST_BOUNDARY 1135
1.2.9.3.2.13 ST_DIMENSION 1136
1.2.9.3.2.14 ST_ENVELOPE 1136
1.2.9.3.2.15 ST_GEOMETRYN 1137
1.2.9.3.2.16 ST_GEOMETRYTYPE 1137
1.2.9.3.2.17 ST_ISCLOSED 1138
1.2.9.3.2.18 ST_ISEMPTY 1138
1.2.9.3.2.19 ST_IsRing 1138
1.2.9.3.2.20 ST_IsSimple 1139
1.2.9.3.2.21 ST_NUMGEOMETRIES 1139
1.2.9.3.2.22 ST_RELATE 1139
1.2.9.3.2.23 ST_SRID 1140
1.2.9.3.3 Geometry Relations 1140
1.2.9.3.3.1 CONTAINS 1141
1.2.9.3.3.2 CROSSES 1141
1.2.9.3.3.3 DISJOINT 1142
1.2.9.3.3.4 EQUALS 1142
1.2.9.3.3.5 INTERSECTS 1142
1.2.9.3.3.6 OVERLAPS 1142
1.2.9.3.3.7 ST_CONTAINS 1143
1.2.9.3.3.8 ST_CROSSES 1143
1.2.9.3.3.9 ST_DIFFERENCE 1144
1.2.9.3.3.10 ST_DISJOINT 1144
1.2.9.3.3.11 ST_DISTANCE 1145
1.2.9.3.3.12 ST_DISTANCE_SPHERE 1145
1.2.9.3.3.13 ST_EQUALS 1146
1.2.9.3.3.14 ST_INTERSECTS 1146
1.2.9.3.3.15 ST_LENGTH 1147
1.2.9.3.3.16 ST_OVERLAPS 1147
1.2.9.3.3.17 ST_TOUCHES 1147
1.2.9.3.3.18 ST_WITHIN 1148
1.2.9.3.3.19 TOUCHES 1148
1.2.9.3.3.20 WITHIN 1149
1.2.9.3.4 LineString Properties 1149
1.2.9.3.4.1 ENDPOINT 1150
1.2.9.3.4.2 GLENGTH 1150
1.2.9.3.4.3 NumPoints 1150
1.2.9.3.4.4 PointN 1150
1.2.9.3.4.5 STARTPOINT 1150
1.2.9.3.4.6 ST_ENDPOINT 1150
1.2.9.3.4.7 ST_NUMPOINTS 1151
1.2.9.3.4.8 ST_POINTN 1151
1.2.9.3.4.9 ST_STARTPOINT 1151
1.2.9.3.5 MBR (Minimum Bounding Rectangle) 1152
1.2.9.3.5.1 MBR Definition 1152
1.2.9.3.5.2 MBRContains 1153
1.2.9.3.5.3 MBRDisjoint 1153
1.2.9.3.5.4 MBREqual 1153
1.2.9.3.5.5 MBRIntersects 1154
1.2.9.3.5.6 MBROverlaps 1154
1.2.9.3.5.7 MBRTouches 1155
1.2.9.3.5.8 MBRWithin 1156

22/3812
1.2.9.3.6 Point Properties 1156
1.2.9.3.6.1 ST_X 1157
1.2.9.3.6.2 ST_Y 1157
1.2.9.3.6.3 X 1157
1.2.9.3.6.4 Y 1157
1.2.9.3.7 Polygon Properties 1157
1.2.9.3.7.1 AREA 1158
1.2.9.3.7.2 CENTROID 1158
1.2.9.3.7.3 ExteriorRing 1158
1.2.9.3.7.4 InteriorRingN 1158
1.2.9.3.7.5 NumInteriorRings 1158
1.2.9.3.7.6 ST_AREA 1158
1.2.9.3.7.7 ST_CENTROID 1159
1.2.9.3.7.8 ST_ExteriorRing 1159
1.2.9.3.7.9 ST_InteriorRingN 1160
1.2.9.3.7.10 ST_NumInteriorRings 1160
1.2.9.3.8 WKB 1161
1.2.9.3.8.1 Well-Known Binary (WKB) Format 1162
1.2.9.3.8.2 AsBinary 1162
1.2.9.3.8.3 AsWKB 1162
1.2.9.3.8.4 MLineFromWKB 1162
1.2.9.3.8.5 MPointFromWKB 1163
1.2.9.3.8.6 MPolyFromWKB 1163
1.2.9.3.8.7 GeomCollFromWKB 1164
1.2.9.3.8.8 GeometryCollectionFromWKB 1164
1.2.9.3.8.9 GeometryFromWKB 1164
1.2.9.3.8.10 GeomFromWKB 1164
1.2.9.3.8.11 LineFromWKB 1164
1.2.9.3.8.12 LineStringFromWKB 1164
1.2.9.3.8.13 MultiLineStringFromWKB 1164
1.2.9.3.8.14 MultiPointFromWKB 1164
1.2.9.3.8.15 MultiPolygonFromWKB 1164
1.2.9.3.8.16 PointFromWKB 1164
1.2.9.3.8.17 PolyFromWKB 1164
1.2.9.3.8.18 PolygonFromWKB 1164
1.2.9.3.8.19 ST_AsBinary 1164
1.2.9.3.8.20 ST_AsWKB 1165
1.2.9.3.8.21 ST_GeomCollFromWKB 1165
1.2.9.3.8.22 ST_GeometryCollectionFromWKB 1165
1.2.9.3.8.23 ST_GeometryFromWKB 1165
1.2.9.3.8.24 ST_GeomFromWKB 1165
1.2.9.3.8.25 ST_LineFromWKB 1166
1.2.9.3.8.26 ST_LineStringFromWKB 1166
1.2.9.3.8.27 ST_PointFromWKB 1166
1.2.9.3.8.28 ST_PolyFromWKB 1167
1.2.9.3.8.29 ST_PolygonFromWKB 1167
1.2.9.3.9 WKT 1167
1.2.9.3.9.1 WKT Definition 1169
1.2.9.3.9.2 AsText 1169
1.2.9.3.9.3 AsWKT 1169
1.2.9.3.9.4 GeomCollFromText 1169
1.2.9.3.9.5 GeometryCollectionFromText 1169
1.2.9.3.9.6 GeometryFromText 1169
1.2.9.3.9.7 GeomFromText 1169
1.2.9.3.9.8 LineFromText 1169
1.2.9.3.9.9 LineStringFromText 1170
1.2.9.3.9.10 MLineFromText 1170
1.2.9.3.9.11 MPointFromText 1170
1.2.9.3.9.12 MPolyFromText 1170
1.2.9.3.9.13 MultiLineStringFromText 1171
1.2.9.3.9.14 MultiPointFromText 1171
1.2.9.3.9.15 MultiPolygonFromText 1171
1.2.9.3.9.16 PointFromText 1171
1.2.9.3.9.17 PolyFromText 1171
1.2.9.3.9.18 PolygonFromText 1171
1.2.9.3.9.19 ST_AsText 1171
1.2.9.3.9.20 ST_ASWKT 1172
1.2.9.3.9.21 ST_GeomCollFromText 1172
1.2.9.3.9.22 ST_GeometryCollectionFromText 1172
1.2.9.3.9.23 ST_GeometryFromText 1172
1.2.9.3.9.24 ST_GeomFromText 1172

23/3812
1.2.9.3.9.25 ST_LineFromText 1173
1.2.9.3.9.26 ST_LineStringFromText 1173
1.2.9.3.9.27 ST_PointFromText 1173
1.2.9.3.9.28 ST_PolyFromText 1173
1.2.9.3.9.29 ST_PolygonFromText 1174
1.2.9.4 JSON Functions 1174
1.2.9.4.1 Differences between JSON_QUERY and JSON_VALUE 1176
1.2.9.4.2 JSONPath Expressions 1176
1.2.9.4.3 JSON_ARRAY 1179
1.2.9.4.4 JSON_ARRAYAGG 1179
1.2.9.4.5 JSON_ARRAY_APPEND 1179
1.2.9.4.6 JSON_ARRAY_INSERT 1180
1.2.9.4.7 JSON_COMPACT 1181
1.2.9.4.8 JSON_CONTAINS 1181
1.2.9.4.9 JSON_CONTAINS_PATH 1182
1.2.9.4.10 JSON_DEPTH 1183
1.2.9.4.11 JSON_DETAILED 1183
1.2.9.4.12 JSON_EQUALS 1184
1.2.9.4.13 JSON_EXISTS 1185
1.2.9.4.14 JSON_EXTRACT 1185
1.2.9.4.15 JSON_INSERT 1186
1.2.9.4.16 JSON_KEYS 1186
1.2.9.4.17 JSON_LENGTH 1187
1.2.9.4.18 JSON_LOOSE 1187
1.2.9.4.19 JSON_MERGE 1188
1.2.9.4.20 JSON_MERGE_PATCH 1188
1.2.9.4.21 JSON_MERGE_PRESERVE 1189
1.2.9.4.22 JSON_NORMALIZE 1189
1.2.9.4.23 JSON_OBJECT 1190
1.2.9.4.24 JSON_OBJECTAGG 1190
1.2.9.4.25 JSON_OVERLAPS 1190
1.2.9.4.26 JSON_QUERY 1191
1.2.9.4.27 JSON_QUOTE 1192
1.2.9.4.28 JSON_REMOVE 1192
1.2.9.4.29 JSON_REPLACE 1193
1.2.9.4.30 JSON_SEARCH 1193
1.2.9.4.31 JSON_SET 1194
1.2.9.4.32 JSON_TABLE 1194
1.2.9.4.33 JSON_TYPE 1198
1.2.9.4.34 JSON_UNQUOTE 1199
1.2.9.4.35 JSON_VALID 1200
1.2.9.4.36 JSON_VALUE 1201
1.2.9.5 SEQUENCE Functions 1201
1.2.9.6 Spider Functions 1201
1.2.9.6.1 SPIDER_BG_DIRECT_SQL 1201
1.2.9.6.2 SPIDER_COPY_TABLES 1202
1.2.9.6.3 SPIDER_DIRECT_SQL 1202
1.2.9.6.4 SPIDER_FLUSH_TABLE_MON_CACHE 1203
1.2.9.7 Window Functions 1203
1.2.9.7.1 Window Functions Overview 1205
1.2.9.7.2 AVG 1210
1.2.9.7.3 BIT_AND 1210
1.2.9.7.4 BIT_OR 1210
1.2.9.7.5 BIT_XOR 1210
1.2.9.7.6 COUNT 1210
1.2.9.7.7 CUME_DIST 1210
1.2.9.7.8 DENSE_RANK 1212
1.2.9.7.9 FIRST_VALUE 1212
1.2.9.7.10 JSON_ARRAYAGG 1214
1.2.9.7.11 JSON_OBJECTAGG 1214
1.2.9.7.12 LAG 1214
1.2.9.7.13 LAST_VALUE 1215
1.2.9.7.14 LEAD 1215
1.2.9.7.15 MAX 1216
1.2.9.7.16 MEDIAN 1216
1.2.9.7.17 MIN 1217
1.2.9.7.18 NTH_VALUE 1217
1.2.9.7.19 NTILE 1217
1.2.9.7.20 PERCENT_RANK 1218
1.2.9.7.21 PERCENTILE_CONT 1222
1.2.9.7.22 PERCENTILE_DISC 1224

24/3812
1.2.9.7.23 RANK 1225
1.2.9.7.24 ROW_NUMBER 1226
1.2.9.7.25 STD 1227
1.2.9.7.26 STDDEV 1227
1.2.9.7.27 STDDEV_POP 1227
1.2.9.7.28 STDDEV_SAMP 1227
1.2.9.7.29 SUM 1227
1.2.9.7.30 VARIANCE 1227
1.2.9.7.31 VAR_POP 1227
1.2.9.7.32 VAR_SAMP 1227
1.2.9.7.33 Aggregate Functions as Window Functions 1227
1.2.9.7.34 ColumnStore Window Functions 1228
1.2.9.7.35 Window Frames 1234
1.3 Clients & Utilities 1236
1.3.1 mysql Client 1239
1.3.2 mysql Command-line Client 1239
1.3.3 Delimiters 1248
1.3.4 mariadb Command-Line Client 1249
1.3.5 Aria Clients and Utilities 1249
1.3.5.1 aria_chk 1249
1.3.5.2 aria_pack 1252
1.3.5.3 aria_read_log 1254
1.3.5.4 aria_s3_copy 1255
1.3.6 Backup, Restore and Import Clients 1255
1.3.6.1 Mariabackup 1255
1.3.6.2 mariadb-dump 1255
1.3.6.3 mariadb-dump/mysqldump 1255
1.3.6.4 mariadb-hotcopy 1266
1.3.6.5 mariadb-import 1266
1.3.6.6 mysqlhotcopy 1266
1.3.6.7 mysqlimport 1268
1.3.7 Graphical and Enhanced Clients 1272
1.3.8 MyISAM Clients and Utilities 1273
1.3.8.1 myisamchk 1274
1.3.8.2 Memory and Disk Use With myisamchk 1277
1.3.8.3 myisamchk Table Information 1278
1.3.8.4 myisamlog 1282
1.3.8.5 myisampack 1283
1.3.8.6 myisam_ftdump 1284
1.3.9 dbdeployer 1285
1.3.10 EXPLAIN Analyzer 1285
1.3.11 EXPLAIN Analyzer API 1285
1.3.12 innochecksum 1286
1.3.13 msql2mysql 1288
1.3.14 my_print_defaults 1288
1.3.15 mysqladmin 1289
1.3.16 mysqlaccess 1296
1.3.17 mysqlbinlog 1297
1.3.17.1 Using mysqlbinlog 1298
1.3.17.2 mysqlbinlog Options 1298
1.3.17.3 Annotate_rows_log_event 1303
1.3.17.4 mariadb-binlog 1308
1.3.18 mysqlcheck 1308
1.3.19 mysql_convert_table_format 1308
1.3.20 mysqldumpslow 1309
1.3.21 mysql_embedded 1310
1.3.22 mysql_find_rows 1311
1.3.23 mysql_fix_extensions 1311
1.3.24 mysql_install_db 1312
1.3.25 mysql_plugin 1319
1.3.26 mysqlreport 1320
1.3.27 mysql_secure_installation 1322
1.3.28 mysql_setpermission 1324
1.3.29 mysqlshow 1325
1.3.30 mysqlslap 1328
1.3.31 mysql-stress-test 1332
1.3.32 mysql-test 1334
1.3.32.1 mysql-test Overview 1334
1.3.32.2 mysql-test Auxiliary Files 1337
1.3.32.3 mysql-test-run.pl Options 1342
1.3.32.4 Pausing mysql-test-run.pl 1347

25/3812
1.3.32.5 mysqltest and mysqltest-embedded 1348
1.3.32.6 New Features for mysqltest in MariaDB 1350
1.3.32.7 Debugging MariaDB With a Debugger 1351
1.3.32.8 The Debug Sync Facility 1353
1.3.32.9 Code Coverage with dgcov 1357
1.3.32.10 Installing MinIO for Usage With mysql-test-run 1358
1.3.33 mysql_tzinfo_to_sql 1359
1.3.34 mysql_upgrade 1360
1.3.35 mysql_waitpid 1364
1.3.36 perror 1365
1.3.37 replace Utility 1366
1.3.38 resolveip 1366
1.3.39 resolve_stack_dump 1367
1.3.40 xtstat 1367
1.3.41 mariadb-access 1370
1.3.42 mariadb-admin 1370
1.3.43 mariadb-check 1371
1.3.44 mariadb-conv 1371
1.3.45 mariadb-convert-table-format 1372
1.3.46 mariadb-dumpslow 1372
1.3.47 mariadb-embedded 1373
1.3.48 mariadb-find-rows 1373
1.3.49 mariadb-fix-extensions 1373
1.3.50 mariadb-install-db 1373
1.3.51 mariadb-plugin 1374
1.3.52 mariadb-report 1374
1.3.53 mariadb-secure-installation 1374
1.3.54 mariadb-setpermission 1374
1.3.55 mariadb-show 1374
1.3.56 mariadb-slap 1375
1.3.57 mariadb-tzinfo-to-sql 1375
1.3.58 mariadb-upgrade 1375
1.3.59 mariadb-waitpid 1375
Chapter 2 MariaDB Administration 1375
2.1 Getting, Installing, and Upgrading MariaDB 1376
2.1.1 Where to Download MariaDB 1377
2.1.2 MariaDB Binary Packages 1377
2.1.2.1 Installing MariaDB RPM Files 1378
2.1.2.1.1 About the MariaDB RPM Files 1379
2.1.2.1.2 Installing MariaDB with yum/dnf 1382
2.1.2.1.3 Installing MariaDB with zypper 1387
2.1.2.1.4 Installing MariaDB With the rpm Tool 1392
2.1.2.1.5 Checking MariaDB RPM Package Signatures 1393
2.1.2.1.6 Troubleshooting MariaDB Installs on Red Hat/CentOS 1394
2.1.2.1.7 MariaDB for DirectAdmin Using RPMs 1394
2.1.2.1.8 MariaDB Installation (Version 10.1.21) via RPMs on CentOS 7 1395
2.1.2.1.9 Why Source RPMs (SRPMs) Aren't Packaged For Some Platforms 1396
2.1.2.1.10 Building MariaDB from a Source RPM 1396
2.1.2.2 Installing MariaDB .deb Files 1397
2.1.2.3 Installing MariaDB MSI Packages on Windows 1407
2.1.2.4 Installing MariaDB Server PKG packages on macOS 1414
2.1.2.5 Installing MariaDB Binary Tarballs 1414
2.1.2.6 Installing MariaDB Server on macOS Using Homebrew 1416
2.1.2.7 Installing MariaDB Windows ZIP Packages 1417
2.1.2.8 Compiling MariaDB From Source 1417
2.1.2.8.1 Get, Build and Test Latest MariaDB the Lazy Way 1419
2.1.2.8.2 MariaDB Source Code 1420
2.1.2.8.3 Build Environment Setup for Linux 1420
2.1.2.8.4 Generic Build Instructions 1421
2.1.2.8.5 Compiling MariaDB with Extra Modules/Options 1424
2.1.2.8.5.1 Compiling MariaDB with TCMalloc 1424
2.1.2.8.5.2 Specifying Which Plugins to Build 1424
2.1.2.8.6 Creating the MariaDB Source Tarball 1425
2.1.2.8.7 Creating the MariaDB Binary Tarball 1425
2.1.2.8.8 Build Environment Setup for Mac 1426
2.1.2.8.9 Building MariaDB From a Source RPM 1426
2.1.2.8.10 Building MariaDB on CentOS 1426
2.1.2.8.11 Building MariaDB on Fedora 1427
2.1.2.8.12 Building MariaDB on Debian 1428
2.1.2.8.13 Building MariaDB on FreeBSD 1429
2.1.2.8.14 Building MariaDB on Gentoo 1431

26/3812
2.1.2.8.15 Building MariaDB on Solaris and OpenSolaris 1431
2.1.2.8.16 Building MariaDB on Ubuntu 1431
2.1.2.8.17 Building MariaDB on Windows 1432
2.1.2.8.19 Creating a Debian Repository 1435
2.1.2.8.20 Building MariaDB From Source Using musl-based GNU/Linux 1436
2.1.2.8.21 Compiling MariaDB for Debugging 1436
2.1.2.8.22 Cross-compiling MariaDB 1439
2.1.2.8.23 MariaDB Source Configuration Options 1440
2.1.2.8.24 Building RPM Packages From Source 1440
2.1.2.8.25 Compile and Using MariaDB with Sanitizers (ASAN, UBSAN, TSAN, MSAN) 1440
2.1.2.9 Distributions Which Include MariaDB 1442
2.1.2.10 Running Multiple MariaDB Server Processes 1443
2.1.2.11 Installing MariaDB Alongside MySQL 1445
2.1.2.12 GPG 1447
2.1.2.13 MariaDB Deprecation Policy 1447
2.1.2.14 Automated MariaDB Deployment and Administration 1451
2.1.2.14.1 Why to Automate MariaDB Deployments and Management 1451
2.1.2.14.2 A Comparison Between Automation Systems 1452
2.1.2.14.3 Ansible and MariaDB 1455
2.1.2.14.3.1 Ansible Overview for MariaDB Users 1455
2.1.2.14.3.2 Deploying to Remote Servers with Ansible 1457
2.1.2.14.3.3 Deploying Docker Containers with Ansible 1459
2.1.2.14.3.4 Existing Ansible Modules and Roles for MariaDB 1459
2.1.2.14.3.5 Installing MariaDB .deb Files with Ansible 1461
2.1.2.14.3.6 Running mariadb-tzinfo-to-sql with Ansible 1463
2.1.2.14.3.7 Managing Secrets in Ansible 1464
2.1.2.14.4 Puppet and MariaDB 1465
2.1.2.14.4.1 Puppet Overview for MariaDB Users 1465
2.1.2.14.4.2 Bolt Examples 1468
2.1.2.14.4.3 Puppet hiera Configuration System 1470
2.1.2.14.4.4 Deploying Docker Containers with Puppet 1471
2.1.2.14.4.5 Existing Puppet Modules for MariaDB 1472
2.1.2.14.5 Vagrant and MariaDB 1473
2.1.2.14.5.1 Vagrant Overview for MariaDB Users 1473
2.1.2.14.5.2 Creating a Vagrantfile 1476
2.1.2.14.5.3 Vagrant Security Concerns 1480
2.1.2.14.5.4 Running MariaDB ColumnStore Docker containers on Linux, Windows and MacOS 1481
2.1.2.14.6 Docker and MariaDB 1481
2.1.2.14.6.1 Benefits of Managing Docker Containers with Orchestration Software 1482
2.1.2.14.6.2 Installing and Using MariaDB via Docker 1484
2.1.2.14.6.3 Running MariaDB ColumnStore Docker containers on Linux, Windows and MacOS 1489
2.1.2.14.6.4 Creating a Custom Docker Image 1489
2.1.2.14.6.5 Setting Up a LAMP Stack with Docker Compose 1492
2.1.2.14.6.6 Docker Security Concerns 1494
2.1.2.14.6.7 MariaDB Container Cheat Sheet 1495
2.1.2.14.6.8 MariaDB Docker Environment Variables 1497
2.1.2.14.7 Kubernetes and MariaDB 1498
2.1.2.14.8 Kubernetes Overview for MariaDB Users 1498
2.1.2.14.9 Kubernetes Operators for MariaDB 1501
2.1.2.14.10 Automating Upgrades with MariaDB.Org Downloads REST API 1501
2.1.2.14.11 HashiCorp Vault and MariaDB 1503
2.1.2.14.12 Orchestrator Overview 1504
2.1.2.14.13 Rotating Logs on Unix and Linux 1505
2.1.2.14.14 Automating MariaDB Tasks with Events 1505
2.1.2.15 MariaDB Package Repository Setup and Usage 1506
2.1.3 Upgrading MariaDB 1511
2.1.3.1 Upgrading Between Major MariaDB Versions 1512
2.1.3.2 Upgrading Between Minor Versions on Linux 1514
2.1.3.3 Upgrading from MariaDB 10.6 to MariaDB 10.7 1515
2.1.3.4 Upgrading from MariaDB 10.5 to MariaDB 10.6 1516
2.1.3.5 Upgrading from MariaDB 10.4 to MariaDB 10.5 1519
2.1.3.6 Upgrading from MariaDB 10.3 to MariaDB 10.4 1521
2.1.3.7 Upgrading from MariaDB 10.2 to MariaDB 10.3 1523
2.1.3.8 Upgrading from MariaDB 10.1 to MariaDB 10.2 1525
2.1.3.9 Upgrading MariaDB on Windows 1529
2.1.3.10 Upgrading Galera Cluster 1530
2.1.3.10.1 Upgrading Between Minor Versions with Galera Cluster 1531
2.1.3.10.2 Upgrading from MariaDB 10.3 to MariaDB 10.4 with Galera Cluster 1531
2.1.3.10.3 Upgrading from MariaDB 10.2 to MariaDB 10.3 with Galera Cluster 1532
2.1.3.10.4 Upgrading from MariaDB 10.1 to MariaDB 10.2 with Galera Cluster 1534
2.1.3.11 Upgrading from MySQL to MariaDB 1536

27/3812
2.1.3.11.1 Upgrading from MySQL to MariaDB 1536
2.1.3.11.2 Moving from MySQL to MariaDB in Debian 9 1537
2.1.3.11.3 Screencast for Upgrading MySQL to MariaDB 1542
2.1.4 Downgrading between Major Versions of MariaDB 1542
2.1.5 Compiling MariaDB From Source 1542
2.1.6 Starting and Stopping MariaDB 1542
2.1.6.1 Starting and Stopping MariaDB Server 1543
2.1.6.2 Configuring MariaDB with Option Files 1544
2.1.6.3 mysqld Configuration Files and Groups 1552
2.1.6.4 mysqld Options 1552
2.1.6.5 What to Do if MariaDB Doesn't Start 1596
2.1.6.6 Running MariaDB from the Build Directory 1599
2.1.6.7 mysql.server 1601
2.1.6.8 mysqld_safe 1603
2.1.6.9 mysqladmin 1608
2.1.6.10 Switching Between Different Installed MariaDB Versions 1608
2.1.6.11 Specifying Permissions for Schema (Data) Directories and Tables 1610
2.1.6.12 mysqld_multi 1610
2.1.6.13 launchd 1614
2.1.6.14 systemd 1615
2.1.6.15 sysVinit 1626
2.1.6.16 Mariadb-admin 1628
2.1.6.17 mariadbd 1628
2.1.6.18 mariadbd-multi 1628
2.1.6.19 mariadbd-safe 1628
2.1.7 MariaDB Performance & Advanced Configurations 1628
2.1.7.1 Fusion-io 1629
2.1.7.1.1 Fusion-io Introduction 1629
2.1.7.1.2 Atomic Write Support 1631
2.1.7.1.3 InnoDB Page Flushing 1632
2.1.7.3 Configuring Linux for MariaDB 1632
2.1.7.4 Configuring MariaDB for Optimal Performance 1634
2.1.7.5 Configuring Swappiness 1635
2.1.8 Troubleshooting Installation Issues 1636
2.1.8.1 Troubleshooting Connection Issues 1637
2.1.8.2 Installation issues on Windows 1637
2.1.8.3 Troubleshooting MariaDB Installs on Red Hat/CentOS 1637
2.1.8.4 Installation issues on Debian and Ubuntu 1638
2.1.8.4.1 Differences in MariaDB in Debian (and Ubuntu) 1638
2.1.8.4.2 Upgrading from MySQL to MariaDB 1639
2.1.8.4.3 Creating a Debian Repository 1639
2.1.8.4.4 apt-upgrade Fails, But the Database is Running 1639
2.1.8.5 What to Do if MariaDB Doesn't Start 1640
2.1.8.6 Installing on an Old Linux Version 1640
2.1.8.7 Error: symbol mysql_get_server_name, version libmysqlclient_16 not defined 1641
2.1.9 Installing System Tables (mysql_install_db) 1641
2.1.10 mysql_install_db.exe 1641
2.1.11 Configuring MariaDB with Option Files 1642
2.1.12 MariaDB Environment Variables 1642
2.1.13 MariaDB on Amazon AWS 1643
2.1.14 Migrating to MariaDB 1644
2.1.14.1 Migrating to MariaDB from MySQL 1644
2.1.14.1.1 MySQL vs MariaDB: Performance 1645
2.1.14.1.2 MariaDB versus MySQL: Compatibility 1648
2.1.14.1.3 Upgrading from MySQL to MariaDB 1653
2.1.14.1.4 Incompatibilities and Feature Differences Between MariaDB 10.8 and MySQL 8.0 1653
2.1.14.1.5 Incompatibilities and Feature Differences Between MariaDB 10.7 and MySQL 8.0 1657
2.1.14.1.6 Incompatibilities and Feature Differences Between MariaDB 10.6 and MySQL 8.0 1660
2.1.14.1.7 Incompatibilities and Feature Differences Between MariaDB 10.5 and MySQL 8.0 1663
2.1.14.1.8 Incompatibilities and Feature Differences Between MariaDB 10.4 and MySQL 8.0 1666
2.1.14.1.9 Incompatibilities and Feature Differences Between MariaDB 10.3 and MySQL 5.7 1669
2.1.14.1.10 Function Differences Between MariaDB and MySQL 1671
2.1.14.1.10.1 Function Differences Between MariaDB 10.8 and MySQL 8.0 1672
2.1.14.1.10.2 Function Differences Between MariaDB 10.7 and MySQL 8.0 1675
2.1.14.1.10.3 Function Differences Between MariaDB 10.6 and MySQL 8.0 1678
2.1.14.1.10.4 Function Differences Between MariaDB 10.5 and MySQL 8.0 1682
2.1.14.1.10.5 Function Differences Between MariaDB 10.4 and MySQL 8.0 1684
2.1.14.1.10.6 Function Differences Between MariaDB 10.3 and MySQL 8.0 1687
2.1.14.1.10.7 Function Differences Between MariaDB 10.3 and MySQL 5.7 1690
2.1.14.1.11 System Variable Differences between MariaDB and MySQL 1692
2.1.14.1.11.1 System Variable Differences Between MariaDB 10.9 and MySQL 8.0 1693

28/3812
2.1.14.1.11.2 System Variable Differences Between MariaDB 10.8 and MySQL 8.0 1703
2.1.14.1.11.3 System Variable Differences Between MariaDB 10.7 and MySQL 8.0 1714
2.1.14.1.11.4 System Variable Differences Between MariaDB 10.6 and MySQL 8.0 1725
2.1.14.1.11.5 System Variable Differences Between MariaDB 10.5 and MySQL 8.0 1735
2.1.14.1.11.6 System Variable Differences Between MariaDB 10.4 and MySQL 8.0 1746
2.1.14.1.11.7 System Variable Differences Between MariaDB 10.3 and MySQL 8.0 1756
2.1.14.1.11.8 System Variable Differences Between MariaDB 10.3 and MySQL 5.7 1766
2.1.14.1.12 Upgrading from MySQL 5.7 to MariaDB 10.2 1773
2.1.14.1.13 Installing MariaDB Alongside MySQL 1773
2.1.14.1.14 Moving from MySQL to MariaDB in Debian 9 1774
2.1.14.2 Migrating to MariaDB from SQL Server 1774
2.1.14.2.1 Understanding MariaDB Architecture 1774
2.1.14.2.2 SQL Server Features Not Available in MariaDB 1781
2.1.14.2.3 SQL Server Features Implemented Differently in MariaDB 1782
2.1.14.2.4 MariaDB Features Not Available in SQL Server 1784
2.1.14.2.5 Setting Up MariaDB for Testing for SQL Server Users 1785
2.1.14.2.6 Syntax Differences between MariaDB and SQL Server 1786
2.1.14.2.7 SQL Server and MariaDB Types Comparison 1791
2.1.14.2.8 MariaDB Transactions and Isolation Levels for SQL Server Users 1795
2.1.14.2.9 MariaDB Authorization and Permissions for SQL Server Users 1801
2.1.14.2.10 Repairing MariaDB Tables for SQL Server Users 1804
2.1.14.2.11 MariaDB Backups Overview for SQL Server Users 1805
2.1.14.2.12 MariaDB Replication Overview for SQL Server Users 1808
2.1.14.2.13 Moving Data Between SQL Server and MariaDB 1814
2.1.14.2.14 SQL_MODE=MSSQL 1816
2.1.14.3 Migrating to MariaDB from PostgreSQL 1817
2.1.14.4.2 SQL_MODE=ORACLE 1819
2.1.14.5 Installing MariaDB on IBM Cloud 1823
2.1.14.6 mysqld Configuration Files and Groups 1833
2.2 User & Server Security 1833
2.2.1 Securing MariaDB 1833
2.2.1.1 Encryption 1833
2.2.1.1.1 Data-in-Transit Encryption 1834
2.2.1.1.1.1 Secure Connections Overview 1834
2.2.1.1.1.2 Certificate Creation with OpenSSL 1839
2.2.1.1.1.3 Securing Connections for Client and Server 1841
2.2.1.1.1.4 Replication with Secure Connections 1844
2.2.1.1.1.5 Securing Communications in Galera Cluster 1847
2.2.1.1.1.6 SSL/TLS System Variables 1848
2.2.1.1.1.7 SSL/TLS Status Variables 1851
2.2.1.1.1.8 Using TLSv1.3 1855
2.2.1.1.2 Data-at-Rest Encryption 1855
2.2.1.1.2.1 Data-at-Rest Encryption Overview 1856
2.2.1.1.2.2 Why Encrypt MariaDB Data? 1857
2.2.1.1.2.3 Key Management and Encryption Plugins 1858
2.2.1.1.2.4 Encrypting Binary Logs 1858
2.2.1.1.2.5 Aria Encryption 1860
2.2.1.1.2.5.1 Aria Encryption Overview 1860
2.2.1.1.2.5.2 Aria Enabling Encryption 1860
2.2.1.1.2.5.3 Aria Disabling Encryption 1861
2.2.1.1.2.5.4 Aria Encryption Keys 1862
2.2.1.1.2.6 InnoDB Encryption 1862
2.2.1.1.2.6.1 InnoDB Encryption Overview 1863
2.2.1.1.2.6.2 Enabling InnoDB Encryption 1863
2.2.1.1.2.6.3 Disabling InnoDB Encryption 1867
2.2.1.1.2.6.4 InnoDB Background Encryption Threads 1869
2.2.1.1.2.6.5 InnoDB Encryption Keys 1870
2.2.1.1.2.6.6 InnoDB Encryption Troubleshooting 1872
2.2.1.1.3 TLS and Cryptography Libraries Used by MariaDB 1875
2.2.1.2 Running mysqld as root 1879
2.2.1.3 mysql_secure_installation 1879
2.2.1.4 Security-Enhanced Linux with MariaDB 1879
2.2.2 User Account Management 1883
2.2.2.1 Account Management SQL Commands 1883
2.2.2.2 Data-in-Transit Encryption 1883
2.2.2.3 Roles 1883
2.2.2.3.1 Roles Overview 1884
2.2.2.3.2 CREATE ROLE 1887
2.2.2.3.3 DROP ROLE 1887
2.2.2.3.4 CURRENT_ROLE 1887
2.2.2.3.5 SET ROLE 1887

29/3812
2.2.2.3.6 SET DEFAULT ROLE 1887
2.2.2.3.7 GRANT 1887
2.2.2.3.8 REVOKE 1887
2.2.2.3.9 mysqlroles_mapping Table 1887
2.2.2.3.10 Information Schema APPLICABLE_ROLES Table 1888
2.2.2.3.11 Information Schema ENABLED_ROLES Table 1888
2.2.2.4 Account Locking 1888
2.2.2.5 Authentication from MariaDB 10.4 1889
2.2.2.6 User Password Expiry 1891
2.3 Backing Up and Restoring Databases 1893
2.3.1 Backup and Restore Overview 1893
2.3.2 Replication as a Backup Solution 1895
2.3.3 mariadb-dump/mysqldump 1895
2.3.4 Mariabackup 1895
2.3.4.1 Mariabackup Overview 1896
2.3.4.2 Mariabackup Options 1905
2.3.4.3 Full Backup and Restore with Mariabackup 1930
2.3.4.4 Incremental Backup and Restore with Mariabackup 1932
2.3.4.5 Partial Backup and Restore with Mariabackup 1934
2.3.4.6 Restoring Individual Tables and Partitions with Mariabackup 1936
2.3.4.7 Setting up a Replica with Mariabackup 1936
2.3.4.8 Files Backed Up By Mariabackup 1939
2.3.4.9 Files Created by Mariabackup 1939
2.3.4.10 Using Encryption and Compression Tools With Mariabackup 1944
2.3.4.11 How Mariabackup Works 1945
2.3.4.12 Mariabackup and BACKUP STAGE Commands 1947
2.3.4.13 mariabackup SST Method 1950
2.3.4.14 Manual SST of Galera Cluster Node with Mariabackup 1954
2.3.5 mysqlhotcopy 1954
2.4 Server Monitoring & Logs 1954
2.4.1 Overview of MariaDB Logs 1955
2.4.2 Error Log 1956
2.4.3 Setting the Language for Error Messages 1961
2.4.4 General Query Log 1963
2.4.5 Slow Query Log 1965
2.4.5.1 Slow Query Log Overview 1966
2.4.5.2 Slow Query Log Extended Statistics 1971
2.4.5.3 mysqldumpslow 1971
2.4.5.4 EXPLAIN in the Slow Query Log 1971
2.4.5.5 mysqlslow_log Table 1971
2.4.6 Rotating Logs on Unix and Linux 1971
2.4.7 Binary Log 1976
2.4.8 InnoDB Redo Log 1976
2.4.9 InnoDB Undo Log 1976
2.4.10 MyISAM Log 1976
2.4.11 Transaction Coordinator Log 1976
2.4.11.1 Transaction Coordinator Log Overview 1976
2.4.11.2 Heuristic Recovery with the Transaction Coordinator Log 1978
2.4.12 SQL Error Log Plugin 1980
2.4.13 Writing Logs Into Tables 1980
2.4.14 Performance Schema 1980
2.4.15 MariaDB Audit Plugin 1980
2.5 Partitioning Tables 1980
2.5.1 Partitioning Overview 1980
2.5.2 Partitioning Types 1981
2.5.2.1 Partitioning Types Overview 1982
2.5.2.2 LIST Partitioning Type 1982
2.5.2.3 RANGE Partitioning Type 1983
2.5.2.4 HASH Partitioning Type 1985
2.5.2.5 RANGE COLUMNS and LIST COLUMNS Partitioning Types 1985
2.5.3 Partition Pruning and Selection 1986
2.5.4 Partition Maintenance 1987
2.5.5 Partitioning Limitations with MariaDB 1990
2.5.6 Partitions Files 1990
2.5.7 Partitions Metadata 1991
2.6 MariaDB Audit Plugin 1991
2.7 Variables and Modes 1991
2.7.1 Full List of MariaDB Options, System and Status Variables 1992
2.7.2 Server System Variables 2039
2.7.3 OLD_MODE 2108
2.7.4 SQL_MODE 2109

30/3812
2.7.5 SQL_MODE-MSSQL 2115
2.8 Copying Tables Between Different MariaDB Databases and MariaDB Servers 2115
Chapter 3 High Availability & Performance Tuning 2117
3.1 MariaDB Replication 2117
3.1.1 Replication Overview 2119
3.1.2 Replication Commands 2122
3.1.3 Setting Up Replication 2122
3.1.4 Setting up a Replica with Mariabackup 2125
3.1.5 Read-Only Replicas 2125
3.1.6 Replication as a Backup Solution 2126
3.1.7 Multi-Source Replication 2126
3.1.8 Replication Threads 2130
3.1.9 Global Transaction ID 2132
3.1.10 Parallel Replication 2144
3.1.11 Replication and Binary Log System Variables 2148
3.1.12 Replication and Binary Log Status Variables 2166
3.1.13 Binary Log 2172
3.1.13.1 Overview of the Binary Log 2173
3.1.13.2 Activating the Binary Log 2173
3.1.13.3 Using and Maintaining the Binary Log 2174
3.1.13.4 Binary Log Formats 2176
3.1.13.5 Binary Logging of Stored Routines 2179
3.1.13.6 SHOW BINARY LOGS 2180
3.1.13.7 PURGE BINARY LOGS 2180
3.1.13.8 SHOW BINLOG EVENTS 2180
3.1.13.9 SHOW MASTER STATUS 2180
3.1.13.10 Binlog Event Checksums 2180
3.1.13.11 Binlog Event Checksum Interoperability 2180
3.1.13.12 Group Commit for the Binary Log 2181
3.1.13.13 mysqlbinlog 2183
3.1.13.14 Transaction Coordinator Log 2183
3.1.13.15 Compressing Events to Reduce Size of the Binary Log 2183
3.1.13.16 Encrypting Binary Logs 2184
3.1.13.17 Flashback 2184
3.1.13.18 Relay Log 2185
3.1.13.19 Replication and Binary Log System Variables 2186
3.1.14 Unsafe Statements for Statement-based Replication 2186
3.1.15 Replication and Foreign Keys 2187
3.1.16 Relay Log 2188
3.1.18 Group Commit for the Binary Log 2189
3.1.19 Selectively Skipping Replication of Binlog Events 2189
3.1.20 Binlog Event Checksums 2190
3.1.21 Annotate_rows_log_event 2191
3.1.22 Row-based Replication With No Primary Key 2191
3.1.23 Replication Filters 2191
3.1.24 Running Triggers on the Replica for Row-based Events 2199
3.1.25 Semisynchronous Replication 2200
3.1.26 Using MariaDB Replication with MariaDB Galera Cluster 2207
3.1.26.1 Using MariaDB Replication with MariaDB Galera Cluster 2207
3.1.26.2 Using MariaDB GTIDs with MariaDB Galera Cluster 2208
3.1.26.3 Configuring MariaDB Replication between MariaDB Galera Cluster and MariaDB Server 2210
3.1.26.4 Configuring MariaDB Replication between Two MariaDB Galera Clusters 2213
3.1.27 Delayed Replication 2217
3.1.28 Replication When the Primary and Replica Have Different Table Definitions 2218
3.1.29 Restricting Speed of Reading Binlog from Primary by a Replica 2221
3.1.30 Changing a Replica to Become the Primary 2221
3.1.31 Replication with Secure Connections 2223
3.2 MariaDB Galera Cluster 2223
3.2.1 What is MariaDB Galera Cluster? 2225
3.2.2 About Galera Replication 2227
3.2.3 Galera Use Cases 2229
3.2.4 MariaDB Galera Cluster - Known Limitations 2229
3.2.5 Tips on Converting to Galera 2231
3.2.6 Getting Started with MariaDB Galera Cluster 2235
3.2.7 Configuring MariaDB Galera Cluster 2240
3.2.8 State Snapshot Transfers (SSTs) in Galera Cluster 2242
3.2.8.1 Introduction to State Snapshot Transfers (SSTs) 2242
3.2.8.2 mariabackup SST Method 2246
3.2.8.3 Manual SST of Galera Cluster Node With Mariabackup 2246
3.2.8.4 xtrabackup-v2 SST Method 2248
3.2.8.5 Manual SST of Galera Cluster Node With Percona XtraBackup 2252

31/3812
3.2.9 Galera Cluster Status Variables 2254
3.2.10 Galera Cluster System Variables 2261
3.2.11 Building the Galera wsrep Package on Ubuntu and Debian 2272
3.2.12 Building the Galera wsrep Package on Fedora 2273
3.2.13 Installing Galera from Source 2275
3.2.14 Galera Test Repositories 2277
3.2.15 wsrep_provider_options 2278
3.2.16 Galera Cluster Address 2288
3.2.17 Galera Load Balancer 2289
3.2.18 Upgrading Galera Cluster 2289
3.2.19 Using MariaDB Replication with MariaDB Galera Cluster 2289
3.2.20 Securing Communications in Galera Cluster 2289
3.2.21 Installing MariaDB Galera on IBM Cloud 2289
3.3 Optimization and Tuning 2299
3.3.1 Hardware Optimization 2300
3.3.2 Operating System Optimizations 2301
3.3.2.1 Configuring Linux for MariaDB 2301
3.3.2.2 Configuring Swappiness 2301
3.3.2.3 Filesystem Optimizations 2301
3.3.3 Optimization and Indexes 2301
3.3.3.1 The Essentials of an Index 2302
3.3.3.2 Getting Started with Indexes 2302
3.3.3.3 Full-Text Indexes 2305
3.3.3.3.1 Full-Text Index Overview 2306
3.3.3.3.2 Full-Text Index Stopwords 2309
3.3.3.3.3 MATCH AGAINST 2313
3.3.3.3.4 myisam_ftdump 2313
3.3.3.4 ANALYZE TABLE 2313
3.3.3.5 Building the best INDEX for a given SELECT 2313
3.3.3.6 Compound (Composite) Indexes 2321
3.3.3.7 EXPLAIN 2324
3.3.3.8 Foreign Keys 2324
3.3.3.9 Ignored Indexes 2328
3.3.3.10 Index Statistics 2330
3.3.3.11 Latitude/Longitude Indexing 2332
3.3.3.12 Primary Keys with Nullable Columns 2339
3.3.3.13 SHOW EXPLAIN 2340
3.3.3.14 Spatial Index 2340
3.3.3.15 Storage Engine Index Types 2340
3.3.4 Query Optimizations 2341
3.3.4.1 Index Hints: How to Force Query Plans 2342
3.3.4.2 Subquery Optimizations 2346
3.3.4.2.1 Subquery Optimizations Map 2347
3.3.4.2.2 Semi-join Subquery Optimizations 2348
3.3.4.2.3 Table Pullout Optimization 2349
3.3.4.2.4 Non-semi-join Subquery Optimizations 2351
3.3.4.2.5 Subquery Cache 2355
3.3.4.2.6 Condition Pushdown Into IN subqueries 2358
3.3.4.2.7 Conversion of Big IN Predicates Into Subqueries 2358
3.3.4.2.8 EXISTS-to-IN Optimization 2359
3.3.4.2.9 Optimizing GROUP BY and DISTINCT Clauses in Subqueries 2360
3.3.4.3 Optimization Strategies 2360
3.3.4.3.1 DuplicateWeedout Strategy 2361
3.3.4.3.2 FirstMatch Strategy 2363
3.3.4.3.3 LooseScan Strategy 2365
3.3.4.3.4 Semi-join Materialization Strategy 2366
3.3.4.3.5 Improvements to ORDER BY Optimization 2369
3.3.4.4 Optimizations for Derived Tables 2370
3.3.4.4.1 Condition Pushdown into Derived Table Optimization 2370
3.3.4.4.2 Derived Table Merge Optimization 2371
3.3.4.4.3 Derived Table with Key Optimization 2373
3.3.4.4.4 Lateral Derived Optimization 2374
3.3.4.5 Table Elimination 2375
3.3.4.5.1 What is Table Elimination? 2376
3.3.4.5.2 Table Elimination in MariaDB 2377
3.3.4.5.3 Table Elimination User Interface 2377
3.3.4.5.4 Table Elimination in Other Databases 2378
3.3.4.5.5 Table Elimination External Resources 2379
3.3.4.6 Statistics for Optimizing Queries 2379
3.3.4.6.1 Engine-Independent Table Statistics 2380
3.3.4.6.2 Histogram-Based Statistics 2382

32/3812
3.3.4.6.3 Index Statistics 2383
3.3.4.6.4 InnoDB Persistent Statistics 2383
3.3.4.6.5 Slow Query Log Extended Statistics 2383
3.3.4.6.6 User Statistics 2384
3.3.4.7 MIN/MAX optimization 2387
3.3.4.8 Filesort with Small LIMIT Optimization 2388
3.3.4.9 LIMIT ROWS EXAMINED 2389
3.3.4.10 Block-Based Join Algorithms 2390
3.3.4.11 index_merge sort_intersection 2393
3.3.4.13 optimizer_switch 2394
3.3.4.14 Extended Keys 2397
3.3.4.15 How to Quickly Insert Data Into MariaDB 2399
3.3.4.16 Index Condition Pushdown 2401
3.3.4.17 Query Limits and Timeouts 2404
3.3.4.18 Aborting Statements that Exceed a Certain Time to Execute 2405
3.3.4.19 Partition Pruning and Selection 2406
3.3.4.20 Big DELETEs 2406
3.3.4.21 Data Sampling: Techniques for Efficiently Finding a Random Row 2410
3.3.4.22 Data Warehousing High Speed Ingestion 2413
3.3.4.23 Data Warehousing Summary Tables 2417
3.3.4.24 Data Warehousing Techniques 2422
3.3.4.25 Equality propagation optimization 2426
3.3.4.26 FORCE INDEX 2428
3.3.4.27 Groupwise Max in MariaDB 2429
3.3.4.28 GUID/UUID Performance 2434
3.3.4.29 IGNORE INDEX 2436
3.3.4.30 not_null_range_scan Optimization 2437
3.3.4.31 Optimizing for "Latest News"-style Queries 2438
3.3.4.32 Pagination Optimization 2440
3.3.4.33 Pivoting in MariaDB 2443
3.3.4.34 Rollup Unique User Counts 2448
3.3.4.35 Rowid Filtering Optimization 2449
3.3.4.36 USE INDEX 2451
3.3.5 Optimizing Tables 2451
3.3.5.1 OPTIMIZE TABLE 2452
3.3.5.2 ANALYZE TABLE 2452
3.3.5.3 Choosing the Right Storage Engine 2452
3.3.5.4 Converting Tables from MyISAM to InnoDB 2452
3.3.5.5 Histogram-Based Statistics 2452
3.3.5.6 Defragmenting InnoDB Tablespaces 2452
3.3.5.7 Entity-Attribute-Value Implementation 2455
3.3.5.8 IP Range Table Performance 2457
3.3.6 MariaDB Memory Allocation 2459
3.3.7 System Variables 2466
3.3.7.1 System and Status Variables Added By Major Release 2468
3.3.7.1.1 System Variables Added in MariaDB 10.11 2469
3.3.7.1.2 System Variables Added in MariaDB 10.9 2469
3.3.7.1.3 System Variables Added in MariaDB 10.6 2469
3.3.7.1.4 Status Variables Added in MariaDB 10.6 2470
3.3.7.1.5 System Variables Added in MariaDB 10.5 2470
3.3.7.1.6 Status Variables Added in MariaDB 10.5 2471
3.3.7.1.7 System Variables Added in MariaDB 10.4 2472
3.3.7.1.8 Status Variables Added in MariaDB 10.4 2473
3.3.7.1.9 System Variables Added in MariaDB 10.3 2473
3.3.7.1.10 Status Variables Added in MariaDB 10.3 2474
3.3.7.1.11 System Variables Added in MariaDB 10.2 2475
3.3.7.1.12 Status Variables Added in MariaDB 10.2 2476
3.3.7.2 Full List of MariaDB Options, System and Status Variables 2476
3.3.7.3 Server Status Variables 2476
3.3.7.4 Server System Variables 2526
3.3.7.5 Aria Status Variables 2526
3.3.7.6 Aria System Variables 2526
3.3.7.7 CONNECT System Variables 2526
3.3.7.8 Galera Cluster Status Variables 2526
3.3.7.9 Galera Cluster System Variables 2526
3.3.7.10 InnoDB Server Status Variables 2526
3.3.7.11 InnoDB System Variables 2526
3.3.7.12 MariaDB Audit Plugin � Status Variables 2526
3.3.7.13 Mroonga Status Variables 2526
3.3.7.14 Mroonga System Variables 2526
3.3.7.15 MyISAM System Variables 2526

33/3812
3.3.7.16 MyRocks System Variables 2526
3.3.7.17 MyRocks Status Variables 2526
3.3.7.18 OQGRAPH System and Status Variables 2526
3.3.7.19 Performance Schema Status Variables 2526
3.3.7.20 Performance Schema System Variables 2526
3.3.7.21 Replication and Binary Log Status Variables 2527
3.3.7.22 Replication and Binary Log System Variables 2527
3.3.7.23 Semisynchronous Replication Plugin Status Variables 2527
3.3.7.24 Semisynchronous Replication 2528
3.3.7.25 Sphinx Status Variables 2529
3.3.7.26 Spider Status Variables 2529
3.3.7.27 Spider Server System Variables 2529
3.3.7.28 SQL_ERROR_LOG Plugin System Variables 2529
3.3.7.29 SSL/TLS Status Variables 2530
3.3.7.30 SSL/TLS System Variables 2531
3.3.7.31 Thread Pool System and Status Variables 2531
3.3.7.34 MariaDB Optimization for MySQL Users 2534
3.3.7.35 InnoDB Buffer Pool 2535
3.3.7.36 InnoDB Change Buffering 2535
3.3.7.37 Optimizing table_open_cache 2535
3.3.7.38 Optimizing key_buffer_size 2536
3.3.7.39 Segmented Key Cache 2536
3.3.7.40 Big Query Settings 2536
3.3.7.41 Sample my.cnf Files 2537
3.3.7.42 Handling Too Many Connections 2537
3.3.7.43 System Variable Differences between MariaDB and MySQL 2537
3.3.7.44 MariaDB Memory Allocation 2537
3.3.7.45 Setting Innodb Buffer Pool Size Dynamically 2537
3.3.8 Buffers, Caches and Threads 2538
3.3.8.1 Thread Pool 2538
3.3.8.2 Thread Pool in MariaDB 2539
3.3.8.3 Thread Groups in the Unix Implementation of the Thread Pool 2543
3.3.8.4 Thread Pool System and Status Variables 2548
3.3.8.5 Thread Pool in MariaDB 5.1 - 5.3 2548
3.3.9 Thread States 2549
3.3.9.1 Delayed Insert Connection Thread States 2549
3.3.9.2 Delayed Insert Handler Thread States 2550
3.3.9.3 Event Scheduler Thread States 2550
3.3.9.4 General Thread States 2550
3.3.9.5 Master Thread States 2553
3.3.9.6 Query Cache Thread States 2553
3.3.9.7 Slave Connection Thread States 2553
3.3.9.8 Slave I/O Thread States 2554
3.3.9.9 Slave SQL Thread States 2554
3.3.9.10 InnoDB Buffer Pool 2555
3.3.9.11 InnoDB Change Buffering 2555
3.3.9.12 Query Cache 2555
3.3.9.13 Segmented Key Cache 2561
3.3.9.14 Subquery Cache 2561
3.3.9.15 Thread Command Values 2562
3.3.10 Optimizing Data Structure 2562
3.3.10.1 Numeric vs String Fields 2563
3.3.10.2 Optimizing MEMORY Tables 2563
3.3.10.3 Optimizing String and Character Fields 2563
3.3.11 MariaDB Internal Optimizations 2563
3.3.11.1 Binary Log Group Commit and InnoDB Flushing Performance 2563
3.3.11.2 Fair Choice Between Range and Index_merge Optimizations 2563
3.3.11.3 Improvements to ORDER BY Optimization 2565
3.3.11.4 Multi Range Read Optimization 2565
3.3.12 Compression 2571
3.3.12.1 Encryption, Hashing and Compression Functions 2571
3.3.12.2 Storage-Engine Independent Column Compression 2571
3.3.12.3 InnoDB Page Compression 2573
3.3.12.4 Compression Plugins 2573
3.3.12.5 Compressing Events to Reduce Size of the Binary Log 2573
3.3.12.6 InnoDB COMPRESSED Row Format 2573
3.3.12.7 ColumnStore Compression Mode 2573
Chapter 4 Programming & Customizing MariaDB 2574
4.1 Programmatic & Compound Statements 2574
4.2 Stored Routines 2574
4.2.1 Stored Procedures 2574

34/3812
4.2.1.1 Stored Procedure Overview 2575
4.2.1.2 Stored Routine Privileges 2577
4.2.1.3 CREATE PROCEDURE 2578
4.2.1.4 ALTER PROCEDURE 2578
4.2.1.5 DROP PROCEDURE 2578
4.2.1.6 SHOW CREATE PROCEDURE 2578
4.2.1.7 SHOW PROCEDURE CODE 2578
4.2.1.8 SHOW PROCEDURE STATUS 2578
4.2.1.9 Binary Logging of Stored Routines 2578
4.2.1.10 Information Schema ROUTINES Table 2578
4.2.1.11 SQL_MODE=ORACLE 2578
4.2.1.12 Stored Procedure Internals 2578
4.2.2.1 Stored Function Overview 2592
4.2.2.2 Stored Routine Privileges 2594
4.2.2.3 CREATE FUNCTION 2594
4.2.2.4 ALTER FUNCTION 2594
4.2.2.5 DROP FUNCTION 2594
4.2.2.6 SHOW CREATE FUNCTION 2594
4.2.2.7 SHOW FUNCTION STATUS 2594
4.2.2.8 SHOW FUNCTION CODE 2594
4.2.2.9 Stored Aggregate Functions 2594
4.2.2.10 Binary Logging of Stored Routines 2594
4.2.2.11 Stored Function Limitations 2594
4.2.2.12 Information Schema ROUTINES Table 2595
4.2.3 Stored Routine Statements 2595
4.2.4 Binary Logging of Stored Routines 2595
4.2.5 Stored Routine Limitations 2595
4.2.6 Stored Routine Privileges 2595
4.3 Triggers & Events 2595
4.3.1 Triggers 2595
4.3.1.1 Trigger Overview 2596
4.3.1.2 Binary Logging of Stored Routines 2600
4.3.1.3 CREATE TRIGGER 2600
4.3.1.4 DROP TRIGGER 2600
4.3.1.5 Information Schema TRIGGERS Table 2600
4.3.1.6 Running Triggers on the Replica for Row-based Events 2600
4.3.1.7 SHOW CREATE TRIGGER 2600
4.3.1.8 SHOW TRIGGERS 2600
4.3.1.9 Trigger Limitations 2600
4.3.1.10 Triggers and Implicit Locks 2600
4.3.2 Event Scheduler 2601
4.3.2.1 Events Overview 2601
4.3.2.2 Event Limitations 2603
4.3.2.3 CREATE EVENT 2604
4.3.2.4 ALTER EVENT 2604
4.3.2.5 DROP EVENT 2604
4.3.2.6 Information Schema EVENTS Table 2604
4.3.2.7 SHOW EVENTS 2604
4.3.2.8 SHOW CREATE EVENT 2604
4.3.2.9 Automating MariaDB Tasks with Events 2604
4.3.2.10 mysql.event Table 2604
4.4 Views 2604
4.4.1 Creating & Using Views 2605
4.4.2 CREATE VIEW 2605
4.4.3 ALTER VIEW 2605
4.4.4 DROP VIEW 2605
4.4.5 SHOW CREATE VIEW 2605
4.4.6 Inserting and Updating with Views 2605
4.4.7 RENAME TABLE 2606
4.4.8 View Algorithms 2606
4.4.9 Information Schema VIEWS Table 2608
4.4.10 SHOW TABLES 2608
4.5 User-Defined Functions 2608
4.5.1 Creating User-Defined Functions 2608
4.5.2 User-Defined Functions Calling Sequences 2610
4.5.3 User-Defined Functions Security 2612
4.5.4 CREATE FUNCTION UDF 2612
4.5.5 DROP FUNCTION UDF 2612
4.5.6 mysql.func Table 2612
Chapter 5 Columns, Storage Engines, and Plugins 2612
5.1 Data Types 2612

35/3812
5.1.1 Numeric Data Types 2615
5.1.1.1 Numeric Data Type Overview 2616
5.1.1.2 TINYINT 2618
5.1.1.3 BOOLEAN 2620
5.1.1.4 SMALLINT 2621
5.1.1.5 MEDIUMINT 2622
5.1.1.6 INT 2624
5.1.1.7 INTEGER 2625
5.1.1.8 BIGINT 2625
5.1.1.9 DECIMAL 2626
5.1.1.10 DEC, NUMERIC, FIXED 2628
5.1.1.11 NUMBER 2628
5.1.1.12 FLOAT 2628
5.1.1.13 DOUBLE 2629
5.1.1.14 DOUBLE PRECISION 2630
5.1.1.15 BIT 2630
5.1.1.16 Floating-point Accuracy 2631
5.1.1.17 INT1 2631
5.1.1.18 INT2 2631
5.1.1.19 INT3 2632
5.1.1.20 INT4 2632
5.1.1.21 INT8 2632
5.1.2 String Data Types 2632
5.1.2.1 String Literals 2633
5.1.2.2 BINARY 2634
5.1.2.3 BLOB 2635
5.1.2.4 BLOB and TEXT Data Types 2636
5.1.2.5 CHAR 2636
5.1.2.6 CHAR BYTE 2637
5.1.2.7 ENUM 2637
5.1.2.8 INET4 2639
5.1.2.9 INET6 2639
5.1.2.10 JSON Data Type 2646
5.1.2.11 MEDIUMBLOB 2647
5.1.2.12 MEDIUMTEXT 2648
5.1.2.13 LONGBLOB 2648
5.1.2.14 LONG and LONG VARCHAR 2648
5.1.2.15 LONGTEXT 2649
5.1.2.16 ROW 2649
5.1.2.17 TEXT 2654
5.1.2.18 TINYBLOB 2655
5.1.2.19 TINYTEXT 2656
5.1.2.20 VARBINARY 2656
5.1.2.21 VARCHAR 2657
5.1.2.22 SET Data Type 2659
5.1.2.23 UUID Data Type 2659
5.1.2.24 Data Type Storage Requirements 2661
5.1.2.25 Supported Character Sets and Collations 2664
5.1.2.26 Character Sets and Collations 2670
5.1.3 Date and Time Data Types 2670
5.1.3.1 DATE 2670
5.1.3.2 TIME 2671
5.1.3.3 DATETIME 2673
5.1.3.4 TIMESTAMP 2675
5.1.3.5 YEAR Data Type 2680
5.1.4 Geometry Types 2681
5.1.5 AUTO_INCREMENT 2681
5.1.6 Data Type Storage Requirements 2685
5.1.7 AUTO_INCREMENT FAQ 2685
5.1.8 NULL Values 2688
5.2 Character Sets and Collations 2692
5.2.1 Character Set and Collation Overview 2693
5.2.2 Supported Character Sets and Collations 2694
5.2.3 Setting Character Sets and Collations 2694
5.2.4 Unicode 2701
5.2.5 SHOW CHARACTER SET 2701
5.2.6 SHOW COLLATION 2701
5.2.7 Information Schema CHARACTER_SETS Table 2702
5.2.8 Information Schema COLLATIONS Table 2702
5.2.9 Internationalization and Localization 2702
5.2.9.3 Setting the Language for Error Messages 2703

36/3812
5.2.9.5 Locales plugin 2703
5.2.9.6 mysql_tzinfo_to_sql 2703
5.2.10 SET CHARACTER SET 2703
5.2.11 SET NAMES 2703
5.3 Storage Engines 2703
5.3.1 Choosing the Right Storage Engine 2704
5.3.2 InnoDB 2706
5.3.2.1 InnoDB Versions 2708
5.3.2.2 InnoDB Limitations 2710
5.3.2.3 InnoDB Troubleshooting 2712
5.3.2.3.1 InnoDB Troubleshooting Overview 2712
5.3.2.3.2 InnoDB Data Dictionary Troubleshooting 2712
5.3.2.3.3 InnoDB Recovery Modes 2713
5.3.2.3.4 Troubleshooting Row Size Too Large Errors with InnoDB 2715
5.3.2.4 InnoDB System Variables 2731
5.3.2.5 InnoDB Server Status Variables 2785
5.3.2.6 AUTO_INCREMENT Handling in InnoDB 2809
5.3.2.7 InnoDB Buffer Pool 2811
5.3.2.8 InnoDB Change Buffering 2812
5.3.2.9 InnoDB Doublewrite Buffer 2813
5.3.2.10 InnoDB Tablespaces 2813
5.3.2.10.1 InnoDB System Tablespaces 2813
5.3.2.10.2 InnoDB File-Per-Table Tablespaces 2815
5.3.2.10.3 InnoDB Temporary Tablespaces 2821
5.3.2.11 InnoDB File Format 2821
5.3.2.12 InnoDB Row Formats 2823
5.3.2.12.1 InnoDB Row Formats Overview 2823
5.3.2.12.2 InnoDB REDUNDANT Row Format 2827
5.3.2.12.3 InnoDB COMPACT Row Format 2828
5.3.2.12.4 InnoDB DYNAMIC Row Format 2829
5.3.2.12.5 InnoDB COMPRESSED Row Format 2831
5.3.2.12.6 Troubleshooting Row Size Too Large Errors with InnoDB 2833
5.3.2.13 InnoDB Strict Mode 2833
5.3.2.14 InnoDB Redo Log 2840
5.3.2.15 InnoDB Undo Log 2842
5.3.2.16 InnoDB Page Flushing 2843
5.3.2.17 InnoDB Purge 2844
5.3.2.18 Information Schema InnoDB Tables 2847
5.3.2.19 InnoDB Online DDL 2847
5.3.2.19.1 InnoDB Online DDL Overview 2847
5.3.2.19.2 InnoDB Online DDL Operations with the INPLACE Alter Algorithm 2853
5.3.2.19.3 InnoDB Online DDL Operations with the NOCOPY Alter Algorithm 2869
5.3.2.19.4 InnoDB Online DDL Operations with the INSTANT Alter Algorithm 2878
5.3.2.19.5 Instant ADD COLUMN for InnoDB 2893
5.3.2.20 Binary Log Group Commit and InnoDB Flushing Performance 2894
5.3.2.21 InnoDB Page Compression 2895
5.3.2.22 InnoDB Data Scrubbing 2903
5.3.2.23 InnoDB Lock Modes 2903
5.3.2.24 InnoDB Monitors 2904
5.3.2.25 InnoDB Encryption Overview 2906
5.3.3 MariaDB ColumnStore 2908
5.3.4 Aria 2909
5.3.4.1 Aria Storage Engine 2909
5.3.4.2 Aria Clients and Utilities 2911
5.3.4.3 Aria FAQ 2911
5.3.4.4 Aria Storage Formats 2916
5.3.4.5 Aria Status Variables 2917
5.3.4.6 Aria System Variables 2918
5.3.4.7 Aria Group Commit 2923
5.3.4.8 Benchmarking Aria 2924
5.3.4.9 Aria Two-step Deadlock Detection 2925
5.3.4.10 Aria Encryption Overview 2925
5.3.4.11 The Aria Name 2926
5.3.5 Archive 2927
5.3.6 BLACKHOLE 2928
5.3.7 CONNECT 2930
5.3.7.1 Introduction to the CONNECT Engine 2933
5.3.7.2 Installing the CONNECT Storage Engine 2933
5.3.7.3 CONNECT Create Table Options 2935
5.3.7.4 CONNECT Data Types 2937
5.3.7.5 Current Status of the CONNECT Handler 2943

37/3812
5.3.7.6 CONNECT Table Types 2943
5.3.7.6.1 CONNECT Table Types Overview 2945
5.3.7.6.2 Inward and Outward Tables 2946
5.3.7.6.3 CONNECT Table Types - Data Files 2947
5.3.7.6.4 CONNECT Zipped File Tables 2949
5.3.7.6.5 CONNECT DOS and FIX Table Types 2951
5.3.7.6.6 CONNECT DBF Table Type 2954
5.3.7.6.7 CONNECT BIN Table Type 2956
5.3.7.6.8 CONNECT VEC Table Type 2958
5.3.7.6.9 CONNECT CSV and FMT Table Types 2959
5.3.7.6.10 CONNECT - NoSQL Table Types 2962
5.3.7.6.11 CONNECT - Files Retrieved Using Rest Queries 2963
5.3.7.6.12 CONNECT JSON Table Type 2964
5.3.7.6.13 CONNECT XML Table Type 3007
5.3.7.6.14 CONNECT INI Table Type 3020
5.3.7.6.15 CONNECT - External Table Types 3022
5.3.7.6.16 CONNECT ODBC Table Type: Accessing Tables From Another DBMS 3023
5.3.7.6.17 CONNECT JDBC Table Type: Accessing Tables from Another DBMS 3035
5.3.7.6.18 CONNECT MONGO Table Type: Accessing Collections from MongoDB 3042
5.3.7.6.19 CONNECT MYSQL Table Type: Accessing MySQL/MariaDB Tables 3049
5.3.7.6.20 CONNECT PROXY Table Type 3054
5.3.7.6.21 CONNECT XCOL Table Type 3055
5.3.7.6.22 CONNECT OCCUR Table Type 3059
5.3.7.6.23 CONNECT PIVOT Table Type 3060
5.3.7.6.24 CONNECT TBL Table Type: Table List 3066
5.3.7.6.25 CONNECT - Using the TBL and MYSQL Table Types Together 3068
5.3.7.6.26 CONNECT Table Types - Special "Virtual" Tables 3070
5.3.7.6.27 CONNECT Table Types - VIR 3074
5.3.7.6.28 CONNECT Table Types - OEM: Implemented in an External LIB 3076
5.3.7.6.29 CONNECT Table Types - Catalog Tables 3077
5.3.7.7 CONNECT - Security 3081
5.3.7.8 CONNECT - OEM Table Example 3082
5.3.7.9 Using CONNECT 3084
5.3.7.9.1 Using CONNECT - General Information 3084
5.3.7.9.2 Using CONNECT - Virtual and Special Columns 3085
5.3.7.9.3 Using CONNECT - Importing File Data Into MariaDB Tables 3086
5.3.7.9.4 Using CONNECT - Exporting Data From MariaDB 3087
5.3.7.9.5 Using CONNECT - Indexing 3087
5.3.7.9.6 Using CONNECT - Condition Pushdown 3090
5.3.7.9.7 USING CONNECT - Offline Documentation 3090
5.3.7.9.8 Using CONNECT - Partitioning and Sharding 3090
5.3.7.10 CONNECT - Making the GetRest Library 3097
5.3.7.11 CONNECT - Adding the REST Feature as a Library Called by an OEM Table 3099
5.3.7.12 CONNECT - Compiling JSON UDFs in a Separate Library 3101
5.3.7.13 CONNECT System Variables 3103
5.3.7.14 JSON Sample Files 3107
5.3.8 CSV 3115
5.3.8.1 CSV Overview 3115
5.3.8.2 Checking and Repairing CSV Tables 3116
5.3.9 FederatedX 3117
5.3.9.1 About FederatedX 3117
5.3.9.2 Differences Between FederatedX and Federated 3123
5.3.10 MEMORY Storage Engine 3123
5.3.11 MERGE 3124
5.3.12 Mroonga 3126
5.3.12.1 About Mroonga 3126
5.3.12.2 Mroonga Overview 3127
5.3.12.3 Mroonga Status Variables 3129
5.3.12.4 Mroonga System Variables 3130
5.3.12.5 Mroonga User-Defined Functions 3134
5.3.12.5.1 Creating Mroonga User-Defined Functions 3134
5.3.12.5.2 last_insert_grn_id 3135
5.3.12.5.3 mroonga_command 3135
5.3.12.5.4 mroonga_escape 3136
5.3.12.5.5 mroonga_highlight_html 3137
5.3.12.5.6 mroonga_normalize 3138
5.3.12.5.7 mroonga_snippet 3139
5.3.12.5.8 mroonga_snippet_html 3139
5.3.12.6 Information Schema MROONGA_STATS Table 3140
5.3.13 MyISAM 3140
5.3.13.1 MyISAM Overview 3140

38/3812
5.3.13.2 MyISAM System Variables 3141
5.3.13.3 MyISAM Storage Formats 3144
5.3.13.4 MyISAM Clients and Utilities 3145
5.3.13.5 MyISAM Index Storage Space 3145
5.3.13.6 MyISAM Log 3145
5.3.13.7 Concurrent Inserts 3146
5.3.13.8 Segmented Key Cache 3146
5.3.14 MyRocks 3147
5.3.14.1 About MyRocks for MariaDB 3148
5.3.14.2 Getting Started with MyRocks 3149
5.3.14.3 Building MyRocks in MariaDB 3151
5.3.14.4 Loading Data Into MyRocks 3152
5.3.14.5 MyRocks Status Variables 3153
5.3.14.6 MyRocks System Variables 3166
5.3.14.7 MyRocks Transactional Isolation 3192
5.3.14.8 MyRocks and Replication 3192
5.3.14.9 MyRocks and Group Commit with Binary log 3193
5.3.14.10 Optimizer Statistics in MyRocks 3194
5.3.14.11 Differences Between MyRocks Variants 3195
5.3.14.12 MyRocks and Bloom Filters 3196
5.3.14.13 MyRocks and CHECK TABLE 3197
5.3.14.14 MyRocks and Data Compression 3198
5.3.14.15 MyRocks and Index-Only Scans 3199
5.3.14.16 MyRocks and START TRANSACTION WITH CONSISTENT SNAPSHOT 3201
5.3.14.17 MyRocks Column Families 3201
5.3.14.18 MyRocks in MariaDB 10.2 vs MariaDB 10.3 3202
5.3.14.19 MyRocks Performance Troubleshooting 3202
5.3.15 OQGRAPH 3203
5.3.15.1 Installing OQGRAPH 3204
5.3.15.2 OQGRAPH Overview 3204
5.3.15.3 OQGRAPH Examples 3207
5.3.15.4 Compiling OQGRAPH 3210
5.3.15.5 Building OQGRAPH Under Windows 3210
5.3.15.6 OQGRAPH System and Status Variables 3211
5.3.16 S3 Storage Engine 3211
5.3.16.1 Using the S3 Storage Engine 3212
5.3.16.2 Testing the Connections to S3 3216
5.3.16.3 S3 Storage Engine Internals 3218
5.3.16.4 aria_s3_copy 3220
5.3.16.5 S3 Storage Engine Status Variables 3221
5.3.16.6 S3 Storage Engine System Variables 3222
5.3.17 Sequence Storage Engine 3225
5.3.18 SphinxSE 3229
5.3.18.1 About SphinxSE 3229
5.3.18.2 Installing Sphinx 3233
5.3.18.3 Configuring Sphinx 3234
5.3.18.4 Installing and Testing SphinxSE with MariaDB 3234
5.3.18.5 Sphinx Status Variables 3235
5.3.19 Spider 3235
5.3.19.1 Spider Storage Engine Overview 3236
5.3.19.2 Spider Installation 3248
5.3.19.3 Spider Storage Engine Core Concepts 3251
5.3.19.4 Spider Use Cases 3253
5.3.19.5 Spider Cluster Management 3256
5.3.19.6 Spider Feature Matrix 3259
5.3.19.7 Spider Server System Variables 3260
5.3.19.8 Spider Table Parameters 3285
5.3.19.9 Spider Status Variables 3289
5.3.19.10 Spider Functions 3290
5.3.19.10.1 SPIDER_BG_DIRECT_SQL 3290
5.3.19.10.2 SPIDER_COPY_TABLES 3290
5.3.19.10.3 SPIDER_DIRECT_SQL 3290
5.3.19.10.4 SPIDER_FLUSH_TABLE_MON_CACHE 3290
5.3.19.11 Spider mysql Database Tables 3290
5.3.19.11.1 mysqlspider_link_failed_log Table 3290
5.3.19.11.2 mysqlspider_link_mon_servers Table 3290
5.3.19.11.3 mysqlspider_tables Table 3290
5.3.19.11.4 mysqlspider_table_crd Table 3291
5.3.19.11.5 mysqlspider_table_position_for_recovery Table 3291
5.3.19.11.6 mysqlspider_table_sts Table 3291
5.3.19.11.7 mysqlspider_xa Table 3291

39/3812
5.3.19.11.8 mysqlspider_xa_failed_log Table 3291
5.3.19.11.9 mysqlspider_xa_member Table 3291
5.3.19.12 Information Schema SPIDER_ALLOC_MEM Table 3291
5.3.19.13 Information Schema SPIDER_WRAPPER_PROTOCOLS Table 3291
5.3.19.14 Spider Differences Between SpiderForMySQL and MariaDB 3291
5.3.19.15 Spider Case Studies 3291
5.3.19.16 Spider Benchmarks 3291
5.3.19.17 Spider FAQ 3293
5.3.20 Information Schema ENGINES Table 3294
5.3.21 PERFORMANCE_SCHEMA Storage Engine 3294
5.3.22 Storage Engine Development 3294
5.3.22.1 Storage Engine FAQ 3294
5.3.22.2 Engine-defined New Table/Field/Index Attributes 3295
5.3.22.3 Table Discovery 3297
5.3.23 Converting Tables from MyISAM to InnoDB 3299
5.3.24 Machine Learning with MindsDB 3302
5.4 Plugins 3303
5.4.1 Plugin Overview 3304
5.4.2 Information on Plugins 3309
5.4.2.1 List of Plugins 3309
5.4.2.2 Information Schema PLUGINS Table 3311
5.4.2.3 Information Schema ALL_PLUGINS Table 3311
5.4.3 Plugin SQL Statements 3311
5.4.4 Creating and Building Plugins 3311
5.4.4.1 Specifying Which Plugins to Build 3311
5.4.4.2 Writing Plugins for MariaDB 3312
5.4.5 MariaDB Audit Plugin 3313
5.4.5.1 MariaDB Audit Plugin - Installation 3314
5.4.5.2 MariaDB Audit Plugin - Configuration 3315
5.4.5.3 MariaDB Audit Plugin - Log Settings 3316
5.4.5.4 MariaDB Audit Plugin - Location and Rotation of Logs 3319
5.4.5.5 MariaDB Audit Plugin - Log Format 3320
5.4.5.6 MariaDB Audit Plugin - Versions 3321
5.4.5.7 MariaDB Audit Plugin Options and System Variables 3321
5.4.5.8 MariaDB Audit Plugin - Status Variables 3326
5.4.6 Authentication Plugins 3326
5.4.6.1 Pluggable Authentication Overview 3327
5.4.6.2 Authentication Plugin - mysql_native_password 3335
5.4.6.3 Authentication Plugin - mysql_old_password 3337
5.4.6.4 Authentication Plugin - ed25519 3339
5.4.6.5 Authentication Plugin - GSSAPI 3342
5.4.6.6 Authentication with Pluggable Authentication Modules (PAM) 3348
5.4.6.6.1 Authentication Plugin - PAM 3348
5.4.6.6.2 User and Group Mapping with PAM 3358
5.4.6.6.3 Configuring PAM Authentication and User Mapping with Unix Authentication 3363
5.4.6.6.4 Configuring PAM Authentication and User Mapping with LDAP Authentication 3366
5.4.6.7 Authentication Plugin - Unix Socket 3375
5.4.6.8 Authentication Plugin - Named Pipe 3378
5.4.6.9 Authentication Plugin - SHA-256 3380
5.4.7 Password Validation Plugins 3381
5.4.7.1 Simple Password Check Plugin 3382
5.4.7.2 Cracklib Password Check Plugin 3384
5.4.7.3 Password Reuse Check Plugin 3387
5.4.7.4 Password Validation Plugin API 3388
5.4.7.5 password_reuse_check_interval 3390
5.4.8 Key Management and Encryption Plugins 3390
5.4.8.1 Encryption Key Management 3390
5.4.8.2 File Key Management Encryption Plugin 3392
5.4.8.3 Hashicorp Key Management Plugin 3397
5.4.8.4 AWS Key Management Encryption Plugin 3400
5.4.8.5 Amazon Web Services (AWS) Key Management Service (KMS) Encryption Plugin Setup Guide 3404
5.4.8.6 Amazon Web Services (AWS) Key Management Service (KMS) Encryption Plugin Advanced Usage 3410
5.4.8.7 Eperi Key Management Encryption Plugin 3417
5.4.8.8 Encryption Plugin API 3420
5.4.9 MariaDB Replication & Cluster Plugins 3423
5.4.9.1 Semisynchronous Replication 3424
5.4.9.2 WSREP_INFO Plugin 3424
5.4.10 Storage Engines 3425
5.4.11 Other Plugins 3425
5.4.11.1 Feedback Plugin 3426
5.4.11.2 Locales Plugin 3429

40/3812
5.4.11.3 METADATA_LOCK_INFO Plugin 3431
5.4.11.4 MYSQL_JSON 3433
5.4.11.5 Query Cache Information Plugin 3434
5.4.11.6 Query Response Time Plugin 3435
5.4.11.7 SQL Error Log Plugin 3439
5.4.11.8 User Statistics 3442
5.4.11.9 User Variables Plugin 3442
5.4.11.10 Disks Plugin 3443
5.4.11.11 Compression Plugins 3445
Chapter 6 Training & Tutorials 3445
6.1 Beginner MariaDB Articles 3446
6.1.1 A MariaDB Primer 3447
6.1.2 MariaDB Basics 3449
6.1.3 Getting Data from MariaDB 3452
6.1.4 Adding and Changing Data in MariaDB 3455
6.1.5 Altering Tables in MariaDB 3458
6.1.6 Changing Times in MariaDB 3462
6.1.7 Doing Time with MariaDB 3465
6.1.8 Importing Data into MariaDB 3470
6.1.9 Making Backups with mysqldump 3474
6.1.10 MariaDB String Functions 3475
6.1.11 Restoring Data from Dump Files 3478
6.1.12 Basic SQL Queries: A Quick SQL Cheat Sheet 3479
6.1.13 Connecting to MariaDB 3480
6.1.14 External Tutorials 3483
6.1.15 Useful MariaDB Queries 3484
6.2 Basic MariaDB Articles 3488
6.2.1 Basic SQL Debugging 3489
6.2.2 Configuring MariaDB for Remote Client Access 3492
6.2.3 Creating & Using Views 3494
6.2.4 Getting Started with Indexes 3499
6.2.5 Joining Tables with JOIN Clauses 3499
6.2.6 The Essentials of an Index 3500
6.2.7 Troubleshooting Connection Issues 3501
6.3 Intermediate MariaDB Articles 3503
6.3.1 Database Theory 3504
6.3.1.1 Introduction to Relational Databases 3504
6.3.1.2 Exploring Early Database Models 3505
6.3.1.3 Understanding the Hierarchical Database Model 3505
6.3.1.4 Understanding the Network Database Model 3506
6.3.1.5 Understanding the Relational Database Model 3506
6.3.1.6 Relational Databases: Basic Terms 3507
6.3.1.7 Relational Databases: Table Keys 3508
6.3.1.8 Relational Databases: Foreign Keys 3508
6.3.1.9 Relational Databases: Views 3509
6.3.1.10 Database Design 3510
6.3.1.10.1 Database Design: Overview 3511
6.3.1.10.2 Database Lifecycle 3511
6.3.1.10.3 Database Design Phase 1: Analysis 3512
6.3.1.10.4 Database Design Phase 2: Conceptual Design 3513
6.3.1.10.5 Database Design Phase 2: Logical and Physical Design 3516
6.3.1.10.6 Database Design Phase 3: Implementation 3517
6.3.1.10.7 Database Design Phase 4: Testing 3518
6.3.1.10.8 Database Design Phase 5: Operation 3518
6.3.1.10.9 Database Design Phase 6: Maintenance 3518
6.3.1.10.10 Database Design Example Phase 1: Analysis 3519
6.3.1.10.11 Database Design Example Phase 2: Design 3519
6.3.1.10.12 Database Design Example Phase 3: Implementation 3522
6.3.1.10.13 Database Design Example Phases 4-6: Testing, Operation and Maintenance 3523
6.3.1.11 Database Normalization 3524
6.3.1.11.1 Database Normalization Overview 3524
6.3.1.11.2 Database Normalization: 1st Normal Form 3528
6.3.1.11.3 Database Normalization: 2nd Normal Form 3529
6.3.1.11.4 Database Normalization: 3rd Normal Form 3530
6.3.1.11.5 Database Normalization: Boyce-Codd Normal Form 3531
6.3.1.11.6 Database Normalization: 4th Normal Form 3533
6.3.1.11.7 Database Normalization: 5th Normal Form and Beyond 3535
6.3.1.11.8 Understanding Denormalization 3536
6.3.1.12 ACID: Concurrency Control with Transactions 3537
6.3.2 Starting and Stopping MariaDB 3537
6.4 Advanced MariaDB Articles 3537

41/3812
6.4.1 Development Articles 3538
6.4.1.2 MariaDB Internals Documentation 3539
6.4.1.2.1 Optimizer Trace 3539
6.4.1.2.1.1 Optimizer Trace Overview 3539
6.4.1.2.1.2 Optimizer Trace Guide 3541
6.4.1.2.1.3 Basic Optimizer Trace Example 3545
6.4.1.2.2 Using MariaDB with Your Programs (API) 3547
6.4.1.2.2.1 Error Codes 3548
6.4.1.2.2.1.1 MariaDB Error Codes 3548
6.4.1.2.2.1.2 Operating System Error Codes 3548
6.4.1.2.2.1.3 SQLSTATE 3552
6.4.1.2.2.2 Progress Reporting 3553
6.4.1.3 EXPLAIN FORMAT=JSON in MySQL 3556
Chapter 7 MariaDB Server Releases 3557
7.1 Release Notes 3558
7.1.1 MariaDB Server 10.11 3561
7.1.1.1 Changes and Improvements in MariaDB 10.11 3561
7.1.1.2 Release Notes - MariaDB 10.11 Series 3562
7.1.1.2.1 MariaDB 10.11.0 Release Notes 3562
7.1.2 MariaDB Server 10.10 3563
7.1.2.1 Changes and Improvements in MariaDB 10.10 3563
7.1.2.2 Release Notes - MariaDB 10.10 Series 3565
7.1.2.2.1 MariaDB 10.10.1 Release Notes 3565
7.1.2.2.2 MariaDB 10.10.0 Release Notes 3567
7.1.3 MariaDB Server 10.9 3568
7.1.3.1 Changes and Improvements in MariaDB 10.9 3568
7.1.3.2 Release Notes - MariaDB 10.9 Series 3569
7.1.3.2.1 MariaDB 10.9.3 Release Notes 3570
7.1.3.2.2 MariaDB 10.9.2 Release Notes 3570
7.1.3.2.3 MariaDB 10.9.1 Release Notes 3572
7.1.3.2.4 MariaDB 10.9.0 Release Notes 3574
7.1.4 MariaDB Server 10.8 3575
7.1.4.1 Changes and Improvements in MariaDB 10.8 3575
7.1.4.2 Release Notes - MariaDB 10.8 Series 3577
7.1.4.2.1 MariaDB 10.8.5 Release Notes 3578
7.1.4.2.2 MariaDB 10.8.4 Release Notes 3578
7.1.4.2.3 MariaDB 10.8.3 Release Notes 3581
7.1.4.2.4 MariaDB 10.8.2 Release notes 3582
7.1.4.2.5 MariaDB 10.8.1 Release Notes 3583
7.1.4.2.6 MariaDB 10.8.0 Release Notes 3585
7.1.5 MariaDB Server 10.7 3587
7.1.5.1 Changes and Improvements in MariaDB 10.7 3587
7.1.5.2 Release Notes - MariaDB 10.7 Series 3589
7.1.5.2.1 MariaDB 10.7.6 Release Notes 3590
7.1.5.2.2 MariaDB 10.7.5 Release Notes 3591
7.1.5.2.3 MariaDB 10.7.4 Release Notes 3593
7.1.5.2.4 MariaDB 10.7.3 Release Notes 3595
7.1.5.2.5 MariaDB 10.7.2 Release Notes 3596
7.1.5.2.6 MariaDB 10.7.1 Release Notes 3598
7.1.5.2.7 MariaDB 10.7.0 Release Notes 3600
7.1.6 MariaDB Server 10.6 3601
7.1.6.1 Changes and Improvements in MariaDB 10.6 3601
7.1.6.2 Release Notes - MariaDB 10.6 Series 3605
7.1.6.2.1 MariaDB 10.6.10 Release Notes 3605
7.1.6.2.2 MariaDB 10.6.9 Release Notes 3606
7.1.6.2.3 MariaDB 10.6.8 Release Notes 3608
7.1.6.2.4 MariaDB 10.6.7 Release Notes 3611
7.1.6.2.5 MariaDB 10.6.6 Release Notes 3611
7.1.6.2.6 MariaDB 10.6.5 Release Notes 3613
7.1.6.2.7 MariaDB 10.6.4 Release Notes 3614
7.1.6.2.8 MariaDB 10.6.3 Release Notes 3616
7.1.6.2.9 MariaDB 10.6.2 Release Notes 3617
7.1.6.2.10 MariaDB 10.6.1 Release Notes 3618
7.1.6.2.11 MariaDB 10.6.0 Release Notes 3619
7.1.7 MariaDB Server 10.5 3621
7.1.7.1 Changes and Improvements in MariaDB 10.5 3621
7.1.7.2 Release Notes - MariaDB 10.5 Series 3627
7.1.7.2.1 MariaDB 10.5.18 Release Notes 3628
7.1.7.2.2 MariaDB 10.5.17 Release Notes 3629
7.1.7.2.3 MariaDB 10.5.16 Release Notes 3631
7.1.7.2.4 MariaDB 10.5.15 Release Notes 3632

42/3812
7.1.7.2.5 MariaDB 10.5.14 Release Notes 3633
7.1.7.2.6 MariaDB 10.5.13 Release Notes 3635
7.1.7.2.7 MariaDB 10.5.12 Release Notes 3636
7.1.7.2.8 MariaDB 10.5.11 Release Notes 3637
7.1.7.2.9 MariaDB 10.5.10 Release Notes 3639
7.1.7.2.10 MariaDB 10.5.9 Release Notes 3640
7.1.7.2.11 MariaDB 10.5.8 Release Notes 3642
7.1.7.2.12 MariaDB 10.5.7 Release Notes 3642
7.1.7.2.13 MariaDB 10.5.6 Release Notes 3644
7.1.7.2.14 MariaDB 10.5.5 Release Notes 3645
7.1.7.2.15 MariaDB 10.5.4 Release Notes 3647
7.1.7.2.16 MariaDB 10.5.3 Release Notes 3648
7.1.7.2.17 MariaDB 10.5.2 Release Notes 3650
7.1.7.2.18 MariaDB 10.5.1 Release Notes 3652
7.1.7.2.19 MariaDB 10.5.0 Release Notes 3653
7.1.8 MariaDB Server 10.4 3655
7.1.8.1 Changes and Improvements in MariaDB 10.4 3655
7.1.8.2 Release Notes - MariaDB 10.4 Series 3661
7.1.8.2.1 MariaDB 10.4.27 Release Notes 3662
7.1.8.2.2 MariaDB 10.4.26 Release Notes 3662
7.1.8.2.3 MariaDB 10.4.25 Release Notes 3664
7.1.8.2.4 MariaDB 10.4.24 Release Notes 3666
7.1.8.2.5 MariaDB 10.4.23 Release Notes 3667
7.1.8.2.6 MariaDB 10.4.22 Release Notes 3668
7.1.8.2.7 MariaDB 10.4.21 Release Notes 3670
7.1.8.2.8 MariaDB 10.4.20 Release Notes 3671
7.1.8.2.9 MariaDB 10.4.19 Release Notes 3672
7.1.8.2.10 MariaDB 10.4.18 Release Notes 3673
7.1.8.2.11 MariaDB 10.4.17 Release Notes 3675
7.1.8.2.12 MariaDB 10.4.16 Release Notes 3675
7.1.8.2.13 MariaDB 10.4.15 Release Notes 3677
7.1.8.2.14 MariaDB 10.4.14 Release Notes 3678
7.1.8.2.15 MariaDB 10.4.13 Release Notes 3679
7.1.8.2.16 MariaDB 10.4.12 Release Notes 3681
7.1.8.2.17 MariaDB 10.4.11 Release Notes 3683
7.1.8.2.18 MariaDB 10.4.10 Release Notes 3684
7.1.8.2.19 MariaDB 10.4.9 Release Notes 3685
7.1.8.2.20 MariaDB 10.4.8 Release Notes 3686
7.1.8.2.21 MariaDB 10.4.7 Release Notes 3687
7.1.8.2.22 MariaDB 10.4.6 Release Notes 3688
7.1.8.2.23 MariaDB 10.4.5 Release Notes 3689
7.1.8.2.24 MariaDB 10.4.4 Release Notes 3690
7.1.8.2.25 MariaDB 10.4.3 Release Notes 3691
7.1.8.2.26 MariaDB 10.4.2 Release Notes 3692
7.1.8.2.27 MariaDB 10.4.1 Release Notes 3694
7.1.8.2.28 MariaDB 10.4.0 Release Notes 3695
7.1.9 MariaDB Server 10.3 3696
7.1.9.1 Changes & Improvements in MariaDB 10.3 3697
7.1.9.2 Release Notes - MariaDB 10.3 Series 3702
7.1.9.2.1 MariaDB 10.3.37 Release Notes 3704
7.1.9.2.2 MariaDB 10.3.36 Release Notes 3705
7.1.9.2.3 MariaDB 10.3.35 Release Notes 3706
7.1.9.2.4 MariaDB 10.3.34 Release Notes 3708
7.1.9.2.5 MariaDB 10.3.33 Release Notes 3709
7.1.9.2.6 MariaDB 10.3.32 Release Notes 3710
7.1.9.2.7 MariaDB 10.3.31 Release Notes 3712
7.1.9.2.8 MariaDB 10.3.30 Release Notes 3713
7.1.9.2.9 MariaDB 10.3.29 Release Notes 3714
7.1.9.2.10 MariaDB 10.3.28 Release Notes 3715
7.1.9.2.11 MariaDB 10.3.27 Release Notes 3717
7.1.9.2.12 MariaDB 10.3.26 Release Notes 3718
7.1.9.2.13 MariaDB 10.3.25 Release Notes 3719
7.1.9.2.14 MariaDB 10.3.24 Release Notes 3720
7.1.9.2.15 MariaDB 10.3.23 Release Notes 3721
7.1.9.2.16 MariaDB 10.3.22 Release Notes 3723
7.1.9.2.17 MariaDB 10.3.21 Release Notes 3724
7.1.9.2.18 MariaDB 10.3.20 Release Notes 3726
7.1.9.2.19 MariaDB 10.3.19 Release Notes 3726
7.1.9.2.20 MariaDB 10.3.18 Release Notes 3728
7.1.9.2.21 MariaDB 10.3.17 Release Notes 3729
7.1.9.2.22 MariaDB 10.3.16 Release Notes 3730

43/3812
7.1.9.2.23 MariaDB 10.3.15 Release Notes 3731
7.1.9.2.24 MariaDB 10.3.14 Release Notes 3732
7.1.9.2.25 MariaDB 10.3.13 Release Notes 3733
7.1.9.2.26 MariaDB 10.3.12 Release Notes 3734
7.1.9.2.27 MariaDB 10.3.11 Release Notes 3735
7.1.9.2.28 MariaDB 10.3.10 Release Notes 3736
7.1.9.2.29 MariaDB 10.3.9 Release Notes 3737
7.1.9.2.30 MariaDB 10.3.8 Release Notes 3738
7.1.9.2.31 MariaDB 10.3.7 Release Notes 3739
7.1.9.2.32 MariaDB 10.3.6 Release Notes 3740
7.1.9.2.33 MariaDB 10.3.5 Release Notes 3741
7.1.9.2.34 MariaDB 10.3.4 Release Notes 3743
7.1.9.2.35 MariaDB 10.3.3 Release Notes 3743
7.1.9.2.36 MariaDB 10.3.2 Release Notes 3745
7.1.9.2.37 MariaDB 10.3.1 Release Notes 3746
7.1.9.2.38 MariaDB 10.3.0 Release Notes 3747
7.1.10 MariaDB Server 10.2 3749
7.1.10.1 Changes & Improvements in MariaDB 10.2 3749
7.1.11 MariaDB Server 10.1 3756
7.1.11.1 Changes & Improvements in MariaDB 10.1 3756
7.1.12 MariaDB Server 10.0 3762
7.1.12.1 Changes & Improvements in MariaDB 10.0 3762
7.1.13 MariaDB Server 5.5 3769
7.1.13.1 Changes & Improvements in MariaDB 5.5 3769
7.1.14 MariaDB Server 5.3 3777
7.1.14.1 Changes & Improvements in MariaDB 5.3 3777
7.1.15 MariaDB Server 5.2 3780
7.1.15.1 Changes & Improvements in MariaDB 5.2 3781
7.1.16 MariaDB Server 5.1 3782
7.1.16.1 Changes & Improvements in MariaDB 5.1 3782
Chapter 8 The Community 3785
8.1 Bug Tracking 3786
8.1.1 MariaDB Community Bug Reporting 3786
8.1.2 Reporting Documentation Bugs 3790
8.1.3 MariaDB Community Bug Processing 3792
8.1.4 MariaDB Security Bug Fixing Policy 3797
8.1.5 Building MariaDB Server for Debugging 3797
8.1.6 Extracting Entries from the Binary Log 3798
8.2 Contributing & Participating 3799
8.2.1 Getting Help With MariaDB 3800
8.2.2 Contributing to the MariaDB Project 3800
8.2.3 Contributing Code 3801
8.2.4 Donate to the Foundation 3804
8.2.5 Sponsoring the MariaDB Project 3804
8.2.6 Using Git with MariaDB 3804
8.2.6.1 MariaDB Source Code 3804
8.2.6.2 Using Git 3804
8.2.6.3 Configuring Git to Send Commit Notices 3808
8.3 Legal Matters 3809
8.3.1 GNU General Public License, Version 2 3809
8.3.2 Legal Notices for the Knowledge Base 3813

44/3812
1 Using MariaDB Server
Documentation on using MariaDB Server.
SQL Statements & Structure
SQL statements, structure, and rules.

Built-in Functions
Functions and procedures in MariaDB.

Clients & Utilities


Client and utility programs for MariaDB.

1.1 SQL Statements & Structure


The letters SQL stand for Structured Query Language. As with all languages—even computer languages—there are
grammar rules. This includes a certain structure to statements, acceptable punctuation (i.e., operators and delimiters),
and a vocabulary (i.e., reserve words).
SQL Statements
Explanations of all of the MariaDB SQL statements.

SQL Language Structure


Explanation of SQL grammar rules, including reserved words and literals.

Geographic & Geometric Features


Spatial extensions for geographic and geometric features.

NoSQL
NoSQL-related commands and interfaces

Operators
Operators for comparing and assigning values.

Sequences
Sequence objects, an alternative to AUTO_INCREMENT.

Temporal Tables
MariaDB supports system-versioning, application-time periods and bitemporal tables.

There are 11 related questions .

1.1.1 SQL Statements


Complete list of SQL statements for data definition, data manipulation, etc.
Account Management SQL Commands
CREATE/DROP USER, GRANT, REVOKE, SET PASSWORD etc.

Administrative SQL Statements


SQL statements for setting, flushing and displaying server variables and resources.

Data Definition
SQL commands for defining data, such as ALTER, CREATE, DROP, RENAME etc.

Data Manipulation
SQL commands for querying and manipulating data, such as SELECT, UPDATE, DELETE etc.

Prepared Statements
Prepared statements from any client using the text based prepared statement interface.

Programmatic & Compound Statements


Compound SQL statements for stored routines and in general.

Stored Routine Statements


SQL statements related to creating and using stored routines.
45/3812
Table Statements
Documentation on creating, altering, analyzing and maintaining tables.

Transactions
Sequence of statements that are either completely successful, or have no effect on any schemas

HELP Command
The HELP command will retrieve syntax and help within the mysql client.

Comment Syntax
Comment syntax and style.

Built-in Functions
Functions and procedures in MariaDB.

There are 17 related questions .

1.1.1.1 Account Management SQL Commands


CREATE/DROP USER, GRANT, REVOKE, SET PASSWORD etc.
CREATE USER
8 Create new MariaDB accounts.

ALTER USER
1 Modify an existing MariaDB account.

DROP USER
1 Remove one or more MariaDB accounts.

GRANT
2 Create accounts and set privileges or roles.

RENAME USER
Rename user account.

REVOKE
4 Remove privileges or roles.

SET PASSWORD
Assign password to an existing MariaDB user.

CREATE ROLE
Add new roles.

DROP ROLE
Drop a role.

SET ROLE
1 Enable a role.

SET DEFAULT ROLE


5 Sets a default role for a specified (or current) user.

SHOW GRANTS
9 View GRANT statements.

SHOW CREATE USER


Show the CREATE USER statement for a specified user.

There are 2 related questions .

46/3812
1.1.1.1.1 CREATE USER
Syntax
CREATE [OR REPLACE] USER [IF NOT EXISTS]
user_specification [,user_specification ...]
[REQUIRE {NONE | tls_option [[AND] tls_option ...] }]
[WITH resource_option [resource_option ...] ]
[lock_option] [password_option]

user_specification:
username [authentication_option]

authentication_option:
IDENTIFIED BY 'password'
| IDENTIFIED BY PASSWORD 'password_hash'
| IDENTIFIED {VIA|WITH} authentication_rule [OR authentication_rule ...]

authentication_rule:
authentication_plugin
| authentication_plugin {USING|AS} 'authentication_string'
| authentication_plugin {USING|AS} PASSWORD('password')

tls_option:
SSL
| X509
| CIPHER 'cipher'
| ISSUER 'issuer'
| SUBJECT 'subject'

resource_option:
MAX_QUERIES_PER_HOUR count
| MAX_UPDATES_PER_HOUR count
| MAX_CONNECTIONS_PER_HOUR count
| MAX_USER_CONNECTIONS count
| MAX_STATEMENT_TIME time

password_option:
PASSWORD EXPIRE
| PASSWORD EXPIRE DEFAULT
| PASSWORD EXPIRE NEVER
| PASSWORD EXPIRE INTERVAL N DAY

lock_option:
ACCOUNT LOCK
| ACCOUNT UNLOCK
}

Contents
1. Syntax
2. Description
3. OR REPLACE
4. IF NOT EXISTS
5. Authentication Options
1. IDENTIFIED BY 'password'
2. IDENTIFIED BY PASSWORD
'password_hash'
3. IDENTIFIED {VIA|WITH}
authentication_plugin
6. TLS Options
7. Resource Limit Options
8. Account Names
1. Host Name Component
2. User Name Component
3. Anonymous Accounts
1. Fixing a Legacy Default Anonymous
Account
9. Password Expiry
10. Account Locking
11. See Also

Description
47/3812
The CREATE USER statement creates new MariaDB accounts. To use it, you must have the global CREATE USER
privilege or the INSERT privilege for the mysql database. For each account, CREATE USER creates a new row in
mysql.user (until MariaDB 10.3 this is a table, from MariaDB 10.4 it's a view) or mysql.global_priv_table (from MariaDB
10.4) that has no privileges.
If any of the specified accounts, or any permissions for the specified accounts, already exist, then the server returns
ERROR 1396 (HY000) . If an error occurs, CREATE USER will still create the accounts that do not result in an error. Only
one error is produced for all users which have not been created:

ERROR 1396 (HY000):


Operation CREATE USER failed for 'u1'@'%','u2'@'%'

CREATE USER , DROP USER, CREATE ROLE, and DROP ROLE all produce the same error code when they fail.
See Account Names below for details on how account names are specified.

OR REPLACE
If the optional OR REPLACE clause is used, it is basically a shortcut for:

DROP USER IF EXISTS name;


CREATE USER name ...;

For example:

CREATE USER foo2@test IDENTIFIED BY 'password';


ERROR 1396 (HY000): Operation CREATE USER failed for 'foo2'@'test'

CREATE OR REPLACE USER foo2@test IDENTIFIED BY 'password';


Query OK, 0 rows affected (0.00 sec)

IF NOT EXISTS
When the IF NOT EXISTS clause is used, MariaDB will return a warning instead of an error if the specified user already
exists.
For example:

CREATE USER foo2@test IDENTIFIED BY 'password';


ERROR 1396 (HY000): Operation CREATE USER failed for 'foo2'@'test'

CREATE USER IF NOT EXISTS foo2@test IDENTIFIED BY 'password';


Query OK, 0 rows affected, 1 warning (0.00 sec)

SHOW WARNINGS;
+-------+------+----------------------------------------------------+
| Level | Code | Message |
+-------+------+----------------------------------------------------+
| Note | 1973 | Can't create user 'foo2'@'test'; it already exists |
+-------+------+----------------------------------------------------+

Authentication Options
IDENTIFIED BY 'password'
The optional IDENTIFIED BY clause can be used to provide an account with a password. The password should be
specified in plain text. It will be hashed by the PASSWORD function prior to being stored in the
mysql.user/mysql.global_priv_table table.
For example, if our password is mariadb , then we can create the user with:

CREATE USER foo2@test IDENTIFIED BY 'mariadb';

If you do not specify a password with the IDENTIFIED BY clause, the user will be able to connect without a password. A
blank password is not a wildcard to match any password. The user must connect without providing a password if no
password is set.
The only authentication plugins that this clause supports are mysql_native_password and mysql_old_password.

IDENTIFIED BY PASSWORD 'password_hash'


48/3812
The optional IDENTIFIED BY PASSWORD clause can be used to provide an account with a password that has already
been hashed. The password should be specified as a hash that was provided by the PASSWORD function. It will be
stored in the mysql.user/mysql.global_priv_table table as-is.
For example, if our password is mariadb , then we can find the hash with:

SELECT PASSWORD('mariadb');
+-------------------------------------------+
| PASSWORD('mariadb') |
+-------------------------------------------+
| *54958E764CE10E50764C2EECBB71D01F08549980 |
+-------------------------------------------+
1 row in set (0.00 sec)

And then we can create a user with the hash:

CREATE USER foo2@test IDENTIFIED BY PASSWORD '*54958E764CE10E50764C2EECBB71D01F08549980';

If you do not specify a password with the IDENTIFIED BY clause, the user will be able to connect without a password. A
blank password is not a wildcard to match any password. The user must connect without providing a password if no
password is set.
The only authentication plugins that this clause supports are mysql_native_password and mysql_old_password.

IDENTIFIED {VIA|WITH} authentication_plugin


The optional IDENTIFIED VIA authentication_plugin allows you to specify that the account should be authenticated
by a specific authentication plugin. The plugin name must be an active authentication plugin as per SHOW PLUGINS. If
it doesn't show up in that output, then you will need to install it with INSTALL PLUGIN or INSTALL SONAME.
For example, this could be used with the PAM authentication plugin:

CREATE USER foo2@test IDENTIFIED VIA pam;

Some authentication plugins allow additional arguments to be specified after a USING or AS keyword. For example, the
PAM authentication plugin accepts a service name:

CREATE USER foo2@test IDENTIFIED VIA pam USING 'mariadb';

The exact meaning of the additional argument would depend on the specific authentication plugin.

MariaDB starting with 10.4.0


The USING or AS keyword can also be used to provide a plain-text password to a plugin if it's provided as an
argument to the PASSWORD() function. This is only valid for authentication plugins that have implemented a hook for
the PASSWORD() function. For example, the ed25519 authentication plugin supports this:
CREATE USER safe@'%' IDENTIFIED VIA ed25519 USING PASSWORD('secret');

MariaDB starting with 10.4.3


One can specify many authentication plugins, they all work as alternatives ways of authenticating a user:
CREATE USER safe@'%' IDENTIFIED VIA ed25519 USING PASSWORD('secret') OR unix_socket;

By default, when you create a user without specifying an authentication plugin, MariaDB uses the
mysql_native_password plugin.

TLS Options
By default, MariaDB transmits data between the server and clients without encrypting it. This is generally acceptable
when the server and client run on the same host or in networks where security is guaranteed through other means.
However, in cases where the server and client exist on separate networks or they are in a high-risk network, the lack of
encryption does introduce security concerns as a malicious actor could potentially eavesdrop on the traffic as it is sent
over the network between them.
To mitigate this concern, MariaDB allows you to encrypt data in transit between the server and clients using the
Transport Layer Security (TLS) protocol. TLS was formerly known as Secure Socket Layer (SSL), but strictly speaking
the SSL protocol is a predecessor to TLS and, that version of the protocol is now considered insecure. The
documentation still uses the term SSL often and for compatibility reasons TLS-related server system and status
49/3812
variables still use the prefix ssl_, but internally, MariaDB only supports its secure successors.
See Secure Connections Overview for more information about how to determine whether your MariaDB server has TLS
support.
You can set certain TLS-related restrictions for specific user accounts. For instance, you might use this with user
accounts that require access to sensitive data while sending it across networks that you do not control. These
restrictions can be enabled for a user account with the CREATE USER, ALTER USER, or GRANT statements. The
following options are available:

Option Description
REQUIRE
TLS is not required for this account, but can still be used.
NONE

REQUIRE The account must use TLS, but no valid X509 certificate is required. This option cannot be combined
SSL with other TLS options.
REQUIRE The account must use TLS and must have a valid X509 certificate. This option implies REQUIRE SSL .
X509 This option cannot be combined with other TLS options.
REQUIRE The account must use TLS and must have a valid X509 certificate. Also, the Certificate Authority must be
ISSUER the one specified via the string issuer . This option implies REQUIRE X509 . This option can be combined
'issuer' with the SUBJECT , and CIPHER options in any order.
REQUIRE The account must use TLS and must have a valid X509 certificate. Also, the certificate's Subject must be
SUBJECT the one specified via the string subject . This option implies REQUIRE X509 . This option can be
'subject' combined with the ISSUER , and CIPHER options in any order.
REQUIRE The account must use TLS, but no valid X509 certificate is required. Also, the encryption used for the
CIPHER connection must use a specific cipher method specified in the string cipher . This option implies
'cipher' REQUIRE SSL . This option can be combined with the ISSUER , and SUBJECT options in any order.

The REQUIRE keyword must be used only once for all specified options, and the AND keyword can be used to separate
individual options, but it is not required.
For example, you can create a user account that requires these TLS options with the following:

CREATE USER 'alice'@'%'


REQUIRE SUBJECT '/CN=alice/O=My Dom, Inc./C=US/ST=Oregon/L=Portland'
AND ISSUER '/C=FI/ST=Somewhere/L=City/ O=Some Company/CN=Peter
Parker/[email protected]'
AND CIPHER 'SHA-DES-CBC3-EDH-RSA';

If any of these options are set for a specific user account, then any client who tries to connect with that user account will
have to be configured to connect with TLS.
See Securing Connections for Client and Server for information on how to enable TLS on the client and server.

Resource Limit Options


It is possible to set per-account limits for certain server resources. The following table shows the values that can be set
per account:

Limit Type Decription


MAX_QUERIES_PER_HOUR Number of statements that the account can issue per hour (including updates)
MAX_UPDATES_PER_HOUR Number of updates (not queries) that the account can issue per hour
MAX_CONNECTIONS_PER_HOUR Number of connections that the account can start per hour
Number of simultaneous connections that can be accepted from the same account; if it
MAX_USER_CONNECTIONS is 0, max_connections will be used instead; if max_connections is 0, there is no limit
for this account's simultaneous connections.
Timeout, in seconds, for statements executed by the user. See also Aborting
MAX_STATEMENT_TIME
Statements that Exceed a Certain Time to Execute.

If any of these limits are set to 0 , then there is no limit for that resource for that user.
Here is an example showing how to create a user with resource limits:

CREATE USER 'someone'@'localhost' WITH


MAX_USER_CONNECTIONS 10
MAX_QUERIES_PER_HOUR 200;

The resources are tracked per account, which means 'user'@'server' ; not per user name or per connection.

50/3812
The count can be reset for all users using FLUSH USER_RESOURCES, FLUSH PRIVILEGES or mysqladmin reload.
Per account resource limits are stored in the user table, in the mysql database. Columns used for resources limits are
named max_questions , max_updates , max_connections (for MAX_CONNECTIONS_PER_HOUR ), and
max_user_connections (for MAX_USER_CONNECTIONS ).

Account Names
Account names have both a user name component and a host name component, and are specified as
'user_name'@'host_name' .
The user name and host name may be unquoted, quoted as strings using double quotes ( " ) or single quotes ( ' ), or
quoted as identifiers using backticks ( ` ). You must use quotes when using special characters (such as a hyphen) or
wildcard characters. If you quote, you must quote the user name and host name separately (for example
'user_name'@'host_name' ).

Host Name Component


If the host name is not provided, it is assumed to be '%' .
Host names may contain the wildcard characters % and _ . They are matched as if by the LIKE clause. If you need to
use a wildcard character literally (for example, to match a domain name with an underscore), prefix the character with a
backslash. See LIKE for more information on escaping wildcard characters.
Host name matches are case-insensitive. Host names can match either domain names or IP addresses. Use
'localhost' as the host name to allow only local client connections.
You can use a netmask to match a range of IP addresses using 'base_ip/netmask' as the host name. A user with an
IP address ip_addr will be allowed to connect if the following condition is true:

ip_addr & netmask = base_ip

For example, given a user:

CREATE USER 'maria'@'247.150.130.0/255.255.255.0';

the IP addresses satisfying this condition range from 247.150.130.0 to 247.150.130.255.


Using 255.255.255.255 is equivalent to not using a netmask at all. Netmasks cannot be used for IPv6 addresses.
Note that the credentials added when creating a user with the '%' wildcard host will not grant access in all cases. For
example, some systems come with an anonymous localhost user, and when connecting from localhost this will take
precedence.
Before MariaDB 10.6, the host name component could be up to 60 characters in length. Starting from MariaDB 10.6, it
can be up to 255 characters.

User Name Component


User names must match exactly, including case. A user name that is empty is known as an anonymous account and is
allowed to match a login attempt with any user name component. These are described more in the next section.
For valid identifiers to use as user names, see Identifier Names.
It is possible for more than one account to match when a user connects. MariaDB selects the first matching account
after sorting according to the following criteria:
Accounts with an exact host name are sorted before accounts using a wildcard in the host name. Host names
using a netmask are considered to be exact for sorting.
Accounts with a wildcard in the host name are sorted according to the position of the first wildcard character.
Those with a wildcard character later in the host name sort before those with a wildcard character earlier in the
host name.
Accounts with a non-empty user name sort before accounts with an empty user name.
Accounts with an empty user name are sorted last. As mentioned previously, these are known as anonymous
accounts. These are described more in the next section.
The following table shows a list of example account as sorted by these criteria:

51/3812
+---------+-------------+
| User | Host |
+---------+-------------+
| joffrey | 192.168.0.3 |
| | 192.168.0.% |
| joffrey | 192.168.% |
| | 192.168.% |
+---------+-------------+

Once connected, you only have the privileges granted to the account that matched, not all accounts that could have
matched. For example, consider the following commands:

CREATE USER 'joffrey'@'192.168.0.3';


CREATE USER 'joffrey'@'%';
GRANT SELECT ON test.t1 to 'joffrey'@'192.168.0.3';
GRANT SELECT ON test.t2 to 'joffrey'@'%';

If you connect as joffrey from 192.168.0.3 , you will have the SELECT privilege on the table test.t1 , but not on the
table test.t2 . If you connect as joffrey from any other IP address, you will have the SELECT privilege on the table
test.t2 , but not on the table test.t1 .
Usernames can be up to 80 characters long before 10.6 and starting from 10.6 it can be 128 characters long.

Anonymous Accounts
Anonymous accounts are accounts where the user name portion of the account name is empty. These accounts act as
special catch-all accounts. If a user attempts to log into the system from a host, and an anonymous account exists with a
host name portion that matches the user's host, then the user will log in as the anonymous account if there is no more
specific account match for the user name that the user entered.
For example, here are some anonymous accounts:

CREATE USER ''@'localhost';


CREATE USER ''@'192.168.0.3';

Fixing a Legacy Default Anonymous Account


On some systems, the mysql.db table has some entries for the ''@'%' anonymous account by default. Unfortunately,
there is no matching entry in the mysql.user/mysql.global_priv_table table, which means that this anonymous account
doesn't exactly exist, but it does have privileges--usually on the default test database created by mysql_install_db.
These account-less privileges are a legacy that is leftover from a time when MySQL's privilege system was less
advanced.
This situation means that you will run into errors if you try to create a ''@'%' account. For example:

CREATE USER ''@'%';


ERROR 1396 (HY000): Operation CREATE USER failed for ''@'%'

The fix is to DELETE the row in the mysql.db table and then execute FLUSH PRIVILEGES:

DELETE FROM mysql.db WHERE User='' AND Host='%';


FLUSH PRIVILEGES;

And then the account can be created:

CREATE USER ''@'%';


Query OK, 0 rows affected (0.01 sec)

See MDEV-13486 for more information.

Password Expiry
MariaDB starting with 10.4.3
Besides automatic password expiry, as determined by default_password_lifetime, password expiry times can be set
on an individual user basis, overriding the global setting, for example:
CREATE USER 'monty'@'localhost' PASSWORD EXPIRE INTERVAL 120 DAY;

See User Password Expiry for more details.

52/3812
Account Locking
MariaDB starting with 10.4.2
Account locking permits privileged administrators to lock/unlock user accounts. No new client connections will be
permitted if an account is locked (existing connections are not affected). For example:
CREATE USER 'marijn'@'localhost' ACCOUNT LOCK;

See Account Locking for more details.

From MariaDB 10.4.7 and MariaDB 10.5.8, the lock_option and password_option clauses can occur in either order.

See Also
Troubleshooting Connection Issues
Authentication from MariaDB 10.4
Identifier Names
GRANT
ALTER USER
DROP USER
SET PASSWORD
SHOW CREATE USER
mysql.user table
mysql.global_priv_table
Password Validation Plugins - permits the setting of basic criteria for passwords
Authentication Plugins - allow various authentication methods to be used, and new ones to be developed.

53/3812
1.1.1.1.2 ALTER USER
Syntax
ALTER USER [IF EXISTS]
user_specification [,user_specification] ...
[REQUIRE {NONE | tls_option [[AND] tls_option] ...}]
[WITH resource_option [resource_option] ...]
[lock_option] [password_option]

user_specification:
username [authentication_option]

authentication_option:
IDENTIFIED BY 'password'
| IDENTIFIED BY PASSWORD 'password_hash'
| IDENTIFIED {VIA|WITH} authentication_rule [OR authentication_rule] ...

authentication_rule:
authentication_plugin
| authentication_plugin {USING|AS} 'authentication_string'
| authentication_plugin {USING|AS} PASSWORD('password')

tls_option
SSL
| X509
| CIPHER 'cipher'
| ISSUER 'issuer'
| SUBJECT 'subject'

resource_option
MAX_QUERIES_PER_HOUR count
| MAX_UPDATES_PER_HOUR count
| MAX_CONNECTIONS_PER_HOUR count
| MAX_USER_CONNECTIONS count
| MAX_STATEMENT_TIME time

password_option:
PASSWORD EXPIRE
| PASSWORD EXPIRE DEFAULT
| PASSWORD EXPIRE NEVER
| PASSWORD EXPIRE INTERVAL N DAY

lock_option:
ACCOUNT LOCK
| ACCOUNT UNLOCK
}

Contents
1. Syntax
2. Description
3. IF EXISTS
4. Account Names
5. Authentication Options
1. IDENTIFIED BY 'password'
2. IDENTIFIED BY PASSWORD
'password_hash'
3. IDENTIFIED {VIA|WITH}
authentication_plugin
6. TLS Options
7. Resource Limit Options
8. Password Expiry
9. Account Locking
10. See Also

Description
The ALTER USER statement modifies existing MariaDB accounts. To use it, you must have the global CREATE USER
privilege or the UPDATE privilege for the mysql database. The global SUPER privilege is also required if the read_only
system variable is enabled.
If any of the specified user accounts do not yet exist, an error results. If an error occurs, ALTER USER will still modify the
accounts that do not result in an error. Only one error is produced for all users which have not been modified.

54/3812
IF EXISTS
When the IF EXISTS clause is used, MariaDB will return a warning instead of an error for each specified user that
does not exist.

Account Names
For ALTER USER statements, account names are specified as the username argument in the same way as they are for
CREATE USER statements. See account names from the CREATE USER page for details on how account names are
specified.
CURRENT_USER or CURRENT_USER() can also be used to alter the account logged into the current session. For
example, to change the current user's password to mariadb :

ALTER USER CURRENT_USER() IDENTIFIED BY 'mariadb';

Authentication Options
MariaDB starting with 10.4
From MariaDB 10.4, it is possible to use more than one authentication plugin for each user account. For example, this
can be useful to slowly migrate users to the more secure ed25519 authentication plugin over time, while allowing the
old mysql_native_password authentication plugin as an alternative for the transitional period. See Authentication from
MariaDB 10.4 for more.
When running ALTER USER , not specifying an authentication option in the IDENTIFIED VIA clause will remove that
authentication method. (However this was not the case before MariaDB 10.4.13, see MDEV-21928 )
For example, a user is created with the ability to authenticate via both a password and unix_socket:
CREATE USER 'bob'@'localhost'
IDENTIFIED VIA mysql_native_password USING PASSWORD('pwd')
OR unix_socket;

SHOW CREATE USER 'bob'@'localhost'\G


*************************** 1. row ***************************
CREATE USER for bob@localhost: CREATE USER `bob`@`localhost`
IDENTIFIED VIA mysql_native_password
USING '*975B2CD4FF9AE554FE8AD33168FBFC326D2021DD'
OR unix_socket

If the user's password is updated, but unix_socket authentication is not specified in the IDENTIFIED VIA clause,
unix_socket authentication will no longer be permitted.
ALTER USER 'bob'@'localhost' IDENTIFIED VIA mysql_native_password
USING PASSWORD('pwd2');

SHOW CREATE USER 'bob'@'localhost'\G


*************************** 1. row ***************************
CREATE USER for bob@localhost: CREATE USER `bob`@`localhost`
IDENTIFIED BY PASSWORD '*38366FDA01695B6A5A9DD4E428D9FB8F7EB75512'

IDENTIFIED BY 'password'
The optional IDENTIFIED BY clause can be used to provide an account with a password. The password should be
specified in plain text. It will be hashed by the PASSWORD function prior to being stored to the mysql.user table.
For example, if our password is mariadb , then we can set the account's password with:

ALTER USER foo2@test IDENTIFIED BY 'mariadb';

If you do not specify a password with the IDENTIFIED BY clause, the user will be able to connect without a password. A
blank password is not a wildcard to match any password. The user must connect without providing a password if no
password is set.
The only authentication plugins that this clause supports are mysql_native_password and mysql_old_password.

IDENTIFIED BY PASSWORD 'password_hash'


The optional IDENTIFIED BY PASSWORD clause can be used to provide an account with a password that has already
been hashed. The password should be specified as a hash that was provided by the PASSWORD#function. It will be
55/3812
stored to the mysql.user table as-is.
For example, if our password is mariadb , then we can find the hash with:

SELECT PASSWORD('mariadb');
+-------------------------------------------+
| PASSWORD('mariadb') |
+-------------------------------------------+
| *54958E764CE10E50764C2EECBB71D01F08549980 |
+-------------------------------------------+

And then we can set an account's password with the hash:

ALTER USER foo2@test


IDENTIFIED BY PASSWORD '*54958E764CE10E50764C2EECBB71D01F08549980';

If you do not specify a password with the IDENTIFIED BY clause, the user will be able to connect without a password. A
blank password is not a wildcard to match any password. The user must connect without providing a password if no
password is set.
The only authentication plugins that this clause supports are mysql_native_password and mysql_old_password.

IDENTIFIED {VIA|WITH} authentication_plugin


The optional IDENTIFIED VIA authentication_plugin allows you to specify that the account should be authenticated
by a specific authentication plugin. The plugin name must be an active authentication plugin as per SHOW PLUGINS. If
it doesn't show up in that output, then you will need to install it with INSTALL PLUGIN or INSTALL SONAME.
For example, this could be used with the PAM authentication plugin:

ALTER USER foo2@test IDENTIFIED VIA pam;

Some authentication plugins allow additional arguments to be specified after a USING or AS keyword. For example, the
PAM authentication plugin accepts a service name:

ALTER USER foo2@test IDENTIFIED VIA pam USING 'mariadb';

The exact meaning of the additional argument would depend on the specific authentication plugin.
In MariaDB 10.4 and later, the USING or AS keyword can also be used to provide a plain-text password to a plugin if it's
provided as an argument to the PASSWORD() function. This is only valid for authentication plugins that have
implemented a hook for the PASSWORD() function. For example, the ed25519 authentication plugin supports this:

ALTER USER safe@'%' IDENTIFIED VIA ed25519 USING PASSWORD('secret');

TLS Options
By default, MariaDB transmits data between the server and clients without encrypting it. This is generally acceptable
when the server and client run on the same host or in networks where security is guaranteed through other means.
However, in cases where the server and client exist on separate networks or they are in a high-risk network, the lack of
encryption does introduce security concerns as a malicious actor could potentially eavesdrop on the traffic as it is sent
over the network between them.
To mitigate this concern, MariaDB allows you to encrypt data in transit between the server and clients using the
Transport Layer Security (TLS) protocol. TLS was formerly known as Secure Socket Layer (SSL), but strictly speaking
the SSL protocol is a predecessor to TLS and, that version of the protocol is now considered insecure. The
documentation still uses the term SSL often and for compatibility reasons TLS-related server system and status
variables still use the prefix ssl_, but internally, MariaDB only supports its secure successors.
See Secure Connections Overview for more information about how to determine whether your MariaDB server has TLS
support.
You can set certain TLS-related restrictions for specific user accounts. For instance, you might use this with user
accounts that require access to sensitive data while sending it across networks that you do not control. These
restrictions can be enabled for a user account with the CREATE USER, ALTER USER, or GRANT statements. The
following options are available:

Option Description
REQUIRE
TLS is not required for this account, but can still be used.
NONE

REQUIRE The account must use TLS, but no valid X509 certificate is required. This option cannot be combined
SSL with other TLS options.
56/3812
REQUIRE The account must use TLS and must have a valid X509 certificate. This option implies REQUIRE SSL .
X509 This option cannot be combined with other TLS options.
REQUIRE The account must use TLS and must have a valid X509 certificate. Also, the Certificate Authority must be
ISSUER the one specified via the string issuer . This option implies REQUIRE X509 . This option can be combined
'issuer' with the SUBJECT , and CIPHER options in any order.
REQUIRE The account must use TLS and must have a valid X509 certificate. Also, the certificate's Subject must be
SUBJECT the one specified via the string subject . This option implies REQUIRE X509 . This option can be
'subject' combined with the ISSUER , and CIPHER options in any order.
REQUIRE The account must use TLS, but no valid X509 certificate is required. Also, the encryption used for the
CIPHER connection must use a specific cipher method specified in the string cipher . This option implies
'cipher' REQUIRE SSL . This option can be combined with the ISSUER , and SUBJECT options in any order.

The REQUIRE keyword must be used only once for all specified options, and the AND keyword can be used to separate
individual options, but it is not required.
For example, you can alter a user account to require these TLS options with the following:

ALTER USER 'alice'@'%'


REQUIRE SUBJECT '/CN=alice/O=My Dom, Inc./C=US/ST=Oregon/L=Portland' AND
ISSUER '/C=FI/ST=Somewhere/L=City/ O=Some Company/CN=Peter Parker/[email protected]'
AND CIPHER 'SHA-DES-CBC3-EDH-RSA';

If any of these options are set for a specific user account, then any client who tries to connect with that user account will
have to be configured to connect with TLS.
See Securing Connections for Client and Server for information on how to enable TLS on the client and server.

Resource Limit Options


It is possible to set per-account limits for certain server resources. The following table shows the values that can be set
per account:

Limit Type Description


MAX_QUERIES_PER_HOUR Number of statements that the account can issue per hour (including updates)
MAX_UPDATES_PER_HOUR Number of updates (not queries) that the account can issue per hour
MAX_CONNECTIONS_PER_HOUR Number of connections that the account can start per hour
Number of simultaneous connections that can be accepted from the same account; if it
MAX_USER_CONNECTIONS is 0, max_connections will be used instead; if max_connections is 0, there is no limit
for this account's simultaneous connections.
Timeout, in seconds, for statements executed by the user. See also Aborting
MAX_STATEMENT_TIME
Statements that Exceed a Certain Time to Execute.

If any of these limits are set to 0 , then there is no limit for that resource for that user.
Here is an example showing how to set an account's resource limits:

ALTER USER 'someone'@'localhost' WITH


MAX_USER_CONNECTIONS 10
MAX_QUERIES_PER_HOUR 200;

The resources are tracked per account, which means 'user'@'server' ; not per user name or per connection.
The count can be reset for all users using FLUSH USER_RESOURCES, FLUSH PRIVILEGES or mysqladmin reload.
Per account resource limits are stored in the user table, in the mysql database. Columns used for resources limits are
named max_questions , max_updates , max_connections (for MAX_CONNECTIONS_PER_HOUR ), and
max_user_connections (for MAX_USER_CONNECTIONS ).

Password Expiry
MariaDB starting with 10.4.3
Besides automatic password expiry, as determined by default_password_lifetime, password expiry times can be set
on an individual user basis, overriding the global setting, for example:
ALTER USER 'monty'@'localhost' PASSWORD EXPIRE INTERVAL 120 DAY;
ALTER USER 'monty'@'localhost' PASSWORD EXPIRE NEVER;
ALTER USER 'monty'@'localhost' PASSWORD EXPIRE DEFAULT;

57/3812
See User Password Expiry for more details.

Account Locking
MariaDB starting with 10.4.2
Account locking permits privileged administrators to lock/unlock user accounts. No new client connections will be
permitted if an account is locked (existing connections are not affected). For example:
ALTER USER 'marijn'@'localhost' ACCOUNT LOCK;

See Account Locking for more details.

From MariaDB 10.4.7 and MariaDB 10.5.8, the lock_option and password_option clauses can occur in either order.

See Also
Authentication from MariaDB 10.4
GRANT
CREATE USER
DROP USER
SET PASSWORD
SHOW CREATE USER
mysql.user table
Password Validation Plugins - permits the setting of basic criteria for passwords
Authentication Plugins - allow various authentication methods to be used, and new ones to be developed.

1.1.1.1.3 DROP USER


Syntax
DROP USER [IF EXISTS] user_name [, user_name] ...

Contents
1. Syntax
2. Description
1. IF EXISTS
3. Examples
4. See Also

Description
The DROP USER statement removes one or more MariaDB accounts. It removes privilege rows for the account from all
grant tables. To use this statement, you must have the global CREATE USER privilege or the DELETE privilege for the
mysql database. Each account is named using the same format as for the CREATE USER statement; for example,
'jeffrey'@'localhost' . If you specify only the user name part of the account name, a host name part of '%' is used.
For additional information about specifying account names, see CREATE USER.
Note that, if you specify an account that is currently connected, it will not be deleted until the connection is closed. The
connection will not be automatically closed.
If any of the specified user accounts do not exist, ERROR 1396 (HY000) results. If an error occurs, DROP USER will still
drop the accounts that do not result in an error. Only one error is produced for all users which have not been dropped:

ERROR 1396 (HY000): Operation DROP USER failed for 'u1'@'%','u2'@'%'

Failed CREATE or DROP operations, for both users and roles, produce the same error code.

IF EXISTS
If the IF EXISTS clause is used, MariaDB will return a note instead of an error if the user does not exist.

Examples
58/3812
DROP USER bob;

IF EXISTS :

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 |
+-------+------+---------------------------------------------+

See Also
CREATE USER
ALTER USER
GRANT
SHOW CREATE USER
mysql.user table

59/3812
1.1.1.1.4 GRANT
Contents
1. Syntax
2. Description
1. Account Names
2. Implicit Account Creation
3. Privilege Levels
1. The USAGE Privilege
2. The ALL PRIVILEGES Privilege
3. The GRANT OPTION Privilege
4. Global Privileges
1. BINLOG ADMIN
2. BINLOG MONITOR
3. BINLOG REPLAY
4. CONNECTION ADMIN
5. CREATE USER
6. FEDERATED ADMIN
7. FILE
8. GRANT OPTION
9. PROCESS
10. READ_ONLY ADMIN
11. RELOAD
12. REPLICATION CLIENT
13. REPLICATION MASTER ADMIN
14. REPLICA MONITOR
15. REPLICATION REPLICA
16. REPLICATION SLAVE
17. REPLICATION SLAVE ADMIN
18. SET USER
19. SHOW DATABASES
20. SHUTDOWN
21. SUPER
5. Database Privileges
6. Table Privileges
7. Column Privileges
8. Function Privileges
9. Procedure Privileges
10. Proxy Privileges
4. Authentication Options
1. IDENTIFIED BY 'password'
2. IDENTIFIED BY PASSWORD 'password_hash'
3. IDENTIFIED {VIA|WITH} authentication_plugin
5. Resource Limit Options
6. TLS Options
7. Roles
1. Syntax
8. TO PUBLIC
1. Syntax
3. Grant Examples
1. Granting Root-like Privileges
4. See Also

Syntax

60/3812
GRANT
priv_type [(column_list)]
[, priv_type [(column_list)]] ...
ON [object_type] priv_level
TO user_specification [ user_options ...]

user_specification:
username [authentication_option]
| PUBLIC
authentication_option:
IDENTIFIED BY 'password'
| IDENTIFIED BY PASSWORD 'password_hash'
| IDENTIFIED {VIA|WITH} authentication_rule [OR authentication_rule ...]

authentication_rule:
authentication_plugin
| authentication_plugin {USING|AS} 'authentication_string'
| authentication_plugin {USING|AS} PASSWORD('password')

GRANT PROXY ON username


TO user_specification [, user_specification ...]
[WITH GRANT OPTION]

GRANT rolename TO grantee [, grantee ...]


[WITH ADMIN OPTION]

grantee:
rolename
username [authentication_option]

user_options:
[REQUIRE {NONE | tls_option [[AND] tls_option] ...}]
[WITH with_option [with_option] ...]

object_type:
TABLE
| FUNCTION
| PROCEDURE
| PACKAGE

priv_level:
*
| *.*
| db_name.*
| db_name.tbl_name
| tbl_name
| db_name.routine_name

with_option:
GRANT OPTION
| resource_option

resource_option:
MAX_QUERIES_PER_HOUR count
| MAX_UPDATES_PER_HOUR count
| MAX_CONNECTIONS_PER_HOUR count
| MAX_USER_CONNECTIONS count
| MAX_STATEMENT_TIME time

tls_option:
SSL
| X509
| CIPHER 'cipher'
| ISSUER 'issuer'
| SUBJECT 'subject'

Description
The GRANT statement allows you to grant privileges or roles to accounts. To use GRANT , you must have the GRANT
OPTION privilege, and you must have the privileges that you are granting.
Use the REVOKE statement to revoke privileges granted with the GRANT statement.
Use the SHOW GRANTS statement to determine what privileges an account has.

Account Names
For GRANT statements, account names are specified as the username argument in the same way as they are for
61/3812
CREATE USER statements. See account names from the CREATE USER page for details on how account names are
specified.

Implicit Account Creation


The GRANT statement also allows you to implicitly create accounts in some cases.
If the account does not yet exist, then GRANT can implicitly create it. To implicitly create an account with GRANT , a user
is required to have the same privileges that would be required to explicitly create the account with the CREATE USER
statement.
If the NO_AUTO_CREATE_USER SQL_MODE is set, then accounts can only be created if authentication information is
specified, or with a CREATE USER statement. If no authentication information is provided, GRANT will produce an error
when the specified account does not exist, for example:

show variables like '%sql_mode%' ;


+---------------+--------------------------------------------+
| Variable_name | Value |
+---------------+--------------------------------------------+
| sql_mode | NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+---------------+--------------------------------------------+

GRANT USAGE ON *.* TO 'user123'@'%' IDENTIFIED BY '';


ERROR 1133 (28000): Can't find any matching row in the user table

GRANT USAGE ON *.* TO 'user123'@'%'


IDENTIFIED VIA PAM using 'mariadb' require ssl ;
Query OK, 0 rows affected (0.00 sec)

select host, user from mysql.user where user='user123' ;

+------+----------+
| host | user |
+------+----------+
| % | user123 |
+------+----------+

Privilege Levels
Privileges can be set globally, for an entire database, for a table or routine, or for individual columns in a table. Certain
privileges can only be set at certain levels.
Global privileges priv_type are granted using *.* for priv_level . Global privileges include privileges to administer
the database and manage user accounts, as well as privileges for all tables, functions, and procedures. Global
privileges are stored in the mysql.user table prior to MariaDB 10.4, and in mysql.global_priv table afterwards.
Database privileges priv_type are granted using db_name.* for priv_level , or using just * to use default
database. Database privileges include privileges to create tables and functions, as well as privileges for all tables,
functions, and procedures in the database. Database privileges are stored in the mysql.db table.
Table privileges priv_type are granted using db_name.tbl_name for priv_level , or using just tbl_name to specify
a table in the default database. The TABLE keyword is optional. Table privileges include the ability to select and
change data in the table. Certain table privileges can be granted for individual columns.
Column privileges priv_type are granted by specifying a table for priv_level and providing a column list after the
privilege type. They allow you to control exactly which columns in a table users can select and change.
Function privileges priv_type are granted using FUNCTION db_name.routine_name for priv_level , or using just
FUNCTION routine_name to specify a function in the default database.
Procedure privileges priv_type are granted using PROCEDURE db_name.routine_name for priv_level , or using just
PROCEDURE routine_name to specify a procedure in the default database.

The USAGE Privilege


The USAGE privilege grants no real privileges. The SHOW GRANTS statement will show a global USAGE privilege for a
newly-created user. You can use USAGE with the GRANT statement to change options like GRANT OPTION and
MAX_USER_CONNECTIONS without changing any account privileges.

The ALL PRIVILEGES Privilege


The ALL PRIVILEGES privilege grants all available privileges. Granting all privileges only affects the given privilege
level. For example, granting all privileges on a table does not grant any privileges on the database or globally.
Using ALL PRIVILEGES does not grant the special GRANT OPTION privilege.
You can use ALL instead of ALL PRIVILEGES .

The GRANT OPTION Privilege


62/3812
Use the WITH GRANT OPTION clause to give users the ability to grant privileges to other users at the given privilege
level. Users with the GRANT OPTION privilege can only grant privileges they have. They cannot grant privileges at a
higher privilege level than they have the GRANT OPTION privilege.
The GRANT OPTION privilege cannot be set for individual columns. If you use WITH GRANT OPTION when specifying
column privileges, the GRANT OPTION privilege will be granted for the entire table.
Using the WITH GRANT OPTION clause is equivalent to listing GRANT OPTION as a privilege.

Global Privileges
The following table lists the privileges that can be granted globally. You can also grant all database, table, and function
privileges globally. When granted globally, these privileges apply to all databases, tables, or functions, including those
created later.
To set a global privilege, use *.* for priv_level .

BINLOG ADMIN

Enables administration of the binary log, including the PURGE BINARY LOGS statement and setting the system
variables:
binlog_annotate_row_events
binlog_cache_size
binlog_commit_wait_count
binlog_commit_wait_usec
binlog_direct_non_transactional_updates
binlog_expire_logs_seconds
binlog_file_cache_size
binlog_format
binlog_row_image
binlog_row_metadata
binlog_stmt_cache_size
expire_logs_days
log_bin_compress
log_bin_compress_min_len
log_bin_trust_function_creators
max_binlog_cache_size
max_binlog_size
max_binlog_stmt_cache_size
sql_log_bin and
sync_binlog.
Added in MariaDB 10.5.2.

BINLOG MONITOR

New name for REPLICATION CLIENT from MariaDB 10.5.2, ( REPLICATION CLIENT still supported as an alias for
compatibility purposes). Permits running SHOW commands related to the binary log, in particular the SHOW BINLOG
STATUS and SHOW BINARY LOGS statements. Unlike REPLICATION CLIENT prior to MariaDB 10.5, SHOW
REPLICA STATUS isn't included in this privilege, and REPLICA MONITOR is required.

BINLOG REPLAY

Enables replaying the binary log with the BINLOG statement (generated by mariadb-binlog), executing SET timestamp
when secure_timestamp is set to replication , and setting the session values of system variables usually included in
BINLOG output, in particular:
gtid_domain_id
gtid_seq_no
pseudo_thread_id
server_id.
Added in MariaDB 10.5.2

CONNECTION ADMIN

Enables administering connection resource limit options. This includes ignoring the limits specified by:
max_connections
max_user_connections and
max_password_errors.
The statements specified in init_connect are not executed, killing connections and queries owned by other users is
permitted. The following connection-related system variables can be changed:
connect_timeout
63/3812
disconnect_on_expired_password
extra_max_connections
init_connect
max_connections
max_connect_errors
max_password_errors
proxy_protocol_networks
secure_auth
slow_launch_time
thread_pool_exact_stats
thread_pool_dedicated_listener
thread_pool_idle_timeout
thread_pool_max_threads
thread_pool_min_threads
thread_pool_oversubscribe
thread_pool_prio_kickup_timer
thread_pool_priority
thread_pool_size, and
thread_pool_stall_limit.
Added in MariaDB 10.5.2.

CREATE USER

Create a user using the CREATE USER statement, or implicitly create a user with the GRANT statement.

FEDERATED ADMIN

Execute CREATE SERVER, ALTER SERVER, and DROP SERVER statements. Added in MariaDB 10.5.2.

FILE
Read and write files on the server, using statements like LOAD DATA INFILE or functions like LOAD_FILE(). Also
needed to create CONNECT outward tables. MariaDB server must have the permissions to access those files.

GRANT OPTION

Grant global privileges. You can only grant privileges that you have.

PROCESS

Show information about the active processes, for example via SHOW PROCESSLIST or mysqladmin processlist. If you
have the PROCESS privilege, you can see all threads. Otherwise, you can see only your own threads (that is, threads
associated with the MariaDB account that you are using).

READ_ONLY ADMIN

User can set the read_only system variable and allows the user to perform write operations, even when the read_only
option is active. Added in MariaDB 10.5.2.
From MariaDB 10.11.0, the READ_ONLY ADMIN privilege has been removed from SUPER. The benefit of this is that one
can remove the READ_ONLY ADMIN privilege from all users and ensure that no one can make any changes on any
non-temporary tables. This is useful on replicas when one wants to ensure that the replica is kept identical to the
primary.

RELOAD

Execute FLUSH statements or equivalent mariadb-admin/mysqladmin commands.

REPLICATION CLIENT

Execute SHOW MASTER STATUS and SHOW BINARY LOGS informative statements. Renamed to BINLOG
MONITOR in MariaDB 10.5.2 (but still supported as an alias for compatibility reasons). SHOW SLAVE STATUS was
part of REPLICATION CLIENT prior to MariaDB 10.5.

REPLICATION MASTER ADMIN


Permits administration of primary servers, including the SHOW REPLICA HOSTS statement, and setting the
gtid_binlog_state, gtid_domain_id, master_verify_checksum and server_id system variables. Added in MariaDB 10.5.2.

REPLICA MONITOR

Permit SHOW REPLICA STATUS and SHOW RELAYLOG EVENTS. From MariaDB 10.5.9.

64/3812
When a user would upgrade from an older major release to a MariaDB 10.5 minor release prior to MariaDB 10.5.9,
certain user accounts would lose capabilities. For example, a user account that had the REPLICATION CLIENT
privilege in older major releases could run SHOW REPLICA STATUS, but after upgrading to a MariaDB 10.5 minor
release prior to MariaDB 10.5.9, they could no longer run SHOW REPLICA STATUS, because that statement was
changed to require the REPLICATION REPLICA ADMIN privilege.
This issue is fixed in MariaDB 10.5.9 with this new privilege, which now grants the user the ability to execute SHOW
[ALL] (SLAVE | REPLICA) STATUS.
When a database is upgraded from an older major release to MariaDB Server 10.5.9 or later, any user accounts with
the REPLICATION CLIENT or REPLICATION SLAVE privileges will automatically be granted the new REPLICA
MONITOR privilege. The privilege fix occurs when the server is started up, not when mariadb-upgrade is performed.
However, when a database is upgraded from an early 10.5 minor release to 10.5.9 and later, the user will have to fix
any user account privileges manually.

REPLICATION REPLICA

Synonym for REPLICATION SLAVE. From MariaDB 10.5.1.

REPLICATION SLAVE

Accounts used by replica servers on the primary need this privilege. This is needed to get the updates made on the
master. From MariaDB 10.5.1, REPLICATION REPLICA is an alias for REPLICATION SLAVE .

REPLICATION SLAVE ADMIN


Permits administering replica servers, including START REPLICA/SLAVE, STOP REPLICA/SLAVE, CHANGE MASTER,
SHOW REPLICA/SLAVE STATUS, SHOW RELAYLOG EVENTS statements, replaying the binary log with the BINLOG
statement (generated by mariadb-binlog), and setting the system variables:
gtid_cleanup_batch_size
gtid_ignore_duplicates
gtid_pos_auto_engines
gtid_slave_pos
gtid_strict_mode
init_slave
read_binlog_speed_limit
relay_log_purge
relay_log_recovery
replicate_do_db
replicate_do_table
replicate_events_marked_for_skip
replicate_ignore_db
replicate_ignore_table
replicate_wild_do_table
replicate_wild_ignore_table
slave_compressed_protocol
slave_ddl_exec_mode
slave_domain_parallel_threads
slave_exec_mode
slave_max_allowed_packet
slave_net_timeout
slave_parallel_max_queued
slave_parallel_mode
slave_parallel_threads
slave_parallel_workers
slave_run_triggers_for_rbr
slave_sql_verify_checksum
slave_transaction_retry_interval
slave_type_conversions
sync_master_info
sync_relay_log, and
sync_relay_log_info.
Added in MariaDB 10.5.2.

SET USER
Enables setting the DEFINER when creating triggers, views, stored functions and stored procedures. Added in MariaDB
10.5.2.

SHOW DATABASES

List all databases using the SHOW DATABASES statement. Without the SHOW DATABASES privilege, you can still issue
65/3812
the SHOW DATABASES statement, but it will only list databases containing tables on which you have privileges.

SHUTDOWN

Shut down the server using SHUTDOWN or the mysqladmin shutdown command.

SUPER

Execute superuser statements: CHANGE MASTER TO, KILL (users who do not have this privilege can only KILL their
own threads), PURGE LOGS, SET global system variables, or the mysqladmin debug command. Also, this permission
allows the user to write data even if the read_only startup option is set, enable or disable logging, enable or disable
replication on replica, specify a DEFINER for statements that support that clause, connect once reaching the
MAX_CONNECTIONS . If a statement has been specified for the init-connect mysqld option, that command will not be
executed when a user with SUPER privileges connects to the server.
The SUPER privilege has been split into multiple smaller privileges from MariaDB 10.5.2 to allow for more fine-grained
privileges, although it remains an alias for these smaller privileges.
From MariaDB 10.11.0, the READ_ONLY ADMIN privilege has been removed from SUPER . The benefit of this is that
one can remove the READ_ONLY ADMIN privilege from all users and ensure that no one can make any changes on
any non-temporary tables. This is useful on replicas when one wants to ensure that the replica is kept identical to the
primary.

Database Privileges
The following table lists the privileges that can be granted at the database level. You can also grant all table and
function privileges at the database level. Table and function privileges on a database apply to all tables or functions in
that database, including those created later.
To set a privilege for a database, specify the database using db_name.* for priv_level , or just use * to specify the
default database.

Privilege Description
Create a database using the CREATE DATABASE statement, when the privilege is granted for a
CREATE database. You can grant the CREATE privilege on databases that do not yet exist. This also grants the
CREATE privilege on all tables in the database.

CREATE
Create Stored Programs using the CREATE PROCEDURE and CREATE FUNCTION statements.
ROUTINE

CREATE
Create temporary tables with the CREATE TEMPORARY TABLE statement. This privilege enable writing
TEMPORARY
and dropping those temporary tables
TABLES

Drop a database using the DROP DATABASE statement, when the privilege is granted for a database.
DROP
This also grants the DROP privilege on all tables in the database.
EVENT Create, drop and alter EVENT s.
GRANT
Grant database privileges. You can only grant privileges that you have.
OPTION

LOCK Acquire explicit locks using the LOCK TABLES statement; you also need to have the SELECT privilege on
TABLES a table, in order to lock it.

Table Privileges
Privilege Description
ALTER Change the structure of an existing table using the ALTER TABLE statement.
Create a table using the CREATE TABLE statement. You can grant the CREATE privilege on tables that
CREATE
do not yet exist.
CREATE
Create a view using the CREATE_VIEW statement.
VIEW

DELETE Remove rows from a table using the DELETE statement.


Remove historical rows from a table using the DELETE HISTORY statement. Displays as DELETE
VERSIONING ROWS when running SHOW GRANTS until MariaDB 10.3.15 and until MariaDB 10.4.5
DELETE (MDEV-17655 ), or when running SHOW PRIVILEGES until MariaDB 10.5.2, MariaDB 10.4.13 and
HISTORY MariaDB 10.3.23 (MDEV-20382 ). From MariaDB 10.3.4. From MariaDB 10.3.5, if a user has the
SUPER privilege but not this privilege, running mysql_upgrade will grant this privilege as well.

66/3812
Drop a table using the DROP TABLE statement or a view using the DROP VIEW statement. Also
DROP
required to execute the TRUNCATE TABLE statement.
GRANT
Grant table privileges. You can only grant privileges that you have.
OPTION

Create an index on a table using the CREATE INDEX statement. Without the INDEX privilege, you can
still create indexes when creating a table using the CREATE TABLE statement if the you have the
INDEX
CREATE privilege, and you can create indexes using the ALTER TABLE statement if you have the
ALTER privilege.

Add rows to a table using the INSERT statement. The INSERT privilege can also be set on individual
INSERT
columns; see Column Privileges below for details.
REFERENCES Unused.
Read data from a table using the SELECT statement. The SELECT privilege can also be set on
SELECT
individual columns; see Column Privileges below for details.
SHOW VIEW Show the CREATE VIEW statement to create a view using the SHOW CREATE VIEW statement.
Execute triggers associated to tables you update, execute the CREATE TRIGGER and DROP
TRIGGER
TRIGGER statements. You will still be able to see triggers.
Update existing rows in a table using the UPDATE statement. UPDATE statements usually include a
WHERE clause to update only certain rows. You must have SELECT privileges on the table or the
UPDATE
appropriate columns for the WHERE clause. The UPDATE privilege can also be set on individual
columns; see Column Privileges below for details.

Column Privileges
Some table privileges can be set for individual columns of a table. To use column privileges, specify the table explicitly
and provide a list of column names after the privilege type. For example, the following statement would allow the user to
read the names and positions of employees, but not other information from the same table, such as salaries.

GRANT SELECT (name, position) on Employee to 'jeffrey'@'localhost';

Privilege Description
Add rows specifying values in columns using the INSERT statement. If you only have column-level
INSERT
INSERT privileges, you must specify the columns you are setting in the INSERT statement. All other
(column_list)
columns will be set to their default values, or NULL .
REFERENCES
Unused.
(column_list)

Read values in columns using the SELECT statement. You cannot access or query any columns for
SELECT
which you do not have SELECT privileges, including in WHERE , ON , GROUP BY , and ORDER BY
(column_list)
clauses.
Update values in columns of existing rows using the UPDATE statement. UPDATE statements usually
UPDATE
include a WHERE clause to update only certain rows. You must have SELECT privileges on the table
(column_list)
or the appropriate columns for the WHERE clause.

Function Privileges
Privilege Description
ALTER
Change the characteristics of a stored function using the ALTER FUNCTION statement.
ROUTINE

Use a stored function. You need SELECT privileges for any tables or columns accessed by the
EXECUTE
function.
GRANT OPTION Grant function privileges. You can only grant privileges that you have.

Procedure Privileges
Privilege Description
ALTER
Change the characteristics of a stored procedure using the ALTER PROCEDURE statement.
ROUTINE

Execute a stored procedure using the CALL statement. The privilege to call a procedure may allow you to
EXECUTE
perform actions you wouldn't otherwise be able to do, such as insert rows into a table.

67/3812
GRANT
Grant procedure privileges. You can only grant privileges that you have.
OPTION

GRANT EXECUTE ON PROCEDURE mysql.create_db TO maintainer;

Proxy Privileges
Privilege Description
PROXY Permits one user to be a proxy for another.

The PROXY privilege allows one user to proxy as another user, which means their privileges change to that of the proxy
user, and the CURRENT_USER() function returns the user name of the proxy user.
The PROXY privilege only works with authentication plugins that support it. The default mysql_native_password
authentication plugin does not support proxy users.
The pam authentication plugin is the only plugin included with MariaDB that currently supports proxy users. The PROXY
privilege is commonly used with the pam authentication plugin to enable user and group mapping with PAM.
For example, to grant the PROXY privilege to an anonymous account that authenticates with the pam authentication
plugin, you could execute the following:

CREATE USER 'dba'@'%' IDENTIFIED BY 'strongpassword';


GRANT ALL PRIVILEGES ON *.* TO 'dba'@'%' ;

CREATE USER ''@'%' IDENTIFIED VIA pam USING 'mariadb';


GRANT PROXY ON 'dba'@'%' TO ''@'%';

A user account can only grant the PROXY privilege for a specific user account if the granter also has the PROXY
privilege for that specific user account, and if that privilege is defined WITH GRANT OPTION . For example, the following
example fails because the granter does not have the PROXY privilege for that specific user account at all:

SELECT USER(), CURRENT_USER();


+-----------------+-----------------+
| USER() | CURRENT_USER() |
+-----------------+-----------------+
| alice@localhost | alice@localhost |
+-----------------+-----------------+

SHOW GRANTS;
+------------------------------------------------------------------------------------------------------
-----------------+
| Grants for alice@localhost
|
+------------------------------------------------------------------------------------------------------
-----------------+
| GRANT ALL PRIVILEGES ON *.* TO 'alice'@'localhost' IDENTIFIED BY PASSWORD
'*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19' |
+------------------------------------------------------------------------------------------------------
-----------------+

GRANT PROXY ON 'dba'@'localhost' TO 'bob'@'localhost';


ERROR 1698 (28000): Access denied for user 'alice'@'localhost'

And the following example fails because the granter does have the PROXY privilege for that specific user account, but it
is not defined WITH GRANT OPTION :

68/3812
SELECT USER(), CURRENT_USER();
+-----------------+-----------------+
| USER() | CURRENT_USER() |
+-----------------+-----------------+
| alice@localhost | alice@localhost |
+-----------------+-----------------+

SHOW GRANTS;
+------------------------------------------------------------------------------------------------------
-----------------+
| Grants for alice@localhost
|
+------------------------------------------------------------------------------------------------------
-----------------+
| GRANT ALL PRIVILEGES ON *.* TO 'alice'@'localhost' IDENTIFIED BY PASSWORD
'*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19' |
| GRANT PROXY ON 'dba'@'localhost' TO 'alice'@'localhost'
|
+------------------------------------------------------------------------------------------------------
-----------------+

GRANT PROXY ON 'dba'@'localhost' TO 'bob'@'localhost';


ERROR 1698 (28000): Access denied for user 'alice'@'localhost'

But the following example succeeds because the granter does have the PROXY privilege for that specific user account,
and it is defined WITH GRANT OPTION :

SELECT USER(), CURRENT_USER();


+-----------------+-----------------+
| USER() | CURRENT_USER() |
+-----------------+-----------------+
| alice@localhost | alice@localhost |
+-----------------+-----------------+

SHOW GRANTS;
+------------------------------------------------------------------------------------------------------
-----------------------------------+
| Grants for alice@localhost
|
+------------------------------------------------------------------------------------------------------
-----------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'alice'@'localhost' IDENTIFIED BY PASSWORD
'*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19' WITH GRANT OPTION |
| GRANT PROXY ON 'dba'@'localhost' TO 'alice'@'localhost' WITH GRANT OPTION
|
+------------------------------------------------------------------------------------------------------
-----------------------------------+

GRANT PROXY ON 'dba'@'localhost' TO 'bob'@'localhost';

A user account can grant the PROXY privilege for any other user account if the granter has the PROXY privilege for the
''@'%' anonymous user account, like this:

GRANT PROXY ON ''@'%' TO 'dba'@'localhost' WITH GRANT OPTION;

For example, the following example succeeds because the user can grant the PROXY privilege for any other user
account:

69/3812
SELECT USER(), CURRENT_USER();
+-----------------+-----------------+
| USER() | CURRENT_USER() |
+-----------------+-----------------+
| alice@localhost | alice@localhost |
+-----------------+-----------------+

SHOW GRANTS;
+------------------------------------------------------------------------------------------------------
-----------------------------------+
| Grants for alice@localhost
|
+------------------------------------------------------------------------------------------------------
-----------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'alice'@'localhost' IDENTIFIED BY PASSWORD
'*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19' WITH GRANT OPTION |
| GRANT PROXY ON ''@'%' TO 'alice'@'localhost' WITH GRANT OPTION
|
+------------------------------------------------------------------------------------------------------
-----------------------------------+

GRANT PROXY ON 'app1_dba'@'localhost' TO 'bob'@'localhost';


Query OK, 0 rows affected (0.004 sec)

GRANT PROXY ON 'app2_dba'@'localhost' TO 'carol'@'localhost';


Query OK, 0 rows affected (0.004 sec)

The default root user accounts created by mysql_install_db have this privilege. For example:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;


GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION;

This allows the default root user accounts to grant the PROXY privilege for any other user account, and it also allows
the default root user accounts to grant others the privilege to do the same.

Authentication Options
The authentication options for the GRANT statement are the same as those for the CREATE USER statement.

IDENTIFIED BY 'password'
The optional IDENTIFIED BY clause can be used to provide an account with a password. The password should be
specified in plain text. It will be hashed by the PASSWORD function prior to being stored.
For example, if our password is mariadb , then we can create the user with:

GRANT USAGE ON *.* TO foo2@test IDENTIFIED BY 'mariadb';

If you do not specify a password with the IDENTIFIED BY clause, the user will be able to connect without a password. A
blank password is not a wildcard to match any password. The user must connect without providing a password if no
password is set.
If the user account already exists and if you provide the IDENTIFIED BY clause, then the user's password will be
changed. You must have the privileges needed for the SET PASSWORD statement to change a user's password with
GRANT .
The only authentication plugins that this clause supports are mysql_native_password and mysql_old_password.

IDENTIFIED BY PASSWORD 'password_hash'


The optional IDENTIFIED BY PASSWORD clause can be used to provide an account with a password that has already
been hashed. The password should be specified as a hash that was provided by the PASSWORD function. It will be
stored as-is.
For example, if our password is mariadb , then we can find the hash with:

SELECT PASSWORD('mariadb');
+-------------------------------------------+
| PASSWORD('mariadb') |
+-------------------------------------------+
| *54958E764CE10E50764C2EECBB71D01F08549980 |
+-------------------------------------------+
1 row in set (0.00 sec)

And then we can create a user with the hash:


70/3812
GRANT USAGE ON *.* TO foo2@test IDENTIFIED BY
PASSWORD '*54958E764CE10E50764C2EECBB71D01F08549980';

If you do not specify a password with the IDENTIFIED BY clause, the user will be able to connect without a password. A
blank password is not a wildcard to match any password. The user must connect without providing a password if no
password is set.
If the user account already exists and if you provide the IDENTIFIED BY clause, then the user's password will be
changed. You must have the privileges needed for the SET PASSWORD statement to change a user's password with
GRANT .
The only authentication plugins that this clause supports are mysql_native_password and mysql_old_password.

IDENTIFIED {VIA|WITH} authentication_plugin


The optional IDENTIFIED VIA authentication_plugin allows you to specify that the account should be authenticated
by a specific authentication plugin. The plugin name must be an active authentication plugin as per SHOW PLUGINS. If
it doesn't show up in that output, then you will need to install it with INSTALL PLUGIN or INSTALL SONAME.
For example, this could be used with the PAM authentication plugin:

GRANT USAGE ON *.* TO foo2@test IDENTIFIED VIA pam;

Some authentication plugins allow additional arguments to be specified after a USING or AS keyword. For example, the
PAM authentication plugin accepts a service name:

GRANT USAGE ON *.* TO foo2@test IDENTIFIED VIA pam USING 'mariadb';

The exact meaning of the additional argument would depend on the specific authentication plugin.

MariaDB starting with 10.4.0


The USING or AS keyword can also be used to provide a plain-text password to a plugin if it's provided as an
argument to the PASSWORD() function. This is only valid for authentication plugins that have implemented a hook for
the PASSWORD() function. For example, the ed25519 authentication plugin supports this:
CREATE USER safe@'%' IDENTIFIED VIA ed25519
USING PASSWORD('secret');

MariaDB starting with 10.4.3


One can specify many authentication plugins, they all work as alternatives ways of authenticating a user:
CREATE USER safe@'%' IDENTIFIED VIA ed25519
USING PASSWORD('secret') OR unix_socket;

By default, when you create a user without specifying an authentication plugin, MariaDB uses the
mysql_native_password plugin.

Resource Limit Options


It is possible to set per-account limits for certain server resources. The following table shows the values that can be set
per account:

Limit Type Decription


MAX_QUERIES_PER_HOUR Number of statements that the account can issue per hour (including updates)
MAX_UPDATES_PER_HOUR Number of updates (not queries) that the account can issue per hour
MAX_CONNECTIONS_PER_HOUR Number of connections that the account can start per hour
Number of simultaneous connections that can be accepted from the same account; if it
MAX_USER_CONNECTIONS is 0, max_connections will be used instead; if max_connections is 0, there is no limit
for this account's simultaneous connections.
Timeout, in seconds, for statements executed by the user. See also Aborting
MAX_STATEMENT_TIME
Statements that Exceed a Certain Time to Execute.

If any of these limits are set to 0 , then there is no limit for that resource for that user.

71/3812
To set resource limits for an account, if you do not want to change that account's privileges, you can issue a GRANT
statement with the USAGE privilege, which has no meaning. The statement can name some or all limit types, in any
order.
Here is an example showing how to set resource limits:

GRANT USAGE ON *.* TO 'someone'@'localhost' WITH


MAX_USER_CONNECTIONS 0
MAX_QUERIES_PER_HOUR 200;

The resources are tracked per account, which means 'user'@'server' ; not per user name or per connection.
The count can be reset for all users using FLUSH USER_RESOURCES, FLUSH PRIVILEGES or mysqladmin reload.
Users with the CONNECTION ADMIN privilege (in MariaDB 10.5.2 and later) or the SUPER privilege are not restricted by
max_user_connections , max_connections , or max_password_errors .
Per account resource limits are stored in the user table, in the mysql database. Columns used for resources limits are
named max_questions , max_updates , max_connections (for MAX_CONNECTIONS_PER_HOUR ), and
max_user_connections (for MAX_USER_CONNECTIONS ).

TLS Options
By default, MariaDB transmits data between the server and clients without encrypting it. This is generally acceptable
when the server and client run on the same host or in networks where security is guaranteed through other means.
However, in cases where the server and client exist on separate networks or they are in a high-risk network, the lack of
encryption does introduce security concerns as a malicious actor could potentially eavesdrop on the traffic as it is sent
over the network between them.
To mitigate this concern, MariaDB allows you to encrypt data in transit between the server and clients using the
Transport Layer Security (TLS) protocol. TLS was formerly known as Secure Socket Layer (SSL), but strictly speaking
the SSL protocol is a predecessor to TLS and, that version of the protocol is now considered insecure. The
documentation still uses the term SSL often and for compatibility reasons TLS-related server system and status
variables still use the prefix ssl_, but internally, MariaDB only supports its secure successors.
See Secure Connections Overview for more information about how to determine whether your MariaDB server has TLS
support.
You can set certain TLS-related restrictions for specific user accounts. For instance, you might use this with user
accounts that require access to sensitive data while sending it across networks that you do not control. These
restrictions can be enabled for a user account with the CREATE USER, ALTER USER, or GRANT statements. The
following options are available:

Option Description
REQUIRE
TLS is not required for this account, but can still be used.
NONE

REQUIRE The account must use TLS, but no valid X509 certificate is required. This option cannot be combined
SSL with other TLS options.
REQUIRE The account must use TLS and must have a valid X509 certificate. This option implies REQUIRE SSL .
X509 This option cannot be combined with other TLS options.
REQUIRE The account must use TLS and must have a valid X509 certificate. Also, the Certificate Authority must be
ISSUER the one specified via the string issuer . This option implies REQUIRE X509 . This option can be combined
'issuer' with the SUBJECT , and CIPHER options in any order.
REQUIRE The account must use TLS and must have a valid X509 certificate. Also, the certificate's Subject must be
SUBJECT the one specified via the string subject . This option implies REQUIRE X509 . This option can be
'subject' combined with the ISSUER , and CIPHER options in any order.
REQUIRE The account must use TLS, but no valid X509 certificate is required. Also, the encryption used for the
CIPHER connection must use a specific cipher method specified in the string cipher . This option implies
'cipher' REQUIRE SSL . This option can be combined with the ISSUER , and SUBJECT options in any order.

The REQUIRE keyword must be used only once for all specified options, and the AND keyword can be used to separate
individual options, but it is not required.
For example, you can create a user account that requires these TLS options with the following:

GRANT USAGE ON *.* TO 'alice'@'%'


REQUIRE SUBJECT '/CN=alice/O=My Dom, Inc./C=US/ST=Oregon/L=Portland'
AND ISSUER '/C=FI/ST=Somewhere/L=City/ O=Some Company/CN=Peter
Parker/[email protected]'
AND CIPHER 'SHA-DES-CBC3-EDH-RSA';

If any of these options are set for a specific user account, then any client who tries to connect with that user account will
72/3812
have to be configured to connect with TLS.
See Securing Connections for Client and Server for information on how to enable TLS on the client and server.

Roles
Syntax

GRANT role TO grantee [, grantee ... ]


[ WITH ADMIN OPTION ]

grantee:
rolename
username [authentication_option]

The GRANT statement is also used to grant the use a role to one or more users or other roles. In order to be able to
grant a role, the grantor doing so must have permission to do so (see WITH ADMIN in the CREATE ROLE article).
Specifying the WITH ADMIN OPTION permits the grantee to in turn grant the role to another.
For example, the following commands show how to grant the same role to a couple different users.

GRANT journalist TO hulda;

GRANT journalist TO berengar WITH ADMIN OPTION;

If a user has been granted a role, they do not automatically obtain all permissions associated with that role. These
permissions are only in use when the user activates the role with the SET ROLE statement.

TO PUBLIC
MariaDB starting with 10.11
Syntax
GRANT <privilege> ON <database>.<object> TO PUBLIC;
REVOKE <privilege> ON <database>.<object> FROM PUBLIC;

GRANT ... TO PUBLIC grants privileges to all users with access to the server. The privileges also apply to users
created after the privileges are granted. This can be useful when one only wants to state once that all users need to
have a certain set of privileges.
When running SHOW GRANTS, a user will also see all privileges inherited from PUBLIC. SHOW GRANTS FOR
PUBLIC will only show TO PUBLIC grants.

Grant Examples
Granting Root-like Privileges
You can create a user that has privileges similar to the default root accounts by executing the following:

CREATE USER 'alexander'@'localhost';


GRANT ALL PRIVILEGES ON *.* to 'alexander'@'localhost' WITH GRANT OPTION;

See Also
Troubleshooting Connection Issues
--skip-grant-tables allows you to start MariaDB without GRANT . This is useful if you lost your root password.
CREATE USER
ALTER USER
DROP USER
SET PASSWORD
SHOW CREATE USER
mysql.global_priv table
mysql.user table
Password Validation Plugins - permits the setting of basic criteria for passwords
Authentication Plugins - allow various authentication methods to be used, and new ones to be developed.

73/3812
1.1.1.1.5 RENAME USER
Syntax
RENAME USER old_user TO new_user
[, old_user TO new_user] ...

Description
The RENAME USER statement renames existing MariaDB accounts. To use it, you must have the global CREATE
USER privilege or the UPDATE privilege for the mysql database. Each account is named using the same format as for
the CREATE USER statement; for example, 'jeffrey'@'localhost' . If you specify only the user name part of the
account name, a host name part of '%' is used.
If any of the old user accounts do not exist or any of the new user accounts already exist, ERROR 1396 (HY000) results.
If an error occurs, RENAME USER will still rename the accounts that do not result in an error.

Examples
CREATE USER 'donald', 'mickey';
RENAME USER 'donald' TO 'duck'@'localhost', 'mickey' TO 'mouse'@'localhost';

1.1.1.1.6 REVOKE
Contents
1. Privileges
1. Syntax
2. Description
3. Examples
2. Roles
1. Syntax
2. Description
3. Example

Privileges
Syntax
REVOKE
priv_type [(column_list)]
[, priv_type [(column_list)]] ...
ON [object_type] priv_level
FROM user [, user] ...

REVOKE ALL PRIVILEGES, GRANT OPTION


FROM user [, user] ...

Description
The REVOKE statement enables system administrators to revoke privileges (or roles - see section below) from MariaDB
accounts. Each account is named using the same format as for the GRANT statement; for example,
' jeffrey'@'localhost '. If you specify only the user name part of the account name, a host name part of ' % ' is used.
For details on the levels at which privileges exist, the allowable priv_type and priv_level values, and the syntax for
specifying users and passwords, see GRANT.
To use the first REVOKE syntax, you must have the GRANT OPTION privilege, and you must have the privileges that you
are revoking.
To revoke all privileges, use the second syntax, which drops all global, database, table, column, and routine privileges
for the named user or users:

REVOKE ALL PRIVILEGES, GRANT OPTION FROM user [, user] ...

To use this REVOKE syntax, you must have the global CREATE USER privilege or the UPDATE privilege for the mysql
74/3812
database. See GRANT.

Examples
REVOKE SUPER ON *.* FROM 'alexander'@'localhost';

Roles
Syntax
REVOKE role [, role ...]
FROM grantee [, grantee2 ... ]

REVOKE ADMIN OPTION FOR role FROM grantee [, grantee2]

Description
REVOKE is also used to remove a role from a user or another role that it's previously been assigned to. If a role has
previously been set as a default role, REVOKE does not remove the record of the default role from the mysql.user table.
If the role is subsequently granted again, it will again be the user's default. Use SET DEFAULT ROLE NONE to
explicitly remove this.
Before MariaDB 10.1.13 , the REVOKE role statement was not permitted in prepared statements.

Example
REVOKE journalist FROM hulda

1.1.1.1.7 SET PASSWORD


Syntax
SET PASSWORD [FOR user] =
{
PASSWORD('some password')
| OLD_PASSWORD('some password')
| 'encrypted password'
}

Contents
1. Syntax
2. Description
3. Authentication Plugin Support
4. Passwordless User Accounts
5. Example
6. See Also

Description
The SET PASSWORD statement assigns a password to an existing MariaDB user account.
If the password is specified using the PASSWORD() or OLD_PASSWORD() function, the literal text of the password should
be given. If the password is specified without using either function, the password should be the already-encrypted
password value as returned by PASSWORD() .
OLD_PASSWORD() should only be used if your MariaDB/MySQL clients are very old (< 4.0.0).

With no FOR clause, this statement sets the password for the current user. Any client that has connected to the server
using a non-anonymous account can change the password for that account.
With a FOR clause, this statement sets the password for a specific account on the current server host. Only clients that
have the UPDATE privilege for the mysql database can do this. The user value should be given in
user_name@host_name format, where user_name and host_name are exactly as they are listed in the User and Host
columns of the mysql.user table (or view in MariaDB-10.4 onwards) entry.

75/3812
The argument to PASSWORD() and the password given to MariaDB clients can be of arbitrary length.

Authentication Plugin Support


MariaDB starting with 10.4
In MariaDB 10.4 and later, SET PASSWORD (with or without PASSWORD() ) works for accounts authenticated via any
authentication plugin that supports passwords stored in the mysql.global_priv table.
The ed25519 , mysql_native_password , and mysql_old_password authentication plugins store passwords in the
mysql.global_priv table.
If you run SET PASSWORD on an account that authenticates with one of these authentication plugins that stores
passwords in the mysql.global_priv table, then the PASSWORD() function is evaluated by the specific authentication
plugin used by the account. The authentication plugin hashes the password with a method that is compatible with that
specific authentication plugin.
The unix_socket , named_pipe , gssapi , and pam authentication plugins do not store passwords in the
mysql.global_priv table. These authentication plugins rely on other methods to authenticate the user.
If you attempt to run SET PASSWORD on an account that authenticates with one of these authentication plugins that
doesn't store a password in the mysql.global_priv table, then MariaDB Server will raise a warning like the
following:
SET PASSWORD is ignored for users authenticating via unix_socket plugin

See Authentication from MariaDB 10.4 for an overview of authentication changes in MariaDB 10.4.

MariaDB until 10.3


In MariaDB 10.3 and before, SET PASSWORD (with or without PASSWORD() ) only works for accounts authenticated via
mysql_native_password or mysql_old_password authentication plugins

Passwordless User Accounts


User accounts do not always require passwords to login.
The unix_socket , named_pipe and gssapi authentication plugins do not require a password to authenticate the
user.
The pam authentication plugin may or may not require a password to authenticate the user, depending on the specific
configuration.
The mysql_native_password and mysql_old_password authentication plugins require passwords for authentication,
but the password can be blank. In that case, no password is required.
If you provide a password while attempting to log into the server as an account that doesn't require a password, then
MariaDB server will simply ignore the password.

MariaDB starting with 10.4


In MariaDB 10.4 and later, a user account can be defined to use multiple authentication plugins in a specific order of
preference. This specific scenario may be more noticeable in these versions, since an account could be associated
with some authentication plugins that require a password, and some that do not.

Example
For example, if you had an entry with User and Host column values of ' bob ' and ' %.loc.gov ', you would write the
statement like this:

SET PASSWORD FOR 'bob'@'%.loc.gov' = PASSWORD('newpass');

If you want to delete a password for a user, you would do:

SET PASSWORD FOR 'bob'@localhost = PASSWORD("");

See Also
Password Validation Plugins - permits the setting of basic criteria for passwords
ALTER USER

76/3812
1.1.1.1.8 CREATE ROLE
Syntax
CREATE [OR REPLACE] ROLE [IF NOT EXISTS] role
[WITH ADMIN
{CURRENT_USER | CURRENT_ROLE | user | role}]

Contents
1. Syntax
2. Description
1. WITH ADMIN
2. OR REPLACE
3. IF NOT EXISTS
3. Examples
4. See Also

Description
The CREATE ROLE statement creates one or more MariaDB roles. To use it, you must have the global CREATE USER
privilege or the INSERT privilege for the mysql database. For each account, CREATE ROLE creates a new row in the
mysql.user table that has no privileges, and with the corresponding is_role field set to Y . It also creates a record in
the mysql.roles_mapping table.
If any of the specified roles already exist, ERROR 1396 (HY000) results. If an error occurs, CREATE ROLE will still create
the roles that do not result in an error. The maximum length for a role is 128 characters. Role names can be quoted, as
explained in the Identifier names page. Only one error is produced for all roles which have not been created:

ERROR 1396 (HY000): Operation CREATE ROLE failed for 'a','b','c'

Failed CREATE or DROP operations, for both users and roles, produce the same error code.
PUBLIC and NONE are reserved, and cannot be used as role names. NONE is used to unset a role and PUBLIC has a
special use in other systems, such as Oracle, so is reserved for compatibility purposes.
For valid identifiers to use as role names, see Identifier Names.

WITH ADMIN
The optional WITH ADMIN clause determines whether the current user, the current role or another user or role has use
of the newly created role. If the clause is omitted, WITH ADMIN CURRENT_USER is treated as the default, which means that
the current user will be able to GRANT this role to users.

OR REPLACE
If the optional OR REPLACE clause is used, it acts as a shortcut for:

DROP ROLE IF EXISTS name;


CREATE ROLE name ...;

IF NOT EXISTS
When the IF NOT EXISTS clause is used, MariaDB will return a warning instead of an error if the specified role already
exists. Cannot be used together with the OR REPLACE clause.

Examples
CREATE ROLE journalist;

CREATE ROLE developer WITH ADMIN lorinda@localhost;

Granting the role to another user. Only user lorinda@localhost has permission to grant the developer role:

77/3812
SELECT USER();
+-------------------+
| USER() |
+-------------------+
| henning@localhost |
+-------------------+
...
GRANT developer TO ian@localhost;
Access denied for user 'henning'@'localhost'

SELECT USER();
+-------------------+
| USER() |
+-------------------+
| lorinda@localhost |
+-------------------+

GRANT m_role TO ian@localhost;

The OR REPLACE and IF NOT EXISTS clauses. The journalist role already exists:

CREATE ROLE journalist;


ERROR 1396 (HY000): Operation CREATE ROLE failed for 'journalist'

CREATE OR REPLACE ROLE journalist;


Query OK, 0 rows affected (0.00 sec)

CREATE ROLE IF NOT EXISTS journalist;


Query OK, 0 rows affected, 1 warning (0.00 sec)

SHOW WARNINGS;
+-------+------+---------------------------------------------------+
| Level | Code | Message |
+-------+------+---------------------------------------------------+
| Note | 1975 | Can't create role 'journalist'; it already exists |
+-------+------+---------------------------------------------------+

See Also
Identifier Names
Roles Overview
DROP ROLE

1.1.1.1.9 DROP ROLE


Syntax
DROP ROLE [IF EXISTS] role_name [,role_name ...]

Contents
1. Syntax
2. Description
1. IF EXISTS
3. Examples
4. See Also

Description
The DROP ROLE statement removes one or more MariaDB roles. To use this statement, you must have the global
CREATE USER privilege or the DELETE privilege for the mysql database.
DROP ROLE does not disable roles for connections which selected them with SET ROLE. If a role has previously been
set as a default role, DROP ROLE does not remove the record of the default role from the mysql.user table. If the role is
subsequently recreated and granted, it will again be the user's default. Use SET DEFAULT ROLE NONE to explicitly
remove this.
If any of the specified user accounts do not exist, ERROR 1396 (HY000) results. If an error occurs, DROP ROLE will still
drop the roles that do not result in an error. Only one error is produced for all roles which have not been dropped:
78/3812
ERROR 1396 (HY000): Operation DROP ROLE failed for 'a','b','c'

Failed CREATE or DROP operations, for both users and roles, produce the same error code.

IF EXISTS
If the IF EXISTS clause is used, MariaDB will return a warning instead of an error if the role does not exist.

Examples
DROP ROLE journalist;

The same thing using the optional IF EXISTS clause:

DROP ROLE journalist;


ERROR 1396 (HY000): Operation DROP ROLE failed for 'journalist'

DROP ROLE IF EXISTS journalist;


Query OK, 0 rows affected, 1 warning (0.00 sec)

Note (Code 1975): Can't drop role 'journalist'; it doesn't exist

See Also
Roles Overview
CREATE ROLE

1.1.1.1.10 SET ROLE


Syntax
SET ROLE { role | NONE }

Contents
1. Syntax
2. Description
3. Example

Description
The SET ROLE statement enables a role, along with all of its associated permissions, for the current session. To unset a
role, use NONE .
If a role that doesn't exist, or to which the user has not been assigned, is specified, an ERROR 1959 (OP000): Invalid
role specification error occurs.
An automatic SET ROLE is implicitly performed when a user connects if that user has been assigned a default role. See
SET DEFAULT ROLE.

Example

79/3812
SELECT CURRENT_ROLE;
+--------------+
| CURRENT_ROLE |
+--------------+
| NULL |
+--------------+

SET ROLE staff;

SELECT CURRENT_ROLE;
+--------------+
| CURRENT_ROLE |
+--------------+
| staff |
+--------------+

SET ROLE NONE;

SELECT CURRENT_ROLE();
+----------------+
| CURRENT_ROLE() |
+----------------+
| NULL |
+----------------+

1.1.1.1.11 SET DEFAULT ROLE


Contents
1. Syntax
2. Description
3. Examples

Syntax
SET DEFAULT ROLE { role | NONE } [ FOR user@host ]

Description
The SET DEFAULT ROLE statement sets a default role for a specified (or current) user. A default role is automatically
enabled when a user connects (an implicit SET ROLE statement is executed immediately after a connection is
established).
To be able to set a role as a default, the role must already have been granted to that user, and one needs the privileges
to enable this role (if you cannot do SET ROLE X , you won't be able to do SET DEFAULT ROLE X ). To set a default role
for another user one needs to have write access to the mysql database.
To remove a user's default role, use SET DEFAULT ROLE NONE [ FOR user@host ] . The record of the default role is not
removed if the role is dropped or revoked, so if the role is subsequently re-created or granted, it will again be the user's
default role.
The default role is stored in the default_role column in the mysql.user table/view, as well as in the Information
Schema APPLICABLE_ROLES table, so these can be viewed to see which role has been assigned to a user as the
default.

Examples
Setting a default role for the current user:

SET DEFAULT ROLE journalist;

Removing a default role from the current user:

SET DEFAULT ROLE NONE;

Setting a default role for another user. The role has to have been granted to the user before it can be set as default:

80/3812
CREATE ROLE journalist;
CREATE USER taniel;

SET DEFAULT ROLE journalist FOR taniel;


ERROR 1959 (OP000): Invalid role specification `journalist`

GRANT journalist TO taniel;


SET DEFAULT ROLE journalist FOR taniel;

Viewing mysql.user:

select * from mysql.user where user='taniel'\G


*************************** 1. row ***************************
Host: %
User: taniel
...
is_role: N
default_role: journalist
...

Removing a default role for another user

SET DEFAULT ROLE NONE FOR taniel;

1.1.1.1.12 SHOW GRANTS


Contents
1. Syntax
2. Description
1. Users
2. Roles
1. Example
3. FOR PUBLIC
3. See Also

Syntax
SHOW GRANTS [FOR user|role]

Description
The SHOW GRANTS statement lists privileges granted to a particular user or role.

Users
The statement lists the GRANT statement or statements that must be issued to duplicate the privileges that are granted
to a MariaDB user account. The account is named using the same format as for the GRANT statement; for example,
' jeffrey'@'localhost '. If you specify only the user name part of the account name, a host name part of ' % ' is used.
For additional information about specifying account names, see GRANT.

SHOW GRANTS FOR 'root'@'localhost';


+---------------------------------------------------------------------+
| Grants for root@localhost |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION |
+---------------------------------------------------------------------+

To list the privileges granted to the account that you are using to connect to the server, you can use any of the following
statements:

SHOW GRANTS;
SHOW GRANTS FOR CURRENT_USER;
SHOW GRANTS FOR CURRENT_USER();

If SHOW GRANTS FOR CURRENT_USER (or any of the equivalent syntaxes) is used in DEFINER context (such as within a
stored procedure that is defined with SQL SECURITY DEFINER ), the grants displayed are those of the definer and not the
invoker.
81/3812
Note that the DELETE HISTORY privilege, introduced in MariaDB 10.3.4, was displayed as DELETE VERSIONING ROWS
when running SHOW GRANTS until MariaDB 10.3.15 (MDEV-17655 ).

Roles
SHOW GRANTS can also be used to view the privileges granted to a role.

Example
SHOW GRANTS FOR journalist;
+------------------------------------------+
| Grants for journalist |
+------------------------------------------+
| GRANT USAGE ON *.* TO 'journalist' |
| GRANT DELETE ON `test`.* TO 'journalist' |
+------------------------------------------+

FOR PUBLIC
MariaDB starting with 10.11
GRANT ... TO PUBLIC was introduced in MariaDB 10.11 to grant privileges to all users. SHOW GRANTS FOR PUBLIC
shows all these grants.
SHOW GRANTS FOR public;
+------------------------------------------------+
| Grants for PUBLIC |
+------------------------------------------------+
| GRANT ALL PRIVILEGES ON `dev_db`.* TO `PUBLIC` |
+------------------------------------------------+

See Also
Authentication from MariaDB 10.4
SHOW CREATE USER shows how the user was created.
SHOW PRIVILEGES shows the privileges supported by MariaDB.
Roles

1.1.1.1.13 SHOW CREATE USER


Syntax
SHOW CREATE USER user_name

Description
Shows the CREATE USER statement that created the given user. The statement requires the SELECT privilege for the
mysql database, except for the current user.

Examples
CREATE USER foo4@test require cipher 'text'
issuer 'foo_issuer' subject 'foo_subject';

SHOW CREATE USER foo4@test\G


*************************** 1. row ***************************
CREATE USER 'foo4'@'test'
REQUIRE ISSUER 'foo_issuer'
SUBJECT 'foo_subject'
CIPHER 'text'

User Password Expiry:

82/3812
CREATE USER 'monty'@'localhost' PASSWORD EXPIRE INTERVAL 120 DAY;

SHOW CREATE USER 'monty'@'localhost';


+------------------------------------------------------------------+
| CREATE USER for monty@localhost |
+------------------------------------------------------------------+
| CREATE USER 'monty'@'localhost' PASSWORD EXPIRE INTERVAL 120 DAY |
+------------------------------------------------------------------+

See Also
CREATE USER
ALTER USER
SHOW GRANTS shows the GRANTS/PRIVILEGES for a user.
SHOW PRIVILEGES shows the privileges supported by MariaDB.

1.1.1.2 Administrative SQL Statements


SQL statements for administering MariaDB.
Table Statements
Documentation on creating, altering, analyzing and maintaining tables.

ANALYZE and EXPLAIN Statements


Articles on the ANALYZE and EXPLAIN statements

BACKUP Commands
Commands used by backup tools.

FLUSH Commands
Commands to flush or reset various caches in MariaDB.

Replication Commands
List of replication-related commands.

Plugin SQL Statements


List of SQL statements related to plugins.

SET Commands
The SET commands

SHOW
Articles on the various SHOW commands.

System Tables

BINLOG
Generated by mysqlbinlog

PURGE BINARY LOGS


PURGE BINARY LOGS removes all binary logs from the server, prior to the provided date or log file.

CACHE INDEX
Caches MyISAM or Aria indexes

DESCRIBE
Information about columns in a table.

EXECUTE Statement
Executes a previously PREPAREd statement

HELP Command
The HELP command will retrieve syntax and help within the mysql client.

KILL [CONNECTION | QUERY]


Kill connection by query or thread id.

83/3812
LOAD INDEX
Loads one or more indexes from one or more MyISAM/Aria tables into a key buffer.

RESET
1 Overall description of the different RESET commands

SHUTDOWN
Shuts down the server.

USE
1 Set the current default database.

There are 1 related questions .

1.1.1.2.1 Table Statements


Articles about creating, modifying, and maintaining tables in MariaDB.
ALTER
The various ALTER statements in MariaDB.

ANALYZE TABLE
3 Store key distributions for a table.

CHECK TABLE
1 Check table for errors.

CHECK VIEW
Check whether the view algorithm is correct.

CHECKSUM TABLE
1 Report a table checksum.

CREATE TABLE
7 Creates a new table.

DELETE
2 Delete rows from one or more tables.

DROP TABLE
Removes definition and data from one or more tables.

Installing System Tables (mysql_install_db)


Using mysql_install_db to create the system tables in the 'mysql' database directory.

mysqlcheck
Tool for checking, repairing, analyzing and optimizing tables.

mysql_upgrade
2 Update to the latest version.

OPTIMIZE TABLE
4 Reclaim unused space and defragment data.

RENAME TABLE
1 Change a table's name.

REPAIR TABLE
Repairs a table, if the storage engine supports this statement.

REPAIR VIEW
Fix view if the algorithms are swapped.

REPLACE
1 Equivalent to DELETE + INSERT, or just an INSERT if no rows are returned.

84/3812
SHOW COLUMNS
Column information.

SHOW CREATE TABLE


Shows the CREATE TABLE statement that created the table.

SHOW INDEX
Information about table indexes.

TRUNCATE TABLE
DROP and re-CREATE a table.

UPDATE
2 Modify rows in one or more tables.

Obsolete Table Commands


Table commands that have been removed from MariaDB

IGNORE
Suppress errors while trying to violate a UNIQUE constraint.

System-Versioned Tables
26 System-versioned tables record the history of all changes to table data.

There are 1 related questions .

1.1.1.2.1.1 ALTER
This category is for documentation on the various ALTER statements.
ALTER TABLE
5 Modify a table's definition.

ALTER DATABASE
Change the overall characteristics of a database.

ALTER EVENT
Change an existing event.

ALTER FUNCTION
Change the characteristics of a stored function.

ALTER LOGFILE GROUP


Only useful with MySQL Cluster, and has no effect in MariaDB.

ALTER PROCEDURE
1 Change stored procedure characteristics.

ALTER SEQUENCE
Change options for a SEQUENCE.

ALTER SERVER
Updates mysql.servers table.

ALTER TABLESPACE
ALTER TABLESPACE is not available in MariaDB.

ALTER USER
1 Modify an existing MariaDB account.

ALTER VIEW
2 Change a view definition.

There are 1 related questions .

85/3812
1.1.1.2.1.1.1 ALTER TABLE
Syntax
ALTER [ONLINE] [IGNORE] TABLE [IF EXISTS] tbl_name
[WAIT n | NOWAIT]
alter_specification [, alter_specification] ...

alter_specification:
table_option ...
| ADD [COLUMN] [IF NOT EXISTS] col_name column_definition
[FIRST | AFTER col_name ]
| ADD [COLUMN] [IF NOT EXISTS] (col_name column_definition,...)
| ADD {INDEX|KEY} [IF NOT EXISTS] [index_name]
[index_type] (index_col_name,...) [index_option] ...
| ADD [CONSTRAINT [symbol]] PRIMARY KEY
[index_type] (index_col_name,...) [index_option] ...
| ADD [CONSTRAINT [symbol]]
UNIQUE [INDEX|KEY] [index_name]
[index_type] (index_col_name,...) [index_option] ...
| ADD FULLTEXT [INDEX|KEY] [index_name]
(index_col_name,...) [index_option] ...
| ADD SPATIAL [INDEX|KEY] [index_name]
(index_col_name,...) [index_option] ...
| ADD [CONSTRAINT [symbol]]
FOREIGN KEY [IF NOT EXISTS] [index_name] (index_col_name,...)
reference_definition
| ADD PERIOD FOR SYSTEM_TIME (start_column_name, end_column_name)
| ALTER [COLUMN] col_name SET DEFAULT literal | (expression)
| ALTER [COLUMN] col_name DROP DEFAULT
| ALTER {INDEX|KEY} index_name [NOT] INVISIBLE
| CHANGE [COLUMN] [IF EXISTS] old_col_name new_col_name column_definition
[FIRST|AFTER col_name]
| MODIFY [COLUMN] [IF EXISTS] col_name column_definition
[FIRST | AFTER col_name]
| DROP [COLUMN] [IF EXISTS] col_name [RESTRICT|CASCADE]
| DROP PRIMARY KEY
| DROP {INDEX|KEY} [IF EXISTS] index_name
| DROP FOREIGN KEY [IF EXISTS] fk_symbol
| DROP CONSTRAINT [IF EXISTS] constraint_name
| DISABLE KEYS
| ENABLE KEYS
| RENAME [TO] new_tbl_name
| ORDER BY col_name [, col_name] ...
| RENAME COLUMN old_col_name TO new_col_name
| RENAME {INDEX|KEY} old_index_name TO new_index_name
| CONVERT TO CHARACTER SET charset_name [COLLATE collation_name]
| [DEFAULT] CHARACTER SET [=] charset_name
| [DEFAULT] COLLATE [=] collation_name
| DISCARD TABLESPACE
| IMPORT TABLESPACE
| ALGORITHM [=] {DEFAULT|INPLACE|COPY|NOCOPY|INSTANT}
| LOCK [=] {DEFAULT|NONE|SHARED|EXCLUSIVE}
| FORCE
| partition_options
| ADD PARTITION [IF NOT EXISTS] (partition_definition)
| DROP PARTITION [IF EXISTS] partition_names
| COALESCE PARTITION number
| REORGANIZE PARTITION [partition_names INTO (partition_definitions)]
| ANALYZE PARTITION partition_names
| CHECK PARTITION partition_names
| OPTIMIZE PARTITION partition_names
| REBUILD PARTITION partition_names
| REPAIR PARTITION partition_names
| EXCHANGE PARTITION partition_name WITH TABLE tbl_name
| REMOVE PARTITIONING
| ADD SYSTEM VERSIONING
| DROP SYSTEM VERSIONING

index_col_name:
86/3812
col_name [(length)] [ASC | DESC]

index_type:
USING {BTREE | HASH | RTREE}

index_option:
[ KEY_BLOCK_SIZE [=] value
| index_type
| WITH PARSER parser_name
| COMMENT 'string'
| CLUSTERING={YES| NO} ]
[ IGNORED | NOT IGNORED ]

table_options:
table_option [[,] table_option] ...

87/3812
Contents
1. Syntax
2. Description
3. Privileges
4. Online DDL
1. ALTER ONLINE TABLE
5. WAIT/NOWAIT
6. IF EXISTS
7. Column Definitions
8. Index Definitions
9. Character Sets and Collations
10. Alter Specifications
1. Table Options
2. ADD COLUMN
3. DROP COLUMN
4. MODIFY COLUMN
5. CHANGE COLUMN
6. ALTER COLUMN
7. RENAME INDEX/KEY
8. RENAME COLUMN
9. ADD PRIMARY KEY
10. DROP PRIMARY KEY
11. ADD FOREIGN KEY
12. DROP FOREIGN KEY
13. ADD INDEX
14. DROP INDEX
15. ADD UNIQUE INDEX
16. DROP UNIQUE INDEX
17. ADD FULLTEXT INDEX
18. DROP FULLTEXT INDEX
19. ADD SPATIAL INDEX
20. DROP SPATIAL INDEX
21. ENABLE/ DISABLE KEYS
22. RENAME TO
23. ADD CONSTRAINT
24. DROP CONSTRAINT
25. ADD SYSTEM VERSIONING
26. DROP SYSTEM VERSIONING
27. ADD PERIOD FOR SYSTEM_TIME
28. FORCE
29. EXCHANGE PARTITION
30. DISCARD TABLESPACE
31. IMPORT TABLESPACE
32. ALGORITHM
1. ALGORITHM=DEFAULT
2. ALGORITHM=COPY
3. ALGORITHM=INPLACE
4. ALGORITHM=NOCOPY
5. ALGORITHM=INSTANT
33. LOCK
11. Progress Reporting
12. Aborting ALTER TABLE Operations
13. Atomic ALTER TABLE
14. Replication
15. Examples
16. See Also

Description
ALTER TABLE enables you to change the structure of an existing table. For example, you can add or delete columns,
create or destroy indexes, change the type of existing columns, or rename columns or the table itself. You can also
change the comment for the table and the storage engine of the table.
If another connection is using the table, a metadata lock is active, and this statement will wait until the lock is released.
This is also true for non-transactional tables.
When adding a UNIQUE index on a column (or a set of columns) which have duplicated values, an error will be
produced and the statement will be stopped. To suppress the error and force the creation of UNIQUE indexes,
discarding duplicates, the IGNORE option can be specified. This can be useful if a column (or a set of columns) should
be UNIQUE but it contains duplicate values; however, this technique provides no control on which rows are preserved
and which are deleted. Also, note that IGNORE is accepted but ignored in ALTER TABLE ... EXCHANGE PARTITION
88/3812
statements.
This statement can also be used to rename a table. For details see RENAME TABLE.
When an index is created, the storage engine may use a configurable buffer in the process. Incrementing the buffer
speeds up the index creation. Aria and MyISAM allocate a buffer whose size is defined by aria_sort_buffer_size or
myisam_sort_buffer_size, also used for REPAIR TABLE. InnoDB allocates three buffers whose size is defined by
innodb_sort_buffer_size.

Privileges
Executing the ALTER TABLE statement generally requires at least the ALTER privilege for the table or the database..
If you are renaming a table, then it also requires the DROP, CREATE and INSERT privileges for the table or the
database as well.

Online DDL
Online DDL is supported with the ALGORITHM and LOCK clauses.
See InnoDB Online DDL Overview for more information on online DDL with InnoDB.

ALTER ONLINE TABLE


ALTER ONLINE TABLE also works for partitioned tables.
Online ALTER TABLE is available by executing the following:

ALTER ONLINE TABLE ...;

This statement has the following semantics:


This statement is equivalent to the following:

ALTER TABLE ... LOCK=NONE;

See the LOCK alter specification for more information.


This statement is equivalent to the following:

ALTER TABLE ... ALGORITHM=INPLACE;

See the ALGORITHM alter specification for more information.

WAIT/NOWAIT
MariaDB starting with 10.3.0
Set the lock wait timeout. See WAIT and NOWAIT.

IF EXISTS
The IF EXISTS and IF NOT EXISTS clauses are available for the following:

ADD COLUMN [IF NOT EXISTS]


ADD INDEX [IF NOT EXISTS]
ADD FOREIGN KEY [IF NOT EXISTS]
ADD PARTITION [IF NOT EXISTS]
CREATE INDEX [IF NOT EXISTS]

DROP COLUMN [IF EXISTS]


DROP INDEX [IF EXISTS]
DROP FOREIGN KEY [IF EXISTS]
DROP PARTITION [IF EXISTS]
CHANGE COLUMN [IF EXISTS]
MODIFY COLUMN [IF EXISTS]
DROP INDEX [IF EXISTS]

When IF EXISTS and IF NOT EXISTS are used in clauses, queries will not report errors when the condition is triggered
for that clause. A warning with the same message text will be issued and the ALTER will move on to the next clause in
89/3812
the statement (or end if finished).

MariaDB starting with 10.5.2


If this is directive is used after ALTER ... TABLE , one will not get an error if the table doesn't exist.

Column Definitions
See CREATE TABLE: Column Definitions for information about column definitions.

Index Definitions
See CREATE TABLE: Index Definitions for information about index definitions.
The CREATE INDEX and DROP INDEX statements can also be used to add or remove an index.

Character Sets and Collations


CONVERT TO CHARACTER SET charset_name [COLLATE collation_name]
[DEFAULT] CHARACTER SET [=] charset_name
[DEFAULT] COLLATE [=] collation_name

See Setting Character Sets and Collations for details on setting the character sets and collations.

Alter Specifications
Table Options
See CREATE TABLE: Table Options for information about table options.

ADD COLUMN
... ADD COLUMN [IF NOT EXISTS] (col_name column_definition,...)

Adds a column to the table. The syntax is the same as in CREATE TABLE. If you are using IF NOT_EXISTS the column
will not be added if it was not there already. This is very useful when doing scripts to modify tables.
The FIRST and AFTER clauses affect the physical order of columns in the datafile. Use FIRST to add a column in the
first (leftmost) position, or AFTER followed by a column name to add the new column in any other position. Note that,
nowadays, the physical position of a column is usually irrelevant.
See also Instant ADD COLUMN for InnoDB.

DROP COLUMN
... DROP COLUMN [IF EXISTS] col_name [CASCADE|RESTRICT]

Drops the column from the table. If you are using IF EXISTS you will not get an error if the column didn't exist. If the
column is part of any index, the column will be dropped from them, except if you add a new column with identical name
at the same time. The index will be dropped if all columns from the index were dropped. If the column was used in a
view or trigger, you will get an error next time the view or trigger is accessed.

MariaDB starting with 10.2.8


Dropping a column that is part of a multi-column UNIQUE constraint is not permitted. For example:
CREATE TABLE a (
a int,
b int,
primary key (a,b)
);

ALTER TABLE x DROP COLUMN a;


[42000][1072] Key column 'A' doesn't exist in table

The reason is that dropping column a would result in the new constraint that all values in column b be unique. In

90/3812
order to drop the column, an explicit DROP PRIMARY KEY and ADD PRIMARY KEY would be required. Up until MariaDB
10.2.7 , the column was dropped and the additional constraint applied, resulting in the following structure:
ALTER TABLE x DROP COLUMN a;
Query OK, 0 rows affected (0.46 sec)

DESC x;
+-------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| b | int(11) | NO | PRI | NULL | |
+-------+---------+------+-----+---------+-------+

MariaDB starting with 10.4.0


MariaDB 10.4.0 supports instant DROP COLUMN. DROP COLUMN of an indexed column would imply DROP INDEX
(and in the case of a non-UNIQUE multi-column index, possibly ADD INDEX). These will not be allowed with
ALGORITHM=INSTANT, but unlike before, they can be allowed with ALGORITHM=NOCOPY

RESTRICT and CASCADE are allowed to make porting from other database systems easier. In MariaDB, they do nothing.

MODIFY COLUMN
Allows you to modify the type of a column. The column will be at the same place as the original column and all indexes
on the column will be kept. Note that when modifying column, you should specify all attributes for the new column.

CREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY((a));


ALTER TABLE t1 MODIFY a BIGINT UNSIGNED AUTO_INCREMENT;

CHANGE COLUMN
Works like MODIFY COLUMN except that you can also change the name of the column. The column will be at the same
place as the original column and all index on the column will be kept.

CREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(a));


ALTER TABLE t1 CHANGE a b BIGINT UNSIGNED AUTO_INCREMENT;

ALTER COLUMN
This lets you change column options.

CREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT, b varchar(50), PRIMARY KEY(a));


ALTER TABLE t1 ALTER b SET DEFAULT 'hello';

RENAME INDEX/KEY
MariaDB starting with 10.5.2
From MariaDB 10.5.2, it is possible to rename an index using the RENAME INDEX (or RENAME KEY ) syntax, for
example:
ALTER TABLE t1 RENAME INDEX i_old TO i_new;

RENAME COLUMN
MariaDB starting with 10.5.2
From MariaDB 10.5.2, it is possible to rename a column using the RENAME COLUMN syntax, for example:
ALTER TABLE t1 RENAME COLUMN c_old TO c_new;

ADD PRIMARY KEY


Add a primary key.

91/3812
For PRIMARY KEY indexes, you can specify a name for the index, but it is silently ignored, and the name of the index is
always PRIMARY .
See Getting Started with Indexes: Primary Key for more information.

DROP PRIMARY KEY


Drop a primary key.
For PRIMARY KEY indexes, you can specify a name for the index, but it is silently ignored, and the name of the index is
always PRIMARY .
See Getting Started with Indexes: Primary Key for more information.

ADD FOREIGN KEY


Add a foreign key.
For FOREIGN KEY indexes, a reference definition must be provided.
For FOREIGN KEY indexes, you can specify a name for the constraint, using the CONSTRAINT keyword. That name will
be used in error messages.
First, you have to specify the name of the target (parent) table and a column or a column list which must be indexed and
whose values must match to the foreign key's values. The MATCH clause is accepted to improve the compatibility with
other DBMS's, but has no meaning in MariaDB. The ON DELETE and ON UPDATE clauses specify what must be done
when a DELETE (or a REPLACE ) statements attempts to delete a referenced row from the parent table, and when an
UPDATE statement attempts to modify the referenced foreign key columns in a parent table row, respectively. The
following options are allowed:
RESTRICT : The delete/update operation is not performed. The statement terminates with a 1451 error
(SQLSTATE '2300').
NO ACTION : Synonym for RESTRICT .
CASCADE : The delete/update operation is performed in both tables.
SET NULL : The update or delete goes ahead in the parent table, and the corresponding foreign key fields in the
child table are set to NULL . (They must not be defined as NOT NULL for this to succeed).
SET DEFAULT : This option is implemented only for the legacy PBXT storage engine, which is disabled by default
and no longer maintained. It sets the child table's foreign key fields to their DEFAULT values when the referenced
parent table key entries are updated or deleted.
If either clause is omitted, the default behavior for the omitted clause is RESTRICT .
See Foreign Keys for more information.

DROP FOREIGN KEY


Drop a foreign key.
See Foreign Keys for more information.

ADD INDEX
Add a plain index.
Plain indexes are regular indexes that are not unique, and are not acting as a primary key or a foreign key. They are
also not the "specialized" FULLTEXT or SPATIAL indexes.
See Getting Started with Indexes: Plain Indexes for more information.

DROP INDEX
Drop a plain index.
Plain indexes are regular indexes that are not unique, and are not acting as a primary key or a foreign key. They are
also not the "specialized" FULLTEXT or SPATIAL indexes.
See Getting Started with Indexes: Plain Indexes for more information.

ADD UNIQUE INDEX


Add a unique index.
The UNIQUE keyword means that the index will not accept duplicated values, except for NULLs. An error will raise if you
try to insert duplicate values in a UNIQUE index.
For UNIQUE indexes, you can specify a name for the constraint, using the CONSTRAINT keyword. That name will be
used in error messages.
92/3812
See Getting Started with Indexes: Unique Index for more information.

DROP UNIQUE INDEX


Drop a unique index.
The UNIQUE keyword means that the index will not accept duplicated values, except for NULLs. An error will raise if you
try to insert duplicate values in a UNIQUE index.
For UNIQUE indexes, you can specify a name for the constraint, using the CONSTRAINT keyword. That name will be
used in error messages.
See Getting Started with Indexes: Unique Index for more information.

ADD FULLTEXT INDEX


Add a FULLTEXT index.
See Full-Text Indexes for more information.

DROP FULLTEXT INDEX


Drop a FULLTEXT index.
See Full-Text Indexes for more information.

ADD SPATIAL INDEX


Add a SPATIAL index.
See SPATIAL INDEX for more information.

DROP SPATIAL INDEX


Drop a SPATIAL index.
See SPATIAL INDEX for more information.

ENABLE/ DISABLE KEYS


DISABLE KEYS will disable all non unique keys for the table for storage engines that support this (at least MyISAM and
Aria). This can be used to speed up inserts into empty tables.
ENABLE KEYS will enable all disabled keys.

RENAME TO
Renames the table. See also RENAME TABLE.

ADD CONSTRAINT
Modifies the table adding a constraint on a particular column or columns.

MariaDB starting with 10.2.1


MariaDB 10.2.1 introduced new ways to define a constraint.

Note: Before MariaDB 10.2.1 , constraint expressions were accepted in syntax, but ignored.

ALTER TABLE table_name


ADD CONSTRAINT [constraint_name] CHECK(expression);

Before a row is inserted or updated, all constraints are evaluated in the order they are defined. If any constraint fails,
then the row will not be updated. One can use most deterministic functions in a constraint, including UDF's.

93/3812
CREATE TABLE account_ledger (
id INT PRIMARY KEY AUTO_INCREMENT,
transaction_name VARCHAR(100),
credit_account VARCHAR(100),
credit_amount INT,
debit_account VARCHAR(100),
debit_amount INT);

ALTER TABLE account_ledger


ADD CONSTRAINT is_balanced
CHECK((debit_amount + credit_amount) = 0);

The constraint_name is optional. If you don't provide one in the ALTER TABLE statement, MariaDB auto-generates a
name for you. This is done so that you can remove it later using DROP CONSTRAINT clause.
You can disable all constraint expression checks by setting the variable check_constraint_checks to OFF . You may find
this useful when loading a table that violates some constraints that you want to later find and fix in SQL.
To view constraints on a table, query information_schema.TABLE_CONSTRAINTS:

SELECT CONSTRAINT_NAME, TABLE_NAME, CONSTRAINT_TYPE


FROM information_schema.TABLE_CONSTRAINTS
WHERE TABLE_NAME = 'account_ledger';

+-----------------+----------------+-----------------+
| CONSTRAINT_NAME | TABLE_NAME | CONSTRAINT_TYPE |
+-----------------+----------------+-----------------+
| is_balanced | account_ledger | CHECK |
+-----------------+----------------+-----------------+

DROP CONSTRAINT
MariaDB starting with 10.2.22
DROP CONSTRAINT for UNIQUE and FOREIGN KEY constraints was introduced in MariaDB 10.2.22 and MariaDB
10.3.13.

MariaDB starting with 10.2.1


DROP CONSTRAINT for CHECK constraints was introduced in MariaDB 10.2.1

Modifies the table, removing the given constraint.

ALTER TABLE table_name


DROP CONSTRAINT constraint_name;

When you add a constraint to a table, whether through a CREATE TABLE or ALTER TABLE...ADD CONSTRAINT
statement, you can either set a constraint_name yourself, or allow MariaDB to auto-generate one for you. To view
constraints on a table, query information_schema.TABLE_CONSTRAINTS. For instance,

CREATE TABLE t (
a INT,
b INT,
c INT,
CONSTRAINT CHECK(a > b),
CONSTRAINT check_equals CHECK(a = c));

SELECT CONSTRAINT_NAME, TABLE_NAME, CONSTRAINT_TYPE


FROM information_schema.TABLE_CONSTRAINTS
WHERE TABLE_NAME = 't';

+-----------------+----------------+-----------------+
| CONSTRAINT_NAME | TABLE_NAME | CONSTRAINT_TYPE |
+-----------------+----------------+-----------------+
| check_equals | t | CHECK |
| CONSTRAINT_1 | t | CHECK |
+-----------------+----------------+-----------------+

To remove a constraint from the table, issue an ALTER TABLE...DROP CONSTRAINT statement. For example,

ALTER TABLE t DROP CONSTRAINT is_unique;

ADD SYSTEM VERSIONING


94/3812
MariaDB starting with 10.3.4
System-versioned tables was added in MariaDB 10.3.4.

Add system versioning.

DROP SYSTEM VERSIONING


MariaDB starting with 10.3.4
System-versioned tables was added in MariaDB 10.3.4.

Drop system versioning.

ADD PERIOD FOR SYSTEM_TIME


MariaDB starting with 10.3.4
System-versioned tables was added in MariaDB 10.3.4.

FORCE
ALTER TABLE ... FORCE can force MariaDB to re-build the table.

In MariaDB 5.5 and before, this could only be done by setting the ENGINE table option to its old value. For example, for
an InnoDB table, one could execute the following:

ALTER TABLE tab_name ENGINE = InnoDB;

The FORCE option can be used instead. For example, :

ALTER TABLE tab_name FORCE;

With InnoDB, the table rebuild will only reclaim unused space (i.e. the space previously used for deleted rows) if the
innodb_file_per_table system variable is set to ON . If the system variable is OFF , then the space will not be reclaimed,
but it will be-re-used for new data that's later added.

EXCHANGE PARTITION
This is used to exchange the tablespace files between a partition and another table.
See copying InnoDB's transportable tablespaces for more information.

DISCARD TABLESPACE
This is used to discard an InnoDB table's tablespace.
See copying InnoDB's transportable tablespaces for more information.

IMPORT TABLESPACE
This is used to import an InnoDB table's tablespace. The tablespace should have been copied from its original server
after executing FLUSH TABLES FOR EXPORT.
See copying InnoDB's transportable tablespaces for more information.
ALTER TABLE ... IMPORT only applies to InnoDB tables. Most other popular storage engines, such as Aria and
MyISAM, will recognize their data files as soon as they've been placed in the proper directory under the datadir, and no
special DDL is required to import them.

ALGORITHM
The ALTER TABLE statement supports the ALGORITHM clause. This clause is one of the clauses that is used to
implement online DDL. ALTER TABLE supports several different algorithms. An algorithm can be explicitly chosen for an
ALTER TABLE operation by setting the ALGORITHM clause. The supported values are:
ALGORITHM=DEFAULT - This implies the default behavior for the specific statement, such as if no ALGORITHM
clause is specified.
ALGORITHM=COPY

95/3812
ALGORITHM=INPLACE
ALGORITHM=NOCOPY - This was added in MariaDB 10.3.7.
ALGORITHM=INSTANT - This was added in MariaDB 10.3.7.
See InnoDB Online DDL Overview: ALGORITHM for information on how the ALGORITHM clause affects InnoDB.

ALGORITHM=DEFAULT
The default behavior, which occurs if ALGORITHM=DEFAULT is specified, or if ALGORITHM is not specified at all, usually
only makes a copy if the operation doesn't support being done in-place at all. In this case, the most efficient available
algorithm will usually be used.
However, in MariaDB 10.3.6 and before, if the value of the old_alter_table system variable is set to ON , then the default
behavior is to perform ALTER TABLE operations by making a copy of the table using the old algorithm.
In MariaDB 10.3.7 and later, the old_alter_table system variable is deprecated. Instead, the alter_algorithm system
variable defines the default algorithm for ALTER TABLE operations.

ALGORITHM=COPY
ALGORITHM=COPY is the name for the original ALTER TABLE algorithm from early MariaDB versions.

When ALGORITHM=COPY is set, MariaDB essentially does the following operations:

-- Create a temporary table with the new definition


CREATE TEMPORARY TABLE tmp_tab (
...
);

-- Copy the data from the original table


INSERT INTO tmp_tab
SELECT * FROM original_tab;

-- Drop the original table


DROP TABLE original_tab;

-- Rename the temporary table, so that it replaces the original one


RENAME TABLE tmp_tab TO original_tab;

This algorithm is very inefficient, but it is generic, so it works for all storage engines.
If ALGORITHM=COPY is specified, then the copy algorithm will be used even if it is not necessary. This can result in a
lengthy table copy. If multiple ALTER TABLE operations are required that each require the table to be rebuilt, then it is
best to specify all operations in a single ALTER TABLE statement, so that the table is only rebuilt once.

ALGORITHM=INPLACE
ALGORITHM=COPY can be incredibly slow, because the whole table has to be copied and rebuilt. ALGORITHM=INPLACE
was introduced as a way to avoid this by performing operations in-place and avoiding the table copy and rebuild, when
possible.
When ALGORITHM=INPLACE is set, the underlying storage engine uses optimizations to perform the operation while
avoiding the table copy and rebuild. However, INPLACE is a bit of a misnomer, since some operations may still require
the table to be rebuilt for some storage engines. Regardless, several operations can be performed without a full copy of
the table for some storage engines.
A more accurate name would have been ALGORITHM=ENGINE , where ENGINE refers to an "engine-specific" algorithm.
If an ALTER TABLE operation supports ALGORITHM=INPLACE , then it can be performed using optimizations by the
underlying storage engine, but it may rebuilt.
See InnoDB Online DDL Operations with ALGORITHM=INPLACE for more.

ALGORITHM=NOCOPY
ALGORITHM=NOCOPY was introduced in MariaDB 10.3.7.
ALGORITHM=INPLACE can sometimes be surprisingly slow in instances where it has to rebuild the clustered index,
because when the clustered index has to be rebuilt, the whole table has to be rebuilt. ALGORITHM=NOCOPY was
introduced as a way to avoid this.
If an ALTER TABLE operation supports ALGORITHM=NOCOPY , then it can be performed without rebuilding the clustered
index.
If ALGORITHM=NOCOPY is specified for an ALTER TABLE operation that does not support ALGORITHM=NOCOPY , then an
error will be raised. In this case, raising an error is preferable, if the alternative is for the operation to rebuild the
clustered index, and perform unexpectedly slowly.

96/3812
See InnoDB Online DDL Operations with ALGORITHM=NOCOPY for more.

ALGORITHM=INSTANT
ALGORITHM=INSTANT was introduced in MariaDB 10.3.7.
ALGORITHM=INPLACE can sometimes be surprisingly slow in instances where it has to modify data files.
ALGORITHM=INSTANT was introduced as a way to avoid this.

If an ALTER TABLE operation supports ALGORITHM=INSTANT , then it can be performed without modifying any data files.
If ALGORITHM=INSTANT is specified for an ALTER TABLE operation that does not support ALGORITHM=INSTANT , then an
error will be raised. In this case, raising an error is preferable, if the alternative is for the operation to modify data files,
and perform unexpectedly slowly.
See InnoDB Online DDL Operations with ALGORITHM=INSTANT for more.

LOCK
The ALTER TABLE statement supports the LOCK clause. This clause is one of the clauses that is used to implement
online DDL. ALTER TABLE supports several different locking strategies. A locking strategy can be explicitly chosen for
an ALTER TABLE operation by setting the LOCK clause. The supported values are:
DEFAULT : Acquire the least restrictive lock on the table that is supported for the specific operation. Permit the
maximum amount of concurrency that is supported for the specific operation.
NONE : Acquire no lock on the table. Permit all concurrent DML. If this locking strategy is not permitted for an
operation, then an error is raised.
SHARED : Acquire a read lock on the table. Permit read-only concurrent DML. If this locking strategy is not
permitted for an operation, then an error is raised.
EXCLUSIVE : Acquire a write lock on the table. Do not permit concurrent DML.
Different storage engines support different locking strategies for different operations. If a specific locking strategy is
chosen for an ALTER TABLE operation, and that table's storage engine does not support that locking strategy for that
specific operation, then an error will be raised.
If the LOCK clause is not explicitly set, then the operation uses LOCK=DEFAULT .
ALTER ONLINE TABLE is equivalent to LOCK=NONE . Therefore, the ALTER ONLINE TABLE statement can be used to
ensure that your ALTER TABLE operation allows all concurrent DML.
See InnoDB Online DDL Overview: LOCK for information on how the LOCK clause affects InnoDB.

Progress Reporting
MariaDB provides progress reporting for ALTER TABLE statement for clients that support the new progress reporting
protocol. For example, if you were using the mysql client, then the progress report might look like this::

ALTER TABLE test ENGINE=Aria;


Stage: 1 of 2 'copy to tmp table' 46% of stage

The progress report is also shown in the output of the SHOW PROCESSLIST statement and in the contents of the
information_schema.PROCESSLIST table.
See Progress Reporting for more information.

Aborting ALTER TABLE Operations


If an ALTER TABLE operation is being performed and the connection is killed, the changes will be rolled back in a
controlled manner. The rollback can be a slow operation as the time it takes is relative to how far the operation has
progressed.

MariaDB starting with 10.2.13


Aborting ALTER TABLE ... ALGORITHM=COPY was made faster by removing excessive undo logging (MDEV-11415 ).
This significantly shortens the time it takes to abort a running ALTER TABLE operation.

Atomic ALTER TABLE


MariaDB starting with 10.6.1
From MariaDB 10.6, ALTER TABLE is atomic for most engines, including InnoDB, MyRocks, MyISAM and Aria (MDEV-
25180 ). This means that if there is a crash (server down or power outage) during an ALTER TABLE operation, after
recovery, either the old table and associated triggers and status will be intact, or the new table will be active.
97/3812
In older MariaDB versions one could get leftover #sql-alter..', '#sql-backup..' or 'table_name.frm˝' files if the system
crashed during the ALTER TABLE operation.
See Atomic DDL for more information.

Replication
MariaDB starting with 10.8.0
Before MariaDB 10.8.0, ALTER TABLE got fully executed on the primary first, and only then was it replicated and
started executing on replicas. From MariaDB 10.8.0, ALTER TABLE gets replicated and starts executing on replicas
when it starts executing on the primary, not when it finishes. This way the replication lag caused by a heavy ALTER
TABLE can be completely eliminated (MDEV-11675 ).

Examples
Adding a new column:

ALTER TABLE t1 ADD x INT;

Dropping a column:

ALTER TABLE t1 DROP x;

Modifying the type of a column:

ALTER TABLE t1 MODIFY x bigint unsigned;

Changing the name and type of a column:

ALTER TABLE t1 CHANGE a b bigint unsigned auto_increment;

Combining multiple clauses in a single ALTER TABLE statement, separated by commas:

ALTER TABLE t1 DROP x, ADD x2 INT, CHANGE y y2 INT;

Changing the storage engine and adding a comment:

ALTER TABLE t1
ENGINE = InnoDB
COMMENT = 'First of three tables containing usage info';

Rebuilding the table (the previous example will also rebuild the table if it was already InnoDB):

ALTER TABLE t1 FORCE;

Dropping an index:

ALTER TABLE rooms DROP INDEX u;

Adding a unique index:

ALTER TABLE rooms ADD UNIQUE INDEX u(room_number);

From MariaDB 10.5.3, adding a primary key for an application-time period table with a WITHOUT OVERLAPS
constraint:

ALTER TABLE rooms ADD PRIMARY KEY(room_number, p WITHOUT OVERLAPS);

See Also
CREATE TABLE
DROP TABLE
Character Sets and Collations
SHOW CREATE TABLE
Instant ADD COLUMN for InnoDB
98/3812
1.1.1.2.1.1.2 ALTER DATABASE
Modifies a database, changing its overall characteristics.

Syntax
ALTER {DATABASE | SCHEMA} [db_name]
alter_specification ...
ALTER {DATABASE | SCHEMA} db_name
UPGRADE DATA DIRECTORY NAME

alter_specification:
[DEFAULT] CHARACTER SET [=] charset_name
| [DEFAULT] COLLATE [=] collation_name
| COMMENT [=] 'comment'

Contents
1. Syntax
2. Description
1. COMMENT
3. Examples
4. See Also

Description
ALTER DATABASE enables you to change the overall characteristics of a database. These characteristics are stored in
the db.opt file in the database directory. To use ALTER DATABASE , you need the ALTER privilege on the database.
ALTER SCHEMA is a synonym for ALTER DATABASE.

The CHARACTER SET clause changes the default database character set. The COLLATE clause changes the default
database collation. See Character Sets and Collations for more.
You can see what character sets and collations are available using, respectively, the SHOW CHARACTER SET and
SHOW COLLATION statements.
Changing the default character set/collation of a database does not change the character set/collation of any stored
procedures or stored functions that were previously created, and relied on the defaults. These need to be dropped and
recreated in order to apply the character set/collation changes.
The database name can be omitted from the first syntax, in which case the statement applies to the default database.
The syntax that includes the UPGRADE DATA DIRECTORY NAME clause was added in MySQL 5.1.23. It updates the name
of the directory associated with the database to use the encoding implemented in MySQL 5.1 for mapping database
names to database directory names (see Identifier to File Name Mapping). This clause is for use under these
conditions:
It is intended when upgrading MySQL to 5.1 or later from older versions.
It is intended to update a database directory name to the current encoding format if the name contains special
characters that need encoding.
The statement is used by mysqlcheck (as invoked by mysql_upgrade ).
For example,if a database in MySQL 5.0 has a name of a-b-c, the name contains instance of the `-' character. In 5.0, the
database directory is also named a-b-c, which is not necessarily safe for all file systems. In MySQL 5.1 and up, the
same database name is encoded as a@002db@002dc to produce a file system-neutral directory name.
When a MySQL installation is upgraded to MySQL 5.1 or later from an older version,the server displays a name such as
a-b-c (which is in the old format) as #mysql50#a-b-c, and you must refer to the name using the #mysql50# prefix. Use
UPGRADE DATA DIRECTORY NAME in this case to explicitly tell the server to re-encode the database directory name to the
current encoding format:

ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME;

After executing this statement, you can refer to the database as a-b-c without the special #mysql50# prefix.

COMMENT

MariaDB starting with 10.5.0


From MariaDB 10.5.0, it is possible to add a comment of a maximum of 1024 bytes. If the comment length exceeds
this length, a error/warning code 4144 is thrown. The database comment is also added to the db.opt file, as well as to
the information_schema.schemata table.

99/3812
Examples
ALTER DATABASE test CHARACTER SET='utf8' COLLATE='utf8_bin';

From MariaDB 10.5.0:

ALTER DATABASE p COMMENT='Presentations';

See Also
CREATE DATABASE
DROP DATABASE
SHOW CREATE DATABASE
SHOW DATABASES
Character Sets and Collations
Information Schema SCHEMATA Table

1.1.1.2.1.1.3 ALTER EVENT


Modifies one or more characteristics of an existing event.

Syntax
ALTER
[DEFINER = { user | CURRENT_USER }]
EVENT event_name
[ON SCHEDULE schedule]
[ON COMPLETION [NOT] PRESERVE]
[RENAME TO new_event_name]
[ENABLE | DISABLE | DISABLE ON SLAVE]
[COMMENT 'comment']
[DO sql_statement]

Contents
1. Syntax
2. Description
3. Examples
4. See Also

Description
The ALTER EVENT statement is used to change one or more of the characteristics of an existing event without the need
to drop and recreate it. The syntax for each of the DEFINER , ON SCHEDULE , ON COMPLETION , COMMENT , ENABLE /
DISABLE , and DO clauses is exactly the same as when used with CREATE EVENT.
This statement requires the EVENT privilege. When a user executes a successful ALTER EVENT statement, that user
becomes the definer for the affected event.
(In MySQL 5.1.11 and earlier, an event could be altered only by its definer, or by a user having the SUPER privilege.)
ALTER EVENT works only with an existing event:

ALTER EVENT no_such_event ON SCHEDULE EVERY '2:3' DAY_HOUR;


ERROR 1539 (HY000): Unknown event 'no_such_event'

Examples
ALTER EVENT myevent
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 2 HOUR
DO
UPDATE myschema.mytable SET mycol = mycol + 1;

See Also
Events Overview
CREATE EVENT
100/3812
SHOW CREATE EVENT
DROP EVENT

1.1.1.2.1.1.4 ALTER FUNCTION


Syntax
ALTER FUNCTION func_name [characteristic ...]

characteristic:
{ CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }
| SQL SECURITY { DEFINER | INVOKER }
| COMMENT 'string'

Contents
1. Syntax
2. Description
3. Example
4. See Also

Description
This statement can be used to change the characteristics of a stored function. More than one change may be specified
in an ALTER FUNCTION statement. However, you cannot change the parameters or body of a stored function using this
statement; to make such changes, you must drop and re-create the function using DROP FUNCTION and CREATE
FUNCTION.
You must have the ALTER ROUTINE privilege for the function. (That privilege is granted automatically to the function
creator.) If binary logging is enabled, the ALTER FUNCTION statement might also require the SUPER privilege, as
described in Binary Logging of Stored Routines.

Example
ALTER FUNCTION hello SQL SECURITY INVOKER;

See Also
CREATE FUNCTION
SHOW CREATE FUNCTION
DROP FUNCTION
SHOW FUNCTION STATUS
Information Schema ROUTINES Table

1.1.1.2.1.1.5 ALTER LOGFILE GROUP


Syntax
ALTER LOGFILE GROUP logfile_group
ADD UNDOFILE 'file_name'
[INITIAL_SIZE [=] size]
[WAIT]
ENGINE [=] engine_name

The ALTER LOGFILE GROUP statement is not supported by MariaDB. It was originally inherited from MySQL NDB
Cluster. See MDEV-19295 for more information.

1.1.1.2.1.1.6 ALTER PROCEDURE


Syntax
101/3812
ALTER PROCEDURE proc_name [characteristic ...]

characteristic:
{ CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }
| SQL SECURITY { DEFINER | INVOKER }
| COMMENT 'string'

Description
This statement can be used to change the characteristics of a stored procedure. More than one change may be
specified in an ALTER PROCEDURE statement. However, you cannot change the parameters or body of a stored
procedure using this statement. To make such changes, you must drop and re-create the procedure using either
CREATE OR REPLACE PROCEDURE (since MariaDB 10.1.3 ) or DROP PROCEDURE and CREATE PROCEDURE
(MariaDB 10.1.2 and before).
You must have the ALTER ROUTINE privilege for the procedure. By default, that privilege is granted automatically to the
procedure creator. See Stored Routine Privileges.

Example
ALTER PROCEDURE simpleproc SQL SECURITY INVOKER;

See Also
Stored Procedure Overview
CREATE PROCEDURE
SHOW CREATE PROCEDURE
DROP PROCEDURE
SHOW CREATE PROCEDURE
SHOW PROCEDURE STATUS
Stored Routine Privileges
Information Schema ROUTINES Table

1.1.1.2.1.1.7 ALTER SEQUENCE


1.1.1.2.1.1.8 ALTER SERVER
Syntax
ALTER SERVER server_name
OPTIONS (option [, option] ...)

Contents
1. Syntax
2. Description
3. Examples
4. See Also

Description
Alters the server information for server_name, adjusting the specified options as per the CREATE SERVER command.
The corresponding fields in the mysql.servers table are updated accordingly. This statement requires the SUPER
privilege or, from MariaDB 10.5.2, the FEDERATED ADMIN privilege.
ALTER SERVER is not written to the binary log, irrespective of the binary log format being used. From MariaDB 10.1.13
, Galera replicates the CREATE SERVER, ALTER SERVER and DROP SERVER statements.

Examples
ALTER SERVER s OPTIONS (USER 'sally');

102/3812
See Also
CREATE SERVER
DROP SERVER
Spider Storage Engine

1.1.1.2.1.1.9 ALTER TABLESPACE


The ALTER TABLESPACE statement is not supported by MariaDB. It was originally inherited from MySQL NDB
Cluster. In MySQL 5.7 and later, the statement is also supported for InnoDB. However, MariaDB has chosen not to
include that specific feature. See MDEV-19294 for more information.

1.1.1.2.1.1.10 ALTER USER


1.1.1.2.1.1.11 ALTER VIEW
Syntax
ALTER
[ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]
[DEFINER = { user | CURRENT_USER }]
[SQL SECURITY { DEFINER | INVOKER }]
VIEW view_name [(column_list)]
AS select_statement
[WITH [CASCADED | LOCAL] CHECK OPTION]

Contents
1. Syntax
2. Description
3. Example
4. See Also

Description
This statement changes the definition of a view, which must exist. The syntax is similar to that for CREATE VIEW and
the effect is the same as for CREATE OR REPLACE VIEW if the view exists. This statement requires the CREATE VIEW and
DROP privileges for the view, and some privilege for each column referred to in the SELECT statement. ALTER VIEW is
allowed only to the definer or users with the SUPER privilege.

Example
ALTER VIEW v AS SELECT a, a*3 AS a2 FROM t;

See Also
CREATE VIEW
DROP VIEW
SHOW CREATE VIEW
INFORMATION SCHEMA VIEWS Table

1.1.1.2.1.2 ANALYZE TABLE


Syntax
ANALYZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE tbl_name [,tbl_name ...]
[PERSISTENT FOR [ALL|COLUMNS ([col_name [,col_name ...]])]
[INDEXES ([index_name [,index_name ...]])]]

103/3812
Contents
1. Syntax
2. Description
3. Engine-Independent Statistics
4. See Also

Description
ANALYZE TABLE analyzes and stores the key distribution for a table (index statistics). This statement works with
MyISAM, Aria and InnoDB tables. During the analysis, InnoDB will allow reads/writes, and MyISAM/Aria reads/inserts.
For MyISAM tables, this statement is equivalent to using myisamchk --analyze.
For more information on how the analysis works within InnoDB, see InnoDB Limitations.
MariaDB uses the stored key distribution to decide the order in which tables should be joined when you perform a join
on something other than a constant. In addition, key distributions can be used when deciding which indexes to use for a
specific table within a query.
This statement requires SELECT and INSERT privileges for the table.
By default, ANALYZE TABLE statements are written to the binary log and will be replicated. The NO_WRITE_TO_BINLOG
keyword ( LOCAL is an alias) will ensure the statement is not written to the binary log.
From MariaDB 10.3.19, ANALYZE TABLE statements are not logged to the binary log if read_only is set. See also Read-
Only Replicas.
ANALYZE TABLE is also supported for partitioned tables. You can use ALTER TABLE ... ANALYZE PARTITION to analyze
one or more partitions.
The Aria storage engine supports progress reporting for the ANALYZE TABLE statement.

Engine-Independent Statistics
ANALYZE TABLE supports engine-independent statistics. See Engine-Independent Table Statistics: Collecting Statistics
with the ANALYZE TABLE Statement for more information.

See Also
Index Statistics
InnoDB Persistent Statistics
Progress Reporting
Engine-independent Statistics
Histogram-based Statistics
ANALYZE Statement

1.1.1.2.1.3 CHECK TABLE


Syntax
CHECK TABLE tbl_name [, tbl_name] ... [option] ...

option = {FOR UPGRADE | QUICK | FAST | MEDIUM | EXTENDED | CHANGED}

Description
CHECK TABLE checks a table or tables for errors. CHECK TABLE works for Archive, Aria, CSV, InnoDB, and MyISAM
tables. For Aria and MyISAM tables, the key statistics are updated as well. For CSV, see also Checking and Repairing
CSV Tables.
As an alternative, myisamchk is a commandline tool for checking MyISAM tables when the tables are not being
accessed.
For checking dynamic columns integrity, COLUMN_CHECK() can be used.
CHECK TABLE can also check views for problems, such as tables that are referenced in the view definition that no longer
exist.
CHECK TABLE is also supported for partitioned tables. You can use ALTER TABLE ... CHECK PARTITION to check one or
more partitions.
The meaning of the different options are as follows - note that this can vary a bit between storage engines:
104/3812
Do a very quick check if the storage format for the table has changed so that one needs to do a
FOR
REPAIR. This is only needed when one upgrades between major versions of MariaDB or MySQL. This
UPGRADE
is usually done by running mysql_upgrade .
Only check tables that has not been closed properly or are marked as corrupt. Only supported by the
FAST
MyISAM and Aria engines. For other engines the table is checked normally
Check only tables that has changed since last REPAIR / CHECK. Only supported by the MyISAM and
CHANGED
Aria engines. For other engines the table is checked normally.
Do a fast check. For MyISAM and Aria engine this means we skip checking the delete link chain which
QUICK
may take some time.
Scan also the data files. Checks integrity between data and index files with checksums. In most cases
MEDIUM
this should find all possible errors.
Does a full check to verify every possible error. For MyISAM and Aria we verify for each row that all it
EXTENDED
keys exists and points to the row. This may take a long time on big tables!

For most cases running CHECK TABLE without options or MEDIUM should be good enough.
The Aria storage engine supports progress reporting for this statement.
If you want to know if two tables are identical, take a look at CHECKSUM TABLE.

InnoDB
If CHECK TABLE finds an error in an InnoDB table, MariaDB might shutdown to prevent the error propagation. In this
case, the problem will be reported in the error log. Otherwise the table or an index might be marked as corrupted, to
prevent use. This does not happen with some minor problems, like a wrong number of entries in a secondary index.
Those problems are reported in the output of CHECK TABLE .
Each tablespace contains a header with metadata. This header is not checked by this statement.
During the execution of CHECK TABLE , other threads may be blocked.

1.1.1.2.1.4 CHECK VIEW


Syntax
CHECK VIEW view_name

Description
The CHECK VIEW statement was introduced in MariaDB 10.0.18 to assist with fixing MDEV-6916 , an issue
introduced in MariaDB 5.2 where the view algorithms were swapped. It checks whether the view algorithm is correct.
It is run as part of mysql_upgrade, and should not normally be required in regular use.

See Also
REPAIR VIEW

1.1.1.2.1.5 CHECKSUM TABLE


Syntax
CHECKSUM TABLE tbl_name [, tbl_name] ... [ QUICK | EXTENDED ]

Contents
1. Syntax
2. Description
3. Differences Between MariaDB and
MySQL

Description
105/3812
CHECKSUM TABLE reports a table checksum. This is very useful if you want to know if two tables are the same (for
example on a master and slave).
With QUICK , the live table checksum is reported if it is available, or NULL otherwise. This is very fast. A live checksum
is enabled by specifying the CHECKSUM=1 table option when you create the table; currently, this is supported only for
Aria and MyISAM tables.
With EXTENDED , the entire table is read row by row and the checksum is calculated. This can be very slow for large
tables.
If neither QUICK nor EXTENDED is specified, MariaDB returns a live checksum if the table storage engine supports it and
scans the table otherwise.
CHECKSUM TABLE requires the SELECT privilege for the table.
For a nonexistent table, CHECKSUM TABLE returns NULL and generates a warning.
The table row format affects the checksum value. If the row format changes, the checksum will change. This means that
when a table created with a MariaDB/MySQL version is upgraded to another version, the checksum value will probably
change.
Two identical tables should always match to the same checksum value; however, also for non-identical tables there is a
very slight chance that they will return the same value as the hashing algorithm is not completely collision-free.

Differences Between MariaDB and MySQL


CHECKSUM TABLE may give a different result as MariaDB doesn't ignore NULL s in the columns as MySQL 5.1 does
(Later MySQL versions should calculate checksums the same way as MariaDB). You can get the 'old style' checksum in
MariaDB by starting mysqld with the --old option. Note however that that the MyISAM and Aria storage engines in
MariaDB are using the new checksum internally, so if you are using --old , the CHECKSUM command will be slower as it
needs to calculate the checksum row by row. Starting from MariaDB Server 10.9, --old is deprecated and will be
removed in a future release. Set --old-mode or OLD_MODE to COMPAT_5_1_CHECKSUM to get 'old style' checksum.

106/3812
1.1.1.2.1.6 CREATE TABLE
Syntax
CREATE [OR REPLACE] [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name
(create_definition,...) [table_options ]... [partition_options]
CREATE [OR REPLACE] [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name
[(create_definition,...)] [table_options ]... [partition_options]
select_statement
CREATE [OR REPLACE] [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name
{ LIKE old_table_name | (LIKE old_table_name) }

select_statement:
[IGNORE | REPLACE] [AS] SELECT ... (Some legal select statement)

Contents
1. Syntax
2. Description
3. Privileges
4. CREATE OR REPLACE
1. Things to be Aware of With CREATE
OR REPLACE
5. CREATE TABLE IF NOT EXISTS
6. CREATE TEMPORARY TABLE
7. CREATE TABLE ... LIKE
8. CREATE TABLE ... SELECT
9. Column Definitions
1. NULL and NOT NULL
2. DEFAULT Column Option
3. AUTO_INCREMENT Column Option
4. ZEROFILL Column Option
5. PRIMARY KEY Column Option
6. UNIQUE KEY Column Option
7. COMMENT Column Option
8. REF_SYSTEM_ID
9. Generated Columns
10. COMPRESSED
11. INVISIBLE
12. WITH SYSTEM VERSIONING Column
Option
13. WITHOUT SYSTEM VERSIONING
Column Option
10. Index Definitions
1. Index Categories
1. Plain Indexes
2. PRIMARY KEY
3. UNIQUE
4. FOREIGN KEY
5. FULLTEXT
6. SPATIAL
2. Index Options
1. KEY_BLOCK_SIZE Index Option
2. Index Types
3. WITH PARSER Index Option
4. COMMENT Index Option
5. CLUSTERING Index Option
6. IGNORED / NOT IGNORED
11. Periods
12. Constraint Expressions
13. Table Options
1. [STORAGE] ENGINE
2. AUTO_INCREMENT
3. AVG_ROW_LENGTH
4. [DEFAULT] CHARACTER
SET/CHARSET
5. CHECKSUM/TABLE_CHECKSUM
6. [DEFAULT] COLLATE
7. COMMENT
8. CONNECTION
107/3812
9. DATA DIRECTORY/INDEX
DIRECTORY
10. DELAY_KEY_WRITE
11. ENCRYPTED
12. ENCRYPTION_KEY_ID
13. IETF_QUOTES
14. INSERT_METHOD
15. KEY_BLOCK_SIZE
16. MIN_ROWS/MAX_ROWS
17. PACK_KEYS
18. PAGE_CHECKSUM
19. PAGE_COMPRESSED
20. PAGE_COMPRESSION_LEVEL
21. PASSWORD
22. RAID_TYPE
23. ROW_FORMAT
1. Supported MyISAM Row Formats
2. Supported Aria Row Formats
3. Supported InnoDB Row Formats
4. Other Storage Engines and
ROW_FORMAT
24. SEQUENCE
25. STATS_AUTO_RECALC
26. STATS_PERSISTENT
27. STATS_SAMPLE_PAGES
28. TRANSACTIONAL
29. UNION
30. WITH SYSTEM VERSIONING
14. Partitions
15. Sequences
16. Atomic DDL
17. Examples
18. See Also

Description
Use the CREATE TABLE statement to create a table with the given name.
In its most basic form, the CREATE TABLE statement provides a table name followed by a list of columns, indexes, and
constraints. By default, the table is created in the default database. Specify a database with db_name.tbl_name . If you
quote the table name, you must quote the database name and table name separately as `db_name`.`tbl_name` . This
is particularly useful for CREATE TABLE ... SELECT, because it allows to create a table into a database, which
contains data from other databases. See Identifier Qualifiers.
If a table with the same name exists, error 1050 results. Use IF NOT EXISTS to suppress this error and issue a note
instead. Use SHOW WARNINGS to see notes.
The CREATE TABLE statement automatically commits the current transaction, except when using the TEMPORARY
keyword.
For valid identifiers to use as table names, see Identifier Names.

Note: if the default_storage_engine is set to ColumnStore then it needs setting on all UMs. Otherwise when the
tables using the default engine are replicated across UMs they will use the wrong engine. You should therefore not
use this option as a session variable with ColumnStore.

Microsecond precision can be between 0-6. If no precision is specified it is assumed to be 0, for backward compatibility
reasons.

Privileges
Executing the CREATE TABLE statement requires the CREATE privilege for the table or the database.

CREATE OR REPLACE
If the OR REPLACE clause is used and the table already exists, then instead of returning an error, the server will drop the
existing table and replace it with the newly defined table.
This syntax was originally added to make replication more robust if it has to rollback and repeat statements such as
CREATE ... SELECT on replicas.

108/3812
CREATE OR REPLACE TABLE table_name (a int);

is basically the same as:

DROP TABLE IF EXISTS table_name;


CREATE TABLE table_name (a int);

with the following exceptions:


If table_name was locked with LOCK TABLES it will continue to be locked after the statement.
Temporary tables are only dropped if the TEMPORARY keyword was used. (With DROP TABLE, temporary tables
are preferred to be dropped before normal tables).

Things to be Aware of With CREATE OR REPLACE


The table is dropped first (if it existed), after that the CREATE is done. Because of this, if the CREATE fails, then
the table will not exist anymore after the statement. If the table was used with LOCK TABLES it will be unlocked.
One can't use OR REPLACE together with IF EXISTS .
Slaves in replication will by default use CREATE OR REPLACE when replicating CREATE statements that don''t use
IF EXISTS . This can be changed by setting the variable slave-ddl-exec-mode to STRICT .

CREATE TABLE IF NOT EXISTS


If the IF NOT EXISTS clause is used, then the table will only be created if a table with the same name does not already
exist. If the table already exists, then a warning will be triggered by default.

CREATE TEMPORARY TABLE


Use the TEMPORARY keyword to create a temporary table that is only available to the current session. Temporary tables
are dropped when the session ends. Temporary table names are specific to the session. They will not conflict with other
temporary tables from other sessions even if they share the same name. They will shadow names of non-temporary
tables or views, if they are identical. A temporary table can have the same name as a non-temporary table which is
located in the same database. In that case, their name will reference the temporary table when used in SQL statements.
You must have the CREATE TEMPORARY TABLES privilege on the database to create temporary tables. If no storage
engine is specified, the default_tmp_storage_engine setting will determine the engine.
ROCKSDB temporary tables cannot be created by setting the default_tmp_storage_engine system variable, or using
CREATE TEMPORARY TABLE LIKE . Before MariaDB 10.7, they could be specified, but would silently fail, and a MyISAM
table would be created instead. From MariaDB 10.7 an error is returned. Explicitly creating a temporary table with
ENGINE=ROCKSDB has never been permitted.

CREATE TABLE ... LIKE


Use the LIKE clause instead of a full table definition to create a table with the same definition as another table,
including columns, indexes, and table options. Foreign key definitions, as well as any DATA DIRECTORY or INDEX
DIRECTORY table options specified on the original table, will not be created.

CREATE TABLE ... SELECT


You can create a table containing data from other tables using the CREATE ... SELECT statement. Columns will be
created in the table for each field returned by the SELECT query.
You can also define some columns normally and add other columns from a SELECT . You can also create columns in the
normal way and assign them some values using the query, this is done to force a certain type or other field
characteristics. The columns that are not named in the query will be placed before the others. For example:

CREATE TABLE test (a INT NOT NULL, b CHAR(10)) ENGINE=MyISAM


SELECT 5 AS b, c, d FROM another_table;

Remember that the query just returns data. If you want to use the same indexes, or the same columns attributes ( [NOT]
NULL , DEFAULT , AUTO_INCREMENT ) in the new table, you need to specify them manually. Types and sizes are not
automatically preserved if no data returned by the SELECT requires the full size, and VARCHAR could be converted into
CHAR . The CAST() function can be used to forcee the new table to use certain types.
Aliases ( AS ) are taken into account, and they should always be used when you SELECT an expression (function,
arithmetical operation, etc).
If an error occurs during the query, the table will not be created at all.

109/3812
If the new table has a primary key or UNIQUE indexes, you can use the IGNORE or REPLACE keywords to handle
duplicate key errors during the query. IGNORE means that the newer values must not be inserted an identical value
exists in the index. REPLACE means that older values must be overwritten.
If the columns in the new table are more than the rows returned by the query, the columns populated by the query will
be placed after other columns. Note that if the strict SQL_MODE is on, and the columns that are not names in the query
do not have a DEFAULT value, an error will raise and no rows will be copied.
Concurrent inserts are not used during the execution of a CREATE ... SELECT .
If the table already exists, an error similar to the following will be returned:

ERROR 1050 (42S01): Table 't' already exists

If the IF NOT EXISTS clause is used and the table exists, a note will be produced instead of an error.
To insert rows from a query into an existing table, INSERT ... SELECT can be used.

Column Definitions
create_definition:
{ col_name column_definition | index_definition | period_definition | CHECK (expr) }

column_definition:
data_type
[NOT NULL | NULL] [DEFAULT default_value | (expression)]
[ON UPDATE [NOW | CURRENT_TIMESTAMP] [(precision)]]
[AUTO_INCREMENT] [ZEROFILL] [UNIQUE [KEY] | [PRIMARY] KEY]
[INVISIBLE] [{WITH|WITHOUT} SYSTEM VERSIONING]
[COMMENT 'string'] [REF_SYSTEM_ID = value]
[reference_definition]
| data_type [GENERATED ALWAYS]
AS { { ROW {START|END} } | { (expression) [VIRTUAL | PERSISTENT | STORED] } }
[UNIQUE [KEY]] [COMMENT 'string']

constraint_definition:
CONSTRAINT [constraint_name] CHECK (expression)

Note: Until MariaDB 10.4, MariaDB accepts the shortcut format with a REFERENCES clause only in ALTER
TABLE and CREATE TABLE statements, but that syntax does nothing. For example:
CREATE TABLE b(for_key INT REFERENCES a(not_key));

MariaDB simply parses it without returning any error or warning, for compatibility with other DBMS's. Before
MariaDB 10.2.1 this was also true for CHECK constraints. However, only the syntax described below creates
foreign keys.
From MariaDB 10.5, MariaDB will attempt to apply the constraint. See Foreign Keys examples.

Each definition either creates a column in the table or specifies and index or constraint on one or more columns. See
Indexes below for details on creating indexes.
Create a column by specifying a column name and a data type, optionally followed by column options. See Data Types
for a full list of data types allowed in MariaDB.

NULL and NOT NULL


Use the NULL or NOT NULL options to specify that values in the column may or may not be NULL , respectively. By
default, values may be NULL . See also NULL Values in MariaDB.

DEFAULT Column Option


MariaDB starting with 10.2.1
The DEFAULT clause was enhanced in MariaDB 10.2.1 . Some enhancements include
BLOB and TEXT columns now support DEFAULT .
The DEFAULT clause can now be used with an expression or function.

Specify a default value using the DEFAULT clause. If you don't specify DEFAULT then the following rules apply:

110/3812
If the column is not defined with NOT NULL , AUTO_INCREMENT or TIMESTAMP , an explicit DEFAULT NULL will be
added. Note that in MySQL and in MariaDB before 10.1.6, you may get an explicit DEFAULT for primary key parts,
if not specified with NOT NULL.
The default value will be used if you INSERT a row without specifying a value for that column, or if you specify
DEFAULT for that column. Before MariaDB 10.2.1 you couldn't usually provide an expression or function to evaluate
at insertion time. You had to provide a constant default value instead. The one exception is that you may use
CURRENT_TIMESTAMP as the default value for a TIMESTAMP column to use the current timestamp at insertion time.
CURRENT_TIMESTAMP may also be used as the default value for a DATETIME
From MariaDB 10.2.1 you can use most functions in DEFAULT . Expressions should have parentheses around them. If
you use a non deterministic function in DEFAULT then all inserts to the table will be replicated in row mode. You can
even refer to earlier columns in the DEFAULT expression (excluding AUTO_INCREMENT columns):

CREATE TABLE t1 (a int DEFAULT (1+1), b int DEFAULT (a+1));


CREATE TABLE t2 (a bigint primary key DEFAULT UUID_SHORT());

The DEFAULT clause cannot contain any stored functions or subqueries, and a column used in the clause must already
have been defined earlier in the statement.
Since MariaDB 10.2.1 , it is possible to assign BLOB or TEXT columns a DEFAULT value. In earlier versions, assigning
a default to these columns was not possible.

MariaDB starting with 10.3.3


Starting from 10.3.3 you can also use DEFAULT (NEXT VALUE FOR sequence)

AUTO_INCREMENT Column Option


Use AUTO_INCREMENT to create a column whose value can can be set automatically from a simple counter. You can
only use AUTO_INCREMENT on a column with an integer type. The column must be a key, and there can only be one
AUTO_INCREMENT column in a table. If you insert a row without specifying a value for that column (or if you specify 0 ,
NULL , or DEFAULT as the value), the actual value will be taken from the counter, with each insertion incrementing the
counter by one. You can still insert a value explicitly. If you insert a value that is greater than the current counter value,
the counter is set based on the new value. An AUTO_INCREMENT column is implicitly NOT NULL . Use LAST_INSERT_ID
to get the AUTO_INCREMENT value most recently used by an INSERT statement.

ZEROFILL Column Option


If the ZEROFILL column option is specified for a column using a numeric data type, then the column will be set to
UNSIGNED and the spaces used by default to pad the field are replaced with zeros. ZEROFILL is ignored in expressions
or as part of a UNION. ZEROFILL is a non-standard MySQL and MariaDB enhancement.

PRIMARY KEY Column Option


Use PRIMARY KEY to make a column a primary key. A primary key is a special type of a unique key. There can be at
most one primary key per table, and it is implicitly NOT NULL .
Specifying a column as a unique key creates a unique index on that column. See the Index Definitions section below for
more information.

UNIQUE KEY Column Option


Use UNIQUE KEY (or just UNIQUE ) to specify that all values in the column must be distinct from each other. Unless the
column is NOT NULL , there may be multiple rows with NULL in the column.
Specifying a column as a unique key creates a unique index on that column. See the Index Definitions section below for
more information.

COMMENT Column Option


You can provide a comment for each column using the COMMENT clause. The maximum length is 1024 characters. Use
the SHOW FULL COLUMNS statement to see column comments.

REF_SYSTEM_ID
REF_SYSTEM_ID can be used to specify Spatial Reference System IDs for spatial data type columns.

Generated Columns
111/3812
A generated column is a column in a table that cannot explicitly be set to a specific value in a DML query. Instead, its
value is automatically generated based on an expression. This expression might generate the value based on the
values of other columns in the table, or it might generate the value by calling built-in functions or user-defined functions
(UDFs).
There are two types of generated columns:
PERSISTENT or STORED : This type's value is actually stored in the table.
VIRTUAL : This type's value is not stored at all. Instead, the value is generated dynamically when the table is
queried. This type is the default.
Generated columns are also sometimes called computed columns or virtual columns.
For a complete description about generated columns and their limitations, see Generated (Virtual and Persistent/Stored)
Columns.

COMPRESSED
MariaDB starting with 10.3.3
Certain columns may be compressed. See Storage-Engine Independent Column Compression.

INVISIBLE
MariaDB starting with 10.3.3
Columns may be made invisible, and hidden in certain contexts. See Invisible Columns.

WITH SYSTEM VERSIONING Column Option


MariaDB starting with 10.3.4
Columns may be explicitly marked as included from system versioning. See System-versioned tables for details.

WITHOUT SYSTEM VERSIONING Column Option


MariaDB starting with 10.3.4
Columns may be explicitly marked as excluded from system versioning. See System-versioned tables for details.

Index Definitions

112/3812
index_definition:
{INDEX|KEY} [index_name] [index_type] (index_col_name,...) [index_option] ...
{{{|}}} {FULLTEXT|SPATIAL} [INDEX|KEY] [index_name] (index_col_name,...) [index_option] ...
{{{|}}} [CONSTRAINT [symbol]] PRIMARY KEY [index_type] (index_col_name,...) [index_option] ...
{{{|}}} [CONSTRAINT [symbol]] UNIQUE [INDEX|KEY] [index_name] [index_type] (index_col_name,...)
[index_option] ...
{{{|}}} [CONSTRAINT [symbol]] FOREIGN KEY [index_name] (index_col_name,...) reference_definition

index_col_name:
col_name [(length)] [ASC | DESC]

index_type:
USING {BTREE | HASH | RTREE}

index_option:
[ KEY_BLOCK_SIZE [=] value
{{{|}}} index_type
{{{|}}} WITH PARSER parser_name
{{{|}}} COMMENT 'string'
{{{|}}} CLUSTERING={YES| NO} ]
[ IGNORED | NOT IGNORED ]

reference_definition:
REFERENCES tbl_name (index_col_name,...)
[MATCH FULL | MATCH PARTIAL | MATCH SIMPLE]
[ON DELETE reference_option]
[ON UPDATE reference_option]

reference_option:
RESTRICT | CASCADE | SET NULL | NO ACTION

INDEX and KEY are synonyms.

Index names are optional, if not specified an automatic name will be assigned. Index name are needed to drop indexes
and appear in error messages when a constraint is violated.

Index Categories
Plain Indexes
Plain indexes are regular indexes that are not unique, and are not acting as a primary key or a foreign key. They are
also not the "specialized" FULLTEXT or SPATIAL indexes.
See Getting Started with Indexes: Plain Indexes for more information.

PRIMARY KEY
For PRIMARY KEY indexes, you can specify a name for the index, but it is ignored, and the name of the index is always
PRIMARY . From MariaDB 10.3.18 and MariaDB 10.4.8, a warning is explicitly issued if a name is specified. Before then,
the name was silently ignored.
See Getting Started with Indexes: Primary Key for more information.

UNIQUE
The UNIQUE keyword means that the index will not accept duplicated values, except for NULLs. An error will raise if you
try to insert duplicate values in a UNIQUE index.
For UNIQUE indexes, you can specify a name for the constraint, using the CONSTRAINT keyword. That name will be
used in error messages.
See Getting Started with Indexes: Unique Index for more information.

FOREIGN KEY
For FOREIGN KEY indexes, a reference definition must be provided.
For FOREIGN KEY indexes, you can specify a name for the constraint, using the CONSTRAINT keyword. That name will
be used in error messages.
First, you have to specify the name of the target (parent) table and a column or a column list which must be indexed and
whose values must match to the foreign key's values. The MATCH clause is accepted to improve the compatibility with
other DBMS's, but has no meaning in MariaDB. The ON DELETE and ON UPDATE clauses specify what must be done
when a DELETE (or a REPLACE ) statements attempts to delete a referenced row from the parent table, and when an
UPDATE statement attempts to modify the referenced foreign key columns in a parent table row, respectively. The
following options are allowed:
113/3812
RESTRICT : The delete/update operation is not performed. The statement terminates with a 1451 error
(SQLSTATE '2300').
NO ACTION : Synonym for RESTRICT .
CASCADE : The delete/update operation is performed in both tables.
SET NULL : The update or delete goes ahead in the parent table, and the corresponding foreign key fields in the
child table are set to NULL . (They must not be defined as NOT NULL for this to succeed).
SET DEFAULT : This option is currently implemented only for the PBXT storage engine, which is disabled by
default and no longer maintained. It sets the child table's foreign key fields to their DEFAULT values when the
referenced parent table key entries are updated or deleted.
If either clause is omitted, the default behavior for the omitted clause is RESTRICT .
See Foreign Keys for more information.

FULLTEXT
Use the FULLTEXT keyword to create full-text indexes.
See Full-Text Indexes for more information.

SPATIAL
Use the SPATIAL keyword to create geometric indexes.
See SPATIAL INDEX for more information.

Index Options
KEY_BLOCK_SIZE Index Option
The KEY_BLOCK_SIZE index option is similar to the KEY_BLOCK_SIZE table option.
With the InnoDB storage engine, if you specify a non-zero value for the KEY_BLOCK_SIZE table option for the whole
table, then the table will implicitly be created with the ROW_FORMAT table option set to COMPRESSED . However, this
does not happen if you just set the KEY_BLOCK_SIZE index option for one or more indexes in the table. The InnoDB
storage engine ignores the KEY_BLOCK_SIZE index option. However, the SHOW CREATE TABLE statement may still
report it for the index.
For information about the KEY_BLOCK_SIZE index option, see the KEY_BLOCK_SIZE table option below.

Index Types
Each storage engine supports some or all index types. See Storage Engine Index Types for details on permitted index
types for each storage engine.
Different index types are optimized for different kind of operations:
BTREE is the default type, and normally is the best choice. It is supported by all storage engines. It can be used to
compare a column's value with a value using the =, >, >=, <, <=, BETWEEN , and LIKE operators. BTREE can also
be used to find NULL values. Searches against an index prefix are possible.
HASH is only supported by the MEMORY storage engine. HASH indexes can only be used for =, <=, and >=
comparisons. It can not be used for the ORDER BY clause. Searches against an index prefix are not possible.
RTREE is the default for SPATIAL indexes, but if the storage engine does not support it BTREE can be used.
Index columns names are listed between parenthesis. After each column, a prefix length can be specified. If no length is
specified, the whole column will be indexed. ASC and DESC can be specified for compatibility with are DBMS's, but
have no meaning in MariaDB.

WITH PARSER Index Option


The WITH PARSER index option only applies to FULLTEXT indexes and contains the fulltext parser name. The fulltext
parser must be an installed plugin.

COMMENT Index Option


A comment of up to 1024 characters is permitted with the COMMENT index option.
The COMMENT index option allows you to specify a comment with user-readable text describing what the index is for.
This information is not used by the server itself.

CLUSTERING Index Option


The CLUSTERING index option is only valid for tables using the TokuDB storage engine.

IGNORED / NOT IGNORED


114/3812
MariaDB starting with 10.6.0
From MariaDB 10.6.0, indexes can be specified to be ignored by the optimizer. See Ignored Indexes.

Periods
MariaDB starting with 10.3.4

period_definition:
PERIOD FOR SYSTEM_TIME (start_column_name, end_column_name)

MariaDB supports a subset of the standard syntax for periods. At the moment it's only used for creating System-
versioned tables. Both columns must be created, must be either of a TIMESTAMP(6) or BIGINT UNSIGNED type, and
be generated as ROW START and ROW END accordingly. See System-versioned tables for details.
The table must also have the WITH SYSTEM VERSIONING clause.

Constraint Expressions
MariaDB starting with 10.2.1
MariaDB 10.2.1 introduced new ways to define a constraint.

Note: Before MariaDB 10.2.1 , constraint expressions were accepted in the syntax but ignored.
MariaDB 10.2.1 introduced two ways to define a constraint:
CHECK(expression) given as part of a column definition.
CONSTRAINT [constraint_name] CHECK (expression)
Before a row is inserted or updated, all constraints are evaluated in the order they are defined. If any constraints fails,
then the row will not be updated. One can use most deterministic functions in a constraint, including UDFs.

create table t1 (a int check(a>0) ,b int check (b> 0), constraint abc check (a>b));

If you use the second format and you don't give a name to the constraint, then the constraint will get a auto generated
name. This is done so that you can later delete the constraint with ALTER TABLE DROP constraint_name.
One can disable all constraint expression checks by setting the variable check_constraint_checks to OFF . This is
useful for example when loading a table that violates some constraints that you want to later find and fix in SQL.
See CONSTRAINT for more information.

Table Options
For each individual table you create (or alter), you can set some table options. The general syntax for setting options is:
<OPTION_NAME> = <option_value>, [<OPTION_NAME> = <option_value> ...]
The equal sign is optional.
Some options are supported by the server and can be used for all tables, no matter what storage engine they use; other
options can be specified for all storage engines, but have a meaning only for some engines. Also, engines can extend
CREATE TABLE with new options.

If the IGNORE_BAD_TABLE_OPTIONS SQL_MODE is enabled, wrong table options generate a warning; otherwise, they
generate an error.

115/3812
table_option:
[STORAGE] ENGINE [=] engine_name
| AUTO_INCREMENT [=] value
| AVG_ROW_LENGTH [=] value
| [DEFAULT] CHARACTER SET [=] charset_name
| CHECKSUM [=] {0 | 1}
| [DEFAULT] COLLATE [=] collation_name
| COMMENT [=] 'string'
| CONNECTION [=] 'connect_string'
| DATA DIRECTORY [=] 'absolute path to directory'
| DELAY_KEY_WRITE [=] {0 | 1}
| ENCRYPTED [=] {YES | NO}
| ENCRYPTION_KEY_ID [=] value
| IETF_QUOTES [=] {YES | NO}
| INDEX DIRECTORY [=] 'absolute path to directory'
| INSERT_METHOD [=] { NO | FIRST | LAST }
| KEY_BLOCK_SIZE [=] value
| MAX_ROWS [=] value
| MIN_ROWS [=] value
| PACK_KEYS [=] {0 | 1 | DEFAULT}
| PAGE_CHECKSUM [=] {0 | 1}
| PAGE_COMPRESSED [=] {0 | 1}
| PAGE_COMPRESSION_LEVEL [=] {0 .. 9}
| PASSWORD [=] 'string'
| ROW_FORMAT [=] {DEFAULT|DYNAMIC|FIXED|COMPRESSED|REDUNDANT|COMPACT|PAGE}
| SEQUENCE [=] {0|1}
| STATS_AUTO_RECALC [=] {DEFAULT|0|1}
| STATS_PERSISTENT [=] {DEFAULT|0|1}
| STATS_SAMPLE_PAGES [=] {DEFAULT|value}
| TABLESPACE tablespace_name
| TRANSACTIONAL [=] {0 | 1}
| UNION [=] (tbl_name[,tbl_name]...)
| WITH SYSTEM VERSIONING

[STORAGE] ENGINE
[STORAGE] ENGINE specifies a storage engine for the table. If this option is not used, the default storage engine is used
instead. That is, the default_storage_engine session option value if it is set, or the value specified for the --default-
storage-engine mysqld startup option, or the default storage engine, InnoDB. If the specified storage engine is not
installed and active, the default value will be used, unless the NO_ENGINE_SUBSTITUTION SQL MODE is set (default).
This is only true for CREATE TABLE , not for ALTER TABLE . For a list of storage engines that are present in your server,
issue a SHOW ENGINES.

AUTO_INCREMENT
AUTO_INCREMENT specifies the initial value for the AUTO_INCREMENT primary key. This works for MyISAM, Aria,
InnoDB, MEMORY, and ARCHIVE tables. You can change this option with ALTER TABLE , but in that case the new value
must be higher than the highest value which is present in the AUTO_INCREMENT column. If the storage engine does not
support this option, you can insert (and then delete) a row having the wanted value - 1 in the AUTO_INCREMENT column.

AVG_ROW_LENGTH
AVG_ROW_LENGTH is the average rows size. It only applies to tables using MyISAM and Aria storage engines that have
the ROW_FORMAT table option set to FIXED format.
MyISAM uses MAX_ROWS and AVG_ROW_LENGTH to decide the maximum size of a table (default: 256TB, or the maximum
file size allowed by the system).

[DEFAULT] CHARACTER SET/CHARSET


[DEFAULT] CHARACTER SET (or [DEFAULT] CHARSET ) is used to set a default character set for the table. This is the
character set used for all columns where an explicit character set is not specified. If this option is omitted or DEFAULT is
specified, database's default character set will be used. See Setting Character Sets and Collations for details on setting
the character sets.

CHECKSUM/TABLE_CHECKSUM
CHECKSUM (or TABLE_CHECKSUM ) can be set to 1 to maintain a live checksum for all table's rows. This makes write

116/3812
operations slower, but CHECKSUM TABLE will be very fast. This option is only supported for MyISAM and Aria tables.

[DEFAULT] COLLATE
[DEFAULT] COLLATE is used to set a default collation for the table. This is the collation used for all columns where an
explicit character set is not specified. If this option is omitted or DEFAULT is specified, database's default option will be
used. See Setting Character Sets and Collations for details on setting the collations

COMMENT
COMMENT is a comment for the table. The maximum length is 2048 characters. Also used to define table parameters
when creating a Spider table.

CONNECTION
CONNECTION is used to specify a server name or a connection string for a Spider, CONNECT, Federated or FederatedX
table.

DATA DIRECTORY/INDEX DIRECTORY


DATA DIRECTORY and INDEX DIRECTORY are supported for MyISAM and Aria, and DATA DIRECTORY is also supported
by InnoDB if the innodb_file_per_table server system variable is enabled, but only in CREATE TABLE, not in ALTER
TABLE. So, carefully choose a path for InnoDB tables at creation time, because it cannot be changed without dropping
and re-creating the table. These options specify the paths for data files and index files, respectively. If these options are
omitted, the database's directory will be used to store data files and index files. Note that these table options do not
work for partitioned tables (use the partition options instead), or if the server has been invoked with the --skip-symbolic-
links startup option. To avoid the overwriting of old files with the same name that could be present in the directories, you
can use the --keep_files_on_create option (an error will be issued if files already exist). These options are ignored if
the NO_DIR_IN_CREATE SQL_MODE is enabled (useful for replication slaves). Also note that symbolic links cannot be
used for InnoDB tables.
DATA DIRECTORY works by creating symlinks from where the table would normally have been (inside the datadir) to
where the option specifies. For security reasons, to avoid bypassing the privilege system, the server does not permit
symlinks inside the datadir. Therefore, DATA DIRECTORY cannot be used to specify a location inside the datadir. An
attempt to do so will result in an error 1210 (HY000) Incorrect arguments to DATA DIRECTORY .

DELAY_KEY_WRITE
DELAY_KEY_WRITE is supported by MyISAM and Aria, and can be set to 1 to speed up write operations. In that case,
when data are modified, the indexes are not updated until the table is closed. Writing the changes to the index file
altogether can be much faster. However, note that this option is applied only if the delay_key_write server variable is
set to 'ON'. If it is 'OFF' the delayed index writes are always disabled, and if it is 'ALL' the delayed index writes are
always used, disregarding the value of DELAY_KEY_WRITE .

ENCRYPTED
The ENCRYPTED table option can be used to manually set the encryption status of an InnoDB table. See InnoDB
Encryption for more information.
Aria does not support the ENCRYPTED table option. See MDEV-18049 .
See Data-at-Rest Encryption for more information.

ENCRYPTION_KEY_ID
The ENCRYPTION_KEY_ID table option can be used to manually set the encryption key of an InnoDB table. See InnoDB
Encryption for more information.
Aria does not support the ENCRYPTION_KEY_ID table option. See MDEV-18049 .
See Data-at-Rest Encryption for more information.

IETF_QUOTES
For the CSV storage engine, the IETF_QUOTES option, when set to YES , enables IETF-compatible parsing of embedded
quote and comma characters. Enabling this option for a table improves compatibility with other tools that use CSV, but is
not compatible with MySQL CSV tables, or MariaDB CSV tables created without this option. Disabled by default.

INSERT_METHOD
117/3812
INSERT_METHOD is only used with MERGE tables. This option determines in which underlying table the new rows should
be inserted. If you set it to 'NO' (which is the default) no new rows can be added to the table (but you will still be able to
perform INSERT s directly against the underlying tables). FIRST means that the rows are inserted into the first table,
and LAST means that thet are inserted into the last table.

KEY_BLOCK_SIZE
KEY_BLOCK_SIZE is used to determine the size of key blocks, in bytes or kilobytes. However, this value is just a hint, and
the storage engine could modify or ignore it. If KEY_BLOCK_SIZE is set to 0, the storage engine's default value will be
used.
With the InnoDB storage engine, if you specify a non-zero value for the KEY_BLOCK_SIZE table option for the whole
table, then the table will implicitly be created with the ROW_FORMAT table option set to COMPRESSED .

MIN_ROWS/MAX_ROWS
MIN_ROWS and MAX_ROWS let the storage engine know how many rows you are planning to store as a minimum and as a
maximum. These values will not be used as real limits, but they help the storage engine to optimize the table. MIN_ROWS
is only used by MEMORY storage engine to decide the minimum memory that is always allocated. MAX_ROWS is used to
decide the minimum size for indexes.

PACK_KEYS
PACK_KEYS can be used to determine whether the indexes will be compressed. Set it to 1 to compress all keys. With a
value of 0, compression will not be used. With the DEFAULT value, only long strings will be compressed. Uncompressed
keys are faster.

PAGE_CHECKSUM
PAGE_CHECKSUM is only applicable to Aria tables, and determines whether indexes and data should use page checksums
for extra safety.

PAGE_COMPRESSED
PAGE_COMPRESSED is used to enable InnoDB page compression for InnoDB tables.

PAGE_COMPRESSION_LEVEL
PAGE_COMPRESSION_LEVEL is used to set the compression level for InnoDB page compression for InnoDB tables. The
table must also have the PAGE_COMPRESSED table option set to 1 .
Valid values for PAGE_COMPRESSION_LEVEL are 1 (the best speed) through 9 (the best compression), .

PASSWORD
PASSWORD is unused.

RAID_TYPE
RAID_TYPE is an obsolete option, as the raid support has been disabled since MySQL 5.0.

ROW_FORMAT
The ROW_FORMAT table option specifies the row format for the data file. Possible values are engine-dependent.

Supported MyISAM Row Formats


For MyISAM, the supported row formats are:
FIXED
DYNAMIC
COMPRESSED
The COMPRESSED row format can only be set by the myisampack command line tool.
See MyISAM Storage Formats for more information.

Supported Aria Row Formats

118/3812
For Aria, the supported row formats are:
PAGE
FIXED
DYNAMIC .
See Aria Storage Formats for more information.

Supported InnoDB Row Formats


For InnoDB, the supported row formats are:
COMPACT
REDUNDANT
COMPRESSED
DYNAMIC .
If the ROW_FORMAT table option is set to FIXED for an InnoDB table, then the server will either return an error or a
warning depending on the value of the innodb_strict_mode system variable. If the innodb_strict_mode system variable is
set to OFF , then a warning is issued, and MariaDB will create the table using the default row format for the specific
MariaDB server version. If the innodb_strict_mode system variable is set to ON , then an error will be raised.
See InnoDB Storage Formats for more information.

Other Storage Engines and ROW_FORMAT


Other storage engines do not support the ROW_FORMAT table option.

SEQUENCE
MariaDB starting with 10.3
If the table is a sequence, then it will have the SEQUENCE set to 1 .

STATS_AUTO_RECALC
STATS_AUTO_RECALC indicates whether to automatically recalculate persistent statistics (see STATS_PERSISTENT , below)
for an InnoDB table. If set to 1 , statistics will be recalculated when more than 10% of the data has changed. When set
to 0 , stats will be recalculated only when an ANALYZE TABLE is run. If set to DEFAULT , or left out, the value set by the
innodb_stats_auto_recalc system variable applies. See InnoDB Persistent Statistics.

STATS_PERSISTENT
STATS_PERSISTENT indicates whether the InnoDB statistics created by ANALYZE TABLE will remain on disk or not. It
can be set to 1 (on disk), 0 (not on disk, the pre-MariaDB 10 behavior), or DEFAULT (the same as leaving out the
option), in which case the value set by the innodb_stats_persistent system variable will apply. Persistent statistics
stored on disk allow the statistics to survive server restarts, and provide better query plan stability. See InnoDB
Persistent Statistics.

STATS_SAMPLE_PAGES
STATS_SAMPLE_PAGES indicates how many pages are used to sample index statistics. If 0 or DEFAULT, the default
value, the innodb_stats_sample_pages value is used. See InnoDB Persistent Statistics.

TRANSACTIONAL
TRANSACTIONAL is only applicable for Aria tables. In future Aria tables created with this option will be fully transactional,
but currently this provides a form of crash protection. See Aria Storage Engine for more details.

UNION
UNION must be specified when you create a MERGE table. This option contains a comma-separated list of MyISAM
tables which are accessed by the new table. The list is enclosed between parenthesis. Example: UNION = (t1,t2)

WITH SYSTEM VERSIONING


WITH SYSTEM VERSIONING is used for creating System-versioned tables.

Partitions
119/3812
partition_options:
PARTITION BY
{ [LINEAR] HASH(expr)
| [LINEAR] KEY(column_list)
| RANGE(expr)
| LIST(expr)
| SYSTEM_TIME [INTERVAL time_quantity time_unit] [LIMIT num] }
[PARTITIONS num]
[SUBPARTITION BY
{ [LINEAR] HASH(expr)
| [LINEAR] KEY(column_list) }
[SUBPARTITIONS num]
]
[(partition_definition [, partition_definition] ...)]

partition_definition:
PARTITION partition_name
[VALUES {LESS THAN {(expr) | MAXVALUE} | IN (value_list)}]
[[STORAGE] ENGINE [=] engine_name]
[COMMENT [=] 'comment_text' ]
[DATA DIRECTORY [=] 'data_dir']
[INDEX DIRECTORY [=] 'index_dir']
[MAX_ROWS [=] max_number_of_rows]
[MIN_ROWS [=] min_number_of_rows]
[TABLESPACE [=] tablespace_name]
[NODEGROUP [=] node_group_id]
[(subpartition_definition [, subpartition_definition] ...)]

subpartition_definition:
SUBPARTITION logical_name
[[STORAGE] ENGINE [=] engine_name]
[COMMENT [=] 'comment_text' ]
[DATA DIRECTORY [=] 'data_dir']
[INDEX DIRECTORY [=] 'index_dir']
[MAX_ROWS [=] max_number_of_rows]
[MIN_ROWS [=] min_number_of_rows]
[TABLESPACE [=] tablespace_name]
[NODEGROUP [=] node_group_id]

If the PARTITION BY clause is used, the table will be partitioned. A partition method must be explicitly indicated for
partitions and subpartitions. Partition methods are:
[LINEAR] HASH creates a hash key which will be used to read and write rows. The partition function can be any
valid SQL expression which returns an INTEGER number. Thus, it is possible to use the HASH method on an
integer column, or on functions which accept integer columns as an argument. However, VALUES LESS THAN and
VALUES IN clauses can not be used with HASH . An example:

CREATE TABLE t1 (a INT, b CHAR(5), c DATETIME)


PARTITION BY HASH ( YEAR(c) );

[LINEAR] HASH can be used for subpartitions, too.

[LINEAR] KEY is similar to HASH , but the index has an even distribution of data. Also, the expression can only be
a column or a list of columns. VALUES LESS THAN and VALUES IN clauses can not be used with KEY .
RANGE partitions the rows using on a range of values, using the VALUES LESS THAN operator. VALUES IN is not
allowed with RANGE . The partition function can be any valid SQL expression which returns a single value.
LIST assigns partitions based on a table's column with a restricted set of possible values. It is similar to RANGE ,
but VALUES IN must be used for at least 1 columns, and VALUES LESS THAN is disallowed.
SYSTEM_TIME partitioning is used for System-versioned tables to store historical data separately from current
data.
Only HASH and KEY can be used for subpartitions, and they can be [LINEAR] .
It is possible to define up to 1024 partitions and subpartitions.
The number of defined partitions can be optionally specified as PARTITION count . This can be done to avoid specifying
all partitions individually. But you can also declare each individual partition and, additionally, specify a PARTITIONS
count clause; in the case, the number of PARTITION s must equal count.

Also see Partitioning Types Overview.

Sequences
120/3812
MariaDB starting with 10.3
CREATE TABLE can also be used to create a SEQUENCE. See CREATE SEQUENCE and Sequence Overview.

Atomic DDL
MariaDB starting with 10.6.1
MariaDB 10.6.1 supports Atomic DDL. CREATE TABLE is atomic, except for CREATE OR REPLACE , which is only crash
safe.

Examples
create table if not exists test (
a bigint auto_increment primary key,
name varchar(128) charset utf8,
key name (name(32))
) engine=InnoDB default charset latin1;

This example shows a couple of things:


Usage of IF NOT EXISTS ; If the table already existed, it will not be created. There will not be any error for the
client, just a warning.
How to create a PRIMARY KEY that is automatically generated.
How to specify a table-specific character set and another for a column.
How to create an index ( name ) that is only partly indexed (to save space).
The following clauses will work from MariaDB 10.2.1 only.

CREATE TABLE t1(


a int DEFAULT (1+1),
b int DEFAULT (a+1),
expires DATETIME DEFAULT(NOW() + INTERVAL 1 YEAR),
x BLOB DEFAULT USER()
);

See Also
Identifier Names
ALTER TABLE
DROP TABLE
Character Sets and Collations
SHOW CREATE TABLE
Storage engines can add their own attributes for columns, indexes and tables.
Variable slave-ddl-exec-mode.

1.1.1.2.1.7 DELETE
Contents
1. Syntax
2. Description
1. PARTITION
2. FOR PORTION OF
3. RETURNING
4. Same Source and Target Table
5. DELETE HISTORY
3. Examples
1. Deleting from the Same Source and
Target
4. See Also

Syntax
Single-table syntax:

121/3812
DELETE [LOW_PRIORITY] [QUICK] [IGNORE]
FROM tbl_name [PARTITION (partition_list)]
[FOR PORTION OF period FROM expr1 TO expr2]
[WHERE where_condition]
[ORDER BY ...]
[LIMIT row_count]
[RETURNING select_expr
[, select_expr ...]]

Multiple-table syntax:

DELETE [LOW_PRIORITY] [QUICK] [IGNORE]


tbl_name[.*] [, tbl_name[.*]] ...
FROM table_references
[WHERE where_condition]

Or:

DELETE [LOW_PRIORITY] [QUICK] [IGNORE]


FROM tbl_name[.*] [, tbl_name[.*]] ...
USING table_references
[WHERE where_condition]

Trimming history:

DELETE HISTORY
FROM tbl_name [PARTITION (partition_list)]
[BEFORE SYSTEM_TIME [TIMESTAMP|TRANSACTION] expression]

Description
Option Description
Wait until all SELECT's are done before starting the statement. Used with storage engines that
LOW_PRIORITY uses table locking (MyISAM, Aria etc). See HIGH_PRIORITY and LOW_PRIORITY clauses for
details.
Signal the storage engine that it should expect that a lot of rows are deleted. The storage engine
engine can do things to speed up the DELETE like ignoring merging of data blocks until all rows
QUICK
are deleted from the block (instead of when a block is half full). This speeds up things at the
expanse of lost space in data blocks. At least MyISAM and Aria support this feature.
Don't stop the query even if a not-critical error occurs (like data overflow). See How IGNORE
IGNORE
works for a full description.

For the single-table syntax, the DELETE statement deletes rows from tbl_name and returns a count of the number of
deleted rows. This count can be obtained by calling the ROW_COUNT() function. The WHERE clause, if given, specifies
the conditions that identify which rows to delete. With no WHERE clause, all rows are deleted. If the ORDER BY clause
is specified, the rows are deleted in the order that is specified. The LIMIT clause places a limit on the number of rows
that can be deleted.
For the multiple-table syntax, DELETE deletes from each tbl_name the rows that satisfy the conditions. In this case,
ORDER BY and LIMIT> cannot be used. A DELETE can also reference tables which are located in different databases;
see Identifier Qualifiers for the syntax.
where_condition is an expression that evaluates to true for each row to be deleted. It is specified as described in
SELECT.
Currently, you cannot delete from a table and select from the same table in a subquery.
You need the DELETE privilege on a table to delete rows from it. You need only the SELECT privilege for any columns
that are only read, such as those named in the WHERE clause. See GRANT.
As stated, a DELETE statement with no WHERE clause deletes all rows. A faster way to do this, when you do not need to
know the number of deleted rows, is to use TRUNCATE TABLE . However, within a transaction or if you have a lock on the
table, TRUNCATE TABLE cannot be used whereas DELETE can. See TRUNCATE TABLE, and LOCK.

PARTITION
See Partition Pruning and Selection for details.

FOR PORTION OF
122/3812
MariaDB starting with 10.4.3
See Application Time Periods - Deletion by Portion.

RETURNING
It is possible to return a resultset of the deleted rows for a single table to the client by using the syntax DELETE ...
RETURNING select_expr [, select_expr2 ...]]

Any of SQL expression that can be calculated from a single row fields is allowed. Subqueries are allowed. The AS
keyword is allowed, so it is possible to use aliases.
The use of aggregate functions is not allowed. RETURNING cannot be used in multi-table DELETEs.

MariaDB starting with 10.3.1

Same Source and Target Table


Until MariaDB 10.3.1, deleting from a table with the same source and target was not possible. From MariaDB 10.3.1,
this is now possible. For example:
DELETE FROM t1 WHERE c1 IN (SELECT b.c1 FROM t1 b WHERE b.c2=0);

MariaDB starting with 10.3.4

DELETE HISTORY
One can use DELETE HISTORY to delete historical information from System-versioned tables.

Examples
How to use the ORDER BY and LIMIT clauses:

DELETE FROM page_hit ORDER BY timestamp LIMIT 1000000;

How to use the RETURNING clause:

DELETE FROM t RETURNING f1;


+------+
| f1 |
+------+
| 5 |
| 50 |
| 500 |
+------+

The following statement joins two tables: one is only used to satisfy a WHERE condition, but no row is deleted from it;
rows from the other table are deleted, instead.

DELETE post FROM blog INNER JOIN post WHERE blog.id = post.blog_id;

Deleting from the Same Source and Target


CREATE TABLE t1 (c1 INT, c2 INT);
DELETE FROM t1 WHERE c1 IN (SELECT b.c1 FROM t1 b WHERE b.c2=0);

Until MariaDB 10.3.1, this returned:

ERROR 1093 (HY000): Table 't1' is specified twice, both as a target for 'DELETE'
and as a separate source for

From MariaDB 10.3.1:

Query OK, 0 rows affected (0.00 sec)

See Also
123/3812
How IGNORE works
SELECT
ORDER BY
LIMIT
REPLACE ... RETURNING
INSERT ... RETURNING
Returning clause (video)

1.1.1.2.1.8 DROP TABLE


Syntax
DROP [TEMPORARY] TABLE [IF EXISTS] [/*COMMENT TO SAVE*/]
tbl_name [, tbl_name] ...
[WAIT n|NOWAIT]
[RESTRICT | CASCADE]

Contents
1. Syntax
2. Description
1. WAIT/NOWAIT
3. DROP TABLE in replication
4. Dropping an Internal #sql-... Table
5. Dropping All Tables in a Database
6. Atomic DROP TABLE
7. Examples
8. Notes
9. See Also

Description
DROP TABLE removes one or more tables. You must have the DROP privilege for each table. All table data and the table
definition are removed, as well as triggers associated to the table, so be careful with this statement! If any of the tables
named in the argument list do not exist, MariaDB returns an error indicating by name which non-existing tables it was
unable to drop, but it also drops all of the tables in the list that do exist.
Important: When a table is dropped, user privileges on the table are not automatically dropped. See GRANT.
If another thread is using the table in an explicit transaction or an autocommit transaction, then the thread acquires a
metadata lock (MDL) on the table. The DROP TABLE statement will wait in the "Waiting for table metadata lock" thread
state until the MDL is released. MDLs are released in the following cases:
If an MDL is acquired in an explicit transaction, then the MDL will be released when the transaction ends.
If an MDL is acquired in an autocommit transaction, then the MDL will be released when the statement ends.
Transactional and non-transactional tables are handled the same.
Note that for a partitioned table, DROP TABLE permanently removes the table definition, all of its partitions, and all of the
data which was stored in those partitions. It also removes the partitioning definition (.par) file associated with the
dropped table.
For each referenced table, DROP TABLE drops a temporary table with that name, if it exists. If it does not exist, and the
TEMPORARY keyword is not used, it drops a non-temporary table with the same name, if it exists. The TEMPORARY
keyword ensures that a non-temporary table will not accidentally be dropped.
Use IF EXISTS to prevent an error from occurring for tables that do not exist. A NOTE is generated for each non-
existent table when using IF EXISTS . See SHOW WARNINGS.
If a foreign key references this table, the table cannot be dropped. In this case, it is necessary to drop the foreign key
first.
RESTRICT and CASCADE are allowed to make porting from other database systems easier. In MariaDB, they do nothing.

The comment before the table names ( /*COMMENT TO SAVE*/ ) is stored in the binary log. That feature can be used by
replication tools to send their internal messages.
It is possible to specify table names as db_name . tab_name . This is useful to delete tables from multiple databases with
one statement. See Identifier Qualifiers for details.
The DROP privilege is required to use DROP TABLE on non-temporary tables. For temporary tables, no privilege is
required, because such tables are only visible for the current session.
Note: DROP TABLE automatically commits the current active transaction, unless you use the TEMPORARY keyword.

124/3812
MariaDB starting with 10.5.4
From MariaDB 10.5.4, DROP TABLE reliably deletes table remnants inside a storage engine even if the .frm file is
missing. Before then, a missing .frm file would result in the statement failing.

MariaDB starting with 10.3.1

WAIT/NOWAIT
Set the lock wait timeout. See WAIT and NOWAIT.

DROP TABLE in replication


DROP TABLE has the following characteristics in replication:

DROP TABLE IF EXISTS are always logged.


DROP TABLE without IF EXISTS for tables that don't exist are not written to the binary log.
Dropping of TEMPORARY tables are prefixed in the log with TEMPORARY . These drops are only logged when
running statement or mixed mode replication.
One DROP TABLE statement can be logged with up to 3 different DROP statements:
DROP TEMPORARY TABLE list_of_non_transactional_temporary_tables
DROP TEMPORARY TABLE list_of_transactional_temporary_tables
DROP TABLE list_of_normal_tables
DROP TABLE on the primary is treated on the replica as DROP TABLE IF EXISTS . You can change that by setting slave-
ddl-exec-mode to STRICT .

Dropping an Internal #sql-... Table


From MariaDB 10.6, DROP TABLE is atomic and the following does not apply. Until MariaDB 10.5, if the
mariadbd/mysqld process is killed during an ALTER TABLE you may find a table named #sql-... in your data directory. In
MariaDB 10.3, InnoDB tables with this prefix will be deleted automatically during startup. From MariaDB 10.4, these
temporary tables will always be deleted automatically.
If you want to delete one of these tables explicitly you can do so by using the following syntax:

DROP TABLE `#mysql50##sql-...`;

When running an ALTER TABLE…ALGORITHM=INPLACE that rebuilds the table, InnoDB will create an internal #sql-ib
table. Until MariaDB 10.3.2, for these tables, the .frm file will be called something else. In order to drop such a table
after a server crash, you must rename the #sql*.frm file to match the #sql-ib*.ibd file.
From MariaDB 10.3.3, the same name as the .frm file is used for the intermediate copy of the table. The #sql-ib names
are used by TRUNCATE and delayed DROP.
From MariaDB 10.2.19 and MariaDB 10.3.10, the #sql-ib tables will be deleted automatically.

Dropping All Tables in a Database


The best way to drop all tables in a database is by executing DROP DATABASE, which will drop the database itself,
and all tables in it.
However, if you want to drop all tables in the database, but you also want to keep the database itself and any other
non-table objects in it, then you would need to execute DROP TABLE to drop each individual table. You can construct
these DROP TABLE commands by querying the TABLES table in the information_schema database. For example:

SELECT CONCAT('DROP TABLE IF EXISTS `', TABLE_SCHEMA, '`.`', TABLE_NAME, '`;')


FROM information_schema.TABLES
WHERE TABLE_SCHEMA = 'mydb';

Atomic DROP TABLE


MariaDB starting with 10.6.1
From MariaDB 10.6, DROP TABLE for a single table is atomic (MDEV-25180 ) for most engines, including InnoDB,
MyRocks, MyISAM and Aria.
This means that if there is a crash (server down or power outage) during DROP TABLE , all tables that have been
processed so far will be completely dropped, including related trigger files and status entries, and the binary log will
include a DROP TABLE statement for the dropped tables. Tables for which the drop had not started will be left intact.
125/3812
In older MariaDB versions, there was a small chance that, during a server crash happening in the middle of DROP
TABLE , some storage engines that were using multiple storage files, like MyISAM, could have only a part of its internal
files dropped.
In MariaDB 10.5, DROP TABLE was extended to be able to delete a table that was only partly dropped (MDEV-11412
) as explained above. Atomic DROP TABLE is the final piece to make DROP TABLE fully reliable.
Dropping multiple tables is crash-safe.
See Atomic DDL for more information.

Examples
DROP TABLE Employees, Customers;

Notes
Beware that DROP TABLE can drop both tables and sequences. This is mainly done to allow old tools like mysqldump to
work with sequences.

See Also
CREATE TABLE
ALTER TABLE
SHOW CREATE TABLE
DROP SEQUENCE
Variable slave-ddl-exec-mode.

1.1.1.2.1.9 Installing System Tables


(mysql_install_db)
mysql_install_db initializes the MariaDB data directory and creates the system tables in the mysql database, if they
do not exist. MariaDB uses these tables to manage privileges, roles, and plugins. It also uses them to provide the data
for the help command in the mysql client.
mysql_install_db works by starting MariaDB Server's mysqld process in --bootstrap mode and sending commands to
create the system tables and their content.
There is a version specifically for Windows, mysql_install_db.exe.
To invoke mysql_install_db , use the following syntax:

mysql_install_db --user=mysql

For the options supported by mysql_install_db, see mysql_install_db: Options.


For the option groups read by mysql_install_db, see mysql_install_db: Option Groups.
See mysql_install_db: Installing System Tables for information on the installation process.
See mysql_install_db: Troubleshooting Issues for information on how to troubleshoot the installation process.

See Also
mysql_install_db
The Windows version of mysql_install_db : mysql_install_db.exe

1.1.1.2.1.10 mysqlcheck
MariaDB starting with 10.4.6
From MariaDB 10.4.6, mariadb-check is a symlink to mysqlcheck .

MariaDB starting with 10.5.2


From MariaDB 10.5.2, mariadb-check is the name of the tool, with mysqlcheck a symlink .

126/3812
Contents
1. Using mysqlcheck
1. Options
2. Option Files
1. Option Groups
2. Notes
1. Default Values
2. mysqlcheck and auto-repair
3. mysqlcheck and all-databases
4. mysqlcheck and verbose

mysqlcheck is a maintenance tool that allows you to check, repair, analyze and optimize multiple tables from the
command line.
It is essentially a commandline interface to the CHECK TABLE, REPAIR TABLE, ANALYZE TABLE and OPTIMIZE
TABLE commands, and so, unlike myisamchk and aria_chk, requires the server to be running.
This tool does not work with partitioned tables.

Using mysqlcheck
./client/mysqlcheck [OPTIONS] database [tables]

OR

./client/mysqlcheck [OPTIONS] --databases DB1 [DB2 DB3...]

OR

./client/mysqlcheck [OPTIONS] --all-databases

mysqlcheck can be used to CHECK (-c, -m, -C), REPAIR (-r), ANALYZE (-a), or OPTIMIZE (-o) tables. Some of the
options (like -e or -q) can be used at the same time. Not all options are supported by all storage engines.
The -c, -r, -a and -o options are exclusive to each other.
The option --check will be used by default, if no other options were specified. You can change the default behavior by
making a symbolic link to the binary, or copying it somewhere with another name, the alternatives are:

mysqlrepair The default option will be -r ( --repair )


mysqlanalyze The default option will be -a ( --analyze )
mysqloptimize The default option will be -o ( --optimize )

Options
mysqlcheck supports the following options:

Option Description
-A , --all-
Check all the databases. This is the same as --databases with all databases selected.
databases

Instead of issuing one query for each table, use one query per database, naming all tables in the
-1 , --all-in-1
database in a comma-separated list.
-a , --analyze Analyze given tables.
If a checked table is corrupted, automatically fix it. Repairing will be done after all tables have
--auto-repair
been checked.
--character-
Directory where character set files are installed.
sets-dir=name

-c , --check Check table for errors.


-C , --check-
Check only tables that have changed since last check or haven't been closed properly.
only-changed

-g , --check- Check tables for version-dependent changes. May be used with --auto-repair to correct tables
upgrade requiring version-dependent updates. Automatically enables the --fix-db-names and --fix-
table-names options. Used when upgrading

127/3812
--compress Compress all information sent between the client and server if both support compression.
Check several databases. Note that normally mysqlcheck treats the first argument as a database
-B , --
name, and following arguments as table names. With this option, no tables are given, and all name
databases
arguments are regarded as database names.
-# , --
Output debug log. Often this is 'd:t:o,filename'.
debug[=name]

--debug-check Check memory and open file usage at exit.


--debug-info Print some debug info at exit.
--default-
Default authentication client-side plugin to use.
auth=plugin

--default-
character- Set the default character set.
set=name

If you are using this option with --check , it will ensure that the table is 100 percent consistent, but
-e , --extended will take a long time. If you are using this option with --repair , it will force using the old, slow,
repair with keycache method, instead of the much faster repair by sorting.
-F , --fast Check only tables that haven't been closed properly.
Convert database names to the format used since MySQL 5.1. Only database names that contain
--fix-db-names
special characters are affected. Used when upgrading from an old MySQL version.
--fix-table- Convert table names (including views) to the format used since MySQL 5.1. Only table names that
names contain special characters are affected. Used when upgrading from an old MySQL version.
Flush each table after check. This is useful if you don't want to have the checked tables take up
--flush
space in the caches after the check.
-f , --force Continue even if we get an SQL error.
-? , --help Display this help message and exit.
-h name , --
Connect to the given host.
host=name

-m , --medium- Faster than extended-check, but only finds 99.99 percent of all errors. Should be good enough for
check most cases.
-o , --optimize Optimize tables.
Password to use when connecting to the server. If you use the short option form ( -p ), you cannot
have a space between the option and the password. If you omit the password value following the
-p , --
--password or -p option on the command line, mysqlcheck prompts for one. Specifying a
password[=name]
password on the command line should be considered insecure. You can use an option file to avoid
giving the password on the command line.
-Z , -- When using ANALYZE TABLE ( --analyze ), uses the PERSISTENT FOR ALL option, which
persistent forces Engine-independent Statistics for this table to be updated. Added in MariaDB 10.1.10

On Windows, connect to the server via a named pipe. This option applies only if the server
-W , --pipe
supports named-pipe connections.
--plugin-dir Directory for client-side plugins.
-P num , -- Port number to use for connection or 0 for default to, in order of preference, my.cnf,
port=num $MYSQL_TCP_PORT, /etc/services, built-in default (3306).
--process- Perform the requested operation (check, repair, analyze, optimize) on tables. Enabled by default.
tables Use --skip-process-tables to disable.
Perform the requested operation (only CHECK VIEW or REPAIR VIEW). Possible values are NO,
--process-
YES (correct the checksum, if necessary, add the mariadb-version field),
views[=val]
UPGRADE_FROM_MYSQL (same as YES and toggle the algorithm MERGE<->TEMPTABLE.
The connection protocol (tcp, socket, pipe, memory) to use for connecting to the server. Useful
--
when other connection parameters would cause a protocol to be used other than the one you
protocol=name
want.
If you are using this option with CHECK TABLE, it prevents the check from scanning the rows to
-q , --quick check for wrong links. This is the fastest check. If you are using this option with REPAIR TABLE, it
will try to repair only the index tree. This is the fastest repair method for a table.
-r , --repair Can fix almost anything except unique keys that aren't unique.

128/3812
--shared-
Shared-memory name to use for Windows connections using shared memory to a local server
memory-base-
(started with the --shared-memory option). Case-sensitive.
name

-s , --silent Print only error messages.


--skip-
Don't process the database (case-sensitive) specified as argument.
database

-S name , -- For connections to localhost, the Unix socket file to use, or, on Windows, the name of the named
socket=name pipe to use.
Enables TLS. TLS is also enabled even without setting this option when certain other TLS options
are set. Starting with MariaDB 10.2, the --ssl option will not enable verifying the server
--ssl
certificate by default. In order to verify the server certificate, the user must specify the --ssl-
verify-server-cert option.

Defines a path to a PEM file that should contain one or more X509 certificates for trusted
Certificate Authorities (CAs) to use for TLS. This option requires that you use the absolute path,
--ssl-ca=name
not a relative path. See Secure Connections Overview: Certificate Authorities (CAs) for more
information. This option implies the --ssl option.
Defines a path to a directory that contains one or more PEM files that should each contain one
X509 certificate for a trusted Certificate Authority (CA) to use for TLS. This option requires that
you use the absolute path, not a relative path. The directory specified by this option needs to be
--ssl- run through the openssl rehash command. See Secure Connections Overview: Certificate
capath=name Authorities (CAs) for more information. This option is only supported if the client was built with
OpenSSL or yaSSL. If the client was built with GnuTLS or Schannel, then this option is not
supported. See TLS and Cryptography Libraries Used by MariaDB for more information about
which libraries are used on which platforms. This option implies the --ssl option.

--ssl- Defines a path to the X509 certificate file to use for TLS. This option requires that you use the
cert=name absolute path, not a relative path. This option implies the --ssl option.
--ssl-
List of permitted ciphers or cipher suites to use for TLS. This option implies the --ssl option.
cipher=name

Defines a path to a PEM file that should contain one or more revoked X509 certificates to use for
TLS. This option requires that you use the absolute path, not a relative path. See Secure
Connections Overview: Certificate Revocation Lists (CRLs) for more information. This option is
--ssl-crl=name
only supported if the client was built with OpenSSL or Schannel. If the client was built with yaSSL
or GnuTLS, then this option is not supported. See TLS and Cryptography Libraries Used by
MariaDB for more information about which libraries are used on which platforms.
Defines a path to a directory that contains one or more PEM files that should each contain one
revoked X509 certificate to use for TLS. This option requires that you use the absolute path, not a
relative path. The directory specified by this option needs to be run through the openssl rehash
--ssl- command. See Secure Connections Overview: Certificate Revocation Lists (CRLs) for more
crlpath=name information. This option is only supported if the client was built with OpenSSL. If the client was
built with yaSSL, GnuTLS, or Schannel, then this option is not supported. See TLS and
Cryptography Libraries Used by MariaDB for more information about which libraries are used on
which platforms.
Defines a path to a private key file to use for TLS. This option requires that you use the absolute
--ssl-key=name
path, not a relative path. This option implies the --ssl option.
--ssl-verify-
Enables server certificate verification. This option is disabled by default.
server-cert

Overrides the --databases or -B option such that all name arguments following the option are
--tables
regarded as table names.
For repair operations on MyISAM tables, get table structure from .frm file, so the table can be
--use-frm
repaired even if the .MYI header is corrupted.
-u , --
User for login if not current user.
user=name

Print info about the various stages. You can give this option several times to get even more
-v , --verbose
information. See mysqlcheck and verbose, below.
-V , --version Output version information and exit.
Write ANALYZE, OPTIMIZE and REPAIR TABLE commands to the binary log. Enabled by default;
--write-binlog
use --skip-write-binlog when commands should not be sent to replication slaves.

Option Files
129/3812
In addition to reading options from the command-line, mysqlcheck can also read options from option files. If an
unknown option is provided to mysqlcheck in an option file, then it is ignored.
The following options relate to how MariaDB command-line tools handles option files. They must be given as the first
argument on the command-line:

Option Description
--print-defaults Print the program argument list and exit.
--no-defaults Don't read default options from any option file.
--defaults-file=# Only read default options from the given file #.
--defaults-extra-file=# Read this file after the global files are read.
--defaults-group-suffix=# In addition to the default option groups, also read option groups with this suffix.

In MariaDB 10.2 and later, mysqlcheck is linked with MariaDB Connector/C . However, MariaDB Connector/C does
not yet handle the parsing of option files for this client. That is still performed by the server option file parsing code. See
MDEV-19035 for more information.

Option Groups
mysqlcheck reads options from the following option groups from option files:

Group Description
[mysqlcheck] Options read by mysqlcheck , which includes both MariaDB Server and MySQL Server.
[mariadb-
Options read by mysqlcheck . Available starting with MariaDB 10.4.6.
check]

Options read by all MariaDB and MySQL client programs, which includes both MariaDB and MySQL
[client]
clients. For example, mysqldump .
[client- Options read by all MariaDB client programs and the MariaDB Server. This is useful for options like
server] socket and port, which is common between the server and the clients.
[client-
Options read by all MariaDB client programs.
mariadb]

Notes
Default Values
To see the default values for the options and also to see the arguments you get from configuration files you can do:

./client/mysqlcheck --print-defaults
./client/mysqlcheck --help

mysqlcheck and auto-repair


When running mysqlcheck with --auto-repair (as done by mysql_upgrade), mysqlcheck will first check all tables
and then in a separate phase repair those that failed the check.

mysqlcheck and all-databases


mysqlcheck --all-databases will ignore the internal log tables general_log and slow_log as these can't be checked,
repaired or optimized.

mysqlcheck and verbose


Using one --verbose option will give you more information about what mysqlcheck is doing.
Using two --verbose options will also give you connection information.
If you use three --verbose options you will also get, on stdout, all ALTER, RENAME, and CHECK commands that
mysqlcheck executes.

1.1.1.2.1.11 OPTIMIZE TABLE


130/3812
Syntax
OPTIMIZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE
tbl_name [, tbl_name] ...
[WAIT n | NOWAIT]

Contents
1. Syntax
2. Description
1. WAIT/NOWAIT
2. Defragmenting
3. Updating an InnoDB fulltext index
4. Defragmenting InnoDB tablespaces
3. See Also

Description
OPTIMIZE TABLE has two main functions. It can either be used to defragment tables, or to update the InnoDB fulltext
index.

MariaDB starting with 10.3.0


WAIT/NOWAIT
Set the lock wait timeout. See WAIT and NOWAIT.

Defragmenting
OPTIMIZE TABLE works for InnoDB (before MariaDB 10.1.1 , only if the innodb_file_per_table server system variable
is set), Aria, MyISAM and ARCHIVE tables, and should be used if you have deleted a large part of a table or if you have
made many changes to a table with variable-length rows (tables that have VARCHAR, VARBINARY, BLOB, or TEXT
columns). Deleted rows are maintained in a linked list and subsequent INSERT operations reuse old row positions.
This statement requires SELECT and INSERT privileges for the table.
By default, OPTIMIZE TABLE statements are written to the binary log and will be replicated. The NO_WRITE_TO_BINLOG
keyword ( LOCAL is an alias) will ensure the statement is not written to the binary log.
From MariaDB 10.3.19, OPTIMIZE TABLE statements are not logged to the binary log if read_only is set. See also Read-
Only Replicas.
OPTIMIZE TABLE is also supported for partitioned tables. You can use ALTER TABLE ... OPTIMIZE PARTITION to
optimize one or more partitions.
You can use OPTIMIZE TABLE to reclaim the unused space and to defragment the data file. With other storage engines,
OPTIMIZE TABLE does nothing by default, and returns this message: " The storage engine for the table doesn't support
optimize". However, if the server has been started with the --skip-new option, OPTIMIZE TABLE is linked to ALTER
TABLE, and recreates the table. This operation frees the unused space and updates index statistics.
The Aria storage engine supports progress reporting for this statement.
If a MyISAM table is fragmented, concurrent inserts will not be performed until an OPTIMIZE TABLE statement is
executed on that table, unless the concurrent_insert server system variable is set to ALWAYS .

Updating an InnoDB fulltext index


When rows are added or deleted to an InnoDB fulltext index, the index is not immediately re-organized, as this can be
an expensive operation. Change statistics are stored in a separate location . The fulltext index is only fully re-organized
when an OPTIMIZE TABLE statement is run.
By default, an OPTIMIZE TABLE will defragment a table. In order to use it to update fulltext index statistics, the
innodb_optimize_fulltext_only system variable must be set to 1 . This is intended to be a temporary setting, and should
be reset to 0 once the fulltext index has been re-organized.
Since fulltext re-organization can take a long time, the innodb_ft_num_word_optimize variable limits the re-organization
to a number of words (2000 by default). You can run multiple OPTIMIZE statements to fully re-organize the index.

Defragmenting InnoDB tablespaces


MariaDB 10.1.1 merged the Facebook/Kakao defragmentation patch, allowing one to use OPTIMIZE TABLE to
defragment InnoDB tablespaces. For this functionality to be enabled, the innodb_defragment system variable must be
enabled. No new tables are created and there is no need to copy data from old tables to new tables. Instead, this

131/3812
feature loads n pages (determined by innodb-defragment-n-pages) and tries to move records so that pages would be
full of records and then frees pages that are fully empty after the operation. Note that tablespace files (including
ibdata1) will not shrink as the result of defragmentation, but one will get better memory utilization in the InnoDB buffer
pool as there are fewer data pages in use.
See Defragmenting InnoDB Tablespaces for more details.

See Also
Optimize Table in InnoDB with ALGORITHM set to INPLACE
Optimize Table in InnoDB with ALGORITHM set to NOCOPY
Optimize Table in InnoDB with ALGORITHM set to INSTANT

1.1.1.2.1.12 RENAME TABLE


Syntax
RENAME TABLE[S] [IF EXISTS] tbl_name
[WAIT n | NOWAIT]
TO new_tbl_name
[, tbl_name2 TO new_tbl_name2] ...

Contents
1. Syntax
2. Description
1. IF EXISTS
2. WAIT/NOWAIT
3. Privileges
4. Atomic RENAME TABLE

Description
This statement renames one or more tables or views, but not the privileges associated with them.

IF EXISTS
MariaDB starting with 10.5.2
If this directive is used, one will not get an error if the table to be renamed doesn't exist.

The rename operation is done atomically, which means that no other session can access any of the tables while the
rename is running. For example, if you have an existing table old_table , you can create another table new_table that
has the same structure but is empty, and then replace the existing table with the empty one as follows (assuming that
backup_table does not already exist):

CREATE TABLE new_table (...);


RENAME TABLE old_table TO backup_table, new_table TO old_table;

tbl_name can optionally be specified as db_name . tbl_name . See Identifier Qualifiers. This allows to use RENAME to
move a table from a database to another (as long as they are on the same filesystem):

RENAME TABLE db1.t TO db2.t;

Note that moving a table to another database is not possible if it has some triggers. Trying to do so produces the
following error:

ERROR 1435 (HY000): Trigger in wrong schema

Also, views cannot be moved to another database:

ERROR 1450 (HY000): Changing schema from 'old_db' to 'new_db' is not allowed.

Multiple tables can be renamed in a single statement. The presence or absence of the optional S ( RENAME TABLE or
RENAME TABLES ) has no impact, whether a single or multiple tables are being renamed.

If a RENAME TABLE renames more than one table and one renaming fails, all renames executed by the same statement
132/3812
are rolled back.
Renames are always executed in the specified order. Knowing this, it is also possible to swap two tables' names:

RENAME TABLE t1 TO tmp_table,


t2 TO t1,
tmp_table TO t2;

WAIT/NOWAIT
MariaDB starting with 10.3.0
Set the lock wait timeout. See WAIT and NOWAIT.

Privileges
Executing the RENAME TABLE statement requires the DROP, CREATE and INSERT privileges for the table or the
database.

Atomic RENAME TABLE


MariaDB starting with 10.6.1
From MariaDB 10.6, RENAME TABLE is atomic for most engines, including InnoDB, MyRocks, MyISAM and Aria
(MDEV-23842 ). This means that if there is a crash (server down or power outage) during RENAME TABLE , all tables
will revert to their original names and any changes to trigger files will be reverted.
In older MariaDB version there was a small chance that, during a server crash happening in the middle of RENAME
TABLE , some tables could have been renamed (in the worst case partly) while others would not be renamed.
See Atomic DDL for more information.

1.1.1.2.1.13 REPAIR TABLE


Syntax
REPAIR [NO_WRITE_TO_BINLOG | LOCAL] TABLE
tbl_name [, tbl_name] ...
[QUICK] [EXTENDED] [USE_FRM]

Description
REPAIR TABLE repairs a possibly corrupted table. By default, it has the same effect as

myisamchk --recover tbl_name

or

aria_chk --recover tbl_name

See aria_chk and myisamchk for more.


REPAIR TABLE works for Archive, Aria, CSV and MyISAM tables. For InnoDB, see recovery modes. For CSV, see also
Checking and Repairing CSV Tables. For Archive, this statement also improves compression. If the storage engine
does not support this statement, a warning is issued.
This statement requires SELECT and INSERT privileges for the table.
By default, REPAIR TABLE statements are written to the binary log and will be replicated. The NO_WRITE_TO_BINLOG
keyword ( LOCAL is an alias) will ensure the statement is not written to the binary log.
From MariaDB 10.3.19, REPAIR TABLE statements are not logged to the binary log if read_only is set. See also Read-
Only Replicas.
When an index is recreated, the storage engine may use a configurable buffer in the process. Incrementing the buffer
speeds up the index creation. Aria and MyISAM allocate a buffer whose size is defined by aria_sort_buffer_size or
myisam_sort_buffer_size , also used for ALTER TABLE .

REPAIR TABLE is also supported for partitioned tables. However, the USE_FRM option cannot be used with this

133/3812
statement on a partitioned table.
ALTER TABLE ... REPAIR PARTITION can be used to repair one or more partitions.
The Aria storage engine supports progress reporting for this statement.

1.1.1.2.1.14 REPAIR VIEW


Syntax
REPAIR [NO_WRITE_TO_BINLOG | LOCAL] VIEW view_name[, view_name] ... [FROM MYSQL]

Contents
1. Syntax
2. Description
3. See Also

Description
The REPAIR VIEW statement was introduced to assist with fixing MDEV-6916 , an issue introduced in MariaDB 5.2
where the view algorithms were swapped compared to their MySQL on disk representation. It checks whether the view
algorithm is correct. It is run as part of mysql_upgrade, and should not normally be required in regular use.
By default it corrects the checksum and if necessary adds the mariadb-version field. If the optional FROM MYSQL clause
is used, and no mariadb-version field is present, the MERGE and TEMPTABLE algorithms are toggled.
By default, REPAIR VIEW statements are written to the binary log and will be replicated. The NO_WRITE_TO_BINLOG
keyword ( LOCAL is an alias) will ensure the statement is not written to the binary log.

See Also
CHECK VIEW

1.1.1.2.1.15 REPLACE
Syntax
REPLACE [LOW_PRIORITY | DELAYED]
[INTO] tbl_name [PARTITION (partition_list)] [(col,...)]
{VALUES | VALUE} ({expr | DEFAULT},...),(...),...
[RETURNING select_expr
[, select_expr ...]]

Or:

REPLACE [LOW_PRIORITY | DELAYED]


[INTO] tbl_name [PARTITION (partition_list)]
SET col={expr | DEFAULT}, ...
[RETURNING select_expr
[, select_expr ...]]

Or:

REPLACE [LOW_PRIORITY | DELAYED]


[INTO] tbl_name [PARTITION (partition_list)] [(col,...)]
SELECT ...
[RETURNING select_expr
[, select_expr ...]]

134/3812
Contents
1. Syntax
2. Description
1. PARTITION
2. REPLACE RETURNING
1. Examples
3. Examples
4. See Also

Description
REPLACE works exactly like INSERT , except that if an old row in the table has the same value as a new row for a
PRIMARY KEY or a UNIQUE index, the old row is deleted before the new row is inserted. If the table has more than one
UNIQUE keys, it is possible that the new row conflicts with more than one row. In this case, all conflicting rows will be
deleted.
The table name can be specified in the form db_name . tbl_name or, if a default database is selected, in the form
tbl_name (see Identifier Qualifiers). This allows to use REPLACE ... SELECT to copy rows between different
databases.

MariaDB starting with 10.5.0


The RETURNING clause was introduced in MariaDB 10.5.0

Basically it works like this:

BEGIN;
SELECT 1 FROM t1 WHERE key=# FOR UPDATE;
IF found-row
DELETE FROM t1 WHERE key=# ;
ENDIF
INSERT INTO t1 VALUES (...);
END;

The above can be replaced with:

REPLACE INTO t1 VALUES (...)

REPLACE is a MariaDB/MySQL extension to the SQL standard. It either inserts, or deletes and inserts. For other
MariaDB/MySQL extensions to standard SQL --- that also handle duplicate values --- see IGNORE and INSERT ON
DUPLICATE KEY UPDATE.
Note that unless the table has a PRIMARY KEY or UNIQUE index, using a REPLACE statement makes no sense. It
becomes equivalent to INSERT , because there is no index to be used to determine whether a new row duplicates
another.
Values for all columns are taken from the values sSee Partition Pruning and Selection for details.pecified in the
REPLACE statement. Any missing columns are set to their default values, just as happens for INSERT . You cannot refer
to values from the current row and use them in the new row. If you use an assignment such as 'SET col = col + 1' ,
the reference to the column name on the right hand side is treated as DEFAULT(col) , so the assignment is equivalent to
'SET col = DEFAULT(col) + 1' .
To use REPLACE , you must have both the INSERT and DELETE privileges for the table.
There are some gotchas you should be aware of, before using REPLACE :
If there is an AUTO_INCREMENT field, a new value will be generated.
If there are foreign keys, ON DELETE action will be activated by REPLACE .
Triggers on DELETE and INSERT will be activated by REPLACE .
To avoid some of these behaviors, you can use INSERT ... ON DUPLICATE KEY UPDATE .
This statement activates INSERT and DELETE triggers. See Trigger Overview for details.

PARTITION
See Partition Pruning and Selection for details.

REPLACE RETURNING
REPLACE ... RETURNING returns a resultset of the replaced rows.
This returns the listed columns for all the rows that are replaced, or alternatively, the specified SELECT expression. Any
135/3812
SQL expressions which can be calculated can be used in the select expression for the RETURNING clause, including
virtual columns and aliases, expressions which use various operators such as bitwise, logical and arithmetic operators,
string functions, date-time functions, numeric functions, control flow functions, secondary functions and stored functions.
Along with this, statements which have subqueries and prepared statements can also be used.

Examples
Simple REPLACE statement

REPLACE INTO t2 VALUES (1,'Leopard'),(2,'Dog') RETURNING id2, id2+id2


as Total ,id2|id2, id2&&id2;
+-----+-------+---------+----------+
| id2 | Total | id2|id2 | id2&&id2 |
+-----+-------+---------+----------+
| 1 | 2 | 1 | 1 |
| 2 | 4 | 2 | 1 |
+-----+-------+---------+----------+

Using stored functions in RETURNING

DELIMITER |
CREATE FUNCTION f(arg INT) RETURNS INT
BEGIN
RETURN (SELECT arg+arg);
END|

DELIMITER ;
PREPARE stmt FROM "REPLACE INTO t2 SET id2=3, animal2='Fox' RETURNING f2(id2),
UPPER(animal2)";

EXECUTE stmt;
+---------+----------------+
| f2(id2) | UPPER(animal2) |
+---------+----------------+
| 6 | FOX |
+---------+----------------+

Subqueries in the statement

REPLACE INTO t1 SELECT * FROM t2 RETURNING (SELECT id2 FROM t2 WHERE


id2 IN (SELECT id2 FROM t2 WHERE id2=1)) AS new_id;
+--------+
| new_id |
+--------+
| 1 |
| 1 |
| 1 |
| 1 |
+--------+

Subqueries in the RETURNING clause that return more than one row or column cannot be used..
Aggregate functions cannot be used in the RETURNING clause. Since aggregate functions work on a set of values and
if the purpose is to get the row count, ROW_COUNT() with SELECT can be used, or it can be used in
REPLACE...SEL== Description
REPLACE ... RETURNING returns a resultset of the replaced rows.

This returns the listed columns for all the rows that are replaced, or alternatively, the specified SELECT expression. Any
SQL expressions which can be calculated can be used in the select expression for the RETURNING clause, including
virtual columns and aliases, expressions which use various operators such as bitwise, logical and arithmetic operators,
string functions, date-time functions, numeric functions, control flow functions, secondary functions and stored functions.
Along with this, statements which have subqueries and prepared statements can also be used.

Examples
Simple REPLACE statement

136/3812
REPLACE INTO t2 VALUES (1,'Leopard'),(2,'Dog') RETURNING id2, id2+id2
as Total ,id2|id2, id2&&id2;
+-----+-------+---------+----------+
| id2 | Total | id2|id2 | id2&&id2 |
+-----+-------+---------+----------+
| 1 | 2 | 1 | 1 |
| 2 | 4 | 2 | 1 |
+-----+-------+---------+----------+

Using stored functions in RETURNING

DELIMITER |
CREATE FUNCTION f(arg INT) RETURNS INT
BEGIN
RETURN (SELECT arg+arg);
END|

DELIMITER ;
PREPARE stmt FROM "REPLACE INTO t2 SET id2=3, animal2='Fox' RETURNING f2(id2),
UPPER(animal2)";

EXECUTE stmt;
+---------+----------------+
| f2(id2) | UPPER(animal2) |
+---------+----------------+
| 6 | FOX |
+---------+----------------+

Subqueries in the statement

REPLACE INTO t1 SELECT * FROM t2 RETURNING (SELECT id2 FROM t2 WHERE


id2 IN (SELECT id2 FROM t2 WHERE id2=1)) AS new_id;
+--------+
| new_id |
+--------+
| 1 |
| 1 |
| 1 |
| 1 |
+--------+

Subqueries in the RETURNING clause that return more than one row or column cannot be used..
Aggregate functions cannot be used in the RETURNING clause. Since aggregate functions work on a set of values and
if the purpose is to get the row count, ROW_COUNT() with SELECT can be used, or it can be used in
REPLACE...SELECT...RETURNING if the table in the RETURNING clause is not the same as the REPLACE table.
ECT...RETURNING if the table in the RETURNING clause is not the same as the REPLACE table.

See Also
INSERT
HIGH_PRIORITY and LOW_PRIORITY clauses
INSERT DELAYED for details on the DELAYED clause

1.1.1.2.1.16 SHOW COLUMNS


Syntax
SHOW [FULL] {COLUMNS | FIELDS} FROM tbl_name [FROM db_name]
[LIKE 'pattern' | WHERE expr]

Contents
1. Syntax
2. Description
3. Examples
4. See Also

Description
SHOW COLUMNS displays information about the columns in a given table. It also works for views. The LIKE clause, if
137/3812
present on its own, indicates which column names to match. The WHERE and LIKE clauses can be given to select rows
using more general conditions, as discussed in Extended SHOW.
If the data types differ from what you expect them to be based on a CREATE TABLE statement, note that MariaDB
sometimes changes data types when you create or alter a table. The conditions under which this occurs are described
in the Silent Column Changes article.
The FULL keyword causes the output to include the column collation and comments, as well as the privileges you have
for each column.
You can use db_name.tbl_name as an alternative to the tbl_name FROM db_name syntax. In other words, these two
statements are equivalent:

SHOW COLUMNS FROM mytable FROM mydb;


SHOW COLUMNS FROM mydb.mytable;

SHOW COLUMNS displays the following values for each table column:
Field indicates the column name.
Type indicates the column data type.
Collation indicates the collation for non-binary string columns, or NULL for other columns. This value is displayed only
if you use the FULL keyword.
The Null field contains YES if NULL values can be stored in the column, NO if not.
The Key field indicates whether the column is indexed:
If Key is empty, the column either is not indexed or is indexed only as a secondary column in a multiple-column,
non-unique index.
If Key is PRI, the column is a PRIMARY KEY or is one of the columns in a multiple-column PRIMARY KEY .
If Key is UNI, the column is the first column of a unique-valued index that cannot contain NULL values.
If Key is MUL, multiple occurrences of a given value are allowed within the column. The column is the first
column of a non-unique index or a unique-valued index that can contain NULL values.
If more than one of the Key values applies to a given column of a table, Key displays the one with the highest priority,
in the order PRI, UNI, MUL.
A UNIQUE index may be displayed as PRI if it cannot contain NULL values and there is no PRIMARY KEY in the table. A
UNIQUE index may display as MUL if several columns form a composite UNIQUE index; although the combination of the
columns is unique, each column can still hold multiple occurrences of a given value.
The Default field indicates the default value that is assigned to the column.
The Extra field contains any additional information that is available about a given column.

Value Description
AUTO_INCREMENT The column was created with the AUTO_INCREMENT keyword.
PERSISTENT The column was created with the PERSISTENT keyword. (New in 5.3)
VIRTUAL The column was created with the VIRTUAL keyword. (New in 5.3)
on update The column is a TIMESTAMP column that is automatically updated on INSERT and
CURRENT_TIMESTAMP UPDATE .

Privileges indicates the privileges you have for the column. This value is displayed only if you use the FULL keyword.
Comment indicates any comment the column has. This value is displayed only if you use the FULL keyword.
SHOW FIELDS is a synonym for SHOW COLUMNS . Also DESCRIBE and EXPLAIN can be used as shortcuts.

You can also list a table's columns with:

mysqlshow db_name tbl_name

See the mysqlshow command for more details.


The DESCRIBE statement provides information similar to SHOW COLUMNS . The information_schema.COLUMNS table
provides similar, but more complete, information.
The SHOW CREATE TABLE, SHOW TABLE STATUS, and SHOW INDEX statements also provide information about
tables.

Examples

138/3812
SHOW COLUMNS FROM city;
+------------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+----------+------+-----+---------+----------------+
| Id | int(11) | NO | PRI | NULL | auto_increment |
| Name | char(35) | NO | | | |
| Country | char(3) | NO | UNI | | |
| District | char(20) | YES | MUL | | |
| Population | int(11) | NO | | 0 | |
+------------+----------+------+-----+---------+----------------+

SHOW COLUMNS FROM employees WHERE Type LIKE 'Varchar%';


+---------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------+-------------+------+-----+---------+-------+
| first_name | varchar(30) | NO | MUL | NULL | |
| last_name | varchar(40) | NO | | NULL | |
| position | varchar(25) | NO | | NULL | |
| home_address | varchar(50) | NO | | NULL | |
| home_phone | varchar(12) | NO | | NULL | |
| employee_code | varchar(25) | NO | UNI | NULL | |
+---------------+-------------+------+-----+---------+-------+

See Also
DESCRIBE
mysqlshow
SHOW CREATE TABLE
SHOW TABLE STATUS
SHOW INDEX
Extended SHOW
Silent Column Changes

1.1.1.2.1.17 SHOW CREATE TABLE


Syntax
SHOW CREATE TABLE tbl_name

Contents
1. Syntax
2. Description
1. Index Order
3. Examples
4. See Also

Description
Shows the CREATE TABLE statement that created the given table. The statement requires the SELECT privilege for
the table. This statement also works with views and SEQUENCE.
SHOW CREATE TABLE quotes table and column names according to the value of the sql_quote_show_create server
system variable.

Certain SQL_MODE values can result in parts of the original CREATE statement not being included in the output.
MariaDB-specific table options, column options, and index options are not included in the output of this statement if
the NO_TABLE_OPTIONS, NO_FIELD_OPTIONS and NO_KEY_OPTIONS SQL_MODE flags are used. All
MariaDB-specific table attributes are also not shown when a non-MariaDB/MySQL emulation mode is used, which
includes ANSI, DB2, POSTGRESQL, MSSQL, MAXDB or ORACLE.

Invalid table options, column options and index options are normally commented out (note, that it is possible to create a
table with invalid options, by altering a table of a different engine, where these options were valid). To have them
uncommented, enable the IGNORE_BAD_TABLE_OPTIONS SQL_MODE. Remember that replaying a CREATE
TABLE statement with uncommented invalid options will fail with an error, unless the IGNORE_BAD_TABLE_OPTIONS
SQL_MODE is in effect.
Note that SHOW CREATE TABLE is not meant to provide metadata about a table. It provides information about how the
139/3812
table was declared, but the real table structure could differ a bit. For example, if an index has been declared as HASH ,
the CREATE TABLE statement returned by SHOW CREATE TABLE will declare that index as HASH ; however, it is possible
that the index is in fact a BTREE , because the storage engine does not support HASH .

MariaDB starting with 10.2.1


MariaDB 10.2.1 permits TEXT and BLOB data types to be assigned a DEFAULT value. As a result, from MariaDB
10.2.1 , SHOW CREATE TABLE will append a DEFAULT NULL to nullable TEXT or BLOB fields if no specific default is
provided.

MariaDB starting with 10.2.2


From MariaDB 10.2.2 , numbers are no longer quoted in the DEFAULT clause in SHOW CREATE statement.
Previously, MariaDB quoted numbers.

Index Order
Indexes are sorted and displayed in the following order, which may differ from the order of the CREATE TABLE
statement.
PRIMARY KEY
UNIQUE keys where all column are NOT NULL
UNIQUE keys that don't contain partial segments
Other UNIQUE keys
LONG UNIQUE keys
Normal keys
Fulltext keys
See sql/sql_table.cc for details.

Examples
SHOW CREATE TABLE t\G
*************************** 1. row ***************************
Table: t
Create Table: CREATE TABLE `t` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`s` char(60) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1

With sql_quote_show_create off:

SHOW CREATE TABLE t\G


*************************** 1. row ***************************
Table: t
Create Table: CREATE TABLE t (
id int(11) NOT NULL AUTO_INCREMENT,
s char(60) DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1

Unquoted numeric DEFAULTs, from MariaDB 10.2.2 :

CREATE TABLE td (link TINYINT DEFAULT 1);

SHOW CREATE TABLE td\G


*************************** 1. row ***************************
Table: td
Create Table: CREATE TABLE `td` (
`link` tinyint(4) DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=latin1

Quoted numeric DEFAULTs, until MariaDB 10.2.1 :

140/3812
CREATE TABLE td (link TINYINT DEFAULT 1);

SHOW CREATE TABLE td\G


*************************** 1. row ***************************
Table: td
Create Table: CREATE TABLE `td` (
`link` tinyint(4) DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=latin1

SQL_MODE impacting the output:

SELECT @@sql_mode;
+-------------------------------------------------------------------------------------------+
| @@sql_mode |
+-------------------------------------------------------------------------------------------+
| STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+-------------------------------------------------------------------------------------------+

CREATE TABLE `t1` (


`id` int(11) NOT NULL AUTO_INCREMENT,
`msg` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
;

SHOW CREATE TABLE t1\G


*************************** 1. row ***************************
Table: t1
Create Table: CREATE TABLE `t1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`msg` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1

SET SQL_MODE=ORACLE;

SHOW CREATE TABLE t1\G


*************************** 1. row ***************************
Table: t1
Create Table: CREATE TABLE "t1" (
"id" int(11) NOT NULL,
"msg" varchar(100) DEFAULT NULL,
PRIMARY KEY ("id")

See Also
SHOW CREATE SEQUENCE
SHOW CREATE VIEW

1.1.1.2.1.18 SHOW INDEX


Syntax
SHOW {INDEX | INDEXES | KEYS}
FROM tbl_name [FROM db_name]
[WHERE expr]

Contents
1. Syntax
2. Description
3. Examples
4. See Also

Description
SHOW INDEX returns table index information. The format resembles that of the SQLStatistics call in ODBC.

You can use db_name.tbl_name as an alternative to the tbl_name FROM db_name syntax. These two statements are
equivalent:

141/3812
SHOW INDEX FROM mytable FROM mydb;
SHOW INDEX FROM mydb.mytable;

SHOW KEYS and SHOW INDEXES are synonyms for SHOW INDEX .
You can also list a table's indexes with the mariadb-show/mysqlshow command:

mysqlshow -k db_name tbl_name

The information_schema.STATISTICS table stores similar information.


The following fields are returned by SHOW INDEX .

Field Description
Table Table name
Non_unique 1 if the index permits duplicate values, 0 if values must be unique.

Key_name Index name. The primary key is always named PRIMARY .


Seq_in_index The column's sequence in the index, beginning with 1 .
Column_name Column name.
Collation Either A , if the column is sorted in ascending order in the index, or NULL if it's not sorted.
Estimated number of unique values in the index. The cardinality statistics are calculated at various
Cardinality
times, and can help the optimizer make improved decisions.
Sub_part NULL if the entire column is included in the index, or the number of included characters if not.

Packed NULL if the index is not packed, otherwise how the index is packed.

Null NULL if NULL values are permitted in the column, an empty string if NULL s are not permitted.

The index type, which can be BTREE , FULLTEXT , HASH or RTREE . See Storage Engine Index
Index_type
Types.
Comment Other information, such as whether the index is disabled.
Index_comment Contents of the COMMENT attribute when the index was created.
Whether or not an index will be ignored by the optimizer. See Ignored Indexes. From MariaDB
Ignored
10.6.0.

The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in Extended
SHOW.

Examples
CREATE TABLE IF NOT EXISTS `employees_example` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`first_name` varchar(30) NOT NULL,
`last_name` varchar(40) NOT NULL,
`position` varchar(25) NOT NULL,
`home_address` varchar(50) NOT NULL,
`home_phone` varchar(12) NOT NULL,
`employee_code` varchar(25) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `employee_code` (`employee_code`),
KEY `first_name` (`first_name`,`last_name`)
) ENGINE=Aria;

INSERT INTO `employees_example` (`first_name`, `last_name`, `position`, `home_address`, `home_phone`,


`employee_code`)
VALUES
('Mustapha', 'Mond', 'Chief Executive Officer', '692 Promiscuous Plaza', '326-555-3492', 'MM1'),
('Henry', 'Foster', 'Store Manager', '314 Savage Circle', '326-555-3847', 'HF1'),
('Bernard', 'Marx', 'Cashier', '1240 Ambient Avenue', '326-555-8456', 'BM1'),
('Lenina', 'Crowne', 'Cashier', '281 Bumblepuppy Boulevard', '328-555-2349', 'LC1'),
('Fanny', 'Crowne', 'Restocker', '1023 Bokanovsky Lane', '326-555-6329', 'FC1'),
('Helmholtz', 'Watson', 'Janitor', '944 Soma Court', '329-555-2478', 'HW1');

142/3812
SHOW INDEXES FROM employees_example\G
*************************** 1. row ***************************
Table: employees_example
Non_unique: 0
Key_name: PRIMARY
Seq_in_index: 1
Column_name: id
Collation: A
Cardinality: 6
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
Ignored: NO
*************************** 2. row ***************************
Table: employees_example
Non_unique: 0
Key_name: employee_code
Seq_in_index: 1
Column_name: employee_code
Collation: A
Cardinality: 6
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
Ignored: NO
*************************** 3. row ***************************
Table: employees_example
Non_unique: 1
Key_name: first_name
Seq_in_index: 1
Column_name: first_name
Collation: A
Cardinality: NULL
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
Ignored: NO
*************************** 4. row ***************************
Table: employees_example
Non_unique: 1
Key_name: first_name
Seq_in_index: 2
Column_name: last_name
Collation: A
Cardinality: NULL
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
Ignored: NO

See Also
Ignored Indexes

1.1.1.2.1.19 TRUNCATE TABLE


Syntax
TRUNCATE [TABLE] tbl_name
[WAIT n | NOWAIT]

143/3812
Contents
1. Syntax
2. Description
1. WAIT/NOWAIT
2. Oracle-mode
3. Performance
3. See Also

Description
TRUNCATE TABLE empties a table completely. It requires the DROP privilege. See GRANT.
tbl_name can also be specified in the form db_name . tbl_name (see Identifier Qualifiers).

Logically, TRUNCATE TABLE is equivalent to a DELETE statement that deletes all rows, but there are practical
differences under some circumstances.
TRUNCATE TABLE will fail for an InnoDB table if any FOREIGN KEY constraints from other tables reference the table,
returning the error:

ERROR 1701 (42000): Cannot truncate a table referenced in a foreign key constraint

Foreign Key constraints between columns in the same table are permitted.
For an InnoDB table, if there are no FOREIGN KEY constraints, InnoDB performs fast truncation by dropping the original
table and creating an empty one with the same definition, which is much faster than deleting rows one by one. The
AUTO_INCREMENT counter is reset by TRUNCATE TABLE , regardless of whether there is a FOREIGN KEY constraint.
The count of rows affected by TRUNCATE TABLE is accurate only when it is mapped to a DELETE statement.
For other storage engines, TRUNCATE TABLE differs from DELETE in the following ways:
Truncate operations drop and re-create the table, which is much faster than deleting rows one by one, particularly
for large tables.
Truncate operations cause an implicit commit.
Truncation operations cannot be performed if the session holds an active table lock.
Truncation operations do not return a meaningful value for the number of deleted rows. The usual result is "0
rows affected," which should be interpreted as "no information."
As long as the table format file tbl_name.frm is valid, the table can be re-created as an empty table with
TRUNCATE TABLE , even if the data or index files have become corrupted.
The table handler does not remember the last used AUTO_INCREMENT value, but starts counting from the
beginning. This is true even for MyISAM and InnoDB, which normally do not reuse sequence values.
When used with partitioned tables, TRUNCATE TABLE preserves the partitioning; that is, the data and index files
are dropped and re-created, while the partition definitions (.par) file is unaffected.
Since truncation of a table does not make any use of DELETE , the TRUNCATE statement does not invoke ON
DELETE triggers.
TRUNCATE TABLE will only reset the values in the Performance Schema summary tables to zero or null, and will
not remove the rows.
For the purposes of binary logging and replication, TRUNCATE TABLE is treated as DROP TABLE followed by CREATE
TABLE (DDL rather than DML).
TRUNCATE TABLE does not work on views. Currently, TRUNCATE TABLE drops all historical records from a system-
versioned table.

MariaDB starting with 10.3.0


WAIT/NOWAIT
Set the lock wait timeout. See WAIT and NOWAIT.

Oracle-mode
Oracle-mode from MariaDB 10.3 permits the optional keywords REUSE STORAGE or DROP STORAGE to be used.
TRUNCATE [TABLE] tbl_name [{DROP | REUSE} STORAGE] [WAIT n | NOWAIT]

These have no effect on the operation.

Performance
TRUNCATE TABLE is faster than DELETE, because it drops and re-creates a table.

With InnoDB, TRUNCATE TABLE is slower if innodb_file_per_table=ON is set (the default). This is because TRUNCATE
TABLE unlinks the underlying tablespace file, which can be an expensive operation. See MDEV-8069 for more details.
144/3812
The performance issues with innodb_file_per_table=ON can be exacerbated in cases where the InnoDB buffer pool is
very large and innodb_adaptive_hash_index=ON is set. In that case, using DROP TABLE followed by CREATE TABLE
instead of TRUNCATE TABLE may perform better. Setting innodb_adaptive_hash_index=OFF (it defaults to ON before
MariaDB 10.5) can also help. In MariaDB 10.2 only, from MariaDB 10.2.19 , this performance can also be improved by
setting innodb_safe_truncate=OFF. See MDEV-9459 for more details.
Setting innodb_adaptive_hash_index=OFF can also improve TRUNCATE TABLE performance in general. See MDEV-
16796 for more details.

See Also
TRUNCATE function
innodb_safe_truncate system variable
Oracle mode from MariaDB 10.3

1.1.1.2.1.20 UPDATE
Syntax
Single-table syntax:

UPDATE [LOW_PRIORITY] [IGNORE] table_reference


[PARTITION (partition_list)]
[FOR PORTION OF period FROM expr1 TO expr2]
SET col1={expr1|DEFAULT} [,col2={expr2|DEFAULT}] ...
[WHERE where_condition]
[ORDER BY ...]
[LIMIT row_count]

Multiple-table syntax:

UPDATE [LOW_PRIORITY] [IGNORE] table_references


SET col1={expr1|DEFAULT} [, col2={expr2|DEFAULT}] ...
[WHERE where_condition]

Contents
1. Syntax
2. Description
1. PARTITION
2. FOR PORTION OF
3. UPDATE Statements With the Same
Source and Target
3. Example
4. See Also

Description
For the single-table syntax, the UPDATE statement updates columns of existing rows in the named table with new
values. The SET clause indicates which columns to modify and the values they should be given. Each value can be
given as an expression, or the keyword DEFAULT to set a column explicitly to its default value. The WHERE clause, if
given, specifies the conditions that identify which rows to update. With no WHERE clause, all rows are updated. If the
ORDER BY clause is specified, the rows are updated in the order that is specified. The LIMIT clause places a limit on
the number of rows that can be updated.
Until MariaDB 10.3.2, for the multiple-table syntax, UPDATE updates rows in each table named in table_references that
satisfy the conditions. In this case, ORDER BY and LIMIT cannot be used. This restriction was lifted in MariaDB 10.3.2
and both clauses can be used with multiple-table updates. An UPDATE can also reference tables which are located in
different databases; see Identifier Qualifiers for the syntax.
where_condition is an expression that evaluates to true for each row to be updated.

table_references and where_condition are as specified as described in SELECT.

For single-table updates, assignments are evaluated in left-to-right order, while for multi-table updates, there is no
guarantee of a particular order. If the SIMULTANEOUS_ASSIGNMENT sql_mode (available from MariaDB 10.3.5) is set,
UPDATE statements evaluate all assignments simultaneously.
You need the UPDATE privilege only for columns referenced in an UPDATE that are actually updated. You need only the
SELECT privilege for any columns that are read but not modified. See GRANT.
The UPDATE statement supports the following modifiers:
145/3812
If you use the LOW_PRIORITY keyword, execution of the UPDATE is delayed until no other clients are reading from
the table. This affects only storage engines that use only table-level locking (MyISAM, MEMORY, MERGE). See
HIGH_PRIORITY and LOW_PRIORITY clauses for details.
If you use the IGNORE keyword, the update statement does not abort even if errors occur during the update.
Rows for which duplicate-key conflicts occur are not updated. Rows for which columns are updated to values that
would cause data conversion errors are updated to the closest valid values instead.

PARTITION
See Partition Pruning and Selection for details.

FOR PORTION OF
MariaDB starting with 10.4.3
See Application Time Periods - Updating by Portion.

UPDATE Statements With the Same Source and Target


MariaDB starting with 10.3.2
From MariaDB 10.3.2, UPDATE statements may have the same source and target.

For example, given the following table:

DROP TABLE t1;


CREATE TABLE t1 (c1 INT, c2 INT);
INSERT INTO t1 VALUES (10,10), (20,20);

Until MariaDB 10.3.1, the following UPDATE statement would not work:

UPDATE t1 SET c1=c1+1 WHERE c2=(SELECT MAX(c2) FROM t1);


ERROR 1093 (HY000): Table 't1' is specified twice,
both as a target for 'UPDATE' and as a separate source for data

From MariaDB 10.3.2, the statement executes successfully:

UPDATE t1 SET c1=c1+1 WHERE c2=(SELECT MAX(c2) FROM t1);

SELECT * FROM t1;


+------+------+
| c1 | c2 |
+------+------+
| 10 | 10 |
| 21 | 20 |
+------+------+

Example
Single-table syntax:

UPDATE table_name SET column1 = value1, column2 = value2 WHERE id=100;

Multiple-table syntax:

UPDATE tab1, tab2 SET tab1.column1 = value1, tab1.column2 = value2 WHERE tab1.id = tab2.id;

See Also
How IGNORE works
SELECT
ORDER BY
LIMIT
Identifier Qualifiers

1.1.1.2.1.21 IGNORE
146/3812
The IGNORE option tells the server to ignore some common errors.
IGNORE can be used with the following statements:
DELETE
INSERT (see also INSERT IGNORE)
LOAD DATA INFILE
UPDATE
ALTER TABLE
CREATE TABLE ... SELECT
INSERT ... SELECT
The logic used:
Variables out of ranges are replaced with the maximum/minimum value.
SQL_MODEs STRICT_TRANS_TABLES , STRICT_ALL_TABLES , NO_ZERO_IN_DATE , NO_ZERO_DATE are ignored.
Inserting NULL in a NOT NULL field will insert 0 ( in a numerical field), 0000-00-00 ( in a date field) or an empty
string ( in a character field).
Rows that cause a duplicate key error or break a foreign key constraint are not inserted, updated, or deleted.
The following errors are ignored:

Error
Symbolic error name Description
number
1022 ER_DUP_KEY Can't write; duplicate key in table '%s'
1048 ER_BAD_NULL_ERROR Column '%s' cannot be null
1062 ER_DUP_ENTRY Duplicate entry '%s' for key %d
1242 ER_SUBQUERY_NO_1_ROW Subquery returns more than 1 row
1264 ER_WARN_DATA_OUT_OF_RANGE Out of range value for column '%s' at row %ld
1265 WARN_DATA_TRUNCATED Data truncated for column '%s' at row %ld
1292 ER_TRUNCATED_WRONG_VALUE Truncated incorrect %s value: '%s'
1366 ER_TRUNCATED_WRONG_VALUE_FOR_FIELD Incorrect integer value
1369 ER_VIEW_CHECK_FAILED CHECK OPTION failed '%s.%s'

1451 ER_ROW_IS_REFERENCED_2 Cannot delete or update a parent row


Cannot add or update a child row: a foreign key
1452 ER_NO_REFERENCED_ROW_2
constraint fails (%s)
1526 ER_NO_PARTITION_FOR_GIVEN_VALUE Table has no partition for value %s
1586 ER_DUP_ENTRY_WITH_KEY_NAME Duplicate entry '%s' for key '%s'
1591 ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT Table has no partition for some existing values
1748 ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET Found a row not matching the given partition set

Ignored errors normally generate a warning.


A property of the IGNORE clause consists in causing transactional engines and non-transactional engines (like XtraDB
and Aria) to behave the same way. For example, normally a multi-row insert which tries to violate a UNIQUE contraint is
completely rolled back on XtraDB/InnoDB, but might be partially executed on Aria. With the IGNORE clause, the
statement will be partially executed in both engines.
Duplicate key errors also generate warnings. The OLD_MODE server variable can be used to prevent this.

1.1.1.2.1.22 System-Versioned Tables


1.1.1.2.2 ANALYZE and EXPLAIN Statements
ANALYZE FORMAT=JSON
Mix of the EXPLAIN FORMAT=JSON and ANALYZE statement features.

ANALYZE FORMAT=JSON Examples


Examples with ANALYZE FORMAT=JSON.

147/3812
ANALYZE Statement
Invokes the optimizer, executes the statement, and then produces EXPLAIN output.

EXPLAIN
EXPLAIN returns information about index usage, as well as being a synonym for DESCRIBE.

EXPLAIN ANALYZE
Old implementation, now ANALYZE statement

EXPLAIN FORMAT=JSON
Variant of EXPLAIN that produces output in JSON form

SHOW EXPLAIN
Shows an execution plan for a running query.

Using Buffer UPDATE Algorithm


Explanation of UPDATE's "Using Buffer" algorithm.

1.1.1.2.2.1 ANALYZE FORMAT=JSON


Contents
1. Basic Execution Data
2. Advanced Execution Data
3. SHOW ANALYZE FORMAT=JSON
4. Data About Individual Query Plan Nodes
5. Use Cases

ANALYZE FORMAT=JSON is a mix of the EXPLAIN FORMAT=JSON and ANALYZE statement features. The ANALYZE
FORMAT=JSON $statement will execute $statement , and then print the output of EXPLAIN FORMAT=JSON , amended with
data from the query execution.

Basic Execution Data


You can get the following also from tabular ANALYZE statement form:
r_rows is provided for any node that reads rows. It shows how many rows were read, on average
r_filtered is provided whenever there is a condition that is checked. It shows the percentage of rows left after
checking the condition.

Advanced Execution Data


The most important data not available in the regular tabula ANALYZE statement are:
r_loops field. This shows how many times the node was executed. Most query plan elements have this field.
r_total_time_ms field. It shows how much time in total was spent executing this node. If the node has subnodes,
their execution time is included.
r_buffer_size field. Query plan nodes that make use of buffers report the size of buffer that was was used.

SHOW ANALYZE FORMAT=JSON


MariaDB starting with 10.9
SHOW ANALYZE FORMAT=JSON for <connection_id> extends ANALYZE [FORMAT=JSON] <select> to allow one to
analyze a query currently running in another connection.

Data About Individual Query Plan Nodes


filesort node reports whether sorting was done with LIMIT n parameter, and how many rows were in the sort
result.
block-nl-join node has r_loops field, which allows to tell whether Using join buffer was efficient
range-checked-for-each-record reports counters that show the result of the check.
expression-cache is used for subqueries, and it reports how many times the cache was used, and what cache
hit ratio was.
union_result node has r_rows so one can see how many rows were produced after UNION operation
and so forth

148/3812
Use Cases
See Examples of ANALYZE FORMAT=JSON.

1.1.1.2.2.2 ANALYZE FORMAT=JSON


Examples
Example #1
Customers who have ordered more than 1M goods.

ANALYZE FORMAT=JSON
SELECT COUNT(*)
FROM customer
WHERE
(SELECT SUM(o_totalprice) FROM orders WHERE o_custkey=c_custkey) > 1000*1000;

The query takes 40 seconds over cold cache

EXPLAIN: {
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": 39872,
"table": {
"table_name": "customer",
"access_type": "index",
"key": "i_c_nationkey",
"key_length": "5",
"used_key_parts": ["c_nationkey"],
"r_loops": 1,
"rows": 150303,
"r_rows": 150000,
"r_total_time_ms": 270.3,
"filtered": 100,
"r_filtered": 60.691,
"attached_condition": "((subquery#2) > <cache>((1000 * 1000)))",
"using_index": true
},
"subqueries": [
{
"query_block": {
"select_id": 2,
"r_loops": 150000,
"r_total_time_ms": 39531,
"table": {
"table_name": "orders",
"access_type": "ref",
"possible_keys": ["i_o_custkey"],
"key": "i_o_custkey",
"key_length": "5",
"used_key_parts": ["o_custkey"],
"ref": ["dbt3sf1.customer.c_custkey"],
"r_loops": 150000,
"rows": 7,
"r_rows": 10,
"r_total_time_ms": 39208,
"filtered": 100,
"r_filtered": 100
}
}
}
]
}
}

ANALYZE shows that 39.2 seconds were spent in the subquery, which was executed 150K times (for every row of outer
table).
149/3812
1.1.1.2.2.3 ANALYZE Statement
Contents
1. Description
2. Command Output
3. Interpreting the Output
1. Joins
2. Meaning of NULL in r_rows and
r_filtered
4. ANALYZE FORMAT=JSON
5. Notes
6. See Also

Description
The ANALYZE statement is similar to the EXPLAIN statement . ANALYZE statement will invoke the optimizer, execute
the statement, and then produce EXPLAIN output instead of the result set. The EXPLAIN output will be annotated with
statistics from statement execution.
This lets one check how close the optimizer's estimates about the query plan are to the reality. ANALYZE produces an
overview, while the ANALYZE FORMAT=JSON command provides a more detailed view of the query plan and the
query execution.
The syntax is

ANALYZE explainable_statement;

where the statement is any statement for which one can run EXPLAIN.

Command Output
Consider an example:

ANALYZE SELECT * FROM tbl1


WHERE key1
BETWEEN 10 AND 200 AND
col1 LIKE 'foo%'\G

*************************** 1. row ***************************


id: 1
select_type: SIMPLE
table: tbl1
type: range
possible_keys: key1
key: key1
key_len: 5
ref: NULL
rows: 181
r_rows: 181
filtered: 100.00
r_filtered: 10.50
Extra: Using index condition; Using where

Compared to EXPLAIN , ANALYZE produces two extra columns:


r_rows is an observation-based counterpart of the rows column. It shows how many rows were actually read
from the table.
r_filtered is an observation-based counterpart of the filtered column. It shows which fraction of rows was left
after applying the WHERE condition.

Interpreting the Output


Joins
Let's consider a more complicated example.

150/3812
ANALYZE SELECT *
FROM orders, customer
WHERE
customer.c_custkey=orders.o_custkey AND
customer.c_acctbal < 0 AND
orders.o_totalprice > 200*1000

+----+-------------+----------+------+---------------+-------------+---------+--------------------+----
----+--------+----------+------------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref |
rows | r_rows | filtered | r_filtered | Extra |
+----+-------------+----------+------+---------------+-------------+---------+--------------------+----
----+--------+----------+------------+-------------+
| 1 | SIMPLE | customer | ALL | PRIMARY,... | NULL | NULL | NULL |
149095 | 150000 | 18.08 | 9.13 | Using where |
| 1 | SIMPLE | orders | ref | i_o_custkey | i_o_custkey | 5 | customer.c_custkey |
7 | 10 | 100.00 | 30.03 | Using where |
+----+-------------+----------+------+---------------+-------------+---------+--------------------+----
----+--------+----------+------------+-------------+

Here, one can see that


For table customer, customer.rows=149095, customer.r_rows=150000. The estimate for number of rows we
will read was fairly precise
customer.filtered=18.08, customer.r_filtered=9.13. The optimizer somewhat overestimated the number of
records that will match selectivity of condition attached to `customer` table (in general, when you have a full scan
and r_filtered is less than 15%, it's time to consider adding an appropriate index).
For table orders, orders.rows=7, orders.r_rows=10. This means that on average, there are 7 orders for a given
c_custkey, but in our case there were 10, which is close to the expectation (when this number is consistently far
from the expectation, it may be time to run ANALYZE TABLE, or even edit the table statistics manually to get
better query plans).
orders.filtered=100, orders.r_filtered=30.03. The optimizer didn't have any way to estimate which fraction of
records will be left after it checks the condition that is attached to table orders (it's orders.o_totalprice >
200*1000). So, it used 100%. In reality, it is 30%. 30% is typically not selective enough to warrant adding new
indexes. For joins with many tables, it might be worth to collect and use column statistics for columns in question,
this may help the optimizer to pick a better query plan.

Meaning of NULL in r_rows and r_filtered


Let's modify the previous example slightly

ANALYZE SELECT *
FROM orders, customer
WHERE
customer.c_custkey=orders.o_custkey AND
customer.c_acctbal < -0 AND
customer.c_comment LIKE '%foo%' AND
orders.o_totalprice > 200*1000;

+----+-------------+----------+------+---------------+-------------+---------+--------------------+----
----+--------+----------+------------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref |
rows | r_rows | filtered | r_filtered | Extra |
+----+-------------+----------+------+---------------+-------------+---------+--------------------+----
----+--------+----------+------------+-------------+
| 1 | SIMPLE | customer | ALL | PRIMARY,... | NULL | NULL | NULL |
149095 | 150000 | 18.08 | 0.00 | Using where |
| 1 | SIMPLE | orders | ref | i_o_custkey | i_o_custkey | 5 | customer.c_custkey |
7 | NULL | 100.00 | NULL | Using where |
+----+-------------+----------+------+---------------+-------------+---------+--------------------+----
----+--------+----------+------------+-------------+

Here, one can see that orders.r_rows=NULL and orders.r_filtered=NULL. This means that table orders was not
scanned even once. Indeed, we can also see customer.r_filtered=0.00. This shows that a part of WHERE attached to
table `customer` was never satisfied (or, satisfied in less than 0.01% of cases).

ANALYZE FORMAT=JSON
ANALYZE FORMAT=JSON produces JSON output. It produces much more information than tabular ANALYZE .

Notes
151/3812
ANALYZE UPDATE or ANALYZE DELETE will actually make updates/deletes ( ANALYZE SELECT will perform the select
operation and then discard the resultset).
PostgreSQL has a similar command, EXPLAIN ANALYZE .
The EXPLAIN in the slow query log feature allows MariaDB to have ANALYZE output of slow queries printed into
the slow query log (see MDEV-6388 ).

See Also
ANALYZE FORMAT=JSON
ANALYZE TABLE
JIRA task for ANALYZE statement, MDEV-406

1.1.1.2.2.4 EXPLAIN
Syntax
EXPLAIN tbl_name [col_name | wild]

Or

EXPLAIN [EXTENDED | PARTITIONS | FORMAT=JSON]


{SELECT select_options | UPDATE update_options | DELETE delete_options}

Contents
1. Syntax
2. Description
1. Columns in EXPLAIN ... SELECT
1. "Select_type" Column
2. "Type" Column
3. "Extra" Column
2. EXPLAIN EXTENDED
3. Examples
1. Example of ref_or_null Optimization
4. See Also

Description
The EXPLAIN statement can be used either as a synonym for DESCRIBE or as a way to obtain information about how
MariaDB executes a SELECT , UPDATE or DELETE statement:
'EXPLAIN tbl_name' is synonymous with 'DESCRIBE tbl_name' or 'SHOW COLUMNS FROM tbl_name' .
When you precede a SELECT , UPDATE or a DELETE statement with the keyword EXPLAIN , MariaDB displays
information from the optimizer about the query execution plan. That is, MariaDB explains how it would process the
SELECT , UPDATE or DELETE , including information about how tables are joined and in which order. EXPLAIN
EXTENDED can be used to provide additional information.
EXPLAIN PARTITIONS is useful only when examining queries involving partitioned tables.
For details, see Partition pruning and selection.
ANALYZE statement performs the query as well as producing EXPLAIN output, and provides actual as well as
estimated statistics.
EXPLAIN output can be printed in the slow query log. See EXPLAIN in the Slow Query Log for details.
SHOW EXPLAIN shows the output of a running statement. In some cases, its output can be closer to reality than
EXPLAIN .

The ANALYZE statement runs a statement and returns information about its execution plan. It also shows additional
columns, to check how much the optimizer's estimation about filtering and found rows are close to reality.
There is an online EXPLAIN Analyzer that you can use to share EXPLAIN and EXPLAIN EXTENDED output with others.

EXPLAIN can acquire metadata locks in the same way that SELECT does, as it needs to know table metadata and,
sometimes, data as well.

Columns in EXPLAIN ... SELECT


Column name Description
id Sequence number that shows in which order tables are joined.
152/3812
select_type What kind of SELECT the table comes from.
table Alias name of table. Materialized temporary tables for sub queries are named <subquery#>
type How rows are found from the table (join type).
possible_keys keys in table that could be used to find rows in the table
key The name of the key that is used to retrieve rows. NULL is no key was used.
How many bytes of the key that was used (shows if we are using only parts of the multi-column
key_len
key).
ref The reference that is used as the key value.
rows An estimate of how many rows we will find in the table for each key lookup.
Extra Extra information about this join.

Here are descriptions of the values for some of the more complex columns in EXPLAIN ... SELECT :

"Select_type" Column
The select_type column can have the following values:

Value Description Comment


DEPENDENT The SUBQUERY is
SUBQUERY DEPENDENT .

DEPENDENT
The UNION is DEPENDENT .
UNION

The SELECT is DERIVED


DERIVED
from the PRIMARY .
Materialized tables will be populated at first access and will be
The SUBQUERY is
MATERIALIZED accessed by the primary key (= one key lookup). Number of rows in
MATERIALIZED .
EXPLAIN shows the cost of populating the table
The SELECT is in the
PRIMARY outermost query, but there is
also a SUBQUERY within it.
It is a simple SELECT query
SIMPLE without any SUBQUERY or
UNION .

The SELECT is a SUBQUERY


SUBQUERY
of the PRIMARY .
UNCACHEABLE The SUBQUERY is
SUBQUERY UNCACHEABLE .

UNCACHEABLE
The UNION is UNCACHEABLE .
UNION

The SELECT is a UNION of


UNION
the PRIMARY .

UNION RESULT The result of the UNION .

LATERAL The SELECT uses a Lateral


DERIVED Derived optimization

"Type" Column
This column contains information on how the table is accessed.

Value Description
A full table scan is done for the table (all rows are read). This is bad if the table is large and the
ALL table is joined against a previous table! This happens when the optimizer could not find any
usable index to access rows.
There is only one possibly matching row in the table. The row is read before the optimization
const
phase and all columns in the table are treated as constants.
eq_ref A unique index is used to find the rows. This is the best possible plan to find the row.

153/3812
fulltext A fulltext index is used to access the rows.
A 'range' access is done for for several index and the found rows are merged. The key column
index_merge
shows which keys are used.
index_subquery This is similar as ref, but used for sub queries that are transformed to key lookups.
A full scan over the used index. Better than ALL but still bad if index is large and the table is
index
joined against a previous table.
range The table will be accessed with a key over one or more value ranges.
Like 'ref' but in addition another search for the 'null' value is done if the first value was not found.
ref_or_null
This happens usually with sub queries.
A non unique index or prefix of an unique index is used to find the rows. Good if the prefix doesn't
ref
match many rows.
system The table has 0 or 1 rows.
unique_subquery This is similar as eq_ref, but used for sub queries that are transformed to key lookups

"Extra" Column
This column consists of one or more of the following values, separated by ';'
Note that some of these values are detected after the optimization phase.
The optimization phase can do the following changes to the WHERE clause:
Add the expressions from the ON and USING clauses to the WHERE clause.
Constant propagation: If there is column=constant , replace all column instances with this constant.
Replace all columns from ' const ' tables with their values.
Remove the used key columns from the WHERE (as this will be tested as part of the key lookup).
Remove impossible constant sub expressions. For example WHERE '(a=1 and a=2) OR b=1' becomes 'b=1' .
Replace columns with other columns that has identical values: Example: WHERE a=b and a=c may be treated as
'WHERE a=b and a=c and b=c' .
Add extra conditions to detect impossible row conditions earlier. This happens mainly with OUTER JOIN where we
in some cases add detection of NULL values in the WHERE (Part of ' Not exists ' optimization). This can cause an
unexpected ' Using where ' in the Extra column.
For each table level we remove expressions that have already been tested when we read the previous row.
Example: When joining tables t1 with t2 using the following WHERE 't1.a=1 and t1.a=t2.b' , we don't have to
test 't1.a=1' when checking rows in t2 as we already know that this expression is true.

Value Description
const row not
The table was a system table (a table with should exactly one row), but no row was found.
found

If distinct optimization (remove duplicates) was used. This is marked only for the last table in
Distinct
the SELECT .
Full scan on NULL The table is a part of the sub query and if the value that is used to match the sub query will be
key NULL , we will do a full table scan.

Impossible HAVING The used HAVING clause is always false so the SELECT will return no rows.
Impossible WHERE
The used WHERE clause is always false so the SELECT will return no rows. This case was
noticed after
detected after we had read all 'const' tables and used the column values as constant in the
reading const
WHERE clause. For example: WHERE const_column=5 and const_column had a value of 4.
tables.

The used WHERE clause is always false so the SELECT will return no rows. For example: WHERE
Impossible WHERE
1=2

No matching During early optimization of MIN() / MAX() values it was detected that no row could match the
min/max row WHERE clause. The MIN() / MAX() function will return NULL .

no matching row The table was a const table (a table with only one possible matching row), but no row was
in const table found.
The SELECT was a sub query that did not use any tables. For example a there was no FROM
No tables used
clause or a FROM DUAL clause.
Stop searching after more row if we find one single matching row. This optimization is used with
LEFT JOIN where one is explicitly searching for rows that doesn't exists in the LEFT JOIN
Not exists TABLE . Example: SELECT * FROM t1 LEFT JOIN t2 on (...) WHERE t2.not_null_column IS
NULL . As t2.not_null_column can only be NULL if there was no matching row for on
condition, we can stop searching if we find a single matching row.

154/3812
For information_schema tables. Only the frm (table definition file was opened) was opened
Open_frm_only
for each matching row.
For information_schema tables. A full table open for each matching row is done to retrieve the
Open_full_table
requested information. (Slow)
For information_schema tables. Only the trigger file definition was opened for each matching
Open_trigger_only
row.
This only happens when there was no good default index to use but there may some index that
Range checked could be used when we can treat all columns from previous table as constants. For each row
for each record combination the optimizer will decide which index to use (if any) to fetch a row from this table.
(index map: ...) This is not fast, but faster than a full table scan that is the only other choice. The index map is a
bitmask that shows which index are considered for each row condition.
Scanned 0/1/all
For information_schema tables. Shows how many times we had to do a directory scan.
databases

All tables in the join was optimized away. This happens when we are only using COUNT(*) ,
Select tables
MIN() and MAX() functions in the SELECT and we where able to replace all of these with
optimized away
constants.
Skip_open_table For information_schema tables. The queried table didn't need to be opened.
unique row not The table was detected to be a const table (a table with only one possible matching row) during
found the early optimization phase, but no row was found.
Filesort is needed to resolve the query. This means an extra phase where we first collect all
columns to sort, sort them with a disk based merge sort and then use the sorted set to retrieve
Using filesort
the rows in sorted order. If the column set is small, we store all the columns in the sort file to not
have to go to the database to retrieve them again.
Only the index is used to retrieve the needed information from the table. There is no need to
Using index
perform an extra seek to retrieve the actual record.
Using index Like ' Using where ' but the where condition is pushed down to the table engine for internal
condition optimization at the index level.
Using index
Like ' Using index condition ' but in addition we use batch key access to retrieve rows.
condition(BKA)

The index is being used to resolve a GROUP BY or DISTINCT query. The rows are not read.
Using index for
This is very efficient if the table has a lot of identical index entries as duplicates are quickly
group-by
jumped over.
Using
For index_merge joins. Shows which index are part of the intersect.
intersect(...)

We store previous row combinations in a row buffer to be able to match each row against all of
Using join buffer
the rows combinations in the join buffer at one go.
Using
For index_merge joins. Shows which index are part of the union.
sort_union(...)

A temporary table is created to hold the result. This typically happens if you are using GROUP
Using temporary
BY , DISTINCT or ORDER BY .

A WHERE expression (in additional to the possible key lookup) is used to check if the row should
Using where be accepted. If you don't have 'Using where' together with a join type of ALL , you are probably
doing something wrong!
Using where with Like ' Using where ' but the where condition is pushed down to the table engine for internal
pushed condition optimization at the row level.
The UPDATE statement will first buffer the rows, and then run the updates, rather than do
Using buffer
updates on the fly. See Using Buffer UPDATE Algorithm for a detailed explanation.

EXPLAIN EXTENDED
The EXTENDED keyword adds another column, filtered, to the output. This is a percentage estimate of the table rows
that will be filtered by the condition.
An EXPLAIN EXTENDED will always throw a warning, as it adds extra Message information to a subsequent SHOW
WARNINGS statement. This includes what the SELECT query would look like after optimizing and rewriting rules are
applied and how the optimizer qualifies columns and tables.

Examples
155/3812
As synonym for DESCRIBE or SHOW COLUMNS FROM :

DESCRIBE city;
+------------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+----------+------+-----+---------+----------------+
| Id | int(11) | NO | PRI | NULL | auto_increment |
| Name | char(35) | YES | | NULL | |
| Country | char(3) | NO | UNI | | |
| District | char(20) | YES | MUL | | |
| Population | int(11) | YES | | NULL | |
+------------+----------+------+-----+---------+----------------+

A simple set of examples to see how EXPLAIN can identify poor index usage:

CREATE TABLE IF NOT EXISTS `employees_example` (


`id` int(11) NOT NULL AUTO_INCREMENT,
`first_name` varchar(30) NOT NULL,
`last_name` varchar(40) NOT NULL,
`position` varchar(25) NOT NULL,
`home_address` varchar(50) NOT NULL,
`home_phone` varchar(12) NOT NULL,
`employee_code` varchar(25) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `employee_code` (`employee_code`),
KEY `first_name` (`first_name`,`last_name`)
) ENGINE=Aria;

INSERT INTO `employees_example` (`first_name`, `last_name`, `position`, `home_address`, `home_phone`,


`employee_code`)
VALUES
('Mustapha', 'Mond', 'Chief Executive Officer', '692 Promiscuous Plaza', '326-555-3492', 'MM1'),
('Henry', 'Foster', 'Store Manager', '314 Savage Circle', '326-555-3847', 'HF1'),
('Bernard', 'Marx', 'Cashier', '1240 Ambient Avenue', '326-555-8456', 'BM1'),
('Lenina', 'Crowne', 'Cashier', '281 Bumblepuppy Boulevard', '328-555-2349', 'LC1'),
('Fanny', 'Crowne', 'Restocker', '1023 Bokanovsky Lane', '326-555-6329', 'FC1'),
('Helmholtz', 'Watson', 'Janitor', '944 Soma Court', '329-555-2478', 'HW1');

SHOW INDEXES FROM employees_example;


+-------------------+------------+---------------+--------------+---------------+-----------+----------
---+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation |
Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+-------------------+------------+---------------+--------------+---------------+-----------+----------
---+----------+--------+------+------------+---------+---------------+
| employees_example | 0 | PRIMARY | 1 | id | A |
7 | NULL | NULL | | BTREE | | |
| employees_example | 0 | employee_code | 1 | employee_code | A |
7 | NULL | NULL | | BTREE | | |
| employees_example | 1 | first_name | 1 | first_name | A |
NULL | NULL | NULL | | BTREE | | |
| employees_example | 1 | first_name | 2 | last_name | A |
NULL | NULL | NULL | | BTREE | | |
+-------------------+------------+---------------+--------------+---------------+-----------+----------
---+----------+--------+------+------------+---------+---------------+

SELECT on a primary key:

EXPLAIN SELECT * FROM employees_example WHERE id=1;


+------+-------------+-------------------+-------+---------------+---------+---------+-------+------+--
-----+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows |
Extra |
+------+-------------+-------------------+-------+---------------+---------+---------+-------+------+--
-----+
| 1 | SIMPLE | employees_example | const | PRIMARY | PRIMARY | 4 | const | 1 |
|
+------+-------------+-------------------+-------+---------------+---------+---------+-------+------+--
-----+

The type is const, which means that only one possible result could be returned. Now, returning the same record but
searching by their phone number:

156/3812
EXPLAIN SELECT * FROM employees_example WHERE home_phone='326-555-3492';
+------+-------------+-------------------+------+---------------+------+---------+------+------+-------
------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra
|
+------+-------------+-------------------+------+---------------+------+---------+------+------+-------
------+
| 1 | SIMPLE | employees_example | ALL | NULL | NULL | NULL | NULL | 6 | Using
where |
+------+-------------+-------------------+------+---------------+------+---------+------+------+-------
------+

Here, the type is All , which means no index could be used. Looking at the rows count, a full table scan (all six rows) had
to be performed in order to retrieve the record. If it's a requirement to search by phone number, an index will have to be
created.
SHOW EXPLAIN example:

SHOW EXPLAIN FOR 1;


+------+-------------+-------+-------+---------------+------+---------+------+---------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+------+-------------+-------+-------+---------------+------+---------+------+---------+-------------+
| 1 | SIMPLE | tbl | index | NULL | a | 5 | NULL | 1000107 | Using index |
+------+-------------+-------+-------+---------------+------+---------+------+---------+-------------+
1 row in set, 1 warning (0.00 sec)

Example of ref_or_null Optimization


SELECT * FROM table_name
WHERE key_column=expr OR key_column IS NULL;

ref_or_null is something that often happens when you use subqueries with NOT IN as then one has to do an extra
check for NULL values if the first value didn't have a matching row.

See Also
SHOW EXPLAIN
Ignored Indexes

1.1.1.2.2.5 EXPLAIN ANALYZE


The syntax for the EXPLAIN ANALYZE feature was changed to ANALYZE statement , available since MariaDB 10.1.0 .
See ANALYZE statement.

1.1.1.2.2.6 EXPLAIN FORMAT=JSON


Contents
1. Synopsis
2. Output is different from MySQL
3. Output Format
4. See Also

Synopsis
EXPLAIN FORMAT=JSON is a variant of EXPLAIN command that produces output in JSON form. The output always has
one row which has only one column titled " JSON ". The contents are a JSON representation of the query plan, formatted
for readability:

EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE col1=1\G

157/3812
*************************** 1. row ***************************
EXPLAIN: {
"query_block": {
"select_id": 1,
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 1000,
"filtered": 100,
"attached_condition": "(t1.col1 = 1)"
}
}
}

Output is different from MySQL


The output of MariaDB's EXPLAIN FORMAT=JSON is different from EXPLAIN FORMAT=JSON in MySQL.The reasons for that
are:
MySQL's output has deficiencies. Some are listed here: EXPLAIN FORMAT=JSON in MySQL
The output of MySQL's EXPLAIN FORMAT=JSON is not defined. Even MySQL Workbench has trouble parsing it
(see this blog post ).
MariaDB has query optimizations that MySQL does not have. Ergo, MariaDB generates query plans that MySQL
does not generate.
A (as yet incomplete) list of how MariaDB's output is different from MySQL can be found here: EXPLAIN
FORMAT=JSON differences from MySQL .

Output Format
TODO: MariaDB's output format description.

See Also
ANALYZE FORMAT=JSON produces output like EXPLAIN FORMAT=JSON , but amended with the data from query
execution.

1.1.1.2.2.7 SHOW EXPLAIN


Contents
1. Syntax
2. Description
1. EXPLAIN FOR CONNECTION
2. FORMAT=JSON
3. Possible Errors
4. Differences Between SHOW EXPLAIN
and EXPLAIN Outputs
1. Background
2. List of Recorded Differences
3. Required Permissions
3. See Also

Syntax
SHOW EXPLAIN [FORMAT=JSON] FOR <connection_id>;
EXPLAIN [FORMAT=JSON] FOR CONNECTION <connection_id>;

Description
The SHOW EXPLAIN command allows one to get an EXPLAIN (that is, a description of a query plan) of a query running in
a certain connection.

SHOW EXPLAIN FOR <connection_id>;

will produce an EXPLAIN output for the query that connection number connection_id is running. The connection id
can be obtained with SHOW PROCESSLIST.

158/3812
SHOW EXPLAIN FOR 1;
+------+-------------+-------+-------+---------------+------+---------+------+---------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+------+-------------+-------+-------+---------------+------+---------+------+---------+-------------+
| 1 | SIMPLE | tbl | index | NULL | a | 5 | NULL | 1000107 | Using index |
+------+-------------+-------+-------+---------------+------+---------+------+---------+-------------+
1 row in set, 1 warning (0.00 sec)

The output is always accompanied with a warning which shows the query the target connection is running (this shows
what the EXPLAIN is for):

SHOW WARNINGS;
+-------+------+------------------------+
| Level | Code | Message |
+-------+------+------------------------+
| Note | 1003 | select sum(a) from tbl |
+-------+------+------------------------+
1 row in set (0.00 sec)

EXPLAIN FOR CONNECTION


MariaDB starting with 10.9
The EXPLAIN FOR CONNECTION syntax was added for MySQL compatibility.

FORMAT=JSON
MariaDB starting with 10.9
SHOW EXPLAIN [FORMAT=JSON] FOR <connection_id> extends SHOW EXPLAIN to return more detailed JSON output.

Possible Errors
The output can be only produced if the target connection is currently running a query, which has a ready query plan. If
this is not the case, the output will be:

SHOW EXPLAIN FOR 2;


ERROR 1932 (HY000): Target is not running an EXPLAINable command

You will get this error when:


the target connection is not running a command for which one can run EXPLAIN
the target connection is running a command for which one can run EXPLAIN , but
there is no query plan yet (for example, tables are open and locks are acquired before the query plan is
produced)

Differences Between SHOW EXPLAIN and EXPLAIN Outputs


Background
In MySQL, EXPLAIN execution takes a slightly different route from the way the real query (typically the SELECT ) is
optimized. This is unfortunate, and has caused a number of bugs in EXPLAIN . (For example, see MDEV-326 , MDEV-
410 , and lp:1013343 . lp:992942 is not directly about EXPLAIN , but it also would not have existed if MySQL didn't
try to delete parts of a query plan in the middle of the query)
SHOW EXPLAIN examines a running SELECT , and hence its output may be slightly different from what EXPLAIN SELECT
would produce. We did our best to make sure that either the difference is negligible, or SHOW EXPLAIN 's output is closer
to reality than EXPLAIN 's output.

List of Recorded Differences


SHOW EXPLAIN may have Extra=' no matching row in const table ', where EXPLAIN would produce
Extra=' Impossible WHERE ... '
For queries with subqueries, SHOW EXPLAIN may print select_type==PRIMARY where regular EXPLAIN used to
print select_type==SIMPLE , or vice versa.

Required Permissions
Running SHOW EXPLAIN requires the same permissions as running SHOW PROCESSLIST would.
159/3812
See Also
EXPLAIN
EXPLAIN ANALYZE, which will perform a query and outputs enhanced EXPLAIN results.
It is also possible to save EXPLAIN into the slow query log.

1.1.1.2.2.8 Using Buffer UPDATE Algorithm


This article explains the UPDATE statement's Using Buffer algorithm.
Take the following table and query:

Name Salary
Babatunde 1000
Jolana 1050
Pankaja 1300

UPDATE employees SET salary = salary+100 WHERE salary < 2000;

Suppose the employees table has an index on the salary column, and the optimizer decides to use a range scan on that
index.
The optimizer starts a range scan on the salary index. We find the first record Babatunde, 1000. If we do an on-the-fly
update, we immediately instruct the storage engine to change this record to be Babatunde, 1000+100=1100.
Then we proceed to search for the next record, and find Jolana, 1050. We instruct the storage engine to update it to be
Jolana, 1050+100=1150.
Then we proceed to search for the next record ... and what happens next depends on the storage engine. In some
storage engines, data changes are visible immediately, so we will find find the Babatunde, 1100 record that we wrote at
the first step, modifying it again, giving Babatunde an undeserved raise. Then we will see Babatunde again and again,
looping continually.
In order to prevent such situations, the optimizer checks whether the UPDATE statement is going to change key values
for the keys it is using. In that case, it will use a different algorithm:
1. Scan everyone with "salary<2000", remembering the rowids of the rows in a buffer.
2. Read the buffer and apply the updates.
This way, each row will be updated only once.
The Using buffer EXPLAIN output indicates that the buffer as described above will be used.

1.1.1.2.3 BACKUP Commands


Commands used by backup tools
BACKUP STAGE
Commands to be used by a MariaDB backup tool.

BACKUP LOCK
Blocks a table from DDL statements.

Mariabackup and BACKUP STAGE Commands


How Mariabackup could use BACKUP STAGE commands.

Storage Snapshots and BACKUP STAGE Commands


How storage snapshots could use BACKUP STAGE commands.

1.1.1.2.3.1 BACKUP STAGE


MariaDB starting with 10.4.1
The BACKUP STAGE commands were introduced in MariaDB 10.4.1.

160/3812
Contents
1. Syntax
2. Goals with BACKUP STAGE Commands
3. BACKUP STAGE Commands
1. BACKUP STAGE START
2. BACKUP STAGE FLUSH
3. BACKUP STAGE BLOCK_DDL
4. BACKUP STAGE BLOCK_COMMIT
5. BACKUP STAGE END
4. Using BACKUP STAGE Commands with
Backup Tools
1. Using BACKUP STAGE Commands
with Mariabackup
2. Using BACKUP STAGE Commands
with Storage Snapshots
5. Privileges
6. Notes
7. See Also

The BACKUP STAGE commands are a set of commands to make it possible to make an efficient external backup tool.

Syntax
BACKUP STAGE [START | FLUSH | BLOCK_DDL | BLOCK_COMMIT | END ]

In the following text, a transactional table means InnoDB or "InnoDB-like engine with redo log that can lock redo purges
and can be copied without locks by an outside process".

Goals with BACKUP STAGE Commands


To be able to do a majority of the backup with the minimum possible server locks. Especially for transactional
tables (InnoDB, MyRocks etc) there is only need for a very short block of new commits while copying statistics
and log tables.
DDL are only needed to be blocked for a very short duration of the backup while mariabackup is copying the
tables affected by DDL during the initial part of the backup.
Most non transactional tables (those that are not in use) will be copied during BACKUP STAGE START . The
exceptions are system statistic and log tables that are not blocked during the backup until BLOCK_COMMIT .
Should work efficiently with backup tools that use disk snapshots.
Should work as efficiently as possible for all table types that store data on the local disks.
As little copying as possible under higher level stages/locks. For example, .frm (dictionary) and .trn (trigger) files
should be copying while copying the table data.

BACKUP STAGE Commands


BACKUP STAGE START
The START stage is designed for the following tasks:
Blocks purge of redo files for storage engines that needs this (Aria)
Start logging of DDL commands into 'datadir'/ddl.log. This may take a short time as the command has to wait until
there are no active DDL commands.

BACKUP STAGE FLUSH


The FLUSH stage is designed for the following tasks:
FLUSH all changes for inactive non-transactional tables, except for statistics and log tables.
Close all tables that are not in use, to ensure they are marked as closed for the backup.
BLOCK all new write locks for all non transactional tables (except statistics and log tables). The command will not
wait for tables that are in use by read-only transactions.
DDLs don't have to be blocked at this stage as they can't cause the table to be in an inconsistent state. This is true also
for non-transactional tables.

BACKUP STAGE BLOCK_DDL


The BLOCK_DDL stage is designed for the following tasks:

161/3812
Wait for all statements using write locked non-transactional tables to end.
Blocks CREATE TABLE, DROP TABLE, TRUNCATE TABLE, and RENAME TABLE.
Blocks also start off a new ALTER TABLE and the final rename phase of ALTER TABLE. Running ALTER
TABLES are not blocked.

BACKUP STAGE BLOCK_COMMIT


The BLOCK_COMMIT stage is designed for the following tasks:
Lock the binary log and commit/rollback to ensure that no changes are committed to any tables. If there are active
commits or data to be copied to the binary log this will be allowed to finish. Active transactions will not affect
BLOCK_COMMIT .
This doesn't lock temporary tables that are not used by replication. However these will be blocked when it's time
to write to the binary log.
Lock system log tables and statistics tables, flush them and mark them closed.
When the BLOCK_COMMIT 's stages return, this is the 'backup time'. Everything committed will be in the backup and
everything not committed will roll back.
Transactional engines will continue to do changes to the redo log during the BLOCK COMMIT stage, but this is not
important as all of these will roll back later as the changes will not be committed.

BACKUP STAGE END


The END stage is designed for the following tasks:
End DDL logging
Free resources

Using BACKUP STAGE Commands with Backup Tools


Using BACKUP STAGE Commands with Mariabackup
The BACKUP STAGE commands are a set of commands to make it possible to make an efficient external backup tool.
How Mariabackup uses these commands depends on whether you are using the version that is bundled with MariaDB
Community Server or the version that is bundled with MariaDB Enterprise Server . See Mariabackup and BACKUP
STAGE Commands for some examples on how Mariabackup uses these commands.

If you would like to use a version of Mariabackup that uses the BACKUP STAGE commands in an efficient way,
then one option is to use MariaDB Enterprise Backup that is bundled with MariaDB Enterprise Server .

Using BACKUP STAGE Commands with Storage Snapshots


The BACKUP STAGE commands are a set of commands to make it possible to make an efficient external backup tool.
These commands could even be used by tools that perform backups by taking a snapshot of a file system, SAN, or
some other kind of storage device. See Storage Snapshots and BACKUP STAGE Commands for some examples on
how to use each BACKUP STAGE command in an efficient way.

Privileges
BACKUP STAGE requires the RELOAD privilege.

Notes
Only one connection can run BACKUP STAGE START . If a second connection tries, it will wait until the first one has
executed BACKUP STAGE END .
If the user skips a BACKUP STAGE , then all intermediate backup stages will automatically be run. This will allow us
to add new stages within the BACKUP STAGE hierarchy in the future with even more precise locks without causing
problems for tools using an earlier version of the BACKUP STAGE implementation.
One can use the max_statement_time or lock_wait_timeout system variables to ensure that a BACKUP STAGE
command doesn't block the server too long.
DDL logging will only be available in MariaDB Enterprise Server 10.2 and later.
A disconnect will automatically release backup stages.
There is no easy way to see which is the current stage.

See Also
BACKUP LOCK Locking a table from DDL's.
162/3812
MDEV-5336 . Implement BACKUP STAGE for safe external backups.

1.1.1.2.3.2 BACKUP LOCK


MariaDB starting with 10.4.2
The BACKUP LOCK command was introduced in MariaDB 10.4.2.

Contents
1. Syntax
2. Usage in a Backup Tool
3. Privileges
4. Notes
5. Implementation
6. See Also

BACKUP LOCK blocks a table from DDL statements. This is mainly intended to be used by tools like mariabackup that
need to ensure there are no DDLs on a table while the table files are opened. For example, for an Aria table that stores
data in 3 files with extensions .frm, .MAI and .MAD. Normal read/write operations can continue as normal.

Syntax
To lock a table:

BACKUP LOCK table_name

To unlock a table:

BACKUP UNLOCK

Usage in a Backup Tool


BACKUP LOCK [database.]table_name;
- Open all files related to a table (for example, t.frm, t.MAI and t.MYD)
BACKUP UNLOCK;
- Copy data
- Close files

This ensures that all files are from the same generation, that is created at the same time by the MariaDB server. This
works, because the open files will point to the original table files which will not be affected if there is any ALTER TABLE
while copying the files.

Privileges
BACKUP LOCK requires the RELOAD privilege.

Notes
The idea is that the BACKUP LOCK should be held for as short a time as possible by the backup tool. The time to
take an uncontested lock is very short! One can easily do 50,000 locks/unlocks per second on low end hardware.
One should use different connections for BACKUP STAGE commands and BACKUP LOCK .

Implementation
Internally, BACKUP LOCK is implemented by taking an MDLSHARED_HIGH_PRIO MDL lock on the table object,
which protects the table from any DDL operations.

See Also
BACKUP STAGE
MDEV-17309 - BACKUP LOCK: DDL locking of tables during backup

163/3812
1.1.1.2.3.3 Mariabackup and BACKUP STAGE
Commands
1.1.1.2.3.4 Storage Snapshots and BACKUP
STAGE Commands
MariaDB starting with 10.4.1
The BACKUP STAGE commands were introduced in MariaDB 10.4.1.

Contents
1. Generic Backup Process with Storage
Snapshots

The BACKUP STAGE commands are a set of commands to make it possible to make an efficient external backup tool.
These commands could even be used by tools that perform backups by taking a snapshot of a file system, SAN, or
some other kind of storage device.

Generic Backup Process with Storage Snapshots


A tool that backs up MariaDB by taking a snapshot of a file system, SAN, or some other kind of storage device could
use each BACKUP STAGE command in the following way:
First, execute the following:

BACKUP STAGE START


BACKUP STAGE BLOCK_COMMIT

Then, take the snapshot.


Then, execute the following:

BACKUP STAGE END

The above ensures that all non-transactional tables are properly flushed to disk before the snapshot is done. Using
BACKUP STAGE commands is also more efficient than using the FLUSH TABLES WITH READ LOCK command as the
above set of commands will not block or be blocked by write operations to transactional tables.
Note that when the backup is completed, one should delete all files with the "#sql" prefix, as these are files used by
concurrent running ALTER TABLE . Note that InnoDB will on server restart automatically delete any tables with the "#sql"
prefix.

1.1.1.2.4 FLUSH Commands


Commands to reset (flush) various caches in MariaDB.
FLUSH
Clear or reload various internal caches.

FLUSH QUERY CACHE


Defragmenting the query cache

FLUSH TABLES FOR EXPORT


Flushes changes to disk for specific tables.

There are 2 related questions .

1.1.1.2.4.1 FLUSH
Syntax
164/3812
FLUSH [NO_WRITE_TO_BINLOG | LOCAL]
flush_option [, flush_option] ...

or when flushing tables:

FLUSH [NO_WRITE_TO_BINLOG | LOCAL] TABLES [table_list] [table_flush_option]

Contents
1. Syntax
2. Description
3. FLUSH RELAY LOGS
1. Compatibility with MySQL
4. FLUSH STATUS
1. Global Status Variables that Support
FLUSH STATUS
5. The different usage of FLUSH TABLES
1. The purpose of FLUSH TABLES
2. The purpose of FLUSH TABLES
WITH READ LOCK
3. The purpose of FLUSH TABLES
table_list
4. The purpose of FLUSH TABLES
table_list WITH READ LOCK
6. Implementation of FLUSH TABLES
commands in MariaDB 10.4.8 and above
1. Implementation of FLUSH TABLES
2. Implementation of FLUSH TABLES
WITH READ LOCK
3. Implementation of FLUSH TABLES
table_list
4. Implementation of FLUSH TABLES
table_list FOR EXPORT
7. FLUSH SSL
8. Reducing Memory Usage

where table_list is a list of tables separated by , (comma).

Description
The FLUSH statement clears or reloads various internal caches used by MariaDB. To execute FLUSH , you must have
the RELOAD privilege. See GRANT.
The RESET statement is similar to FLUSH . See RESET.
You cannot issue a FLUSH statement from within a stored function or a trigger. Doing so within a stored procedure is
permitted, as long as it is not called by a stored function or trigger. See Stored Routine Limitations, Stored Function
Limitations and Trigger Limitations.
If a listed table is a view, an error like the following will be produced:

ERROR 1347 (HY000): 'test.v' is not BASE TABLE

By default, FLUSH statements are written to the binary log and will be replicated. The NO_WRITE_TO_BINLOG keyword
( LOCAL is an alias) will ensure the statement is not written to the binary log.
The different flush options are:

Option Description
XtraDB only. Internal command used for backup purposes. See the Information Schema
CHANGED_PAGE_BITMAPS
CHANGED_PAGE_BITMAPS Table .
CLIENT_STATISTICS Reset client statistics (see SHOW CLIENT_STATISTICS).
DES_KEY_FILE Reloads the DES key file (Specified with the --des-key-file startup option).
Flush the hostname cache (used for converting ip to host names and for unblocking blocked
HOSTS
hosts. See max_connect_errors)
INDEX_STATISTICS Reset index statistics (see SHOW INDEX_STATISTICS).

165/3812
Close and reopen the specified log type, or all log types if none are specified. FLUSH RELAY
LOGS [connection-name] can be used to flush the relay logs for a specific connection. Only
one connection can be specified per FLUSH command. See Multi-source replication. FLUSH
[ERROR | ENGINE | ENGINE LOGS will delete all unneeded Aria redo logs. Since MariaDB 10.1.30 and
GENERAL | SLOW | BINARY MariaDB 10.2.11 , FLUSH BINARY LOGS DELETE_DOMAIN_ID=(list-of-domains) can be
| RELAY] LOGS used to discard obsolete GTID domains from the server's binary log state. In order for this to
be successful, no event group from the listed GTID domains can be present in existing
binary log files. If some still exist, then they must be purged prior to executing this command.
If the command completes successfully, then it also rotates the binary log.
MASTER Deprecated option, use RESET MASTER instead.
Reload all privileges from the privilege tables in the mysql database. If the server is started
PRIVILEGES
with --skip-grant-table option, this will activate the privilege tables again.
Defragment the query cache to better utilize its memory. If you want to reset the query
QUERY CACHE
cache, you can do it with RESET QUERY CACHE.
QUERY_RESPONSE_TIME See the QUERY_RESPONSE_TIME plugin.
SLAVE Deprecated option, use RESET REPLICA or RESET SLAVE instead.
Used to dynamically reinitialize the server's TLS context by reloading the files defined by
SSL several TLS system variables. See FLUSH SSL for more information. This command was
first added in MariaDB 10.4.1.
Resets all server status variables that can be reset to 0. Not all global status variables
STATUS
support this, so not all global values are reset. See FLUSH STATUS for more information.
Close tables given as options or all open tables if no table list was used. From MariaDB
10.4.1, using without any table list will only close tables not in use, and tables not locked by
the FLUSH TABLES connection. If there are no locked tables, FLUSH TABLES will be
TABLE instant and will not cause any waits, as it no longer waits for tables in use. When a table list
is provided, from MariaDB 10.4.1, the server will wait for the end of any transactions that
are using the tables. Previously, FLUSH TABLES only waited for the statements to
complete.

TABLES Same as FLUSH TABLE .


TABLES ... FOR For InnoDB tables, flushes table changes to disk to permit binary table copies while the
EXPORT server is running. See FLUSH TABLES ... FOR EXPORT for more.
TABLES WITH READ Closes all open tables. New tables are only allowed to be opened with read locks until an
LOCK UNLOCK TABLES is given.
TABLES WITH READ
As TABLES WITH READ LOCK but also disable all checkpoint writes by transactional table
LOCK AND DISABLE
engines. This is useful when doing a disk snapshot of all tables.
CHECKPOINT

TABLE_STATISTICS Reset table statistics (see SHOW TABLE_STATISTICS).


Resets all per hour user resources. This enables clients that have exhausted their
USER_RESOURCES
resources to connect again.
USER_STATISTICS Reset user statistics (see SHOW USER_STATISTICS).
USER_VARIABLES Reset user variables (see User-defined variables).

You can also use the mysqladmin client to flush things. Use mysqladmin --help to examine what flush commands it
supports.

FLUSH RELAY LOGS


FLUSH RELAY LOGS 'connection_name';

Compatibility with MySQL


MariaDB starting with 10.7.0
The FOR CHANNEL keyword was added for MySQL compatibility. This is identical as using the channel_name directly
after the FLUSH command .
For example, one can now use:
FLUSH RELAY LOGS FOR CHANNEL 'connection_name';

166/3812
FLUSH STATUS
Server status variables can be reset by executing the following:

FLUSH STATUS;

Global Status Variables that Support FLUSH STATUS


Not all global status variables support being reset by FLUSH STATUS . Currently, the following status variables are reset
by FLUSH STATUS :
Aborted_clients
Aborted_connects
Binlog_cache_disk_use
Binlog_cache_use
Binlog_stmt_cache_disk_use
Binlog_stmt_cache_use
Connection_errors_accept
Connection_errors_internal
Connection_errors_max_connections
Connection_errors_peer_address
Connection_errors_select
Connection_errors_tcpwrap
Created_tmp_files
Delayed_errors
Delayed_writes
Feature_check_constraint
Feature_delay_key_write
Max_used_connections
Opened_plugin_libraries
Performance_schema_accounts_lost
Performance_schema_cond_instances_lost
Performance_schema_digest_lost
Performance_schema_file_handles_lost
Performance_schema_file_instances_lost
Performance_schema_hosts_lost
Performance_schema_locker_lost
Performance_schema_mutex_instances_lost
Performance_schema_rwlock_instances_lost
Performance_schema_session_connect_attrs_lost
Performance_schema_socket_instances_lost
Performance_schema_stage_classes_lost
Performance_schema_statement_classes_lost
Performance_schema_table_handles_lost
Performance_schema_table_instances_lost
Performance_schema_thread_instances_lost
Performance_schema_users_lost
Qcache_hits
Qcache_inserts
Qcache_lowmem_prunes
Qcache_not_cached
Rpl_semi_sync_master_no_times
Rpl_semi_sync_master_no_tx
Rpl_semi_sync_master_timefunc_failures
Rpl_semi_sync_master_wait_pos_backtraverse
Rpl_semi_sync_master_yes_tx
Rpl_transactions_multi_engine
Server_audit_writes_failed
Slave_retried_transactions
Slow_launch_threads
Ssl_accept_renegotiates
Ssl_accepts
Ssl_callback_cache_hits
Ssl_client_connects
Ssl_connect_renegotiates
Ssl_ctx_verify_depth
Ssl_ctx_verify_mode
Ssl_finished_accepts
Ssl_finished_connects
167/3812
Ssl_session_cache_hits
Ssl_session_cache_misses
Ssl_session_cache_overflows
Ssl_session_cache_size
Ssl_session_cache_timeouts
Ssl_sessions_reused
Ssl_used_session_cache_entries
Subquery_cache_hit
Subquery_cache_miss
Table_locks_immediate
Table_locks_waited
Tc_log_max_pages_used
Tc_log_page_waits
Transactions_gtid_foreign_engine
Transactions_multi_engine

The different usage of FLUSH TABLES


The purpose of FLUSH TABLES
The purpose of FLUSH TABLES is to clean up the open table cache and table definition cache from not in use tables.
This frees up memory and file descriptors. Normally this is not needed as the caches works on a FIFO bases, but can
be useful if the server seams to use up to much memory for some reason.

The purpose of FLUSH TABLES WITH READ LOCK


FLUSH TABLES WITH READ LOCK is useful if you want to take a backup of some tables. When FLUSH TABLES WITH READ
LOCK returns, all write access to tables are blocked and all tables are marked as 'properly closed' on disk. The tables
can still be used for read operations.

The purpose of FLUSH TABLES table_list


FLUSH TABLES table_list is useful if you want to copy a table object/files to or from the server. This command puts a lock
that stops new users of the table and will wait until everyone has stopped using the table. The table is then removed
from the table definition and table cache.
Note that it's up to the user to ensure that no one is accessing the table between FLUSH TABLES and the table is copied
to or from the server. This can be secured by using LOCK TABLES.
If there are any tables locked by the connection that is using FLUSH TABLES all the locked tables will be closed as part
of the flush and reopened and relocked before FLUSH TABLES returns. This allows one to copy the table after FLUSH
TABLES returns without having any writes on the table. For now this works works with most tables, except InnoDB as
InnoDB may do background purges on the table even while it's write locked.

The purpose of FLUSH TABLES table_list WITH READ LOCK


FLUSH TABLES table_list WITH READ LOCK should work as FLUSH TABLES WITH READ LOCK , but only those tables that
are listed will be properly closed. However in practice this works exactly like FLUSH TABLES WITH READ LOCK as the
FLUSH command has anyway to wait for all WRITE operations to end because we are depending on a global read lock
for this code. In the future we should consider fixing this to instead use meta data locks.

Implementation of FLUSH TABLES commands in


MariaDB 10.4.8 and above
Implementation of FLUSH TABLES
Free memory and file descriptors not in use

Implementation of FLUSH TABLES WITH READ LOCK


Lock all tables read only for simple old style backup.
All background writes are suspended and tables are marked as closed.
No statement requiring table changes are allowed for any user until UNLOCK TABLES .
Instead of using FLUSH TABLE WITH READ LOCK one should in most cases instead use BACKUP STAGE
BLOCK_COMMIT.

168/3812
Implementation of FLUSH TABLES table_list
Free memory and file descriptors for tables not in use from table list.
Lock given tables as read only.
Wait until all translations has ended that uses any of the given tables.
Wait until all background writes are suspended and tables are marked as closed.

Implementation of FLUSH TABLES table_list FOR EXPORT


Free memory and file descriptors for tables not in use from table list
Lock given tables as read.
Wait until all background writes are suspended and tables are marked as closed.
Check that all tables supports FOR EXPORT
No changes to these tables allowed until UNLOCK TABLES
This is basically the same behavior as in old MariaDB version if one first lock the tables, then do FLUSH TABLES . The
tables will be copyable until UNLOCK TABLES .

FLUSH SSL
MariaDB starting with 10.4
The FLUSH SSL command was first added in MariaDB 10.4.

In MariaDB 10.4 and later, the FLUSH SSL command can be used to dynamically reinitialize the server's TLS context.
This is most useful if you need to replace a certificate that is about to expire without restarting the server.
This operation is performed by reloading the files defined by the following TLS system variables:
ssl_cert
ssl_key
ssl_ca
ssl_capath
ssl_crl
ssl_crlpath
These TLS system variables are not dynamic, so their values can not be changed without restarting the server.
If you want to dynamically reinitialize the server's TLS context, then you need to change the certificate and key files at
the relevant paths defined by these TLS system variables, without actually changing the values of the variables. See
MDEV-19341 for more information.

Reducing Memory Usage


To flush some of the global caches that take up memory, you could execute the following command:

FLUSH LOCAL HOSTS,


QUERY CACHE,
TABLE_STATISTICS,
INDEX_STATISTICS,
USER_STATISTICS;

1.1.1.2.4.2 FLUSH QUERY CACHE


Description
You can defragment the query cache to better utilize its memory with the FLUSH QUERY CACHE statement. The statement
does not remove any queries from the cache.
The RESET QUERY CACHE statement removes all query results from the query cache. The FLUSH TABLES
statement also does this.

1.1.1.2.4.3 FLUSH TABLES FOR EXPORT


Syntax

169/3812
FLUSH TABLES table_name [, table_name] FOR EXPORT

Contents
1. Syntax
2. Description
3. Example
4. See Also

Description
FLUSH TABLES ... FOR EXPORT flushes changes to the specified tables to disk so that binary copies can be made while
the server is still running. This works for Archive, Aria, CSV, InnoDB, MyISAM, MERGE, and XtraDB tables.
The table is read locked until one has issued UNLOCK TABLES.
If a storage engine does not support FLUSH TABLES FOR EXPORT , a 1031 error (SQLSTATE 'HY000') is produced.
If FLUSH TABLES ... FOR EXPORT is in effect in the session, the following statements will produce an error if attempted:
FLUSH TABLES WITH READ LOCK
FLUSH TABLES ... WITH READ LOCK
FLUSH TABLES ... FOR EXPORT
Any statement trying to update any table
If any of the following statements is in effect in the session, attempting FLUSH TABLES ... FOR EXPORT will produce an
error.
FLUSH TABLES ... WITH READ LOCK
FLUSH TABLES ... FOR EXPORT
LOCK TABLES ... READ
LOCK TABLES ... WRITE
FLUSH FOR EXPORT is not written to the binary log.

This statement requires the RELOAD and the LOCK TABLES privileges.
If one of the specified tables cannot be locked, none of the tables will be locked.
If a table does not exist, an error like the following will be produced:

ERROR 1146 (42S02): Table 'test.xxx' doesn't exist

If a table is a view, an error like the following will be produced:

ERROR 1347 (HY000): 'test.v' is not BASE TABLE

Example
FLUSH TABLES test.t1 FOR EXPORT;
# Copy files related to the table (see below)
UNLOCK TABLES;

For a full description, please see copying MariaDB tables.

See Also
Copying Tables Between Different MariaDB Databases and MariaDB Servers
Copying Transportable InnoDB Tablespaces
myisampack - Compressing the MyISAM data file for easier distribution.
aria_pack - Compressing the Aria data file for easier distribution

1.1.1.2.5 Replication Commands


The terms master and slave have historically been used in replication, but the terms terms primary and replica are
now preferred. The old terms are used still used in parts of the documentation, and in MariaDB commands,
although MariaDB 10.5 has begun the process of renaming. The documentation process is ongoing. See MDEV-
18777 to follow progress on this effort.

A list of replication-related commands. See replication for more replication-related information.

170/3812
CHANGE MASTER TO
1 Set or change replica parameters for connecting to the primary.

START SLAVE
Start replica threads.

STOP SLAVE
Stop replica threads.

RESET REPLICA/SLAVE
1 Forget replica connection information and start a new relay log file.

SET GLOBAL SQL_SLAVE_SKIP_COUNTER


Skips a number of events from the primary.

SHOW RELAYLOG EVENTS


Show events in the relay log.

SHOW SLAVE STATUS


Show status for one or all primaries.

SHOW MASTER STATUS


Status information about the binary log.

SHOW SLAVE HOSTS


Display replicas currently registered with the primary.

RESET MASTER
Delete binary log files.

171/3812
1.1.1.2.5.1 CHANGE MASTER TO
The terms master and slave have historically been used in replication, but the terms terms primary and replica are
now preferred. The old terms are used still used in parts of the documentation, and in MariaDB commands,
although MariaDB 10.5 has begun the process of renaming. The documentation process is ongoing. See MDEV-
18777 to follow progress on this effort.

Syntax
CHANGE MASTER ['connection_name'] TO master_def [, master_def] ...
[FOR CHANNEL 'channel_name']

master_def:
MASTER_BIND = 'interface_name'
| MASTER_HOST = 'host_name'
| MASTER_USER = 'user_name'
| MASTER_PASSWORD = 'password'
| MASTER_PORT = port_num
| MASTER_CONNECT_RETRY = interval
| MASTER_HEARTBEAT_PERIOD = interval
| MASTER_LOG_FILE = 'master_log_name'
| MASTER_LOG_POS = master_log_pos
| RELAY_LOG_FILE = 'relay_log_name'
| RELAY_LOG_POS = relay_log_pos
| MASTER_DELAY = interval
| MASTER_SSL = {0|1}
| MASTER_SSL_CA = 'ca_file_name'
| MASTER_SSL_CAPATH = 'ca_directory_name'
| MASTER_SSL_CERT = 'cert_file_name'
| MASTER_SSL_CRL = 'crl_file_name'
| MASTER_SSL_CRLPATH = 'crl_directory_name'
| MASTER_SSL_KEY = 'key_file_name'
| MASTER_SSL_CIPHER = 'cipher_list'
| MASTER_SSL_VERIFY_SERVER_CERT = {0|1}
| MASTER_USE_GTID = {current_pos|slave_pos|no}
| MASTER_DEMOTE_TO_SLAVE = bool
| IGNORE_SERVER_IDS = (server_id_list)
| DO_DOMAIN_IDS = ([N,..])
| IGNORE_DOMAIN_IDS = ([N,..])

172/3812
Contents
1. Syntax
2. Description
3. Multi-Source Replication
1. default_master_connection
2. connection_name
4. Options
1. Connection Options
1. MASTER_USER
2. MASTER_PASSWORD
3. MASTER_HOST
4. MASTER_PORT
5. MASTER_CONNECT_RETRY
6. MASTER_BIND
7. MASTER_HEARTBEAT_PERIOD
2. TLS Options
1. MASTER_SSL
2. MASTER_SSL_CA
3. MASTER_SSL_CAPATH
4. MASTER_SSL_CERT
5. MASTER_SSL_CRL
6. MASTER_SSL_CRLPATH
7. MASTER_SSL_KEY
8. MASTER_SSL_CIPHER
9. MASTER_SSL_VERIFY_SERVER_CERT
3. Binary Log Options
1. MASTER_LOG_FILE
2. MASTER_LOG_POS
4. Relay Log Options
1. RELAY_LOG_FILE
2. RELAY_LOG_POS
5. GTID Options
1. MASTER_USE_GTID
2. MASTER_DEMOTE_TO_SLAVE
6. Replication Filter Options
1. IGNORE_SERVER_IDS
2. DO_DOMAIN_IDS
3. IGNORE_DOMAIN_IDS
7. Delayed Replication Options
1. MASTER_DELAY
5. Changing Option Values
6. Option Persistence
7. GTID Persistence
8. Creating a Replica from a Backup
9. Example
10. See Also

Description
The CHANGE MASTER statement sets the options that a replica uses to connect to and replicate from a primary.

MariaDB starting with 10.7.0


The FOR CHANNEL keyword was added for MySQL compatibility. This is identical to using the channel_name directly
after CHANGE MASTER .

Multi-Source Replication
If you are using multi-source replication, then you need to specify a connection name when you execute CHANGE
MASTER . There are two ways to do this:

Setting the default_master_connection system variable prior to executing CHANGE MASTER .


Setting the connection_name parameter when executing CHANGE MASTER .

default_master_connection

173/3812
SET default_master_connection = 'gandalf';
STOP SLAVE;
CHANGE MASTER TO
MASTER_PASSWORD='new3cret';
START SLAVE;

connection_name
STOP SLAVE 'gandalf';
CHANGE MASTER 'gandalf' TO
MASTER_PASSWORD='new3cret';
START SLAVE 'gandalf';

Options
Connection Options
MASTER_USER
The MASTER_USER option for CHANGE MASTER defines the user account that the replica will use to connect to the
primary.
This user account will need the REPLICATION SLAVE privilege (or, from MariaDB 10.5.1, the REPLICATION REPLICA
on the primary.
For example:

STOP SLAVE;
CHANGE MASTER TO
MASTER_USER='repl',
MASTER_PASSWORD='new3cret';
START SLAVE;

The maximum length of the MASTER_USER string is 96 characters until MariaDB 10.5, and 128 characters from MariaDB
10.6.

MASTER_PASSWORD
The MASTER_USER option for CHANGE MASTER defines the password that the replica will use to connect to the primary as
the user account defined by the MASTER_USER option.
For example:

STOP SLAVE;
CHANGE MASTER TO
MASTER_PASSWORD='new3cret';
START SLAVE;

The maximum length of the MASTER_PASSWORD string is 32 characters.

MASTER_HOST
The MASTER_HOST option for CHANGE MASTER defines the hostname or IP address of the primary.
If you set the value of the MASTER_HOST option to the empty string, then that is not the same as not setting the option's
value at all. If you set the value of the MASTER_HOST option to the empty string, then the CHANGE MASTER command will
fail with an error. In MariaDB 5.3 and before, if you set the value of the MASTER_HOST option to the empty string, then
the CHANGE MASTER command would succeed, but the subsequent START SLAVE command would fail.
For example:

STOP SLAVE;
CHANGE MASTER TO
MASTER_HOST='dbserver1.example.com',
MASTER_USER='repl',
MASTER_PASSWORD='new3cret',
MASTER_USE_GTID=slave_pos;
START SLAVE;

If you set the value of the MASTER_HOST option in a CHANGE MASTER command, then the replica assumes that the

174/3812
primary is different from before, even if you set the value of this option to the same value it had previously. In this
scenario, the replica will consider the old values for the primary's binary log file name and position to be invalid for
the new primary. As a side effect, if you do not explicitly set the values of the MASTER_LOG_FILE and
MASTER_LOG_POS options in the statement, then the statement will be implicitly appended with
MASTER_LOG_FILE='' and MASTER_LOG_POS=4 . However, if you enable GTID mode for replication by setting the
MASTER_USE_GTID option to some value other than no in the statement, then these values will effectively be
ignored anyway.

Replicas cannot connect to primaries using Unix socket files or Windows named pipes. The replica must connect to
the primary using TCP/IP.

The maximum length of the MASTER_HOST string is 60 characters until MariaDB 10.5, and 255 characters from MariaDB
10.6.

MASTER_PORT
The MASTER_PORT option for CHANGE MASTER defines the TCP/IP port of the primary.
For example:

STOP SLAVE;
CHANGE MASTER TO
MASTER_HOST='dbserver1.example.com',
MASTER_PORT=3307,
MASTER_USER='repl',
MASTER_PASSWORD='new3cret',
MASTER_USE_GTID=slave_pos;
START SLAVE;

If you set the value of the MASTER_PORT option in a CHANGE MASTER command, then the replica assumes that the
primary is different from before, even if you set the value of this option to the same value it had previously. In this
scenario, the replica will consider the old values for the primary's binary log file name and position to be invalid for
the new primary. As a side effect, if you do not explicitly set the values of the MASTER_LOG_FILE and
MASTER_LOG_POS options in the statement, then the statement will be implicitly appended with
MASTER_LOG_FILE='' and MASTER_LOG_POS=4 . However, if you enable GTID mode for replication by setting the
MASTER_USE_GTID option to some value other than no in the statement, then these values will effectively be
ignored anyway.

Replicas cannot connect to primaries using Unix socket files or Windows named pipes. The replica must connect to
the primary using TCP/IP.

MASTER_CONNECT_RETRY
The MASTER_CONNECT_RETRY option for CHANGE MASTER defines how many seconds that the replica will wait between
connection retries. The default is 60 .

STOP SLAVE;
CHANGE MASTER TO
MASTER_CONNECT_RETRY=20;
START SLAVE;

The number of connection attempts is limited by the master_retry_count option. It can be set either on the command-line
or in a server option group in an option file prior to starting up the server. For example:

[mariadb]
...
master_retry_count=4294967295

MASTER_BIND

The MASTER_BIND option for CHANGE MASTER is only supported by MySQL 5.6.2 and later and by MySQL NDB
Cluster 7.3.1 and later. This option is not supported by MariaDB. See MDEV-19248 for more information.

MASTER_HEARTBEAT_PERIOD

175/3812
The MASTER_HEARTBEAT_PERIOD option for CHANGE MASTER can be used to set the interval in seconds between
replication heartbeats. Whenever the primary's binary log is updated with an event, the waiting period for the next
heartbeat is reset.
This option's interval argument has the following characteristics:
It is a decimal value with a range of 0 to 4294967 seconds.
It has a resolution of hundredths of a second.
Its smallest valid non-zero value is 0.001 .
Its default value is the value of the slave_net_timeout system variable divided by 2.
If it's set to 0 , then heartbeats are disabled.
Heartbeats are sent by the primary only if there are no unsent events in the binary log file for a period longer than the
interval.
If the RESET SLAVE statement is executed, then the heartbeat interval is reset to the default.

If the slave_net_timeout system variable is set to a value that is lower than the current heartbeat interval, then a
warning will be issued.

TLS Options
The TLS options are used for providing information about TLS. The options can be set even on replicas that are
compiled without TLS support. The TLS options are saved to either the default master.info file or the file that is
configured by the master_info_file option, but these TLS options are ignored unless the replica supports TLS.
See Replication with Secure Connections for more information.

MASTER_SSL
The MASTER_SSL option for CHANGE MASTER tells the replica whether to force TLS for the connection. The valid values
are 0 or 1 .
For example:

STOP SLAVE;
CHANGE MASTER TO
MASTER_SSL=1;
START SLAVE;

MASTER_SSL_CA
The MASTER_SSL_CA option for CHANGE MASTER defines a path to a PEM file that should contain one or more X509
certificates for trusted Certificate Authorities (CAs) to use for TLS. This option requires that you use the absolute path,
not a relative path. This option implies the MASTER_SSL option.
For example:

STOP SLAVE;
CHANGE MASTER TO
MASTER_SSL_CERT='/etc/my.cnf.d/certificates/server-cert.pem',
MASTER_SSL_KEY='/etc/my.cnf.d/certificates/server-key.pem',
MASTER_SSL_CA='/etc/my.cnf.d/certificates/ca.pem',
MASTER_SSL_VERIFY_SERVER_CERT=1;
START SLAVE;

See Secure Connections Overview: Certificate Authorities (CAs) for more information.
The maximum length of MASTER_SSL_CA string is 511 characters.

MASTER_SSL_CAPATH
The MASTER_SSL_CAPATH option for CHANGE MASTER defines a path to a directory that contains one or more PEM files
that should each contain one X509 certificate for a trusted Certificate Authority (CA) to use for TLS. This option requires
that you use the absolute path, not a relative path. The directory specified by this option needs to be run through the
openssl rehash command. This option implies the MASTER_SSL option.
For example:

176/3812
STOP SLAVE;
CHANGE MASTER TO
MASTER_SSL_CERT='/etc/my.cnf.d/certificates/server-cert.pem',
MASTER_SSL_KEY='/etc/my.cnf.d/certificates/server-key.pem',
MASTER_SSL_CAPATH='/etc/my.cnf.d/certificates/ca/',
MASTER_SSL_VERIFY_SERVER_CERT=1;
START SLAVE;

See Secure Connections Overview: Certificate Authorities (CAs) for more information.
The maximum length of MASTER_SSL_CA_PATH string is 511 characters.

MASTER_SSL_CERT
The MASTER_SSL_CERT option for CHANGE MASTER defines a path to the X509 certificate file to use for TLS. This option
requires that you use the absolute path, not a relative path. This option implies the MASTER_SSL option.
For example:

STOP SLAVE;
CHANGE MASTER TO
MASTER_SSL_CERT='/etc/my.cnf.d/certificates/server-cert.pem',
MASTER_SSL_KEY='/etc/my.cnf.d/certificates/server-key.pem',
MASTER_SSL_CA='/etc/my.cnf.d/certificates/ca.pem',
MASTER_SSL_VERIFY_SERVER_CERT=1;
START SLAVE;

The maximum length of MASTER_SSL_CERT string is 511 characters.

MASTER_SSL_CRL
The MASTER_SSL_CRL option for CHANGE MASTER defines a path to a PEM file that should contain one or more revoked
X509 certificates to use for TLS. This option requires that you use the absolute path, not a relative path.
This option is only supported if the server was built with OpenSSL. If the server was built with yaSSL, then this option is
not supported. See TLS and Cryptography Libraries Used by MariaDB for more information about which libraries are
used on which platforms.
For example:

STOP SLAVE;
CHANGE MASTER TO
MASTER_SSL_CERT='/etc/my.cnf.d/certificates/server-cert.pem',
MASTER_SSL_KEY='/etc/my.cnf.d/certificates/server-key.pem',
MASTER_SSL_CA='/etc/my.cnf.d/certificates/ca.pem',
MASTER_SSL_VERIFY_SERVER_CERT=1,
MASTER_SSL_CRL='/etc/my.cnf.d/certificates/crl.pem';
START SLAVE;

See Secure Connections Overview: Certificate Revocation Lists (CRLs) for more information.
The maximum length of MASTER_SSL_CRL string is 511 characters.

MASTER_SSL_CRLPATH
The MASTER_SSL_CRLPATH option for CHANGE MASTER defines a path to a directory that contains one or more PEM files
that should each contain one revoked X509 certificate to use for TLS. This option requires that you use the absolute
path, not a relative path. The directory specified by this variable needs to be run through the openssl rehash
command.
This option is only supported if the server was built with OpenSSL. If the server was built with yaSSL, then this option is
not supported. See TLS and Cryptography Libraries Used by MariaDB for more information about which libraries are
used on which platforms.
For example:

STOP SLAVE;
CHANGE MASTER TO
MASTER_SSL_CERT='/etc/my.cnf.d/certificates/server-cert.pem',
MASTER_SSL_KEY='/etc/my.cnf.d/certificates/server-key.pem',
MASTER_SSL_CA='/etc/my.cnf.d/certificates/ca.pem',
MASTER_SSL_VERIFY_SERVER_CERT=1,
MASTER_SSL_CRLPATH='/etc/my.cnf.d/certificates/crl/';
START SLAVE;

See Secure Connections Overview: Certificate Revocation Lists (CRLs) for more information.
177/3812
The maximum length of MASTER_SSL_CRL_PATH string is 511 characters.

MASTER_SSL_KEY
The MASTER_SSL_KEY option for CHANGE MASTER defines a path to a private key file to use for TLS. This option requires
that you use the absolute path, not a relative path. This option implies the MASTER_SSL option.
For example:

STOP SLAVE;
CHANGE MASTER TO
MASTER_SSL_CERT='/etc/my.cnf.d/certificates/server-cert.pem',
MASTER_SSL_KEY='/etc/my.cnf.d/certificates/server-key.pem',
MASTER_SSL_CA='/etc/my.cnf.d/certificates/ca.pem',
MASTER_SSL_VERIFY_SERVER_CERT=1;
START SLAVE;

The maximum length of MASTER_SSL_KEY string is 511 characters.

MASTER_SSL_CIPHER
The MASTER_SSL_CIPHER option for CHANGE MASTER defines the list of permitted ciphers or cipher suites to use for TLS.
Besides cipher names, if MariaDB was compiled with OpenSSL, this option could be set to "SSLv3" or "TLSv1.2" to
allow all SSLv3 or all TLSv1.2 ciphers. Note that the TLSv1.3 ciphers cannot be excluded when using OpenSSL, even
by using this option. See Using TLSv1.3 for details. This option implies the MASTER_SSL option.
For example:

STOP SLAVE;
CHANGE MASTER TO
MASTER_SSL_CERT='/etc/my.cnf.d/certificates/server-cert.pem',
MASTER_SSL_KEY='/etc/my.cnf.d/certificates/server-key.pem',
MASTER_SSL_CA='/etc/my.cnf.d/certificates/ca.pem',
MASTER_SSL_VERIFY_SERVER_CERT=1,
MASTER_SSL_CIPHER='TLSv1.2';
START SLAVE;

The maximum length of MASTER_SSL_CIPHER string is 511 characters.

MASTER_SSL_VERIFY_SERVER_CERT
The MASTER_SSL_VERIFY_SERVER_CERT option for CHANGE MASTER enables server certificate verification. This option is
disabled by default.
For example:

STOP SLAVE;
CHANGE MASTER TO
MASTER_SSL_CERT='/etc/my.cnf.d/certificates/server-cert.pem',
MASTER_SSL_KEY='/etc/my.cnf.d/certificates/server-key.pem',
MASTER_SSL_CA='/etc/my.cnf.d/certificates/ca.pem',
MASTER_SSL_VERIFY_SERVER_CERT=1;
START SLAVE;

See Secure Connections Overview: Server Certificate Verification for more information.

Binary Log Options


These options are related to the binary log position on the primary.

MASTER_LOG_FILE
The MASTER_LOG_FILE option for CHANGE MASTER can be used along with MASTER_LOG_POS to specify the coordinates
at which the replica's I/O thread should begin reading from the primary's binary logs the next time the thread starts.
For example:

STOP SLAVE;
CHANGE MASTER TO
MASTER_LOG_FILE='master2-bin.001',
MASTER_LOG_POS=4;
START SLAVE;

178/3812
The MASTER_LOG_FILE and MASTER_LOG_POS options cannot be specified if the RELAY_LOG_FILE and
RELAY_LOG_POS options were also specified.

The MASTER_LOG_FILE and MASTER_LOG_POS options are effectively ignored if you enable GTID mode for
replication by setting the MASTER_USE_GTID option to some value other than no in the statement.

MASTER_LOG_POS
The MASTER_LOG_POS option for CHANGE MASTER can be used along with MASTER_LOG_FILE to specify the coordinates
at which the replica's I/O thread should begin reading from the primary's binary logs the next time the thread starts.
For example:

STOP SLAVE;
CHANGE MASTER TO
MASTER_LOG_FILE='master2-bin.001',
MASTER_LOG_POS=4;
START SLAVE;

The MASTER_LOG_FILE and MASTER_LOG_POS options cannot be specified if the RELAY_LOG_FILE and
RELAY_LOG_POS options were also specified.

The MASTER_LOG_FILE and MASTER_LOG_POS options are effectively ignored if you enable GTID mode for
replication by setting the MASTER_USE_GTID option to some value other than no in the statement.

Relay Log Options


These options are related to the relay log position on the replica.

RELAY_LOG_FILE
The RELAY_LOG_FILE option for CHANGE MASTER can be used along with the RELAY_LOG_POS option to specify the
coordinates at which the replica's SQL thread should begin reading from the relay log the next time the thread starts.
The CHANGE MASTER statement usually deletes all relay log files. However, if the RELAY_LOG_FILE and/or
RELAY_LOG_POS options are specified, then existing relay log files are kept.

When you want to change the relay log position, you only need to stop the replica's SQL thread. The replica's I/O thread
can continue running. The STOP SLAVE and START SLAVE statements support the SQL_THREAD option for this
scenario. For example:

STOP SLAVE SQL_THREAD;


CHANGE MASTER TO
RELAY_LOG_FILE='slave-relay-bin.006',
RELAY_LOG_POS=4025;
START SLAVE SQL_THREAD;

When the value of this option is changed, the metadata about the replica's SQL thread's position in the relay logs will
also be changed in the relay-log.info file or the file that is configured by the relay_log_info_file system variable.

The RELAY_LOG_FILE and RELAY_LOG_POS options cannot be specified if the MASTER_LOG_FILE and
MASTER_LOG_POS options were also specified.

RELAY_LOG_POS
The RELAY_LOG_POS option for CHANGE MASTER can be used along with the RELAY_LOG_FILE option to specify the
coordinates at which the replica's SQL thread should begin reading from the relay log the next time the thread starts.
The CHANGE MASTER statement usually deletes all relay log files. However, if the RELAY_LOG_FILE and/or
RELAY_LOG_POS options are specified, then existing relay log files are kept.

When you want to change the relay log position, you only need to stop the replica's SQL thread. The replica's I/O thread
can continue running. The STOP SLAVE and START SLAVE statements support the SQL_THREAD option for this
scenario. For example:

179/3812
STOP SLAVE SQL_THREAD;
CHANGE MASTER TO
RELAY_LOG_FILE='slave-relay-bin.006',
RELAY_LOG_POS=4025;
START SLAVE SQL_THREAD;

When the value of this option is changed, the metadata about the replica's SQL thread's position in the relay logs will
also be changed in the relay-log.info file or the file that is configured by the relay_log_info_file system variable.

The RELAY_LOG_FILE and RELAY_LOG_POS options cannot be specified if the MASTER_LOG_FILE and
MASTER_LOG_POS options were also specified.

GTID Options
MASTER_USE_GTID
The MASTER_USE_GTID option for CHANGE MASTER can be used to configure the replica to use the global transaction ID
(GTID) when connecting to a primary. The possible values are:
current_pos - Replicate in GTID mode and use gtid_current_pos as the position to start downloading
transactions from the primary. Deprecated from MariaDB 10.10. Using to transition to primary can break the
replication state if the replica executes local transactions due to actively updating gtid_current_pos with
gtid_binlog_pos and gtid_slave_pos. Use the new, safe, MASTER_DEMOTE_TO_SLAVE=<bool> option
instead.
slave_pos - Replicate in GTID mode and use gtid_slave_pos as the position to start downloading transactions
from the primary. From MariaDB 10.5.1, replica_pos is an alias for slave_pos .
no - Don't replicate in GTID mode.

MASTER_DEMOTE_TO_SLAVE

MariaDB starting with 10.10


Used to transition a primary to become a replica. Replaces the old MASTER_USE_GTID=current_pos with a safe
alternative by forcing users to set Using_Gtid=Slave_Pos and merging gtid_binlog_pos into gtid_slave_pos once
at CHANGE MASTER TO time. If gtid_slave_pos is more recent than gtid_binlog_pos (as in the case of chain
replication), the replication state should be preserved.

For example:

STOP SLAVE;
CHANGE MASTER TO
MASTER_USE_GTID = current_pos;
START SLAVE;

Or:

STOP SLAVE;
SET GLOBAL gtid_slave_pos='0-1-153';
CHANGE MASTER TO
MASTER_USE_GTID = slave_pos;
START SLAVE;

Replication Filter Options


Also see Replication filters.

IGNORE_SERVER_IDS
The IGNORE_SERVER_IDS option for CHANGE MASTER can be used to configure a replica to ignore binary log events that
originated from certain servers. Filtered binary log events will not get logged to the replica’s relay log, and they will not
be applied by the replica.
The option's value can be specified by providing a comma-separated list of server_id values. For example:

STOP SLAVE;
CHANGE MASTER TO
IGNORE_SERVER_IDS = (3,5);
START SLAVE;

If you would like to clear a previously set list, then you can set the value to an empty list. For example:
180/3812
STOP SLAVE;
CHANGE MASTER TO
IGNORE_SERVER_IDS = ();
START SLAVE;

DO_DOMAIN_IDS
The DO_DOMAIN_IDS option for CHANGE MASTER can be used to configure a replica to only apply binary log events if the
transaction's GTID is in a specific gtid_domain_id value. Filtered binary log events will not get logged to the replica’s
relay log, and they will not be applied by the replica.
The option's value can be specified by providing a comma-separated list of gtid_domain_id values. Duplicate values are
automatically ignored. For example:

STOP SLAVE;
CHANGE MASTER TO
DO_DOMAIN_IDS = (1,2);
START SLAVE;

If you would like to clear a previously set list, then you can set the value to an empty list. For example:

STOP SLAVE;
CHANGE MASTER TO
DO_DOMAIN_IDS = ();
START SLAVE;

The DO_DOMAIN_IDS option and the IGNORE_DOMAIN_IDS option cannot both be set to non-empty values at
the same time. If you want to set the DO_DOMAIN_IDS option, and the IGNORE_DOMAIN_IDS option was
previously set, then you need to clear the value of the IGNORE_DOMAIN_IDS option. For example:
STOP SLAVE;
CHANGE MASTER TO
IGNORE_DOMAIN_IDS = (),
DO_DOMAIN_IDS = (1,2);
START SLAVE;

The DO_DOMAIN_IDS option can only be specified if the replica is replicating in GTID mode. Therefore, the
MASTER_USE_GTID option must also be set to some value other than no in order to use this option.

IGNORE_DOMAIN_IDS
The IGNORE_DOMAIN_IDS option for CHANGE MASTER can be used to configure a replica to ignore binary log events if the
transaction's GTID is in a specific gtid_domain_id value. Filtered binary log events will not get logged to the replica’s
relay log, and they will not be applied by the replica.
The option's value can be specified by providing a comma-separated list of gtid_domain_id values. Duplicate values are
automatically ignored. For example:

STOP SLAVE;
CHANGE MASTER TO
IGNORE_DOMAIN_IDS = (1,2);
START SLAVE;

If you would like to clear a previously set list, then you can set the value to an empty list. For example:

STOP SLAVE;
CHANGE MASTER TO
IGNORE_DOMAIN_IDS = ();
START SLAVE;

The DO_DOMAIN_IDS option and the IGNORE_DOMAIN_IDS option cannot both be set to non-empty values at
the same time. If you want to set the IGNORE_DOMAIN_IDS option, and the DO_DOMAIN_IDS option was
previously set, then you need to clear the value of the DO_DOMAIN_IDS option. For example:

181/3812
STOP SLAVE;
CHANGE MASTER TO
DO_DOMAIN_IDS = (),
IGNORE_DOMAIN_IDS = (1,2);
START SLAVE;

The IGNORE_DOMAIN_IDS option can only be specified if the replica is replicating in GTID mode. Therefore, the
MASTER_USE_GTID option must also be set to some value other than no in order to use this option.

Delayed Replication Options


MASTER_DELAY
The MASTER_DELAY option for CHANGE MASTER can be used to enable delayed replication. This option specifies the time
in seconds (at least) that a replica should lag behind the primary up to a maximum value of 2147483647, or about 68
years. Before executing an event, the replica will first wait, if necessary, until the given time has passed since the event
was created on the primary. The result is that the replica will reflect the state of the primary some time back in the past.
The default is zero, no delay.

STOP SLAVE;
CHANGE MASTER TO
MASTER_DELAY=3600;
START SLAVE;

Changing Option Values


If you don't specify a given option when executing the CHANGE MASTER statement, then the option keeps its old value in
most cases. Most of the time, there is no need to specify the options that do not need to change. For example, if the
password for the user account that the replica uses to connect to its primary has changed, but no other options need to
change, then you can just change the MASTER_PASSWORD option by executing the following commands:

STOP SLAVE;
CHANGE MASTER TO
MASTER_PASSWORD='new3cret';
START SLAVE;

There are some cases where options are implicitly reset, such as when the MASTER_HOST and MASTER_PORT
options are changed.

Option Persistence
The values of the MASTER_LOG_FILE and MASTER_LOG_POS options (i.e. the binary log position on the primary)
and most other options are written to either the default master.info file or the file that is configured by the
master_info_file option. The replica's I/O thread keeps this binary log position updated as it downloads events only
when MASTER_USE_GTID option is set to NO . Otherwise the file is not updated on a per event basis.
The master_info_file option can be set either on the command-line or in a server option group in an option file prior to
starting up the server. For example:

[mariadb]
...
master_info_file=/mariadb/myserver1-master.info

The values of the RELAY_LOG_FILE and RELAY_LOG_POS options (i.e. the relay log position) are written to either
the default relay-log.info file or the file that is configured by the relay_log_info_file system variable. The replica's
SQL thread keeps this relay log position updated as it applies events.
The relay_log_info_file system variable can be set either on the command-line or in a server option group in an option
file prior to starting up the server. For example:

[mariadb]
...
relay_log_info_file=/mariadb/myserver1-relay-log.info

GTID Persistence
182/3812
If the replica is replicating binary log events that contain GTIDs, then the replica's SQL thread will write every GTID that
it applies to the mysql.gtid_slave_pos table. This GTID can be inspected and modified through the gtid_slave_pos
system variable.
If the replica has the log_slave_updates system variable enabled and if the replica has the binary log enabled, then
every write by the replica's SQL thread will also go into the replica's binary log. This means that GTIDs of replicated
transactions would be reflected in the value of the gtid_binlog_pos system variable.

Creating a Replica from a Backup


The CHANGE MASTER statement is useful for setting up a replica when you have a backup of the primary and you also
have the binary log position or GTID position corresponding to the backup.
After restoring the backup on the replica, you could execute something like this to use the binary log position:

CHANGE MASTER TO
MASTER_LOG_FILE='master2-bin.001',
MASTER_LOG_POS=4;
START SLAVE;

Or you could execute something like this to use the GTID position:

SET GLOBAL gtid_slave_pos='0-1-153';


CHANGE MASTER TO
MASTER_USE_GTID=slave_pos;
START SLAVE;

See Setting up a Replication Slave with Mariabackup for more information on how to do this with Mariabackup.

Example
The following example changes the primary and primary's binary log coordinates. This is used when you want to set up
the replica to replicate the primary:

CHANGE MASTER TO
MASTER_HOST='master2.mycompany.com',
MASTER_USER='replication',
MASTER_PASSWORD='bigs3cret',
MASTER_PORT=3306,
MASTER_LOG_FILE='master2-bin.001',
MASTER_LOG_POS=4,
MASTER_CONNECT_RETRY=10;
START SLAVE;

See Also
Setting up replication
START SLAVE
Multi-source replication
RESET SLAVE. Removes a connection created with CHANGE MASTER TO .
Global Transaction ID

183/3812
1.1.1.2.5.2 START SLAVE
The terms master and slave have historically been used in replication, but the terms terms primary and replica are
now preferred. The old terms are used still used in parts of the documentation, and in MariaDB commands,
although MariaDB 10.5 has begun the process of renaming. The documentation process is ongoing. See MDEV-
18777 to follow progress on this effort.

Syntax
START SLAVE ["connection_name"] [thread_type [, thread_type] ... ] [FOR CHANNEL "connection_name"]
START SLAVE ["connection_name"] [SQL_THREAD] UNTIL
MASTER_LOG_FILE = 'log_name', MASTER_LOG_POS = log_pos [FOR CHANNEL "connection_name"]
START SLAVE ["connection_name"] [SQL_THREAD] UNTIL
RELAY_LOG_FILE = 'log_name', RELAY_LOG_POS = log_pos [FOR CHANNEL "connection_name"]
START SLAVE ["connection_name"] [SQL_THREAD] UNTIL
MASTER_GTID_POS = <GTID position> [FOR CHANNEL "connection_name"]
START ALL SLAVES [thread_type [, thread_type]]

START REPLICA ["connection_name"] [thread_type [, thread_type] ... ] -- from 10.5.1


START REPLICA ["connection_name"] [SQL_THREAD] UNTIL
MASTER_LOG_FILE = 'log_name', MASTER_LOG_POS = log_pos -- from 10.5.1
START REPLICA ["connection_name"] [SQL_THREAD] UNTIL
RELAY_LOG_FILE = 'log_name', RELAY_LOG_POS = log_pos -- from 10.5.1
START REPLICA ["connection_name"] [SQL_THREAD] UNTIL
MASTER_GTID_POS = <GTID position> -- from 10.5.1
START ALL REPLICAS [thread_type [, thread_type]] -- from 10.5.1

thread_type: IO_THREAD | SQL_THREAD

Contents
1. Syntax
2. Description
1. START SLAVE UNTIL
2. connection_name
3. START ALL SLAVES
4. START REPLICA
3. See Also

Description
START SLAVE ( START REPLICA from MariaDB 10.5.1) with no thread_type options starts both of the replica threads (see
replication). The I/O thread reads events from the primary server and stores them in the relay log. The SQL thread
reads events from the relay log and executes them. START SLAVE requires the SUPER privilege, or, from MariaDB
10.5.2, the REPLICATION SLAVE ADMIN privilege.
If START SLAVE succeeds in starting the replica threads, it returns without any error. However, even in that case, it
might be that the replica threads start and then later stop (for example, because they do not manage to connect to the
primary or read its binary log, or some other problem). START SLAVE does not warn you about this. You must check the
replica's error log for error messages generated by the replica threads, or check that they are running satisfactorily with
SHOW SLAVE STATUS (SHOW REPLICA STATUS from MariaDB 10.5.1).

START SLAVE UNTIL


START SLAVE UNTIL refers to the SQL_THREAD replica position at which the SQL_THREAD replication will halt. If
SQL_THREAD isn't specified both threads are started.

START SLAVE UNTIL master_gtid_pos=xxx is also supported. See Global Transaction ID/START SLAVE UNTIL
master_gtid_pos=xxx for more details.

connection_name
If there is only one nameless primary, or the default primary (as specified by the default_master_connection system
variable) is intended, connection_name can be omitted. If provided, the START SLAVE statement will apply to the
specified primary. connection_name is case-insensitive.

MariaDB starting with 10.7.0


The FOR CHANNEL keyword was added for MySQL compatibility. This is identical as using the channel_name directly
after START SLAVE .

184/3812
START ALL SLAVES
START ALL SLAVES starts all configured replicas (replicas with master_host not empty) that were not started before. It
will give a note for all started connections. You can check the notes with SHOW WARNINGS.

START REPLICA

MariaDB starting with 10.5.1


START REPLICA is an alias for START SLAVE from MariaDB 10.5.1.

See Also
Setting up replication.
CHANGE MASTER TO is used to create and change connections.
STOP SLAVE is used to stop a running connection.
RESET SLAVE is used to reset parameters for a connection and also to permanently delete a primary
connection.

1.1.1.2.5.3 STOP SLAVE


The terms master and slave have historically been used in replication, but the terms terms primary and replica are
now preferred. The old terms are used still used in parts of the documentation, and in MariaDB commands,
although MariaDB 10.5 has begun the process of renaming. The documentation process is ongoing. See MDEV-
18777 to follow progress on this effort.

Syntax
STOP SLAVE ["connection_name"] [thread_type [, thread_type] ... ] [FOR CHANNEL "connection_name"]

STOP ALL SLAVES [thread_type [, thread_type]]

STOP REPLICA ["connection_name"] [thread_type [, thread_type] ... ] -- from 10.5.1

STOP ALL REPLICAS [thread_type [, thread_type]] -- from 10.5.1

thread_type: IO_THREAD | SQL_THREAD

Contents
1. Syntax
2. Description
1. STOP ALL SLAVES
2. connection_name
3. STOP REPLICA
3. See Also

Description
Stops the replica threads. STOP SLAVE requires the SUPER privilege, or, from MariaDB 10.5.2, the REPLICATION
SLAVE ADMIN privilege.
Like START SLAVE, this statement may be used with the IO_THREAD and SQL_THREAD options to name the thread or
threads to be stopped. In almost all cases, one never need to use the thread_type options.
STOP SLAVE waits until any current replication event group affecting one or more non-transactional tables has finished
executing (if there is any such replication group), or until the user issues a KILL QUERY or KILL CONNECTION
statement.
Note that STOP SLAVE doesn't delete the connection permanently. Next time you execute START SLAVE or the
MariaDB server restarts, the replica connection is restored with it's original arguments. If you want to delete a
connection, you should execute RESET SLAVE.

STOP ALL SLAVES


STOP ALL SLAVES stops all your running replicas. It will give you a note for every stopped connection. You can check
the notes with SHOW WARNINGS.

185/3812
connection_name
The connection_name option is used for multi-source replication.
If there is only one nameless master, or the default master (as specified by the default_master_connection system
variable) is intended, connection_name can be omitted. If provided, the STOP SLAVE statement will apply to the
specified master. connection_name is case-insensitive.

MariaDB starting with 10.7.0


The FOR CHANNEL keyword was added for MySQL compatibility. This is identical as using the channel_name directly
after STOP SLAVE .

STOP REPLICA

MariaDB starting with 10.5.1


STOP REPLICA is an alias for STOP SLAVE from MariaDB 10.5.1.

See Also
CHANGE MASTER TO is used to create and change connections.
START SLAVE is used to start a predefined connection.
RESET SLAVE is used to reset parameters for a connection and also to permanently delete a master connection.

1.1.1.2.5.4 RESET REPLICA/SLAVE


The terms master and slave have historically been used in replication, but the terms terms primary and replica are
now preferred. The old terms are used still used in parts of the documentation, and in MariaDB commands,
although MariaDB 10.5 has begun the process of renaming. The documentation process is ongoing. See MDEV-
18777 to follow progress on this effort.

Syntax
RESET REPLICA ["connection_name"] [ALL] [FOR CHANNEL "connection_name"] -- from MariaDB 10.5.1
RESET SLAVE ["connection_name"] [ALL] [FOR CHANNEL "connection_name"]

Contents
1. Syntax
2. Description
1. connection_name
2. RESET REPLICA
3. See Also

Description
RESET REPLICA/SLAVE makes the replica forget its replication position in the master's binary log. This statement is
meant to be used for a clean start. It deletes the master.info and relay-log.info files, all the relay log files, and starts a
new relay log file. To use RESET REPLICA/SLAVE, the replica threads must be stopped (use STOP REPLICA/SLAVE if
necessary).

Note: All relay log files are deleted, even if they have not been completely executed by the slave SQL thread. (This
is a condition likely to exist on a replication slave if you have issued a STOP REPLICA/SLAVE statement or if the
slave is highly loaded.)

Note: RESET REPLICA does not reset the global gtid_slave_pos variable. This means that a replica server
configured with CHANGE MASTER TO MASTER_USE_GTID=slave_pos will not receive events with GTIDs occurring
before the state saved in gtid_slave_pos . If the intent is to reprocess these events, gtid_slave_pos must be
manually reset, e.g. by executing set global gtid_slave_pos="" .

Connection information stored in the master.info file is immediately reset using any values specified in the
corresponding startup options. This information includes values such as master host, master port, master user, and
186/3812
master password. If the replica SQL thread was in the middle of replicating temporary tables when it was stopped, and
RESET REPLICA/SLAVE is issued, these replicated temporary tables are deleted on the slave.
The ALL also resets the PORT , HOST , USER and PASSWORD parameters for the slave. If you are using a connection
name, it will permanently delete it and it will not show up anymore in SHOW ALL REPLICAS/SLAVE STATUS.

connection_name
The connection_name option is used for multi-source replication.
If there is only one nameless primary, or the default primary (as specified by the default_master_connection system
variable) is intended, connection_name can be omitted. If provided, the RESET REPLICA/SLAVE statement will apply to
the specified primary. connection_name is case-insensitive.

MariaDB starting with 10.7.0


The FOR CHANNEL keyword was added for MySQL compatibility. This is identical as using the channel_name directly
after RESET REPLICA .

RESET REPLICA

MariaDB starting with 10.5.1


RESET REPLICA is an alias for RESET SLAVE from MariaDB 10.5.1.

See Also
STOP REPLICA/SLAVE stops the replica, but it can be restarted with START REPLICA/SLAVE or after next
MariaDB server restart.

1.1.1.2.5.5 SET GLOBAL


SQL_SLAVE_SKIP_COUNTER
Syntax
SET GLOBAL sql_slave_skip_counter = N

Contents
1. Syntax
2. Description
3. Example
4. Multiple Replication Domains
5. See Also

Description
This statement skips the next N events from the primary. This is useful for recovering from replication stops caused by
a statement.
If multi-source replication is used, this statement applies to the default connection. It could be necessary to change the
value of the default_master_connection system variable.
Note that, if the event is a transaction, the whole transaction will be skipped. With non-transactional engines, an event
is always a single statement.
This statement is valid only when the replica threads are not running. Otherwise, it produces an error.
The statement does not automatically restart the replica threads.

Example
SHOW SLAVE STATUS \G
...
SET GLOBAL sql_slave_skip_counter = 1;
START SLAVE;

187/3812
Multi-source replication:

SET @@default_master_connection = 'master_01';


SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
START SLAVE;

Multiple Replication Domains


sql_slave_skip_counter can't be used to skip transactions on a replica if GTID replication is in use and if
gtid_slave_pos contains multiple gtid_domain_id values. In that case, you'll get an error like the following:

ERROR 1966 (HY000): When using parallel replication and GTID with multiple
replication domains, @@sql_slave_skip_counter can not be used. Instead,
setting @@gtid_slave_pos explicitly can be used to skip to after a given GTID
position.

In order to skip transactions in cases like this, you will have to manually change gtid_slave_pos.

See Also
Selectively Skipping Replication of Binlog Events

1.1.1.2.5.6 SHOW RELAYLOG EVENTS


The terms master and slave have historically been used in replication, but the terms terms primary and replica are
now preferred. The old terms are used still used in parts of the documentation, and in MariaDB commands,
although MariaDB 10.5 has begun the process of renaming. The documentation process is ongoing. See MDEV-
18777 to follow progress on this effort.

Syntax
SHOW RELAYLOG ['connection_name'] EVENTS
[IN 'log_name'] [FROM pos] [LIMIT [offset,] row_count]
[ FOR CHANNEL 'channel_name']

Description
On replicas, this command shows the events in the relay log. If 'log_name' is not specified, the first relay log is shown.
Syntax for the LIMIT clause is the same as for SELECT ... LIMIT.

Using the LIMIT clause is highly recommended because the SHOW RELAYLOG EVENTS command returns the
complete contents of the relay log, which can be quite large.

This command does not return events related to setting user and system variables. If you need those, use mariadb-
binlog/mysqlbinlog.
On the primary, this command does nothing.
Requires the REPLICA MONITOR privilege (>= MariaDB 10.5.9), the REPLICATION SLAVE ADMIN privilege (>=
MariaDB 10.5.2) or the REPLICATION SLAVE privilege (<= MariaDB 10.5.1).

connection_name
If there is only one nameless primary, or the default primary (as specified by the default_master_connection system
variable) is intended, connection_name can be omitted. If provided, the SHOW RELAYLOG statement will apply to the
specified primary. connection_name is case-insensitive.

MariaDB starting with 10.7.0


The FOR CHANNEL keyword was added for MySQL compatibility. This is identical as using the channel_name directly
after SHOW RELAYLOG .

1.1.1.2.5.7 SHOW SLAVE STATUS


188/3812
Syntax
SHOW SLAVE ["connection_name"] STATUS [FOR CHANNEL "connection_name"]
SHOW REPLICA ["connection_name"] STATUS -- From MariaDB 10.5.1

or

SHOW ALL SLAVES STATUS


SHOW ALL REPLICAS STATUS -- From MariaDB 10.5.1

Contents
1. Syntax
2. Description
1. Multi-Source
2. Column Descriptions
3. SHOW REPLICA STATUS
3. Examples
4. See Also

Description
This statement is to be run on a replica and provides status information on essential parameters of the replica threads.
This statement requires the SUPER privilege, the REPLICATION_CLIENT privilege, or, from MariaDB 10.5.2, the
REPLICATION SLAVE ADMIN privilege, or, from MariaDB 10.5.9, the REPLICA MONITOR privilege.

Multi-Source
The ALL and "connection_name" options allow you to connect to many primaries at the same time.
ALL SLAVES (or ALL REPLICAS from MariaDB 10.5.1) gives you a list of all connections to the primary nodes.

The rows will be sorted according to Connection_name .


If you specify a connection_name , you only get the information about that connection. If connection_name is not used,
then the name set by default_master_connection is used. If the connection name doesn't exist you will get an error:
There is no master connection for 'xxx' .

MariaDB starting with 10.7.0


The FOR CHANNEL keyword was added for MySQL compatibility. This is identical as using the channel_name directly
after SHOW SLAVE .

Column Descriptions
Name Description Added
Name of the primary connection. Returned with SHOW ALL SLAVES
Connection_name
STATUS (or SHOW ALL REPLICAS STATUS from MariaDB 10.5.1) only.

State of SQL thread. Returned with SHOW ALL SLAVES STATUS (or
Slave_SQL_State SHOW ALL REPLICAS STATUS from MariaDB 10.5.1) only. See Slave
SQL Thread States.
Slave_IO_State State of I/O thread. See Slave I/O Thread States.
Master_host Master host that the replica is connected to.
Master_user Account user name being used to connect to the primary.
Master_port The port being used to connect to the primary.
Time in seconds between retries to connect. The default is 60. The
Connect_Retry CHANGE MASTER TO statement can set this. The master-retry-count
option determines the maximum number of reconnection attempts.
Name of the primary binary log file that the I/O thread is currently
Master_Log_File
reading from.
Position up to which the I/O thread has read in the current primary
Read_Master_Log_Pos
binary log file.
Relay_Log_File Name of the relay log file that the SQL thread is currently processing.
189/3812
Position up to which the SQL thread has finished processing in the
Relay_Log_Pos
current relay log file.
Name of the primary binary log file that contains the most recent event
Relay_Master_Log_File
executed by the SQL thread.
Whether the replica I/O thread is running and connected ( Yes ),
Slave_IO_Running running but not connected to a primary ( Connecting ) or not running
( No ).
Slave_SQL_Running Whether or not the SQL thread is running.
Replicate_Do_DB Databases specified for replicating with the replicate_do_db option.
Databases specified for ignoring with the replicate_ignore_db
Replicate_Ignore_DB
option.
Replicate_Do_Table Tables specified for replicating with the replicate_do_table option.
Tables specified for ignoring with the replicate_ignore_table
Replicate_Ignore_Table
option.
Tables specified for replicating with the replicate_wild_do_table
Replicate_Wild_Do_Table
option.
Tables specified for ignoring with the replicate_wild_ignore_table
Replicate_Wild_Ignore_Table
option.
Last_Errno Alias for Last_SQL_Errno (see below)
Last Error Alias for Last_SQL_Error (see below)
Number of events that a replica skips from the master, as recorded in
Skip_Counter
the sql_slave_skip_counter system variable.
Position up to which the SQL thread has processed in the current
master binary log file. Can be used to start a new replica from a
Exec_Master_Log_Pos
current replica with the CHANGE MASTER TO ...
MASTER_LOG_POS option.
Relay_Log_Space Total size of all relay log files combined.
Until_Condition
Until_Log_File The MASTER_LOG_FILE value of the START SLAVE UNTIL condition.
Until_Log_Pos The MASTER_LOG_POS value of the START SLAVE UNTIL condition.
Whether an SSL connection is permitted ( Yes ), not permitted ( No ) or
Master_SSL_Allowed permitted but without the replica having SSL support enabled
( Ignored )
Master_SSL_CA_File The MASTER_SSL_CA option of the CHANGE MASTER TO statement.
Master_SSL_CA_Path The MASTER_SSL_CAPATH option of the CHANGE MASTER TO statement.
Master_SSL_Cert The MASTER_SSL_CERT option of the CHANGE MASTER TO statement.
Master_SSL_Cipher The MASTER_SSL_CIPHER option of the CHANGE MASTER TO statement.
Master_SSL_Key The MASTER_SSL_KEY option of the CHANGE MASTER TO statement.
Difference between the timestamp logged on the master for the event
that the replica is currently processing, and the current timestamp on
Seconds_Behind_Master the replica. Zero if the replica is not currently processing an event.
With parallel replication, seconds_behind_master is updated only
after transactions commit.
The MASTER_SSL_VERIFY_SERVER_CERT option of the CHANGE MASTER
Master_SSL_Verify_Server_Cert
TO statement.

Error code of the most recent error that caused the I/O thread to stop
Last_IO_Errno (also recorded in the replica's error log). 0 means no error. RESET
SLAVE or RESET MASTER will reset this value.
Error message of the most recent error that caused the I/O thread to
Last_IO_Error stop (also recorded in the replica's error log). An empty string means
no error. RESET SLAVE or RESET MASTER will reset this value.
Error code of the most recent error that caused the SQL thread to stop
Last_SQL_Errno (also recorded in the replica's error log). 0 means no error. RESET
SLAVE or RESET MASTER will reset this value.
190/3812
Error message of the most recent error that caused the SQL thread to
Last_SQL_Error stop (also recorded in the replica's error log). An empty string means
no error. RESET SLAVE or RESET MASTER will reset this value.
List of server_ids that are currently being ignored for replication
Replicate_Ignore_Server_Ids purposes, or an empty string for none, as specified in the
IGNORE_SERVER_IDS option of the CHANGE MASTER TO statement.

Master_Server_Id The master's server_id value.


Master_SSL_Crl The MASTER_SSL_CRL option of the CHANGE MASTER TO statement.
Master_SSL_Crlpath The MASTER_SSL_CRLPATH option of the CHANGE MASTER TO statement.
Whether or not global transaction ID's are being used for replication
Using_Gtid
(can be No , Slave_Pos , or Current_Pos ).
Gtid_IO_Pos Current global transaction ID value.
Number of retried transactions for this connection. Returned with SHOW
Retried_transactions
ALL SLAVES STATUS only.

Max relay log size for this connection. Returned with SHOW ALL SLAVES
Max_relay_log_size
STATUS only.

How many log entries the replica has executed. Returned with SHOW
Executed_log_entries
ALL SLAVES STATUS only.

How many heartbeats we have got from the master. Returned with
Slave_received_heartbeats
SHOW ALL SLAVES STATUS only.

How often to request a heartbeat packet from the master (in seconds).
Slave_heartbeat_period
Returned with SHOW ALL SLAVES STATUS only.
GTID of the last event group replicated on a replica server, for each
Gtid_Slave_Pos replication domain, as stored in the gtid_slave_pos system variable.
Returned with SHOW ALL SLAVES STATUS only.
MariaDB
SQL_Delay Value specified by MASTER_DELAY in CHANGE MASTER (or 0 if none).
10.2.3
When the replica is delaying the execution of an event due to
MariaDB
SQL_Remaining_Delay MASTER_DELAY , this is the number of seconds of delay remaining
10.2.3
before the event will be applied. Otherwise, the value is NULL .
The state of the SQL driver threads, same as in SHOW PROCESSLIST .
When the replica is delaying the execution of an event due to MariaDB
Slave_SQL_Running_State
MASTER_DELAY , this field displays: " Waiting until MASTER_DELAY 10.2.3
seconds after master executed event ".

This status variable counts the occurrence of DDL statements. This is MariaDB
Slave_DDL_Groups
a replica-side counter for optimistic parallel replication. 10.3.7
This status variable counts the occurrence of non-transactional event MariaDB
Slave_Non_Transactional_Groups
groups. This is a replica-side counter for optimistic parallel replication. 10.3.7
This status variable counts the occurrence of transactional event MariaDB
Slave_Transactional_Groups
groups. This is a replica-side counter for optimistic parallel replication. 10.3.7

SHOW REPLICA STATUS


MariaDB starting with 10.5.1
SHOW REPLICA STATUS is an alias for SHOW SLAVE STATUS from MariaDB 10.5.1.

Examples
If you issue this statement using the mysql client, you can use a \G statement terminator rather than a semicolon to
obtain a more readable vertical layout.

191/3812
SHOW SLAVE STATUS\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: db01.example.com
Master_User: replicant
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mariadb-bin.000010
Read_Master_Log_Pos: 548
Relay_Log_File: relay-bin.000004
Relay_Log_Pos: 837
Relay_Master_Log_File: mariadb-bin.000010
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 548
Relay_Log_Space: 1497
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 101
Master_SSL_Crl:
Master_SSL_Crlpath:
Using_Gtid: No
Gtid_IO_Pos:

192/3812
SHOW ALL SLAVES STATUS\G
*************************** 1. row ***************************
Connection_name:
Slave_SQL_State: Slave has read all relay log; waiting for the slave I/O thread to update
it
Slave_IO_State: Waiting for master to send event
Master_Host: db01.example.com
Master_User: replicant
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mariadb-bin.000010
Read_Master_Log_Pos: 3608
Relay_Log_File: relay-bin.000004
Relay_Log_Pos: 3897
Relay_Master_Log_File: mariadb-bin.000010
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 3608
Relay_Log_Space: 4557
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 101
Master_SSL_Crl:
Master_SSL_Crlpath:
Using_Gtid: No
Gtid_IO_Pos:
Retried_transactions: 0
Max_relay_log_size: 104857600
Executed_log_entries: 40
Slave_received_heartbeats: 11
Slave_heartbeat_period: 1800.000
Gtid_Slave_Pos: 0-101-2320

You can also access some of the variables directly from status variables:

SET @@default_master_connection="test" ;
show status like "%slave%"

Variable_name Value
Com_show_slave_hosts 0
Com_show_slave_status 0
Com_start_all_slaves 0
Com_start_slave 0
Com_stop_all_slaves 0
Com_stop_slave 0
Rpl_semi_sync_slave_status OFF
Slave_connections 0
Slave_heartbeat_period 1800.000
Slave_open_temp_tables 0
Slave_received_heartbeats 0
Slave_retried_transactions 0
Slave_running OFF
Slaves_connected 0
Slaves_running 1

193/3812
See Also
MariaDB replication

1.1.1.2.5.8 SHOW MASTER STATUS


Syntax
SHOW MASTER STATUS
SHOW BINLOG STATUS -- From MariaDB 10.5.2

Description
Provides status information about the binary log files of the primary.
This statement requires the SUPER privilege, the REPLICATION_CLIENT privilege, or, from MariaDB 10.5.2, the
BINLOG MONITOR privilege.
To see information about the current GTIDs in the binary log, use the gtid_binlog_pos variable.
SHOW MASTER STATUS was renamed to SHOW BINLOG STATUS in MariaDB 10.5.2, but the old name remains an alias for
compatibility purposes.

Example
SHOW MASTER STATUS;
+--------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+--------------------+----------+--------------+------------------+
| mariadb-bin.000016 | 475 | | |
+--------------------+----------+--------------+------------------+
SELECT @@global.gtid_binlog_pos;
+--------------------------+
| @@global.gtid_binlog_pos |
+--------------------------+
| 0-1-2 |
+--------------------------+

See Also
MariaDB replication
Using and Maintaining the Binary Log
The gtid_binlog_pos variable

1.1.1.2.5.9 SHOW SLAVE HOSTS


Contents
1. Syntax
2. Description
1. SHOW REPLICA HOSTS
3. See Also

Syntax
SHOW SLAVE HOSTS
SHOW REPLICA HOSTS -- from MariaDB 10.5.1

Description
This command is run on the primary and displays a list of replicas that are currently registered with it. Only replicas
started with the --report-host=host_name option are visible in this list.
The list is displayed on any server (not just the primary server). The output looks like this:

194/3812
SHOW SLAVE HOSTS;
+------------+-----------+------+-----------+
| Server_id | Host | Port | Master_id |
+------------+-----------+------+-----------+
| 192168010 | iconnect2 | 3306 | 192168011 |
| 1921680101 | athena | 3306 | 192168011 |
+------------+-----------+------+-----------+

Server_id : The unique server ID of the replica server, as configured in the server's option file, or on the
command line with --server-id=value.
Host : The host name of the replica server, as configured in the server's option file, or on the command line with
--report-host=host_name . Note that this can differ from the machine name as configured in the operating
system.
Port : The port the replica server is listening on.
Master_id : The unique server ID of the primary server that the replica server is replicating from.
Some MariaDB and MySQL versions report another variable, rpl_recovery_rank. This variable was never used, and
was eventually removed in MariaDB 10.1.2 .
Requires the REPLICATION MASTER ADMIN privilege (>= MariaDB 10.5.2) or the REPLICATION SLAVE privilege (<=
MariaDB 10.5.1).

SHOW REPLICA HOSTS

MariaDB starting with 10.5.1


SHOW REPLICA HOSTS is an alias for SHOW SLAVE HOSTS from MariaDB 10.5.1.

See Also
MariaDB replication
Replication threads
SHOW PROCESSLIST. In SHOW PROCESSLIST output, replica threads are identified by Binlog Dump

1.1.1.2.5.10 RESET MASTER


RESET MASTER [TO #]

Deletes all binary log files listed in the index file, resets the binary log index file to be empty, and creates a new binary
log file with a suffix of .000001.
If TO # is given, then the first new binary log file will start from number #.

This statement is for use only when the master is started for the first time, and should never be used if any slaves
are actively replicating from the binary log.

See Also
The PURGE BINARY LOGS statement is intended for use in active replication.

1.1.1.2.6 Plugin SQL Statements


Plugin commands.
SHOW PLUGINS
Display information about installed plugins.

SHOW PLUGINS SONAME


Information about all available plugins, installed or not.

INSTALL PLUGIN
3 Install a plugin.

UNINSTALL PLUGIN
Remove a single installed plugin.

195/3812
INSTALL SONAME
2 Installs all plugins from a given library.

UNINSTALL SONAME
Remove all plugins belonging to a specified library.

mysql_plugin
Tool for enabling or disabling plugins.

1.1.1.2.6.1 SHOW PLUGINS


Syntax
SHOW PLUGINS;

Contents
1. Syntax
2. Description
3. Examples
4. See Also

Description
SHOW PLUGINS displays information about installed plugins. The Library column indicates the plugin library - if it is
NULL , the plugin is built-in and cannot be uninstalled.

The PLUGINS table in the information_schema database contains more detailed information.
For specific information about storage engines (a particular type of plugin), see the information_schema.ENGINES table
and the SHOW ENGINES statement.

Examples
SHOW PLUGINS;
+----------------------------+----------+--------------------+-------------+---------+
| Name | Status | Type | Library | License |
+----------------------------+----------+--------------------+-------------+---------+
| binlog | ACTIVE | STORAGE ENGINE | NULL | GPL |
| mysql_native_password | ACTIVE | AUTHENTICATION | NULL | GPL |
| mysql_old_password | ACTIVE | AUTHENTICATION | NULL | GPL |
| MRG_MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| CSV | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MEMORY | ACTIVE | STORAGE ENGINE | NULL | GPL |
| FEDERATED | ACTIVE | STORAGE ENGINE | NULL | GPL |
| PERFORMANCE_SCHEMA | ACTIVE | STORAGE ENGINE | NULL | GPL |
| Aria | ACTIVE | STORAGE ENGINE | NULL | GPL |
| InnoDB | ACTIVE | STORAGE ENGINE | NULL | GPL |
| INNODB_TRX | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
...
| INNODB_SYS_FOREIGN | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_FOREIGN_COLS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| SPHINX | ACTIVE | STORAGE ENGINE | NULL | GPL |
| ARCHIVE | ACTIVE | STORAGE ENGINE | NULL | GPL |
| BLACKHOLE | ACTIVE | STORAGE ENGINE | NULL | GPL |
| FEEDBACK | DISABLED | INFORMATION SCHEMA | NULL | GPL |
| partition | ACTIVE | STORAGE ENGINE | NULL | GPL |
| pam | ACTIVE | AUTHENTICATION | auth_pam.so | GPL |
+----------------------------+----------+--------------------+-------------+---------+

See Also
List of Plugins
Plugin Overview
INFORMATION_SCHEMA.PLUGINS Table
INSTALL PLUGIN
INFORMATION_SCHEMA.ALL_PLUGINS Table (all plugins, installed or not)
INSTALL SONAME
196/3812
UNINSTALL PLUGIN
UNINSTALL SONAME

1.1.1.2.6.2 SHOW PLUGINS SONAME


Syntax
SHOW PLUGINS SONAME { library | LIKE 'pattern' | WHERE expr };

Description
SHOW PLUGINS SONAME displays information about compiled-in and all server plugins in the plugin_dir directory,
including plugins that haven't been installed.

Examples
SHOW PLUGINS SONAME 'ha_example.so';
+----------+---------------+----------------+---------------+---------+
| Name | Status | Type | Library | License |
+----------+---------------+----------------+---------------+---------+
| EXAMPLE | NOT INSTALLED | STORAGE ENGINE | ha_example.so | GPL |
| UNUSABLE | NOT INSTALLED | DAEMON | ha_example.so | GPL |
+----------+---------------+----------------+---------------+---------+

There is also a corresponding information_schema table, called ALL_PLUGINS , which contains more complete
information.

1.1.1.2.6.3 INSTALL PLUGIN


Syntax
INSTALL PLUGIN [IF NOT EXISTS] plugin_name SONAME 'plugin_library'

Contents
1. Syntax
2. Description
1. IF NOT EXISTS
3. Examples
4. See Also

Description
This statement installs an individual plugin from the specified library. To install the whole library (which could be
required), use INSTALL SONAME. See also Installing a Plugin.
plugin_name is the name of the plugin as defined in the plugin declaration structure contained in the library file. Plugin
names are not case sensitive. For maximal compatibility, plugin names should be limited to ASCII letters, digits, and
underscore, because they are used in C source files, shell command lines, M4 and Bourne shell scripts, and SQL
environments.
plugin_library is the name of the shared library that contains the plugin code. The file name extension can be
omitted (which makes the statement look the same on all architectures).
The shared library must be located in the plugin directory (that is, the directory named by the plugin_dir system
variable). The library must be in the plugin directory itself, not in a subdirectory. By default, plugin_dir is plugin
directory under the directory named by the pkglibdir configuration variable, but it can be changed by setting the value
of plugin_dir at server startup. For example, set its value in a my.cnf file:

[mysqld]
plugin_dir=/path/to/plugin/directory

If the value of plugin_dir is a relative path name, it is taken to be relative to the MySQL base directory (the value of the
basedir system variable).

197/3812
INSTALL PLUGIN adds a line to the mysql.plugin table that describes the plugin. This table contains the plugin name
and library file name.
INSTALL PLUGIN causes the server to read option ( my.cnf ) files just as during server startup. This enables the plugin
to pick up any relevant options from those files. It is possible to add plugin options to an option file even before loading
a plugin (if the loose prefix is used). It is also possible to uninstall a plugin, edit my.cnf , and install the plugin again.
Restarting the plugin this way enables it to the new option values without a server restart.
INSTALL PLUGIN also loads and initializes the plugin code to make the plugin available for use. A plugin is initialized by
executing its initialization function, which handles any setup that the plugin must perform before it can be used.
To use INSTALL PLUGIN , you must have the INSERT privilege for the mysql.plugin table.
At server startup, the server loads and initializes any plugin that is listed in the mysql.plugin table. This means that a
plugin is installed with INSTALL PLUGIN only once, not every time the server starts. Plugin loading at startup does not
occur if the server is started with the --skip-grant-tables option.
When the server shuts down, it executes the de-initialization function for each plugin that is loaded so that the plugin
has a chance to perform any final cleanup.
If you need to load plugins for a single server startup when the --skip-grant-tables option is given (which tells the
server not to read system tables), use the --plugin-load mysqld option.

MariaDB starting with 10.4.0


IF NOT EXISTS
When the IF NOT EXISTS clause is used, MariaDB will return a note instead of an error if the specified plugin already
exists. See SHOW WARNINGS.

Examples
INSTALL PLUGIN sphinx SONAME 'ha_sphinx.so';

The extension can also be omitted:

INSTALL PLUGIN innodb SONAME 'ha_xtradb';

From MariaDB 10.4.0:

INSTALL PLUGIN IF NOT EXISTS example SONAME 'ha_example';


Query OK, 0 rows affected (0.104 sec)

INSTALL PLUGIN IF NOT EXISTS example SONAME 'ha_example';


Query OK, 0 rows affected, 1 warning (0.000 sec)

SHOW WARNINGS;
+-------+------+------------------------------------+
| Level | Code | Message |
+-------+------+------------------------------------+
| Note | 1968 | Plugin 'example' already installed |
+-------+------+------------------------------------+

See Also
List of Plugins
Plugin Overview
INFORMATION_SCHEMA.PLUGINS Table
mysql_plugin
SHOW PLUGINS
INSTALL SONAME
UNINSTALL PLUGIN
UNINSTALL SONAME

1.1.1.2.6.4 UNINSTALL PLUGIN


Syntax
UNINSTALL PLUGIN [IF EXISTS] plugin_name

198/3812
Contents
1. Syntax
2. Description
1. IF EXISTS
3. Examples
4. See Also

Description
This statement removes a single installed plugin. To uninstall the whole library which contains the plugin, use
UNINSTALL SONAME. You cannot uninstall a plugin if any table that uses it is open.
plugin_name must be the name of some plugin that is listed in the mysql.plugin table. The server executes the plugin's
deinitialization function and removes the row for the plugin from the mysql.plugin table, so that subsequent server
restarts will not load and initialize the plugin. UNINSTALL PLUGIN does not remove the plugin's shared library file.
To use UNINSTALL PLUGIN , you must have the DELETE privilege for the mysql.plugin table.

MariaDB starting with 10.4.0


IF EXISTS
If the IF EXISTS clause is used, MariaDB will return a note instead of an error if the plugin does not exist. See
SHOW WARNINGS.

Examples
UNINSTALL PLUGIN example;

From MariaDB 10.4.0:

UNINSTALL PLUGIN IF EXISTS example;


Query OK, 0 rows affected (0.099 sec)

UNINSTALL PLUGIN IF EXISTS example;


Query OK, 0 rows affected, 1 warning (0.000 sec)

SHOW WARNINGS;
+-------+------+-------------------------------+
| Level | Code | Message |
+-------+------+-------------------------------+
| Note | 1305 | PLUGIN example does not exist |
+-------+------+-------------------------------+

See Also
Plugin Overview
mysql_plugin
INSTALL PLUGIN
List of Plugins

1.1.1.2.6.5 INSTALL SONAME


Syntax
INSTALL SONAME 'plugin_library'

Contents
1. Syntax
2. Description
3. Examples
4. See Also

Description
This statement is a variant of INSTALL PLUGIN. It installs all plugins from a given plugin_library . See INSTALL
199/3812
PLUGIN for details.
plugin_library is the name of the shared library that contains the plugin code. The file name extension (for example,
libmyplugin.so or libmyplugin.dll ) can be omitted (which makes the statement look the same on all architectures).
The shared library must be located in the plugin directory (that is, the directory named by the plugin_dir system
variable). The library must be in the plugin directory itself, not in a subdirectory. By default, plugin_dir is plugin
directory under the directory named by the pkglibdir configuration variable, but it can be changed by setting the value
of plugin_dir at server startup. For example, set its value in a my.cnf file:

[mysqld]
plugin_dir=/path/to/plugin/directory

If the value of plugin_dir is a relative path name, it is taken to be relative to the MySQL base directory (the value of the
basedir system variable).

INSTALL SONAME adds one or more lines to the mysql.plugin table that describes the plugin. This table contains the
plugin name and library file name.
INSTALL SONAME causes the server to read option ( my.cnf ) files just as during server startup. This enables the plugin
to pick up any relevant options from those files. It is possible to add plugin options to an option file even before loading
a plugin (if the loose prefix is used). It is also possible to uninstall a plugin, edit my.cnf , and install the plugin again.
Restarting the plugin this way enables it to the new option values without a server restart.
INSTALL SONAME also loads and initializes the plugin code to make the plugin available for use. A plugin is initialized by
executing its initialization function, which handles any setup that the plugin must perform before it can be used.
To use INSTALL SONAME , you must have the INSERT privilege for the mysql.plugin table.
At server startup, the server loads and initializes any plugin that is listed in the mysql.plugin table. This means that a
plugin is installed with INSTALL SONAME only once, not every time the server starts. Plugin loading at startup does not
occur if the server is started with the --skip-grant-tables option.
When the server shuts down, it executes the de-initialization function for each plugin that is loaded so that the plugin
has a chance to perform any final cleanup.
If you need to load plugins for a single server startup when the --skip-grant-tables option is given (which tells the
server not to read system tables), use the --plugin-load mysqld option.
If you need to install only one plugin from a library, use the INSTALL PLUGIN statement.

Examples
To load the XtraDB storage engine and all of its information_schema tables with one statement, use

INSTALL SONAME 'ha_xtradb';

This statement can be used instead of INSTALL PLUGIN even when the library contains only one plugin:

INSTALL SONAME 'ha_sequence';

See Also
List of Plugins
Plugin Overview
SHOW PLUGINS
INSTALL PLUGIN
UNINSTALL PLUGIN
UNINSTALL SONAME
SHOW PLUGINS
INFORMATION_SCHEMA.PLUGINS Table
mysql_plugin

1.1.1.2.6.6 UNINSTALL SONAME


Syntax
UNINSTALL SONAME [IF EXISTS] 'plugin_library'

200/3812
Contents
1. Syntax
2. Description
1. IF EXISTS
3. Examples
4. See Also

Description
This statement is a variant of UNINSTALL PLUGIN statement, that removes all plugins belonging to a specified
plugin_library . See UNINSTALL PLUGIN for details.
plugin_library is the name of the shared library that contains the plugin code. The file name extension (for example,
libmyplugin.so or libmyplugin.dll ) can be omitted (which makes the statement look the same on all architectures).

To use UNINSTALL SONAME , you must have the DELETE privilege for the mysql.plugin table.

MariaDB starting with 10.4.0


IF EXISTS
If the IF EXISTS clause is used, MariaDB will return a note instead of an error if the plugin library does not exist. See
SHOW WARNINGS.

Examples
To uninstall the XtraDB plugin and all of its information_schema tables with one statement, use

UNINSTALL SONAME 'ha_xtradb';

From MariaDB 10.4.0:

UNINSTALL SONAME IF EXISTS 'ha_example';


Query OK, 0 rows affected (0.099 sec)

UNINSTALL SONAME IF EXISTS 'ha_example';


Query OK, 0 rows affected, 1 warning (0.000 sec)

SHOW WARNINGS;
+-------+------+-------------------------------------+
| Level | Code | Message |
+-------+------+-------------------------------------+
| Note | 1305 | SONAME ha_example.so does not exist |
+-------+------+-------------------------------------+

See Also
INSTALL SONAME
SHOW PLUGINS
INSTALL PLUGIN
UNINSTALL PLUGIN
SHOW PLUGINS
INFORMATION_SCHEMA.PLUGINS Table
mysql_plugin
List of Plugins

1.1.1.2.6.7 mysql_plugin
1.1.1.2.7 SET Commands
SET
1 Set a variable value.

SET CHARACTER SET


Maps all strings sent between the current client and the server with the given mapping.

SET GLOBAL SQL_SLAVE_SKIP_COUNTER


Skips a number of events from the primary.
201/3812
SET NAMES
The character set used to send statements to the server, and results back to the client.

SET PASSWORD
Assign password to an existing MariaDB user.

SET ROLE
1 Enable a role.

SET SQL_LOG_BIN
Set binary logging for the current connection.

SET STATEMENT
Set variable values on a per-query basis

SET TRANSACTION
5 Sets the transaction isolation level.

SET Variable
1 Used to insert a value into a variable with a code block.

There are 1 related questions .

1.1.1.2.7.1 SET
Syntax
SET variable_assignment [, variable_assignment] ...

variable_assignment:
user_var_name = expr
| [GLOBAL | SESSION] system_var_name = expr
| [@@global. | @@session. | @@]system_var_name = expr

Contents
1. Syntax
2. Description
1. GLOBAL / SESSION
2. DEFAULT
3. Examples
4. See Also

One can also set a user variable in any expression with this syntax:

user_var_name:= expr

Description
The SET statement assigns values to different types of variables that affect the operation of the server or your client.
Older versions of MySQL employed SET OPTION , but this syntax was deprecated in favor of SET without OPTION , and
was removed in MariaDB 10.0.
Changing a system variable by using the SET statement does not make the change permanently. To do so, the change
must be made in a configuration file.
For setting variables on a per-query basis, see SET STATEMENT.
See SHOW VARIABLES for documentation on viewing server system variables.
See Server System Variables for a list of all the system variables.

GLOBAL / SESSION
When setting a system variable, the scope can be specified as either GLOBAL or SESSION.
A global variable change affects all new sessions. It does not affect any currently open sessions, including the one that
made the change.
202/3812
A session variable change affects the current session only.
If the variable has a session value, not specifying either GLOBAL or SESSION will be the same as specifying SESSION.
If the variable only has a global value, not specifying GLOBAL or SESSION will apply to the change to the global value.

DEFAULT
Setting a global variable to DEFAULT will restore it to the server default, and setting a session variable to DEFAULT will
restore it to the current global value.

Examples
innodb_sync_spin_loops is a global variable.
skip_parallel_replication is a session variable.
max_error_count is both global and session.

SELECT VARIABLE_NAME, SESSION_VALUE, GLOBAL_VALUE FROM


INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE
VARIABLE_NAME IN ('max_error_count', 'skip_parallel_replication', 'innodb_sync_spin_loops');
+---------------------------+---------------+--------------+
| VARIABLE_NAME | SESSION_VALUE | GLOBAL_VALUE |
+---------------------------+---------------+--------------+
| MAX_ERROR_COUNT | 64 | 64 |
| SKIP_PARALLEL_REPLICATION | OFF | NULL |
| INNODB_SYNC_SPIN_LOOPS | NULL | 30 |
+---------------------------+---------------+--------------+

Setting the session values:

SET max_error_count=128;Query OK, 0 rows affected (0.000 sec)

SET skip_parallel_replication=ON;Query OK, 0 rows affected (0.000 sec)

SET innodb_sync_spin_loops=60;
ERROR 1229 (HY000): Variable 'innodb_sync_spin_loops' is a GLOBAL variable
and should be set with SET GLOBAL

SELECT VARIABLE_NAME, SESSION_VALUE, GLOBAL_VALUE FROM


INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE
VARIABLE_NAME IN ('max_error_count', 'skip_parallel_replication', 'innodb_sync_spin_loops');
+---------------------------+---------------+--------------+
| VARIABLE_NAME | SESSION_VALUE | GLOBAL_VALUE |
+---------------------------+---------------+--------------+
| MAX_ERROR_COUNT | 128 | 64 |
| SKIP_PARALLEL_REPLICATION | ON | NULL |
| INNODB_SYNC_SPIN_LOOPS | NULL | 30 |
+---------------------------+---------------+--------------+

Setting the global values:

SET GLOBAL max_error_count=256;

SET GLOBAL skip_parallel_replication=ON;


ERROR 1228 (HY000): Variable 'skip_parallel_replication' is a SESSION variable
and can't be used with SET GLOBAL

SET GLOBAL innodb_sync_spin_loops=120;

SELECT VARIABLE_NAME, SESSION_VALUE, GLOBAL_VALUE FROM


INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE
VARIABLE_NAME IN ('max_error_count', 'skip_parallel_replication', 'innodb_sync_spin_loops');
+---------------------------+---------------+--------------+
| VARIABLE_NAME | SESSION_VALUE | GLOBAL_VALUE |
+---------------------------+---------------+--------------+
| MAX_ERROR_COUNT | 128 | 256 |
| SKIP_PARALLEL_REPLICATION | ON | NULL |
| INNODB_SYNC_SPIN_LOOPS | NULL | 120 |
+---------------------------+---------------+--------------+

SHOW VARIABLES will by default return the session value unless the variable is global only.

203/3812
SHOW VARIABLES LIKE 'max_error_count';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_error_count | 128 |
+-----------------+-------+

SHOW VARIABLES LIKE 'skip_parallel_replication';


+---------------------------+-------+
| Variable_name | Value |
+---------------------------+-------+
| skip_parallel_replication | ON |
+---------------------------+-------+

SHOW VARIABLES LIKE 'innodb_sync_spin_loops';


+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| innodb_sync_spin_loops | 120 |
+------------------------+-------+

Using the inplace syntax:

SELECT (@a:=1);
+---------+
| (@a:=1) |
+---------+
| 1 |
+---------+

SELECT @a;
+------+
| @a |
+------+
| 1 |
+------+

See Also
Using last_value() to return data of used rows
SET STATEMENT
SET Variable
SET Data Type
DECLARE Variable

1.1.1.2.7.2 SET CHARACTER SET


Syntax
SET {CHARACTER SET | CHARSET}
{charset_name | DEFAULT}

Description
Sets the character_set_client and character_set_results session system variables to the specified character set and
collation_connection to the value of collation_database, which implicitly sets character_set_connection to the value of
character_set_database.
This maps all strings sent between the current client and the server with the given mapping.

Example

204/3812
SHOW VARIABLES LIKE 'character_set\_%';
+--------------------------+--------+
| Variable_name | Value |
+--------------------------+--------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
+--------------------------+--------+

SHOW VARIABLES LIKE 'collation%';


+----------------------+-------------------+
| Variable_name | Value |
+----------------------+-------------------+
| collation_connection | utf8_general_ci |
| collation_database | latin1_swedish_ci |
| collation_server | latin1_swedish_ci |
+----------------------+-------------------+

SET CHARACTER SET utf8mb4;

SHOW VARIABLES LIKE 'character_set\_%';


+--------------------------+---------+
| Variable_name | Value |
+--------------------------+---------+
| character_set_client | utf8mb4 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8mb4 |
| character_set_server | latin1 |
| character_set_system | utf8 |
+--------------------------+---------+

SHOW VARIABLES LIKE 'collation%';


+----------------------+-------------------+
| Variable_name | Value |
+----------------------+-------------------+
| collation_connection | latin1_swedish_ci |
| collation_database | latin1_swedish_ci |
| collation_server | latin1_swedish_ci |
+----------------------+-------------------+

See Also
SET NAMES

1.1.1.2.7.3 SET GLOBAL


SQL_SLAVE_SKIP_COUNTER
1.1.1.2.7.4 SET NAMES
Syntax
SET NAMES {'charset_name'
[COLLATE 'collation_name'] | DEFAULT}

Contents
1. Syntax
2. Description
3. Examples
4. See Also

Description
Sets the character_set_client, character_set_connection, character_set_results and, implicitly, the collation_connection
205/3812
session system variables to the specified character set and collation.
This determines which character set the client will use to send statements to the server, and the server will use for
sending results back to the client.
ucs2 , utf16 , and utf32 are not valid character sets for SET NAMES , as they cannot be used as client character sets.

The collation clause is optional. If not defined (or if DEFAULT is specified), the default collation for the character set will
be used.
Quotes are optional for the character set or collation clauses.

Examples
SELECT VARIABLE_NAME, SESSION_VALUE
FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE
VARIABLE_NAME LIKE 'character_set_c%' OR
VARIABLE_NAME LIKE 'character_set_re%' OR
VARIABLE_NAME LIKE 'collation_c%';
+--------------------------+-----------------+
| VARIABLE_NAME | SESSION_VALUE |
+--------------------------+-----------------+
| CHARACTER_SET_RESULTS | utf8 |
| CHARACTER_SET_CONNECTION | utf8 |
| CHARACTER_SET_CLIENT | utf8 |
| COLLATION_CONNECTION | utf8_general_ci |
+--------------------------+-----------------+

SET NAMES big5;

SELECT VARIABLE_NAME, SESSION_VALUE


FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE
VARIABLE_NAME LIKE 'character_set_c%' OR
VARIABLE_NAME LIKE 'character_set_re%' OR
VARIABLE_NAME LIKE 'collation_c%';
+--------------------------+-----------------+
| VARIABLE_NAME | SESSION_VALUE |
+--------------------------+-----------------+
| CHARACTER_SET_RESULTS | big5 |
| CHARACTER_SET_CONNECTION | big5 |
| CHARACTER_SET_CLIENT | big5 |
| COLLATION_CONNECTION | big5_chinese_ci |
+--------------------------+-----------------+

SET NAMES 'latin1' COLLATE 'latin1_bin';

SELECT VARIABLE_NAME, SESSION_VALUE


FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE
VARIABLE_NAME LIKE 'character_set_c%' OR
VARIABLE_NAME LIKE 'character_set_re%' OR
VARIABLE_NAME LIKE 'collation_c%';
+--------------------------+---------------+
| VARIABLE_NAME | SESSION_VALUE |
+--------------------------+---------------+
| CHARACTER_SET_RESULTS | latin1 |
| CHARACTER_SET_CONNECTION | latin1 |
| CHARACTER_SET_CLIENT | latin1 |
| COLLATION_CONNECTION | latin1_bin |
+--------------------------+---------------+

SET NAMES DEFAULT;

SELECT VARIABLE_NAME, SESSION_VALUE


FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE
VARIABLE_NAME LIKE 'character_set_c%' OR
VARIABLE_NAME LIKE 'character_set_re%' OR
VARIABLE_NAME LIKE 'collation_c%';
+--------------------------+-------------------+
| VARIABLE_NAME | SESSION_VALUE |
+--------------------------+-------------------+
| CHARACTER_SET_RESULTS | latin1 |
| CHARACTER_SET_CONNECTION | latin1 |
| CHARACTER_SET_CLIENT | latin1 |
| COLLATION_CONNECTION | latin1_swedish_ci |
+--------------------------+-------------------+

See Also
206/3812
SET CHARACTER SET
Character Sets and Collations

1.1.1.2.7.5 SET PASSWORD


1.1.1.2.7.6 SET ROLE
1.1.1.2.7.7 SET SQL_LOG_BIN
Syntax
SET [SESSION] sql_log_bin = {0|1}

Description
Sets the sql_log_bin system variable, which disables or enables binary logging for the current connection, if the client
has the SUPER privilege. The statement is refused with an error if the client does not have that privilege.
Before MariaDB 5.5 and before MySQL 5.6 one could also set sql_log_bin as a global variable. This was disabled as
this was too dangerous as it could damage replication.

1.1.1.2.7.8 SET STATEMENT


Contents
1. Syntax
2. Description
3. Examples
4. Limitations
5. Source

MariaDB starting with 10.1.2


Per-query variables were introduced in MariaDB 10.1.2

SET STATEMENT can be used to set the value of a system variable for the duration of the statement. It is also possible to
set multiple variables.

Syntax
SET STATEMENT var1=value1 [, var2=value2, ...]
FOR <statement>

where varN is a system variable (list of allowed variables is provided below), and valueN is a constant literal.

Description
SET STATEMENT var1=value1 FOR stmt
is roughly equivalent to

SET @save_value=@@var1;
SET SESSION var1=value1;
stmt;
SET SESSION var1=@save_value;

The server parses the whole statement before executing it, so any variables set in this fashion that affect the parser
may not have the expected effect. Examples include the charset variables, sql_mode=ansi_quotes, etc.

Examples
One can limit statement execution time max_statement_time :
207/3812
SET STATEMENT max_statement_time=1000 FOR SELECT ... ;

One can switch on/off individual optimizations:

SET STATEMENT optimizer_switch='materialization=off' FOR SELECT ....;

It is possible to enable MRR/BKA for a query:

SET STATEMENT join_cache_level=6, optimizer_switch='mrr=on' FOR SELECT ...

Note that it makes no sense to try to set a session variable inside a SET STATEMENT :

#USELESS STATEMENT
SET STATEMENT sort_buffer_size = 100000 for SET SESSION sort_buffer_size = 200000;

For the above, after setting sort_buffer_size to 200000 it will be reset to its original state (the state before the SET
STATEMENT started) after the statement execution.

Limitations
There are a number of variables that cannot be set on per-query basis. These include:
autocommit
character_set_client
character_set_connection
character_set_filesystem
collation_connection
default_master_connection
debug_sync
interactive_timeout
gtid_domain_id
last_insert_id
log_slow_filter
log_slow_rate_limit
log_slow_verbosity
long_query_time
min_examined_row_limit
profiling
profiling_history_size
query_cache_type
rand_seed1
rand_seed2
skip_replication
slow_query_log
sql_log_off
tx_isolation
wait_timeout

Source
The feature was originally implemented as a Google Summer of Code 2009 project by Joseph Lukas.
Percona Server 5.6 included it as Per-query variable statement
MariaDB ported the patch and fixed many bugs. The task in MariaDB Jira is MDEV-5231 .

1.1.1.2.7.9 SET TRANSACTION


Syntax

208/3812
SET [GLOBAL | SESSION] TRANSACTION
transaction_property [, transaction_property] ...

transaction_property:
ISOLATION LEVEL level
| READ WRITE
| READ ONLY

level:
REPEATABLE READ
| READ COMMITTED
| READ UNCOMMITTED
| SERIALIZABLE

Contents
1. Syntax
2. Description
1. Isolation Level
2. Isolation Levels
1. READ UNCOMMITTED
2. READ COMMITTED
3. REPEATABLE READ
4. SERIALIZABLE
3. Access Mode
3. Examples

Description
This statement sets the transaction isolation level or the transaction access mode globally, for the current session, or for
the next transaction:
With the GLOBAL keyword, the statement sets the default transaction level globally for all subsequent sessions.
Existing sessions are unaffected.
With the SESSION keyword, the statement sets the default transaction level for all subsequent transactions
performed within the current session.
Without any SESSION or GLOBAL keyword, the statement sets the isolation level for the next (not started)
transaction performed within the current session.
A change to the global default isolation level requires the SUPER privilege. Any session is free to change its session
isolation level (even in the middle of a transaction), or the isolation level for its next transaction.

Isolation Level
To set the global default isolation level at server startup, use the --transaction-isolation=level option on the
command line or in an option file. Values of level for this option use dashes rather than spaces, so the allowable values
are READ-UNCOMMITTED , READ-COMMITTED , REPEATABLE-READ , or SERIALIZABLE . For example, to set the default
isolation level to REPEATABLE READ , use these lines in the [mysqld] section of an option file:

[mysqld]
transaction-isolation = REPEATABLE-READ

To determine the global and session transaction isolation levels at runtime, check the value of the tx_isolation
system variable:

SELECT @@GLOBAL.tx_isolation, @@tx_isolation;

InnoDB supports each of the translation isolation levels described here using different locking strategies. The default
level is REPEATABLE READ . For additional information about InnoDB record-level locks and how it uses them to execute
various types of statements, see InnoDB Lock Modes, and http://dev.mysql.com/doc/refman/en/innodb-locks-set.html .

Isolation Levels
The following sections describe how MariaDB supports the different transaction levels.

READ UNCOMMITTED
SELECT statements are performed in a non-locking fashion, but a possible earlier version of a row might be used. Thus,
using this isolation level, such reads are not consistent. This is also called a "dirty read." Otherwise, this isolation level
works like READ COMMITTED .

209/3812
READ COMMITTED
A somewhat Oracle-like isolation level with respect to consistent (non-locking) reads: Each consistent read, even within
the same transaction, sets and reads its own fresh snapshot. See http://dev.mysql.com/doc/refman/en/innodb-
consistent-read.html .
For locking reads ( SELECT with FOR UPDATE or LOCK IN SHARE MODE ), InnoDB locks only index records, not the gaps
before them, and thus allows the free insertion of new records next to locked records. For UPDATE and DELETE
statements, locking depends on whether the statement uses a unique index with a unique search condition (such as
WHERE id = 100 ), or a range-type search condition (such as WHERE id > 100 ). For a unique index with a unique
search condition, InnoDB locks only the index record found, not the gap before it. For range-type searches, InnoDB
locks the index range scanned, using gap locks or next-key (gap plus index-record) locks to block insertions by other
sessions into the gaps covered by the range. This is necessary because "phantom rows" must be blocked for MySQL
replication and recovery to work.
Note: If the READ COMMITTED isolation level is used or the innodb_locks_unsafe_for_binlog system variable is enabled,
there is no InnoDB gap locking except for foreign-key constraint checking and duplicate-key checking. Also, record
locks for non-matching rows are released after MariaDB has evaluated the WHERE condition.If you use READ COMMITTED
or enable innodb_locks_unsafe_for_binlog, you must use row-based binary logging.

REPEATABLE READ
This is the default isolation level for InnoDB. For consistent reads, there is an important difference from the READ
COMMITTED isolation level: All consistent reads within the same transaction read the snapshot established by the first
read. This convention means that if you issue several plain (non-locking) SELECT statements within the same
transaction, these SELECT statements are consistent also with respect to each other. See
http://dev.mysql.com/doc/refman/en/innodb-consistent-read.html .
For locking reads (SELECT with FOR UPDATE or LOCK IN SHARE MODE), UPDATE, and DELETE statements,
locking depends on whether the statement uses a unique index with a unique search condition, or a range-type search
condition. For a unique index with a unique search condition, InnoDB locks only the index record found, not the gap
before it. For other search conditions, InnoDB locks the index range scanned, using gap locks or next-key (gap plus
index-record) locks to block insertions by other sessions into the gaps covered by the range.
This is the minimum isolation level for non-distributed XA transactions.

SERIALIZABLE
This level is like REPEATABLE READ, but InnoDB implicitly converts all plain SELECT statements to SELECT ... LOCK
IN SHARE MODE if autocommit is disabled. If autocommit is enabled, the SELECT is its own transaction. It therefore is
known to be read only and can be serialized if performed as a consistent (non-locking) read and need not block for
other transactions. (This means that to force a plain SELECT to block if other transactions have modified the selected
rows, you should disable autocommit.)
Distributed XA transactions should always use this isolation level.

Access Mode
The access mode specifies whether the transaction is allowed to write data or not. By default, transactions are in READ
WRITE mode (see the tx_read_only system variable). READ ONLY mode allows the storage engine to apply optimizations
that cannot be used for transactions which write data. The only exception to this rule is that read only transactions can
perform DDL statements on temporary tables.
It is not permitted to specify both READ WRITE and READ ONLY in the same statement.
READ WRITE and READ ONLY can also be specified in the START TRANSACTION statement, in which case the specified
mode is only valid for one transaction.

Examples
SET GLOBAL TRANSACTION ISOLATION LEVEL SERIALIZABLE;

Attempting to set the isolation level within an existing transaction without specifying GLOBAL or SESSION .

START TRANSACTION;

SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;


ERROR 1568 (25001): Transaction characteristics can't be changed while a transaction is in progress

1.1.1.2.7.10 SET Variable


210/3812
Syntax
SET var_name = expr [, var_name = expr] ...

Contents
1. Syntax
2. Description
3. See Also

Description
The SET statement in stored programs is an extended version of the general SET statement. Referenced variables
may be ones declared inside a stored program, global system variables, or user-defined variables.
The SET statement in stored programs is implemented as part of the pre-existing SET syntax. This allows an extended
syntax of SET a=x,
b=y, ... where different variable types (locally declared variables, global and session server variables, user-defined
variables) can be mixed. This also allows combinations of local variables and some options that make sense only for
system variables; in that case, the options are recognized but ignored.
SET can be used with both local variables and user-defined variables.

When setting several variables using the columns returned by a query, SELECT INTO should be preferred.
To set many variables to the same value, the LAST_VALUE( ) function can be used.
Below is an example of how a user-defined variable may be set:

SET @x = 1;

See Also
SET
SET STATEMENT
DECLARE Variable

1.1.1.2.8 SHOW
Articles on the various SHOW commands.
About SHOW
General information about the SHOW statement.

Extended Show
Extended SHOW with WHERE and LIKE.

SHOW AUTHORS
Information about the people who work on MariaDB.

SHOW BINARY LOGS


SHOW BINARY LOGS lists all binary logs on the server.

SHOW BINLOG EVENTS


Show events in the binary log.

SHOW CHARACTER SET


Available character sets.

SHOW CLIENT_STATISTICS
Statistics about client connections.

SHOW COLLATION
Supported collations.

SHOW COLUMNS
Column information.

211/3812
SHOW CONTRIBUTORS
Companies and people who financially contribute to MariaDB.

SHOW CREATE DATABASE


Shows the CREATE DATABASE statement that created the database.

SHOW CREATE EVENT


Displays the CREATE EVENT statement needed to re-create a given event

SHOW CREATE FUNCTION


Statement that created the function.

SHOW CREATE PACKAGE


Show the CREATE statement that creates the given package specification.

SHOW CREATE PACKAGE BODY


Show the CREATE statement that creates the given package body (i.e. implementation).

SHOW CREATE PROCEDURE


Returns the string used for creating a stored procedure.

SHOW CREATE SEQUENCE


Shows the CREATE SEQUENCE statement that created the sequence.

SHOW CREATE TABLE


Shows the CREATE TABLE statement that created the table.

SHOW CREATE TRIGGER


Shows the CREATE TRIGGER statement used to create the trigger

SHOW CREATE USER


Show the CREATE USER statement for a specified user.

SHOW CREATE VIEW


Show the CREATE VIEW statement that created a view.

SHOW DATABASES
Lists the databases on the server.

SHOW ENGINE
Show storage engine information.

SHOW ENGINE INNODB STATUS


Display extensive InnoDB information.

SHOW ENGINES
Server storage engine info

SHOW ERRORS
1 Displays errors.

SHOW EVENTS
Shows information about events

SHOW EXPLAIN
Shows an execution plan for a running query.

SHOW FUNCTION CODE


Representation of the internal implementation of the stored function

SHOW FUNCTION STATUS


Stored function characteristics

SHOW GRANTS
9 View GRANT statements.

SHOW INDEX
Information about table indexes.

212/3812
SHOW INDEX_STATISTICS
Index usage statistics.

SHOW INNODB STATUS (removed)


Removed synonym for SHOW ENGINE INNODB STATUS

SHOW LOCALES
View locales information.

SHOW MASTER STATUS


Status information about the binary log.

SHOW OPEN TABLES


List non-temporary open tables.

SHOW PACKAGE BODY STATUS


Returns characteristics of stored package bodies (implementations).

SHOW PACKAGE STATUS


Returns characteristics of stored package specifications.

SHOW PLUGINS
Display information about installed plugins.

SHOW PLUGINS SONAME


Information about all available plugins, installed or not.

SHOW PRIVILEGES
Shows the list of supported system privileges.

SHOW PROCEDURE CODE


Display internal implementation of a stored procedure.

SHOW PROCEDURE STATUS


Stored procedure characteristics.

SHOW PROCESSLIST
1 Running threads and information about them.

SHOW PROFILE
Display statement resource usage

SHOW PROFILES
Show statement resource usage

SHOW QUERY_RESPONSE_TIME
Retrieving information from the QUERY_RESPONSE_TIME plugin.

SHOW RELAYLOG EVENTS


Show events in the relay log.

SHOW SLAVE HOSTS


Display replicas currently registered with the primary.

SHOW SLAVE STATUS


Show status for one or all primaries.

SHOW STATUS
Server status information.

SHOW TABLE STATUS


SHOW TABLES with information about non-temporary tables.

SHOW TABLES
List of non-temporary tables, views or sequences.

SHOW TABLE_STATISTICS
Table usage statistics.

213/3812
SHOW TRIGGERS
Shows currently-defined triggers

SHOW USER_STATISTICS
User activity statistics.

SHOW VARIABLES
Displays the values of system variables.

SHOW WARNINGS
Displays errors, warnings and notes.

SHOW WSREP_MEMBERSHIP
Galera node cluster membership information.

SHOW WSREP_STATUS
Galera node cluster status information.

1.1.1.2.8.1 About SHOW


SHOW has many forms that provide information about databases, tables, columns, or status information about the
server. These include:
SHOW AUTHORS
SHOW CHARACTER SET [like_or_where]
SHOW COLLATION [like_or_where]
SHOW [FULL] COLUMNS FROM tbl_name [FROM db_name] [like_or_where]
SHOW CONTRIBUTORS
SHOW CREATE DATABASE db_name
SHOW CREATE EVENT event_name
SHOW CREATE PACKAGE package_name
SHOW CREATE PACKAGE BODY package_name
SHOW CREATE PROCEDURE proc_name
SHOW CREATE TABLE tbl_name
SHOW CREATE TRIGGER trigger_name
SHOW CREATE VIEW view_name
SHOW DATABASES [like_or_where]
SHOW ENGINE engine_name {STATUS | MUTEX}
SHOW [STORAGE] ENGINES
SHOW ERRORS [LIMIT [offset,] row_count]
SHOW [FULL] EVENTS
SHOW FUNCTION CODE func_name
SHOW FUNCTION STATUS [like_or_where]
SHOW GRANTS FOR user
SHOW INDEX FROM tbl_name [FROM db_name]
SHOW INNODB STATUS
SHOW OPEN TABLES [FROM db_name] [like_or_where]
SHOW PLUGINS
SHOW PROCEDURE CODE proc_name
SHOW PROCEDURE STATUS [like_or_where]
SHOW PRIVILEGES
SHOW [FULL] PROCESSLIST
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
SHOW PROFILES
SHOW [GLOBAL | SESSION] STATUS [like_or_where]
SHOW TABLE STATUS [FROM db_name] [like_or_where]
SHOW TABLES [FROM db_name] [like_or_where]
SHOW TRIGGERS [FROM db_name] [like_or_where]
SHOW [GLOBAL | SESSION] VARIABLES [like_or_where]
SHOW WARNINGS [LIMIT [offset,] row_count]

like_or_where:
LIKE 'pattern'
| WHERE expr

If the syntax for a given SHOW statement includes a LIKE 'pattern' part, 'pattern' is a string that can contain the
SQL " % " and " _ " wildcard characters. The pattern is useful for restricting statement output to matching values.
Several SHOW statements also accept a WHERE clause that provides more flexibility in specifying which rows to display.
See Extended Show.
214/3812
1.1.1.2.8.2 Extended Show
Contents
1. Examples

The following SHOW statements can be extended by using a WHERE clause and a LIKE clause to refine the results:
SHOW CHARACTER SET
SHOW COLLATION
SHOW COLUMNS
SHOW DATABASES
SHOW FUNCTION STATUS
SHOW INDEX
SHOW OPEN TABLES
SHOW PACKAGE STATUS
SHOW PACKAGE BODY STATUS
SHOW INDEX
SHOW PROCEDURE STATUS
SHOW STATUS
SHOW TABLE STATUS
SHOW TABLES
SHOW TRIGGERS
SHOW VARIABLES
As with a regular SELECT , the WHERE clause can be used for the specific columns returned, and the LIKE clause with
the regular wildcards.

Examples
SHOW TABLES;
+----------------------+
| Tables_in_test |
+----------------------+
| animal_count |
| animals |
| are_the_mooses_loose |
| aria_test2 |
| t1 |
| view1 |
+----------------------+

Showing the tables beginning with a only.

SHOW TABLES WHERE Tables_in_test LIKE 'a%';


+----------------------+
| Tables_in_test |
+----------------------+
| animal_count |
| animals |
| are_the_mooses_loose |
| aria_test2 |
+----------------------+

Variables whose name starts with aria and with a valued of greater than 8192:

SHOW VARIABLES WHERE Variable_name LIKE 'aria%' AND Value >8192;


+------------------------------+---------------------+
| Variable_name | Value |
+------------------------------+---------------------+
| aria_checkpoint_log_activity | 1048576 |
| aria_log_file_size | 1073741824 |
| aria_max_sort_file_size | 9223372036853727232 |
| aria_pagecache_buffer_size | 134217728 |
| aria_sort_buffer_size | 134217728 |
+------------------------------+---------------------+

Shortcut, just returning variables whose name begins with aria.

215/3812
SHOW VARIABLES LIKE 'aria%';
+------------------------------------------+---------------------+
| Variable_name | Value |
+------------------------------------------+---------------------+
| aria_block_size | 8192 |
| aria_checkpoint_interval | 30 |
| aria_checkpoint_log_activity | 1048576 |
| aria_force_start_after_recovery_failures | 0 |
| aria_group_commit | none |
| aria_group_commit_interval | 0 |
| aria_log_file_size | 1073741824 |
| aria_log_purge_type | immediate |
| aria_max_sort_file_size | 9223372036853727232 |
| aria_page_checksum | ON |
| aria_pagecache_age_threshold | 300 |
| aria_pagecache_buffer_size | 134217728 |
| aria_pagecache_division_limit | 100 |
| aria_recover | NORMAL |
| aria_repair_threads | 1 |
| aria_sort_buffer_size | 134217728 |
| aria_stats_method | nulls_unequal |
| aria_sync_log_dir | NEWFILE |
| aria_used_for_temp_tables | ON |
+------------------------------------------+---------------------+

1.1.1.2.8.3 SHOW AUTHORS


Syntax
SHOW AUTHORS

Description
The SHOW AUTHORS statement displays information about the people who work on MariaDB. For each author, it displays
Name, Location, and Comment values. All columns are encoded as latin1.
These include:
First the active people in MariaDB are listed.
Then the active people in MySQL.
Last the people that have contributed to MariaDB/MySQL in the past.
The order is somewhat related to importance of the contribution given to the MariaDB project, but this is not 100%
accurate. There is still room for improvement and debate...

Example
SHOW AUTHORS\G
*************************** 1. row ***************************
Name: Michael (Monty) Widenius
Location: Tusby, Finland
Comment: Lead developer and main author
*************************** 2. row ***************************
Name: Sergei Golubchik
Location: Kerpen, Germany
Comment: Architect, Full-text search, precision math, plugin framework, merges etc
*************************** 3. row ***************************
Name: Igor Babaev
Location: Bellevue, USA
Comment: Optimizer, keycache, core work
*************************** 4. row ***************************
Name: Sergey Petrunia
Location: St. Petersburg, Russia
Comment: Optimizer
*************************** 5. row ***************************
Name: Oleksandr Byelkin
Location: Lugansk, Ukraine
Comment: Query Cache (4.0), Subqueries (4.1), Views (5.0)
*************************** 6. row ***************************
Name: Timour Katchaounov
Location: Sofia , Bulgaria
Comment: Optimizer
*************************** 7. row ***************************
216/3812
Name: Kristian Nielsen
Location: Copenhagen, Denmark
Comment: Replication, Async client prototocol, General buildbot stuff
*************************** 8. row ***************************
Name: Alexander (Bar) Barkov
Location: Izhevsk, Russia
Comment: Unicode and character sets
*************************** 9. row ***************************
Name: Alexey Botchkov (Holyfoot)
Location: Izhevsk, Russia
Comment: GIS extensions, embedded server, precision math
*************************** 10. row ***************************
Name: Daniel Bartholomew
Location: Raleigh, USA
Comment: MariaDB documentation, Buildbot, releases
*************************** 11. row ***************************
Name: Colin Charles
Location: Selangor, Malesia
Comment: MariaDB documentation, talks at a LOT of conferences
*************************** 12. row ***************************
Name: Sergey Vojtovich
Location: Izhevsk, Russia
Comment: initial implementation of plugin architecture, maintained native storage engines (MyISAM,
MEMORY, ARCHIVE, etc), rewrite of table cache
*************************** 13. row ***************************
Name: Vladislav Vaintroub
Location: Mannheim, Germany
Comment: MariaDB Java connector, new thread pool, Windows optimizations
*************************** 14. row ***************************
Name: Elena Stepanova
Location: Sankt Petersburg, Russia
Comment: QA, test cases
*************************** 15. row ***************************
Name: Georg Richter
Location: Heidelberg, Germany
Comment: New LGPL C connector, PHP connector
*************************** 16. row ***************************
Name: Jan Lindström
Location: Ylämylly, Finland
Comment: Working on InnoDB
*************************** 17. row ***************************
Name: Lixun Peng
Location: Hangzhou, China
Comment: Multi Source replication
*************************** 18. row ***************************
Name: Olivier Bertrand
Location: Paris, France
Comment: CONNECT storage engine
*************************** 19. row ***************************
Name: Kentoku Shiba
Location: Tokyo, Japan
Comment: Spider storage engine, metadata_lock_info Information schema
*************************** 20. row ***************************
Name: Percona
Location: CA, USA
Comment: XtraDB, microslow patches, extensions to slow log
*************************** 21. row ***************************
Name: Vicentiu Ciorbaru
Location: Bucharest, Romania
Comment: Roles
*************************** 22. row ***************************
Name: Sudheera Palihakkara
Location:
Comment: PCRE Regular Expressions
*************************** 23. row ***************************
Name: Pavel Ivanov
Location: USA
Comment: Some patches and bug fixes
*************************** 24. row ***************************
Name: Konstantin Osipov
Location: Moscow, Russia
Comment: Prepared statements (4.1), Cursors (5.0), GET_LOCK (10.0)
*************************** 25. row ***************************
Name: Ian Gilfillan
Location: South Africa
Comment: MariaDB documentation
*************************** 26. row ***************************
Name: Federico Razolli
Location: Italy
Comment: MariaDB documentation Italian translation
*************************** 27. row ***************************
Name: Guilhem Bichot
217/3812
Name: Guilhem Bichot
Location: Bordeaux, France
Comment: Replication (since 4.0)
*************************** 28. row ***************************
Name: Andrei Elkin
Location: Espoo, Finland
Comment: Replication
*************************** 29. row ***************************
Name: Dmitri Lenev
Location: Moscow, Russia
Comment: Time zones support (4.1), Triggers (5.0)
*************************** 30. row ***************************
Name: Marc Alff
Location: Denver, CO, USA
Comment: Signal, Resignal, Performance schema
*************************** 31. row ***************************
Name: Mikael Ronström
Location: Stockholm, Sweden
Comment: NDB Cluster, Partitioning, online alter table
*************************** 32. row ***************************
Name: Ingo Strüwing
Location: Berlin, Germany
Comment: Bug fixing in MyISAM, Merge tables etc
*************************** 33. row ***************************
Name: Marko Mäkelä
Location: Helsinki, Finland
Comment: InnoDB core developer
...

See Also
SHOW CONTRIBUTORS. This list all members and sponsors of the MariaDB Foundation and other sponsors.

1.1.1.2.8.4 SHOW BINARY LOGS


Syntax
SHOW BINARY LOGS
SHOW MASTER LOGS

Description
Lists the binary log files on the server. This statement is used as part of the procedure described in PURGE BINARY
LOGS , that shows how to determine which logs can be purged.

This statement requires the SUPER privilege, the REPLICATION_CLIENT privilege, or, from MariaDB 10.5.2, the
BINLOG MONITOR privilege.

Examples
SHOW BINARY LOGS;
+--------------------+-----------+
| Log_name | File_size |
+--------------------+-----------+
| mariadb-bin.000001 | 19039 |
| mariadb-bin.000002 | 717389 |
| mariadb-bin.000003 | 300 |
| mariadb-bin.000004 | 333 |
| mariadb-bin.000005 | 899 |
| mariadb-bin.000006 | 125 |
| mariadb-bin.000007 | 18907 |
| mariadb-bin.000008 | 19530 |
| mariadb-bin.000009 | 151 |
| mariadb-bin.000010 | 151 |
| mariadb-bin.000011 | 125 |
| mariadb-bin.000012 | 151 |
| mariadb-bin.000013 | 151 |
| mariadb-bin.000014 | 125 |
| mariadb-bin.000015 | 151 |
| mariadb-bin.000016 | 314 |
+--------------------+-----------+

218/3812
1.1.1.2.8.5 SHOW BINLOG EVENTS
Syntax
SHOW BINLOG EVENTS
[IN 'log_name'] [FROM pos] [LIMIT [offset,] row_count]

Description
Shows the events in the binary log. If you do not specify ' log_name ', the first binary log is displayed.
Requires the BINLOG MONITOR privilege (>= MariaDB 10.5.2) or the REPLICATION SLAVE privilege (<= MariaDB
10.5.1).

Example
SHOW BINLOG EVENTS IN 'mysql_sandbox10019-bin.000002';
+-------------------------------+-----+-------------------+-----------+-------------+------------------
------------------------------+
| Log_name | Pos | Event_type | Server_id | End_log_pos | Info
|
+-------------------------------+-----+-------------------+-----------+-------------+------------------
------------------------------+
| mysql_sandbox10019-bin.000002 | 4 | Format_desc | 1 | 248 | Server ver:
10.0.19-MariaDB-log, Binlog ver: 4 |
| mysql_sandbox10019-bin.000002 | 248 | Gtid_list | 1 | 273 | []
|
| mysql_sandbox10019-bin.000002 | 273 | Binlog_checkpoint | 1 | 325 |
mysql_sandbox10019-bin.000002 |
| mysql_sandbox10019-bin.000002 | 325 | Gtid | 1 | 363 | GTID 0-1-1
|
| mysql_sandbox10019-bin.000002 | 363 | Query | 1 | 446 | CREATE DATABASE
blog |
| mysql_sandbox10019-bin.000002 | 446 | Gtid | 1 | 484 | GTID 0-1-2
|
| mysql_sandbox10019-bin.000002 | 484 | Query | 1 | 571 | use `blog`;
CREATE TABLE bb (id INT) |
+-------------------------------+-----+-------------------+-----------+-------------+------------------
------------------------------+

1.1.1.2.8.6 SHOW CHARACTER SET


Syntax
SHOW CHARACTER SET
[LIKE 'pattern' | WHERE expr]

Contents
1. Syntax
2. Description
3. Examples
4. See Also

Description
The SHOW CHARACTER SET statement shows all available character sets. The LIKE clause, if present on its own,
indicates which character set names to match. The WHERE and LIKE clauses can be given to select rows using more
general conditions, as discussed in Extended SHOW.
The same information can be queried from the Information Schema CHARACTER_SETS table.
See Setting Character Sets and Collations for details on specifying the character set at the server, database, table and
column levels.

Examples
219/3812
SHOW CHARACTER SET LIKE 'latin%';
+---------+-----------------------------+-------------------+--------+
| Charset | Description | Default collation | Maxlen |
+---------+-----------------------------+-------------------+--------+
| latin1 | cp1252 West European | latin1_swedish_ci | 1 |
| latin2 | ISO 8859-2 Central European | latin2_general_ci | 1 |
| latin5 | ISO 8859-9 Turkish | latin5_turkish_ci | 1 |
| latin7 | ISO 8859-13 Baltic | latin7_general_ci | 1 |
+---------+-----------------------------+-------------------+--------+

SHOW CHARACTER SET WHERE Maxlen LIKE '2';


+---------+---------------------------+-------------------+--------+
| Charset | Description | Default collation | Maxlen |
+---------+---------------------------+-------------------+--------+
| big5 | Big5 Traditional Chinese | big5_chinese_ci | 2 |
| sjis | Shift-JIS Japanese | sjis_japanese_ci | 2 |
| euckr | EUC-KR Korean | euckr_korean_ci | 2 |
| gb2312 | GB2312 Simplified Chinese | gb2312_chinese_ci | 2 |
| gbk | GBK Simplified Chinese | gbk_chinese_ci | 2 |
| ucs2 | UCS-2 Unicode | ucs2_general_ci | 2 |
| cp932 | SJIS for Windows Japanese | cp932_japanese_ci | 2 |
+---------+---------------------------+-------------------+--------+

See Also
Supported Character Sets and Collations
Setting Character Sets and Collations
Information Schema CHARACTER_SETS

1.1.1.2.8.7 SHOW CLIENT_STATISTICS


Syntax
SHOW CLIENT_STATISTICS

Description
The SHOW CLIENT_STATISTICS statement is part of the User Statistics feature. It was removed as a separate statement
in MariaDB 10.1.1 , but effectively replaced by the generic SHOW information_schema_table statement. The
information_schema.CLIENT_STATISTICS table holds statistics about client connections.
The userstat system variable must be set to 1 to activate this feature. See the User Statistics and
information_schema.CLIENT_STATISTICS articles for more information.

Example

220/3812
SHOW CLIENT_STATISTICS\G
*************************** 1. row ***************************
Client: localhost
Total_connections: 35
Concurrent_connections: 0
Connected_time: 708
Busy_time: 2.5557979999999985
Cpu_time: 0.04123740000000002
Bytes_received: 3883
Bytes_sent: 21595
Binlog_bytes_written: 0
Rows_read: 18
Rows_sent: 115
Rows_deleted: 0
Rows_inserted: 0
Rows_updated: 0
Select_commands: 70
Update_commands: 0
Other_commands: 0
Commit_transactions: 1
Rollback_transactions: 0
Denied_connections: 0
Lost_connections: 0
Access_denied: 0
Empty_queries: 35

1.1.1.2.8.8 SHOW COLLATION


1.1.1.2.8.9 SHOW COLUMNS
1.1.1.2.8.10 SHOW CONTRIBUTORS
Syntax
SHOW CONTRIBUTORS

Description
The SHOW CONTRIBUTORS statement displays information about the companies and people who financially contribute to
MariaDB. For each contributor, it displays Name , Location , and Comment values. All columns are encoded as latin1 .
It displays all members and sponsors of the MariaDB Foundation as well as other financial contributors.

Example

221/3812
SHOW CONTRIBUTORS;
+---------------------+-------------------------------+------------------------------------------------
-------------+
| Name | Location | Comment
|
+---------------------+-------------------------------+------------------------------------------------
-------------+
| Alibaba Cloud | https://www.alibabacloud.com/ | Platinum Sponsor of the MariaDB Foundation
|
| Tencent Cloud | https://cloud.tencent.com | Platinum Sponsor of the MariaDB Foundation
|
| Microsoft | https://microsoft.com/ | Platinum Sponsor of the MariaDB Foundation
|
| MariaDB Corporation | https://mariadb.com | Founding member, Platinum Sponsor of the
MariaDB Foundation |
| ServiceNow | https://servicenow.com | Platinum Sponsor of the MariaDB Foundation
|
| Intel | https://www.intel.com | Platinum Sponsor of the MariaDB Foundation
|
| SIT | https://sit.org | Platinum Sponsor of the MariaDB Foundation
|
| Visma | https://visma.com | Gold Sponsor of the MariaDB Foundation
|
| DBS | https://dbs.com | Gold Sponsor of the MariaDB Foundation
|
| IBM | https://www.ibm.com | Gold Sponsor of the MariaDB Foundation
|
| Automattic | https://automattic.com | Silver Sponsor of the MariaDB Foundation
|
| Percona | https://www.percona.com/ | Sponsor of the MariaDB Foundation
|
| Galera Cluster | https://galeracluster.com | Sponsor of the MariaDB Foundation
|
| Google | USA | Sponsoring encryption, parallel replication and
GTID |
| Facebook | USA | Sponsoring non-blocking API, LIMIT ROWS
EXAMINED etc |
| Ronald Bradford | Brisbane, Australia | EFF contribution for UC2006 Auction
|
| Sheeri Kritzer | Boston, Mass. USA | EFF contribution for UC2006 Auction
|
| Mark Shuttleworth | London, UK. | EFF contribution for UC2006 Auction
|
+---------------------+-------------------------------+------------------------------------------------
-------------+

See Also
Log of MariaDB contributors .
SHOW AUTHORS list the authors of MariaDB (including documentation, QA etc).
MariaDB Foundation page on contributing financially

1.1.1.2.8.11 SHOW CREATE DATABASE


Syntax
SHOW CREATE {DATABASE | SCHEMA} db_name

Contents
1. Syntax
2. Description
3. Examples
4. See Also

Description
Shows the CREATE DATABASE statement that creates the given database. SHOW CREATE SCHEMA is a synonym for
SHOW CREATE DATABASE . SHOW CREATE DATABASE quotes database names according to the value of the
sql_quote_show_create server system variable.

222/3812
Examples
SHOW CREATE DATABASE test;
+----------+-----------------------------------------------------------------+
| Database | Create Database |
+----------+-----------------------------------------------------------------+
| test | CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */ |
+----------+-----------------------------------------------------------------+

SHOW CREATE SCHEMA test;


+----------+-----------------------------------------------------------------+
| Database | Create Database |
+----------+-----------------------------------------------------------------+
| test | CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */ |
+----------+-----------------------------------------------------------------+

With sql_quote_show_create off:

SHOW CREATE DATABASE test;


+----------+---------------------------------------------------------------+
| Database | Create Database |
+----------+---------------------------------------------------------------+
| test | CREATE DATABASE test /*!40100 DEFAULT CHARACTER SET latin1 */ |
+----------+---------------------------------------------------------------+

With a comment, from MariaDB 10.5:

SHOW CREATE DATABASE p;


+----------+--------------------------------------------------------------------------------------+
| Database | Create Database |
+----------+--------------------------------------------------------------------------------------+
| p | CREATE DATABASE `p` /*!40100 DEFAULT CHARACTER SET latin1 */ COMMENT 'presentations' |
+----------+--------------------------------------------------------------------------------------+

See Also
CREATE DATABASE
ALTER DATABASE
Character Sets and Collations

1.1.1.2.8.12 SHOW CREATE EVENT


Syntax
SHOW CREATE EVENT event_name

Description
This statement displays the CREATE EVENT statement needed to re-create a given event, as well as the SQL_MODE that
was used when the trigger has been created and the character set used by the connection. To find out which events
are present, use SHOW EVENTS .
The output of this statement is unreliably affected by the sql_quote_show_create server system variable - see
http://bugs.mysql.com/bug.php?id=12719
The information_schema.EVENTS table provides similar, but more complete, information.

Examples

223/3812
SHOW CREATE EVENT test.e_daily\G
*************************** 1. row ***************************
Event: e_daily
sql_mode:
time_zone: SYSTEM
Create Event: CREATE EVENT `e_daily`
ON SCHEDULE EVERY 1 DAY
STARTS CURRENT_TIMESTAMP + INTERVAL 6 HOUR
ON COMPLETION NOT PRESERVE
ENABLE
COMMENT 'Saves total number of sessions then
clears the table each day'
DO BEGIN
INSERT INTO site_activity.totals (time, total)
SELECT CURRENT_TIMESTAMP, COUNT(*)
FROM site_activity.sessions;
DELETE FROM site_activity.sessions;
END
character_set_client: latin1
collation_connection: latin1_swedish_ci
Database Collation: latin1_swedish_ci

See also
Events Overview
CREATE EVENT
ALTER EVENT
DROP EVENT

1.1.1.2.8.13 SHOW CREATE FUNCTION


Syntax
SHOW CREATE FUNCTION func_name

Description
This statement is similar to SHOW CREATE PROCEDURE but for stored functions.
The output of this statement is unreliably affected by the sql_quote_show_create server system variable - see
http://bugs.mysql.com/bug.php?id=12719

Example
SHOW CREATE FUNCTION VatCents\G
*************************** 1. row ***************************
Function: VatCents
sql_mode:
Create Function: CREATE DEFINER=`root`@`localhost` FUNCTION `VatCents`(price DECIMAL(10,2))
RETURNS int(11)
DETERMINISTIC
BEGIN
DECLARE x INT;
SET x = price * 114;
RETURN x;
END
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: latin1_swedish_ci

See Also
Stored Functions
CREATE FUNCTION

1.1.1.2.8.14 SHOW CREATE PACKAGE


224/3812
MariaDB starting with 10.3.5
Oracle-style packages were introduced in MariaDB 10.3.5.

Syntax
SHOW CREATE PACKAGE [ db_name . ] package_name

Contents
1. Syntax
2. Description
3. Examples
4. See Also

Description
The SHOW CREATE PACKAGE statement can be used when Oracle SQL_MODE is set.
Shows the CREATE statement that creates the given package specification.

Examples
SHOW CREATE PACKAGE employee_tools\G
*************************** 1. row ***************************
Package: employee_tools
sql_mode:
PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUT
O_CREATE_USER
Create Package: CREATE DEFINER="root"@"localhost" PACKAGE "employee_tools" AS
FUNCTION getSalary(eid INT) RETURN DECIMAL(10,2);
PROCEDURE raiseSalary(eid INT, amount DECIMAL(10,2));
PROCEDURE raiseSalaryStd(eid INT);
PROCEDURE hire(ename TEXT, esalary DECIMAL(10,2));
END
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: latin1_swedish_ci

See Also
CREATE PACKAGE
DROP PACKAGE
CREATE PACKAGE BODY
SHOW CREATE PACKAGE BODY
DROP PACKAGE BODY
Oracle SQL_MODE

1.1.1.2.8.15 SHOW CREATE PACKAGE


BODY
MariaDB starting with 10.3.5
Oracle-style packages were introduced in MariaDB 10.3.5.

Syntax
SHOW CREATE PACKAGE BODY [ db_name . ] package_name

225/3812
Contents
1. Syntax
2. Description
3. Examples
4. See Also

Description
The SHOW CREATE PACKAGE BODY statement can be used when Oracle SQL_MODE is set.
Shows the CREATE statement that creates the given package body (i.e. the implementation).

Examples
SHOW CREATE PACKAGE BODY employee_tools\G
*************************** 1. row ***************************
Package body: employee_tools
sql_mode:
PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUT
O_CREATE_USER
Create Package Body: CREATE DEFINER="root"@"localhost" PACKAGE BODY "employee_tools" AS

stdRaiseAmount DECIMAL(10,2):=500;

PROCEDURE log (eid INT, ecmnt TEXT) AS


BEGIN
INSERT INTO employee_log (id, cmnt) VALUES (eid, ecmnt);
END;

PROCEDURE hire(ename TEXT, esalary DECIMAL(10,2)) AS


eid INT;
BEGIN
INSERT INTO employee (name, salary) VALUES (ename, esalary);
eid:= last_insert_id();
log(eid, 'hire ' || ename);
END;

FUNCTION getSalary(eid INT) RETURN DECIMAL(10,2) AS


nSalary DECIMAL(10,2);
BEGIN
SELECT salary INTO nSalary FROM employee WHERE id=eid;
log(eid, 'getSalary id=' || eid || ' salary=' || nSalary);
RETURN nSalary;
END;

PROCEDURE raiseSalary(eid INT, amount DECIMAL(10,2)) AS


BEGIN
UPDATE employee SET salary=salary+amount WHERE id=eid;
log(eid, 'raiseSalary id=' || eid || ' amount=' || amount);
END;

PROCEDURE raiseSalaryStd(eid INT) AS


BEGIN
raiseSalary(eid, stdRaiseAmount);
log(eid, 'raiseSalaryStd id=' || eid);
END;

BEGIN
log(0, 'Session ' || connection_id() || ' ' || current_user || ' started');
END
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: latin1_swedish_ci

See Also
CREATE PACKAGE
SHOW CREATE PACKAGE
DROP PACKAGE
CREATE PACKAGE BODY
DROP PACKAGE BODY
Oracle SQL_MODE

226/3812
1.1.1.2.8.16 SHOW CREATE PROCEDURE
Syntax
SHOW CREATE PROCEDURE proc_name

Contents
1. Syntax
2. Description
3. Examples
4. See Also

Description
This statement is a MariaDB extension. It returns the exact string that can be used to re-create the named stored
procedure, as well as the SQL_MODE that was used when the trigger has been created and the character set used by
the connection.. A similar statement, SHOW CREATE FUNCTION , displays information about stored functions.
Both statements require that you are the owner of the routine or have the SELECT privilege on the mysql.proc table.
When neither is true, the statements display NULL for the Create Procedure or Create Function field.

Warning Users with SELECT privileges on mysql.proc or USAGE privileges on *.* can view the text of routines,
even when they do not have privileges for the function or procedure itself.

The output of these statements is unreliably affected by the sql_quote_show_create server system variable - see
http://bugs.mysql.com/bug.php?id=12719

Examples
Here's a comparison of the SHOW CREATE PROCEDURE and SHOW CREATE FUNCTION statements.

SHOW CREATE PROCEDURE test.simpleproc\G


*************************** 1. row ***************************
Procedure: simpleproc
sql_mode:
Create Procedure: CREATE PROCEDURE `simpleproc`(OUT param1 INT)
BEGIN
SELECT COUNT(*) INTO param1 FROM t;
END
character_set_client: latin1
collation_connection: latin1_swedish_ci
Database Collation: latin1_swedish_ci

SHOW CREATE FUNCTION test.hello\G


*************************** 1. row ***************************
Function: hello
sql_mode:
Create Function: CREATE FUNCTION `hello`(s CHAR(20))
RETURNS CHAR(50)
RETURN CONCAT('Hello, ',s,'!')
character_set_client: latin1
collation_connection: latin1_swedish_ci
Database Collation: latin1_swedish_ci

When the user issuing the statement does not have privileges on the routine, attempting to CALL the procedure raises
Error 1370.

CALL test.prc1();
Error 1370 (42000): execute command denieed to user 'test_user'@'localhost' for routine 'test'.'prc1'

If the user neither has privilege to the routine nor the SELECT privilege on mysql.proc table, it raises Error 1305,
informing them that the procedure does not exist.

SHOW CREATE TABLES test.prc1\G


Error 1305 (42000): PROCEDURE prc1 does not exist

See Also
227/3812
Stored Procedure Overview
CREATE PROCEDURE
ALTER PROCEDURE
DROP PROCEDURE
SHOW PROCEDURE STATUS
Stored Routine Privileges
Information Schema ROUTINES Table

1.1.1.2.8.17 SHOW CREATE SEQUENCE


MariaDB starting with 10.3.1
Sequences were introduced in MariaDB 10.3.

Syntax
SHOW CREATE SEQUENCE sequence_name;

Contents
1. Syntax
2. Description
3. Example
4. Notes
5. See Also

Description
Shows the CREATE SEQUENCE statement that created the given sequence. The statement requires the SELECT
privilege for the table.

Example
CREATE SEQUENCE s1 START WITH 50;
SHOW CREATE SEQUENCE s1\G;
*************************** 1. row ***************************
Table: s1
Create Table: CREATE SEQUENCE `s1` start with 50 minvalue 1 maxvalue 9223372036854775806
increment by 1 cache 1000 nocycle ENGINE=InnoDB

Notes
If you want to see the underlying table structure used for the SEQUENCE you can use SHOW CREATE TABLE on the
SEQUENCE . You can also use SELECT to read the current recorded state of the SEQUENCE :

228/3812
SHOW CREATE TABLE s1\G
*************************** 1. row ***************************
Table: s1
Create Table: CREATE TABLE `s1` (
`next_not_cached_value` bigint(21) NOT NULL,
`minimum_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created
or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
`cache_size` bigint(21) unsigned NOT NULL,
`cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed,
1 if the sequence should begin a new cycle when maximum_value is passed',
`cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=InnoDB SEQUENCE=1

SELECT * FROM s1\G


*************************** 1. row ***************************
next_not_cached_value: 50
minimum_value: 1
maximum_value: 9223372036854775806
start_value: 50
increment: 1
cache_size: 1000
cycle_option: 0
cycle_count: 0

See Also
CREATE SEQUENCE
ALTER SEQUENCE

1.1.1.2.8.18 SHOW CREATE TABLE


1.1.1.2.8.19 SHOW CREATE TRIGGER
Syntax
SHOW CREATE TRIGGER trigger_name

Contents
1. Syntax
2. Description
3. Examples
4. See also

Description
This statement shows a CREATE TRIGGER statement that creates the given trigger, as well as the SQL_MODE that was
used when the trigger has been created and the character set used by the connection.
The output of this statement is unreliably affected by the sql_quote_show_create server system variable - see
http://bugs.mysql.com/bug.php?id=12719

Examples

229/3812
SHOW CREATE TRIGGER example\G
*************************** 1. row ***************************
Trigger: example
sql_mode: ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,STRICT_ALL_TABLES
,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_
ENGINE_SUBSTITUTION
SQL Original Statement: CREATE DEFINER=`root`@`localhost` TRIGGER example BEFORE
INSERT ON t FOR EACH ROW
BEGIN
SET NEW.c = NEW.c * 2;
END
character_set_client: cp850
collation_connection: cp850_general_ci
Database Collation: utf8_general_ci
Created: 2016-09-29 13:53:34.35

MariaDB starting with 10.2.3


The Created column was added in MySQL 5.7 and MariaDB 10.2.3 as part of introducing multiple trigger events
per action.

See also
Trigger Overview
CREATE TRIGGER
DROP TRIGGER
information_schema.TRIGGERS Table
SHOW TRIGGERS
Trigger Limitations

1.1.1.2.8.20 SHOW CREATE USER


1.1.1.2.8.21 SHOW CREATE VIEW
Syntax
SHOW CREATE VIEW view_name

Description
This statement shows a CREATE VIEW statement that creates the given view, as well as the character set used by the
connection when the view was created. This statement also works with views.
SHOW CREATE VIEW quotes table, column and stored function names according to the value of the
sql_quote_show_create server system variable.

Examples
SHOW CREATE VIEW example\G
*************************** 1. row ***************************
View: example
Create View: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL
SECURITY DEFINER VIEW `example` AS (select `t`.`id` AS `id`,`t`.`s` AS `s` from
`t`)
character_set_client: cp850
collation_connection: cp850_general_ci

With sql_quote_show_create off:

SHOW CREATE VIEW example\G


*************************** 1. row ***************************
View: example
Create View: CREATE ALGORITHM=UNDEFINED DEFINER=root@localhost SQL SECU
RITY DEFINER VIEW example AS (select t.id AS id,t.s AS s from t)
character_set_client: cp850
collation_connection: cp850_general_ci

230/3812
Grants
To be able to see a view, you need to have the SHOW VIEW and the SELECT privilege on the view:

GRANT SHOW VIEW,SELECT ON test_database.test_view TO 'test'@'localhost';

See Also
Grant privileges to tables, views etc

1.1.1.2.8.22 SHOW DATABASES


Syntax
SHOW {DATABASES | SCHEMAS}
[LIKE 'pattern' | WHERE expr]

Contents
1. Syntax
2. Description
3. Examples
4. See Also

Description
SHOW DATABASES lists the databases on the MariaDB server host. SHOW SCHEMAS is a synonym for SHOW DATABASES .
The LIKE clause, if present on its own, indicates which database names to match. The WHERE and LIKE clauses can
be given to select rows using more general conditions, as discussed in Extended SHOW.
You see only those databases for which you have some kind of privilege, unless you have the global SHOW
DATABASES privilege. You can also get this list using the mysqlshow command.
If the server was started with the --skip-show-database option, you cannot use this statement at all unless you have
the SHOW DATABASES privilege.
The list of results returned by SHOW DATABASES is based on directories in the data directory, which is how MariaDB
implements databases. It's possible that output includes directories that do not correspond to actual databases.
The Information Schema SCHEMATA table also contains database information.

Examples
SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+

SHOW DATABASES LIKE 'm%';


+---------------+
| Database (m%) |
+---------------+
| mysql |
+---------------+

See Also
CREATE DATABASE
ALTER DATABASE
DROP DATABASE
SHOW CREATE DATABASE
Character Sets and Collations
231/3812
Information Schema SCHEMATA Table

1.1.1.2.8.23 SHOW ENGINE


Contents
1. Syntax
2. Description
1. SHOW ENGINE INNODB STATUS
2. SHOW ENGINE INNODB MUTEX
3. SHOW ENGINE
PERFORMANCE_SCHEMA STATUS
4. SHOW ENGINE ROCKSDB STATUS

Syntax
SHOW ENGINE engine_name {STATUS | MUTEX}

Description
SHOW ENGINE displays operational information about a storage engine. The following statements currently are
supported:

SHOW ENGINE INNODB STATUS


SHOW ENGINE INNODB MUTEX
SHOW ENGINE PERFORMANCE_SCHEMA STATUS
SHOW ENGINE ROCKSDB STATUS

If the Sphinx Storage Engine is installed, the following is also supported:

SHOW ENGINE SPHINX STATUS

See SHOW ENGINE SPHINX STATUS .


Older (and now removed) synonyms were SHOW INNODB STATUS for SHOW ENGINE INNODB STATUS and SHOW MUTEX
STATUS for SHOW ENGINE INNODB MUTEX .

SHOW ENGINE INNODB STATUS


SHOW ENGINE INNODB STATUS displays extensive information from the standard InnoDB Monitor about the state of the
InnoDB storage engine. See SHOW ENGINE INNODB STATUS for more.

SHOW ENGINE INNODB MUTEX


SHOW ENGINE INNODB MUTEX displays InnoDB mutex statistics.

The statement displays the following output fields:


Type: Always InnoDB.
Name: The source file where the mutex is implemented, and the line number in the file where the mutex is
created. The line number is dependent on the MariaDB version.
Status: This field displays the following values if UNIV_DEBUG was defined at compilation time (for example, in
include/univ.h in the InnoDB part of the source tree). Only the os_waits value is displayed if UNIV_DEBUG was
not defined. Without UNIV_DEBUG , the information on which the output is based is insufficient to distinguish
regular mutexes and mutexes that protect rw-locks (which allow multiple readers or a single writer). Consequently,
the output may appear to contain multiple rows for the same mutex.
count indicates how many times the mutex was requested.
spin_waits indicates how many times the spinlock had to run.
spin_rounds indicates the number of spinlock rounds. (spin_rounds divided by spin_waits provides the
average round count.)
os_waits indicates the number of operating system waits. This occurs when the spinlock did not work (the
mutex was not locked during the spinlock and it was necessary to yield to the operating system and wait).
os_yields indicates the number of times a the thread trying to lock a mutex gave up its timeslice and
yielded to the operating system (on the presumption that allowing other threads to run will free the mutex so
that it can be locked).
os_wait_times indicates the amount of time (in ms) spent in operating system waits, if the timed_mutexes
system variable is 1 (ON). If timed_mutexes is 0 (OFF), timing is disabled, so os_wait_times is 0.
timed_mutexes is off by default.
Information from this statement can be used to diagnose system problems. For example, large values of spin_waits and
232/3812
spin_rounds may indicate scalability problems.
The information_schema.INNODB_MUTEXES table provides similar information.

SHOW ENGINE PERFORMANCE_SCHEMA STATUS


This statement shows how much memory is used for performance_schema tables and internal buffers.
The output contains the following fields:
Type: Always performance_schema .
Name: The name of a table, the name of an internal buffer, or the performance_schema word, followed by a dot
and an attribute. Internal buffers names are enclosed by parenthesis. performance_schema means that the
attribute refers to the whole database (it is a total).
Status: The value for the attribute.
The following attributes are shown, in this order, for all tables:
row_size: The memory used for an individual record. This value will never change.
row_count: The number of rows in the table or buffer. For some tables, this value depends on a server system
variable.
memory: For tables and performance_schema , this is the result of row_size * row_count .
For internal buffers, the attributes are:
count
size

SHOW ENGINE ROCKSDB STATUS


See also MyRocks Performance Troubleshooting

1.1.1.2.8.24 SHOW ENGINE INNODB STATUS


SHOW ENGINE INNODB STATUS is a specific form of the SHOW ENGINE statement that displays the InnoDB Monitor
output, which is extensive InnoDB information which can be useful in diagnosing problems.
The following sections are displayed
Status: Shows the timestamp, monitor name and the number of seconds, or the elapsed time between the
current time and the time the InnoDB Monitor output was last displayed. The per-second averages are based
upon this time.
BACKGROUND THREAD: srv_master_thread lines show work performed by the main background thread.
SEMAPHORES: Threads waiting for a semaphore and stats on how the number of times threads have needed a
spin or a wait on a mutex or rw-lock semaphore. If this number of threads is large, there may be I/O or contention
issues. Reducing the size of the innodb_thread_concurrency system variable may help if contention is related to
thread scheduling. Spin rounds per wait shows the number of spinlock rounds per OS wait for a mutex.
LATEST FOREIGN KEY ERROR: Only shown if there has been a foreign key constraint error, it displays the
failed statement and information about the constraint and the related tables.
LATEST DETECTED DEADLOCK: Only shown if there has been a deadlock, it displays the transactions
involved in the deadlock and the statements being executed, held and required locked and the transaction rolled
back to.
TRANSACTIONS: The output of this section can help identify lock contention, as well as reasons for the
deadlocks.
FILE I/O: InnoDB thread information as well as pending I/O operations and I/O performance statistics.
INSERT BUFFER AND ADAPTIVE HASH INDEX: InnoDB insert buffer (old name for the change buffer) and
adaptive hash index status information, including the number of each type of operation performed, and adaptive
hash index performance.
LOG: InnoDB log information, including current log sequence number, how far the log has been flushed to disk,
the position at which InnoDB last took a checkpoint, pending writes and write performance statistics.
BUFFER POOL AND MEMORY: Information on buffer pool pages read and written, which allows you to see the
number of data file I/O operations performed by your queries. See InnoDB Buffer Pool for more. Similar
information is also available from the INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS table.
ROW OPERATIONS:Information about the main thread, including the number and performance rate for each
type of row operation.
If the innodb_status_output_locks system variable is set to 1 , extended lock information will be displayed.
Example output:

=====================================
2019-09-06 12:44:13 0x7f93cc236700 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 4 seconds
-----------------
BACKGROUND THREAD
-----------------
233/3812
-----------------
srv_master_thread loops: 2 srv_active, 0 srv_shutdown, 83698 srv_idle
srv_master_thread log flush and writes: 83682
----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 15
OS WAIT ARRAY INFO: signal count 8
RW-shared spins 0, rounds 20, OS waits 7
RW-excl spins 0, rounds 0, OS waits 0
RW-sx spins 0, rounds 0, OS waits 0
Spin rounds per wait: 20.00 RW-shared, 0.00 RW-excl, 0.00 RW-sx
------------
TRANSACTIONS
------------
Trx id counter 236
Purge done for trx's n:o < 236 undo n:o < 0 state: running
History list length 22
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 421747401994584, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421747401990328, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
--------
FILE I/O
--------
I/O thread 0 state: waiting for completed aio requests (insert buffer thread)
I/O thread 1 state: waiting for completed aio requests (log thread)
I/O thread 2 state: waiting for completed aio requests (read thread)
I/O thread 3 state: waiting for completed aio requests (read thread)
I/O thread 4 state: waiting for completed aio requests (read thread)
I/O thread 5 state: waiting for completed aio requests (read thread)
I/O thread 6 state: waiting for completed aio requests (write thread)
I/O thread 7 state: waiting for completed aio requests (write thread)
I/O thread 8 state: waiting for completed aio requests (write thread)
I/O thread 9 state: waiting for completed aio requests (write thread)
Pending normal aio reads: [0, 0, 0, 0] , aio writes: [0, 0, 0, 0] ,
ibuf aio reads:, log i/o's:, sync i/o's:
Pending flushes (fsync) log: 0; buffer pool: 0
286 OS file reads, 171 OS file writes, 22 OS fsyncs
0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s
-------------------------------------
INSERT BUFFER AND ADAPTIVE HASH INDEX
-------------------------------------
Ibuf: size 1, free list len 0, seg size 2, 0 merges
merged operations:
insert 0, delete mark 0, delete 0
discarded operations:
insert 0, delete mark 0, delete 0
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
0.00 hash searches/s, 0.00 non-hash searches/s
---
LOG
---
Log sequence number 445926
Log flushed up to 445926
Pages flushed up to 445926
Last checkpoint at 445917
0 pending log flushes, 0 pending chkp writes
18 log i/o's done, 0.00 log i/o's/second
----------------------
BUFFER POOL AND MEMORY
----------------------
Total large memory allocated 167772160
Dictionary memory allocated 50768
Buffer pool size 8012
Free buffers 7611
Database pages 401
Old database pages 0
Modified db pages 0
Percent of dirty pages(LRU & free pages): 0.000
Max dirty pages percent: 75.000
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s 234/3812
0.00 youngs/s, 0.00 non-youngs/s
Pages read 264, created 137, written 156
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 401, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
--------------
ROW OPERATIONS
--------------
0 queries inside InnoDB, 0 queries in queue
0 read views open inside InnoDB
Process ID=4267, Main thread ID=140272021272320, state: sleeping
Number of rows inserted 1, updated 0, deleted 0, read 1
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
Number of system rows inserted 0, updated 0, deleted 0, read 0
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
----------------------------
END OF INNODB MONITOR OUTPUT
============================

1.1.1.2.8.25 SHOW ENGINES


Syntax
SHOW [STORAGE] ENGINES

Description
SHOW ENGINES displays status information about the server's storage engines. This is particularly useful for checking
whether a storage engine is supported, or to see what the default engine is. SHOW TABLE TYPES is a deprecated
synonym.
The information_schema.ENGINES table provides the same information.
Since storage engines are plugins, different information about them is also shown in the information_schema.PLUGINS
table and by the SHOW PLUGINS statement.
Note that both MySQL's InnoDB and Percona's XtraDB replacement are labeled as InnoDB . However, if XtraDB is in
use, it will be specified in the COMMENT field. See XtraDB and InnoDB. The same applies to FederatedX .
The output consists of the following columns:
Engine indicates the engine's name.
Support indicates whether the engine is installed, and whether it is the default engine for the current session.
Comment is a brief description.
Transactions , XA and Savepoints indicate whether transactions, XA transactions and transaction savepoints
are supported by the engine.

Examples

235/3812
SHOW ENGINES\G
*************************** 1. row ***************************
Engine: InnoDB
Support: DEFAULT
Comment: Supports transactions, row-level locking, and foreign keys
Transactions: YES
XA: YES
Savepoints: YES
*************************** 2. row ***************************
Engine: CSV
Support: YES
Comment: CSV storage engine
Transactions: NO
XA: NO
Savepoints: NO
*************************** 3. row ***************************
Engine: MyISAM
Support: YES
Comment: MyISAM storage engine
Transactions: NO
XA: NO
Savepoints: NO
*************************** 4. row ***************************
Engine: BLACKHOLE
Support: YES
Comment: /dev/null storage engine (anything you write to it disappears)
Transactions: NO
XA: NO
Savepoints: NO
*************************** 5. row ***************************
Engine: FEDERATED
Support: YES
Comment: FederatedX pluggable storage engine
Transactions: YES
XA: NO
Savepoints: YES
*************************** 6. row ***************************
Engine: MRG_MyISAM
Support: YES
Comment: Collection of identical MyISAM tables
Transactions: NO
XA: NO
Savepoints: NO
*************************** 7. row ***************************
Engine: ARCHIVE
Support: YES
Comment: Archive storage engine
Transactions: NO
XA: NO
Savepoints: NO
*************************** 8. row ***************************
Engine: MEMORY
Support: YES
Comment: Hash based, stored in memory, useful for temporary tables
Transactions: NO
XA: NO
Savepoints: NO
*************************** 9. row ***************************
Engine: PERFORMANCE_SCHEMA
Support: YES
Comment: Performance Schema
Transactions: NO
XA: NO
Savepoints: NO
*************************** 10. row ***************************
Engine: Aria
Support: YES
Comment: Crash-safe tables with MyISAM heritage
Transactions: NO
XA: NO
Savepoints: NO
10 rows in set (0.00 sec)

1.1.1.2.8.26 SHOW ERRORS


Syntax
236/3812
SHOW ERRORS [LIMIT [offset,] row_count]
SHOW ERRORS [LIMIT row_count OFFSET offset]
SHOW COUNT(*) ERRORS

Contents
1. Syntax
2. Description
3. Examples

Description
This statement is similar to SHOW WARNINGS, except that instead of displaying errors, warnings, and notes, it displays
only errors.
The LIMIT clause has the same syntax as for the SELECT statement.
The SHOW COUNT(*) ERRORS statement displays the number of errors. You can also retrieve this number from the
error_count variable.

SHOW COUNT(*) ERRORS;


SELECT @@error_count;

The value of error_count might be greater than the number of messages displayed by SHOW WARNINGS if the
max_error_count system variable is set so low that not all messages are stored.
For a list of MariaDB error codes, see MariaDB Error Codes.

Examples
SELECT f();
ERROR 1305 (42000): FUNCTION f does not exist

SHOW COUNT(*) ERRORS;


+-----------------------+
| @@session.error_count |
+-----------------------+
| 1 |
+-----------------------+

SHOW ERRORS;
+-------+------+---------------------------+
| Level | Code | Message |
+-------+------+---------------------------+
| Error | 1305 | FUNCTION f does not exist |
+-------+------+---------------------------+

1.1.1.2.8.27 SHOW EVENTS


Syntax
SHOW EVENTS [{FROM | IN} schema_name]
[LIKE 'pattern' | WHERE expr]

Description
Shows information about Event Manager events (created with CREATE EVENT ). Requires the EVENT privilege. Without
any arguments, SHOW EVENTS lists all of the events in the current schema:

237/3812
SELECT CURRENT_USER(), SCHEMA();
+----------------+----------+
| CURRENT_USER() | SCHEMA() |
+----------------+----------+
| jon@ghidora | myschema |
+----------------+----------+

SHOW EVENTS\G
*************************** 1. row ***************************
Db: myschema
Name: e_daily
Definer: jon@ghidora
Time zone: SYSTEM
Type: RECURRING
Execute at: NULL
Interval value: 10
Interval field: SECOND
Starts: 2006-02-09 10:41:23
Ends: NULL
Status: ENABLED
Originator: 0
character_set_client: latin1
collation_connection: latin1_swedish_ci
Database Collation: latin1_swedish_ci

To see the event action, use SHOW CREATE EVENT instead, or look at the information_schema.EVENTS table.
To see events for a specific schema, use the FROM clause. For example, to see events for the test schema, use the
following statement:

SHOW EVENTS FROM test;

The LIKE clause, if present, indicates which event names to match. The WHERE clause can be given to select rows
using more general conditions, as discussed in Extended Show.

1.1.1.2.8.28 SHOW FUNCTION CODE


1.1.1.2.8.29 SHOW FUNCTION STATUS
Syntax
SHOW FUNCTION STATUS
[LIKE 'pattern' | WHERE expr]

Description
This statement is similar to SHOW PROCEDURE STATUS but for stored functions.
The LIKE clause, if present on its own, indicates which function names to match.
The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in Extended
SHOW.
The information_schema.ROUTINES table contains more detailed information.

Examples
Showing all stored functions:

238/3812
SHOW FUNCTION STATUS\G
*************************** 1. row ***************************
Db: test
Name: VatCents
Type: FUNCTION
Definer: root@localhost
Modified: 2013-06-01 12:40:31
Created: 2013-06-01 12:40:31
Security_type: DEFINER
Comment:
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: latin1_swedish_ci

Stored functions whose name starts with 'V':

SHOW FUNCTION STATUS LIKE 'V%' \G


*************************** 1. row ***************************
Db: test
Name: VatCents
Type: FUNCTION
Definer: root@localhost
Modified: 2013-06-01 12:40:31
Created: 2013-06-01 12:40:31
Security_type: DEFINER
Comment:
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: latin1_swedish_ci

Stored functions with a security type of 'DEFINER':

SHOW FUNCTION STATUS WHERE Security_type LIKE 'DEFINER' \G


*************************** 1. row ***************************
Db: test
Name: VatCents
Type: FUNCTION
Definer: root@localhost
Modified: 2013-06-01 12:40:31
Created: 2013-06-01 12:40:31
Security_type: DEFINER
Comment:
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: latin1_swedish_ci

1.1.1.2.8.30 SHOW GRANTS


1.1.1.2.8.31 SHOW INDEX
1.1.1.2.8.32 SHOW INDEX_STATISTICS
Syntax
SHOW INDEX_STATISTICS

Description
The SHOW INDEX_STATISTICS statement was introduced in MariaDB 5.2 as part of the User Statistics feature. It was
removed as a separate statement in MariaDB 10.1.1 , but effectively replaced by the generic SHOW
information_schema_table statement. The information_schmea.INDEX_STATISTICS table shows statistics on index
usage and makes it possible to do such things as locating unused indexes and generating the commands to remove
them.
The userstat system variable must be set to 1 to activate this feature. See the User Statistics and
information_schema.INDEX_STATISTICS table for more information.

239/3812
Example
SHOW INDEX_STATISTICS;
+--------------+-------------------+------------+-----------+
| Table_schema | Table_name | Index_name | Rows_read |
+--------------+-------------------+------------+-----------+
| test | employees_example | PRIMARY | 1 |
+--------------+-------------------+------------+-----------+

1.1.1.2.8.34 SHOW LOCALES


SHOW LOCALES was introduced as part of the Information Schema plugin extension .

SHOW LOCALES is used to return locales information as part of the Locales plugin. While the
information_schema.LOCALES table has 8 columns, the SHOW LOCALES statement will only display 4 of them:

Example
SHOW LOCALES;
+-----+-------+-------------------------------------+------------------------+
| Id | Name | Description | Error_Message_Language |
+-----+-------+-------------------------------------+------------------------+
| 0 | en_US | English - United States | english |
| 1 | en_GB | English - United Kingdom | english |
| 2 | ja_JP | Japanese - Japan | japanese |
| 3 | sv_SE | Swedish - Sweden | swedish |
...

1.1.1.2.8.35 SHOW BINLOG STATUS


1.1.1.2.8.36 SHOW OPEN TABLES
Syntax
SHOW OPEN TABLES [FROM db_name]
[LIKE 'pattern' | WHERE expr]

Description
SHOW OPEN TABLES lists the non- TEMPORARY tables that are currently open in the table cache. See
http://dev.mysql.com/doc/refman/5.1/en/table-cache.html .
The FROM and LIKE clauses may be used.
The FROM clause, if present, restricts the tables shown to those present in the db_name database.
The LIKE clause, if present on its own, indicates which table names to match. The WHERE and LIKE clauses can be
given to select rows using more general conditions, as discussed in Extended SHOW.
The following information is returned:

Column Description
Database Database name.
Name Table name.
In_use Number of table instances being used.
Name_locked 1 if the table is name-locked, e.g. if it is being dropped or renamed, otherwise 0 .

Before MariaDB 5.5, each use of, for example, LOCK TABLE ... WRITE would increment In_use for that table. With the
implementation of the metadata locking improvements in MariaDB 5.5, LOCK TABLE... WRITE acquires a strong MDL
lock, and concurrent connections will wait on this MDL lock, so any subsequent LOCK TABLE... WRITE will not
increment In_use .

240/3812
Example
SHOW OPEN TABLES;
+----------+---------------------------+--------+-------------+
| Database | Table | In_use | Name_locked |
+----------+---------------------------+--------+-------------+
...
| test | xjson | 0 | 0 |
| test | jauthor | 0 | 0 |
| test | locks | 1 | 0 |
...
+----------+---------------------------+--------+-------------+

1.1.1.2.8.37 SHOW PACKAGE BODY STATUS


MariaDB starting with 10.3.5
Oracle-style packages were introduced in MariaDB 10.3.5.

Syntax
SHOW PACKAGE BODY STATUS
[LIKE 'pattern' | WHERE expr]

Contents
1. Syntax
2. Description
3. Examples
4. See Also

Description
The SHOW PACKAGE BODY STATUS statement returns characteristics of stored package bodies (implementations), such as
the database, name, type, creator, creation and modification dates, and character set information. A similar statement,
SHOW PACKAGE STATUS , displays information about stored package specifications.
The LIKE clause, if present, indicates which package names to match. The WHERE and LIKE clauses can be given to
select rows using more general conditions, as discussed in Extended SHOW.
The ROUTINES table in the INFORMATION_SCHEMA database contains more detailed information.

Examples
SHOW PACKAGE BODY STATUS LIKE 'pkg1'\G
*************************** 1. row ***************************
Db: test
Name: pkg1
Type: PACKAGE BODY
Definer: root@localhost
Modified: 2018-02-27 14:44:14
Created: 2018-02-27 14:44:14
Security_type: DEFINER
Comment: This is my first package body
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: latin1_swedish_ci

See Also
SHOW PACKAGE STATUS
SHOW CREATE PACKAGE BODY
CREATE PACKAGE BODY
DROP PACKAGE BODY
Oracle SQL_MODE

241/3812
1.1.1.2.8.38 SHOW PACKAGE STATUS
MariaDB starting with 10.3.5
Oracle-style packages were introduced in MariaDB 10.3.5.

Syntax
SHOW PACKAGE STATUS
[LIKE 'pattern' | WHERE expr]

Contents
1. Syntax
2. Description
3. Examples
4. See Also

Description
The SHOW PACKAGE STATUS statement returns characteristics of stored package specifications, such as the database,
name, type, creator, creation and modification dates, and character set information. A similar statement, SHOW PACKAGE
BODY STATUS , displays information about stored package bodies (i.e. implementations).

The LIKE clause, if present, indicates which package names to match. The WHERE and LIKE clauses can be given to
select rows using more general conditions, as discussed in Extended SHOW.
The ROUTINES table in the INFORMATION_SCHEMA database contains more detailed information.

Examples
SHOW PACKAGE STATUS LIKE 'pkg1'\G
*************************** 1. row ***************************
Db: test
Name: pkg1
Type: PACKAGE
Definer: root@localhost
Modified: 2018-02-27 14:38:15
Created: 2018-02-27 14:38:15
Security_type: DEFINER
Comment: This is my first package
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: latin1_swedish_ci

See Also
SHOW PACKAGE BODY
SHOW CREATE PACKAGE
CREATE PACKAGE
DROP PACKAGE
Oracle SQL_MODE

1.1.1.2.8.39 SHOW PLUGINS


1.1.1.2.8.40 SHOW PLUGINS SONAME
1.1.1.2.8.41 SHOW PRIVILEGES
Syntax
SHOW PRIVILEGES

242/3812
Description
SHOW PRIVILEGES shows the list of system privileges that the MariaDB server supports. The exact list of privileges
depends on the version of your server.
Note that before MariaDB 10.3.23, MariaDB 10.4.13 and MariaDB 10.5.2 , the Delete history privilege displays as
Delete versioning rows (MDEV-20382 ).

Example
From MariaDB 10.5.9

SHOW PRIVILEGES;
+--------------------------+---------------------------------------+-----------------------------------
---------------------------------+
| Privilege | Context | Comment
|
+--------------------------+---------------------------------------+-----------------------------------
---------------------------------+
| Alter | Tables | To alter the table
|
| Alter routine | Functions,Procedures | To alter or drop stored
functions/procedures |
| Create | Databases,Tables,Indexes | To create new databases and tables
|
| Create routine | Databases | To use CREATE FUNCTION/PROCEDURE
|
| Create temporary tables | Databases | To use CREATE TEMPORARY TABLE
|
| Create view | Tables | To create new views
|
| Create user | Server Admin | To create new users
|
| Delete | Tables | To delete existing rows
|
| Delete history | Tables | To delete versioning table
historical rows |
| Drop | Databases,Tables | To drop databases, tables, and
views |
| Event | Server Admin | To create, alter, drop and execute
events |
| Execute | Functions,Procedures | To execute stored routines
|
| File | File access on server | To read and write files on the
server |
| Grant option | Databases,Tables,Functions,Procedures | To give to other users those
privileges you possess |
| Index | Tables | To create or drop indexes
|
| Insert | Tables | To insert data into tables
|
| Lock tables | Databases | To use LOCK TABLES (together with
SELECT privilege) |
| Process | Server Admin | To view the plain text of
currently executing queries |
| Proxy | Server Admin | To make proxy user possible
|
| References | Databases,Tables | To have references on tables
|
| Reload | Server Admin | To reload or refresh tables, logs
and privileges |
| Binlog admin | Server | To purge binary logs
|
| Binlog monitor | Server | To use SHOW BINLOG STATUS and SHOW
BINARY LOG |
| Binlog replay | Server | To use BINLOG (generated by
mariadb-binlog) |
| Replication master admin | Server | To monitor connected slaves
|
| Replication slave admin | Server | To start/stop slave and apply
binlog events |
| Slave monitor | Server | To use SHOW SLAVE STATUS and SHOW
RELAYLOG EVENTS |
| Replication slave | Server Admin | To read binary log events from the
master |
| Select | Tables | To retrieve rows from table
|
| Show databases | Server Admin | To see all databases with SHOW
DATABASES |
| Show view | Tables | To see views with SHOW CREATE VIEW
243/3812
| Show view | Tables | To see views with SHOW CREATE VIEW
|
| Shutdown | Server Admin | To shut down the server
|
| Super | Server Admin | To use KILL thread, SET GLOBAL,
CHANGE MASTER, etc. |
| Trigger | Tables | To use triggers
|
| Create tablespace | Server Admin | To create/alter/drop tablespaces
|
| Update | Tables | To update existing rows
|
| Set user | Server | To create views and stored
routines with a different definer |
| Federated admin | Server | To execute the CREATE SERVER,
ALTER SERVER, DROP SERVER statements |
| Connection admin | Server | To bypass connection limits and
kill other users' connections |
| Read_only admin | Server | To perform write operations even
if @@read_only=ON |
| Usage | Server Admin | No privileges - allow connect only
|
+--------------------------+---------------------------------------+-----------------------------------
---------------------------------+
41 rows in set (0.000 sec)

See Also
SHOW CREATE USER shows how the user was created.
SHOW GRANTS shows the GRANTS/PRIVILEGES for a user.

1.1.1.2.8.42 SHOW PROCEDURE CODE


Syntax
SHOW PROCEDURE CODE proc_name

Contents
1. Syntax
2. Description
3. Examples
4. See Also

Description
This statement is a MariaDB extension that is available only for servers that have been built with debugging support. It
displays a representation of the internal implementation of the named stored procedure. A similar statement, SHOW
FUNCTION CODE , displays information about stored functions.
Both statements require that you be the owner of the routine or have SELECT access to the mysql.proc table.
If the named routine is available, each statement produces a result set. Each row in the result set corresponds to one
"instruction" in the routine. The first column is Pos, which is an ordinal number beginning with 0. The second column is
Instruction, which contains an SQL statement (usually changed from the original source), or a directive which has
meaning only to the stored-routine handler.

Examples

244/3812
DELIMITER //

CREATE PROCEDURE p1 ()
BEGIN
DECLARE fanta INT DEFAULT 55;
DROP TABLE t2;
LOOP
INSERT INTO t3 VALUES (fanta);
END LOOP;
END//
Query OK, 0 rows affected (0.00 sec)

SHOW PROCEDURE CODE p1//


+-----+----------------------------------------+
| Pos | Instruction |
+-----+----------------------------------------+
| 0 | set fanta@0 55 |
| 1 | stmt 9 "DROP TABLE t2" |
| 2 | stmt 5 "INSERT INTO t3 VALUES (fanta)" |
| 3 | jump 2 |
+-----+----------------------------------------+

See Also
Stored Procedure Overview
CREATE PROCEDURE
ALTER PROCEDURE
DROP PROCEDURE
SHOW CREATE PROCEDURE
SHOW PROCEDURE STATUS
Stored Routine Privileges
Information Schema ROUTINES Table

1.1.1.2.8.43 SHOW PROCEDURE STATUS


Syntax
SHOW PROCEDURE STATUS
[LIKE 'pattern' | WHERE expr]

Description
This statement is a MariaDB extension. It returns characteristics of a stored procedure, such as the database, name,
type, creator, creation and modification dates, and character set information. A similar statement, SHOW FUNCTION
STATUS , displays information about stored functions.

The LIKE clause, if present, indicates which procedure or function names to match. The WHERE and LIKE clauses can
be given to select rows using more general conditions, as discussed in Extended SHOW.
The ROUTINES table in the INFORMATION_SCHEMA database contains more detailed information.

Examples
SHOW PROCEDURE STATUS LIKE 'p1'\G
*************************** 1. row ***************************
Db: test
Name: p1
Type: PROCEDURE
Definer: root@localhost
Modified: 2010-08-23 13:23:03
Created: 2010-08-23 13:23:03
Security_type: DEFINER
Comment:
character_set_client: latin1
collation_connection: latin1_swedish_ci
Database Collation: latin1_swedish_ci

See Also
245/3812
Stored Procedure Overview
CREATE PROCEDURE
ALTER PROCEDURE
DROP PROCEDURE
SHOW CREATE PROCEDURE
Stored Routine Privileges
Information Schema ROUTINES Table

1.1.1.2.8.44 SHOW PROCESSLIST


Syntax
SHOW [FULL] PROCESSLIST

Description
SHOW PROCESSLIST shows you which threads are running. You can also get this information from the
information_schema.PROCESSLIST table or the mysqladmin processlist command. If you have the PROCESS
privilege , you can see all threads. Otherwise, you can see only your own threads (that is, threads associated with the
MariaDB account that you are using). If you do not use the FULL keyword, only the first 100 characters of each
statement are shown in the Info field.
The columns shown in SHOW PROCESSLIST are:

Name Description
ID The client's process ID.
USER The username associated with the process.
HOST The host the client is connected to.
DB The default database of the process (NULL if no default).
COMMAND The command type. See Thread Command Values.
The amount of time, in seconds, the process has been in its current state. For a replica SQL thread
TIME before MariaDB 10.1, this is the time in seconds between the last replicated event's timestamp and the
replica machine's real time.
STATE See Thread States.
INFO The statement being executed.
PROGRESS The total progress of the process (0-100%) (see Progress Reporting).

See TIME_MS column in information_schema.PROCESSLIST for differences in the TIME column between MariaDB and
MySQL.
The information_schema.PROCESSLIST table contains the following additional columns:

Name Description
TIME_MS The amount of time, in milliseconds, the process has been in its current state.
STAGE The stage the process is currently in.
MAX_STAGE The maximum number of stages.
PROGRESS The progress of the process within the current stage (0-100%).
MEMORY_USED The amount of memory used by the process.
EXAMINED_ROWS The number of rows the process has examined.
QUERY_ID Query ID.

Note that the PROGRESS field from the information schema, and the PROGRESS field from SHOW PROCESSLIST display
different results. SHOW PROCESSLIST shows the total progress, while the information schema shows the progress for the
current stage only.
Threads can be killed using their thread_id or their query_id, with the KILL statement.
Since queries on this table are locking, if the performance_schema is enabled, you may want to query the THREADS
table instead.

246/3812
Examples
SHOW PROCESSLIST;
+----+-----------------+-----------+------+---------+------+------------------------+------------------
+----------+
| Id | User | Host | db | Command | Time | State | Info
| Progress |
+----+-----------------+-----------+------+---------+------+------------------------+------------------
+----------+
| 2 | event_scheduler | localhost | NULL | Daemon | 2693 | Waiting on empty queue | NULL
| 0.000 |
| 4 | root | localhost | NULL | Query | 0 | Table lock | SHOW PROCESSLIST
| 0.000 |
+----+-----------------+-----------+------+---------+------+------------------------+------------------
+----------+

See Also
CONNECTION_ID()

1.1.1.2.8.45 SHOW PROFILE


Syntax
SHOW PROFILE [type [, type] ... ]
[FOR QUERY n]
[LIMIT row_count [OFFSET offset]]

type:
ALL
| BLOCK IO
| CONTEXT SWITCHES
| CPU
| IPC
| MEMORY
| PAGE FAULTS
| SOURCE
| SWAPS

Description
The SHOW PROFILE and SHOW PROFILES statements display profiling information that indicates resource usage for
statements executed during the course of the current session.
Profiling is controlled by the profiling session variable, which has a default value of 0 ( OFF ). Profiling is enabled by
setting profiling to 1 or ON :

SET profiling = 1;

SHOW PROFILES displays a list of the most recent statements sent to the master. The size of the list is controlled by the
profiling_history_size session variable, which has a default value of 15 . The maximum value is 100 . Setting the
value to 0 has the practical effect of disabling profiling.
All statements are profiled except SHOW PROFILES and SHOW PROFILE , so you will find neither of those statements in the
profile list. Malformed statements are profiled. For example, SHOW PROFILING is an illegal statement, and a syntax error
occurs if you try to execute it, but it will show up in the profiling list.
SHOW PROFILE displays detailed information about a single statement. Without the FOR QUERY n clause, the output
pertains to the most recently executed statement. If FOR QUERY n is included, SHOW PROFILE displays information for
statement n. The values of n correspond to the Query_ID values displayed by SHOW PROFILES .
The LIMIT row_count clause may be given to limit the output to row_count rows. If LIMIT is given, OFFSET offset
may be added to begin the output offset rows into the full set of rows.
By default, SHOW PROFILE displays Status and Duration columns. The Status values are like the State values displayed
by SHOW PROCESSLIST , although there might be some minor differences in interpretation for the two statements for some
status values (see http://dev.mysql.com/doc/refman/5.6/en/thread-information.html ).
Optional type values may be specified to display specific additional types of information:
ALL displays all information

247/3812
BLOCK IO displays counts for block input and output operations
CONTEXT SWITCHES displays counts for voluntary and involuntary context switches
CPU displays user and system CPU usage times
IPC displays counts for messages sent and received
MEMORY is not currently implemented
PAGE FAULTS displays counts for major and minor page faults
SOURCE displays the names of functions from the source code, together with the name and line number of the file
in which the function occurs
SWAPS displays swap counts
Profiling is enabled per session. When a session ends, its profiling information is lost.
The information_schema.PROFILING table contains similar information.

Examples

248/3812
SELECT @@profiling;
+-------------+
| @@profiling |
+-------------+
| 0 |
+-------------+

SET profiling = 1;

USE test;

DROP TABLE IF EXISTS t1;

CREATE TABLE T1 (id INT);

SHOW PROFILES;
+----------+------------+--------------------------+
| Query_ID | Duration | Query |
+----------+------------+--------------------------+
| 1 | 0.00009200 | SELECT DATABASE() |
| 2 | 0.00023800 | show databases |
| 3 | 0.00018900 | show tables |
| 4 | 0.00014700 | DROP TABLE IF EXISTS t1 |
| 5 | 0.24476900 | CREATE TABLE T1 (id INT) |
+----------+------------+--------------------------+

SHOW PROFILE;
+----------------------+----------+
| Status | Duration |
+----------------------+----------+
| starting | 0.000042 |
| checking permissions | 0.000044 |
| creating table | 0.244645 |
| After create | 0.000013 |
| query end | 0.000003 |
| freeing items | 0.000016 |
| logging slow query | 0.000003 |
| cleaning up | 0.000003 |
+----------------------+----------+

SHOW PROFILE FOR QUERY 4;


+--------------------+----------+
| Status | Duration |
+--------------------+----------+
| starting | 0.000126 |
| query end | 0.000004 |
| freeing items | 0.000012 |
| logging slow query | 0.000003 |
| cleaning up | 0.000002 |
+--------------------+----------+

SHOW PROFILE CPU FOR QUERY 5;


+----------------------+----------+----------+------------+
| Status | Duration | CPU_user | CPU_system |
+----------------------+----------+----------+------------+
| starting | 0.000042 | 0.000000 | 0.000000 |
| checking permissions | 0.000044 | 0.000000 | 0.000000 |
| creating table | 0.244645 | 0.000000 | 0.000000 |
| After create | 0.000013 | 0.000000 | 0.000000 |
| query end | 0.000003 | 0.000000 | 0.000000 |
| freeing items | 0.000016 | 0.000000 | 0.000000 |
| logging slow query | 0.000003 | 0.000000 | 0.000000 |
| cleaning up | 0.000003 | 0.000000 | 0.000000 |
+----------------------+----------+----------+------------+

1.1.1.2.8.46 SHOW PROFILES


Syntax
SHOW PROFILES

Description
The SHOW PROFILES statement displays profiling information that indicates resource usage for statements executed
249/3812
during the course of the current session. It is used together with SHOW PROFILE .

1.1.1.2.8.47 SHOW
QUERY_RESPONSE_TIME
It is possible to use SHOW QUERY_RESPONSE_TIME as an alternative for retrieving information from the
QUERY_RESPONSE_TIME plugin.
This was introduced as part of the Information Schema plugin extension .

1.1.1.2.8.48 SHOW RELAYLOG EVENTS


1.1.1.2.8.49 SHOW REPLICA HOSTS
1.1.1.2.8.50 SHOW REPLICA STATUS
1.1.1.2.8.51 SHOW STATUS
Syntax
SHOW [GLOBAL | SESSION] STATUS
[LIKE 'pattern' | WHERE expr]

Description
SHOW STATUS provides server status information. This information also can be obtained using the mysqladmin
extended-status command, or by querying the Information Schema GLOBAL_STATUS and SESSION_STATUS
tables. The LIKE clause, if present, indicates which variable names to match. The WHERE clause can be given to select
rows using more general conditions.
With the GLOBAL modifier, SHOW STATUS displays the status values for all connections to MariaDB. With SESSION , it
displays the status values for the current connection. If no modifier is present, the default is SESSION . LOCAL is a
synonym for SESSION . If you see a lot of 0 values, the reason is probably that you have used SHOW STATUS with a new
connection instead of SHOW GLOBAL STATUS .
Some status variables have only a global value. For these, you get the same value for both GLOBAL and SESSION .
See Server Status Variables for a full list, scope and description of the variables that can be viewed with SHOW STATUS .
The LIKE clause, if present on its own, indicates which variable name to match.
The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in Extended
SHOW.

Examples
Full output from MariaDB 10.1.17 :

SHOW GLOBAL STATUS;


+--------------------------------------------------------------+---------------------------------------
-+
| Variable_name | Value
|
+--------------------------------------------------------------+---------------------------------------
-+
| Aborted_clients | 0
|
| Aborted_connects | 0
|
| Access_denied_errors | 0
|
| Acl_column_grants | 0
|
| Acl_database_grants | 2
|
| Acl_function_grants | 0
|
| Acl_procedure_grants | 0 250/3812
| Acl_procedure_grants | 0
|
| Acl_proxy_users | 2
|
| Acl_role_grants | 0
|
| Acl_roles | 0
|
| Acl_table_grants | 0
|
| Acl_users | 6
|
| Aria_pagecache_blocks_not_flushed | 0
|
| Aria_pagecache_blocks_unused | 15706
|
| Aria_pagecache_blocks_used | 0
|
| Aria_pagecache_read_requests | 0
|
| Aria_pagecache_reads | 0
|
| Aria_pagecache_write_requests | 0
|
| Aria_pagecache_writes | 0
|
| Aria_transaction_log_syncs | 0
|
| Binlog_commits | 0
|
| Binlog_group_commits | 0
|
| Binlog_group_commit_trigger_count | 0
|
| Binlog_group_commit_trigger_lock_wait | 0
|
| Binlog_group_commit_trigger_timeout | 0
|
| Binlog_snapshot_file |
|
| Binlog_snapshot_position | 0
|
| Binlog_bytes_written | 0
|
| Binlog_cache_disk_use | 0
|
| Binlog_cache_use | 0
|
| Binlog_stmt_cache_disk_use | 0
|
| Binlog_stmt_cache_use | 0
|
| Busy_time | 0.000000
|
| Bytes_received | 432
|
| Bytes_sent | 15183
|
| Com_admin_commands | 1
|
| Com_alter_db | 0
|
| Com_alter_db_upgrade | 0
|
| Com_alter_event | 0
|
| Com_alter_function | 0
|
| Com_alter_procedure | 0
|
| Com_alter_server | 0
|
| Com_alter_table | 0
|
| Com_alter_tablespace | 0
|
| Com_analyze | 0
|
| Com_assign_to_keycache | 0
|
| Com_begin | 0
|
251/3812
| Com_binlog | 0
|
| Com_call_procedure | 0
|
| Com_change_db | 0
|
| Com_change_master | 0
|
| Com_check | 0
|
| Com_checksum | 0
|
| Com_commit | 0
|
| Com_compound_sql | 0
|
| Com_create_db | 0
|
| Com_create_event | 0
|
| Com_create_function | 0
|
| Com_create_index | 0
|
| Com_create_procedure | 0
|
| Com_create_role | 0
|
| Com_create_server | 0
|
| Com_create_table | 0
|
| Com_create_temporary_table | 0
|
| Com_create_trigger | 0
|
| Com_create_udf | 0
|
| Com_create_user | 0
|
| Com_create_view | 0
|
| Com_dealloc_sql | 0
|
| Com_delete | 0
|
| Com_delete_multi | 0
|
| Com_do | 0
|
| Com_drop_db | 0
|
| Com_drop_event | 0
|
| Com_drop_function | 0
|
| Com_drop_index | 0
|
| Com_drop_procedure | 0
|
| Com_drop_role | 0
|
| Com_drop_server | 0
|
| Com_drop_table | 0
|
| Com_drop_temporary_table | 0
|
| Com_drop_trigger | 0
|
| Com_drop_user | 0
|
| Com_drop_view | 0
|
| Com_empty_query | 0
|
| Com_execute_sql | 0
|
| Com_flush | 0
|
| Com_get_diagnostics | 0
|
252/3812
|
| Com_grant | 0
|
| Com_grant_role | 0
|
| Com_ha_close | 0
|
| Com_ha_open | 0
|
| Com_ha_read | 0
|
| Com_help | 0
|
| Com_insert | 0
|
| Com_insert_select | 0
|
| Com_install_plugin | 0
|
| Com_kill | 0
|
| Com_load | 0
|
| Com_lock_tables | 0
|
| Com_optimize | 0
|
| Com_preload_keys | 0
|
| Com_prepare_sql | 0
|
| Com_purge | 0
|
| Com_purge_before_date | 0
|
| Com_release_savepoint | 0
|
| Com_rename_table | 0
|
| Com_rename_user | 0
|
| Com_repair | 0
|
| Com_replace | 0
|
| Com_replace_select | 0
|
| Com_reset | 0
|
| Com_resignal | 0
|
| Com_revoke | 0
|
| Com_revoke_all | 0
|
| Com_revoke_role | 0
|
| Com_rollback | 0
|
| Com_rollback_to_savepoint | 0
|
| Com_savepoint | 0
|
| Com_select | 1
|
| Com_set_option | 0
|
| Com_show_authors | 0
|
| Com_show_binlog_events | 0
|
| Com_show_binlogs | 0
|
| Com_show_charsets | 0
|
| Com_show_collations | 0
|
| Com_show_contributors | 0
|
| Com_show_create_db | 0
|
| Com_show_create_event | 0
| 253/3812
|
| Com_show_create_func | 0
|
| Com_show_create_proc | 0
|
| Com_show_create_table | 0
|
| Com_show_create_trigger | 0
|
| Com_show_databases | 0
|
| Com_show_engine_logs | 0
|
| Com_show_engine_mutex | 0
|
| Com_show_engine_status | 0
|
| Com_show_errors | 0
|
| Com_show_events | 0
|
| Com_show_explain | 0
|
| Com_show_fields | 0
|
| Com_show_function_status | 0
|
| Com_show_generic | 0
|
| Com_show_grants | 0
|
| Com_show_keys | 0
|
| Com_show_master_status | 0
|
| Com_show_open_tables | 0
|
| Com_show_plugins | 0
|
| Com_show_privileges | 0
|
| Com_show_procedure_status | 0
|
| Com_show_processlist | 0
|
| Com_show_profile | 0
|
| Com_show_profiles | 0
|
| Com_show_relaylog_events | 0
|
| Com_show_slave_hosts | 0
|
| Com_show_slave_status | 0
|
| Com_show_status | 2
|
| Com_show_storage_engines | 0
|
| Com_show_table_status | 0
|
| Com_show_tables | 0
|
| Com_show_triggers | 0
|
| Com_show_variables | 0
|
| Com_show_warnings | 0
|
| Com_shutdown | 0
|
| Com_signal | 0
|
| Com_start_all_slaves | 0
|
| Com_start_slave | 0
|
| Com_stmt_close | 0
|
| Com_stmt_execute | 0
|
| Com_stmt_fetch | 0
254/3812
| Com_stmt_fetch | 0
|
| Com_stmt_prepare | 0
|
| Com_stmt_reprepare | 0
|
| Com_stmt_reset | 0
|
| Com_stmt_send_long_data | 0
|
| Com_stop_all_slaves | 0
|
| Com_stop_slave | 0
|
| Com_truncate | 0
|
| Com_uninstall_plugin | 0
|
| Com_unlock_tables | 0
|
| Com_update | 0
|
| Com_update_multi | 0
|
| Com_xa_commit | 0
|
| Com_xa_end | 0
|
| Com_xa_prepare | 0
|
| Com_xa_recover | 0
|
| Com_xa_rollback | 0
|
| Com_xa_start | 0
|
| Compression | OFF
|
| Connection_errors_accept | 0
|
| Connection_errors_internal | 0
|
| Connection_errors_max_connections | 0
|
| Connection_errors_peer_address | 0
|
| Connection_errors_select | 0
|
| Connection_errors_tcpwrap | 0
|
| Connections | 4
|
| Cpu_time | 0.000000
|
| Created_tmp_disk_tables | 0
|
| Created_tmp_files | 6
|
| Created_tmp_tables | 2
|
| Delayed_errors | 0
|
| Delayed_insert_threads | 0
|
| Delayed_writes | 0
|
| Delete_scan | 0
|
| Empty_queries | 0
|
| Executed_events | 0
|
| Executed_triggers | 0
|
| Feature_delay_key_write | 0
|
| Feature_dynamic_columns | 0
|
| Feature_fulltext | 0
|
| Feature_gis | 0
|
| Feature_locale | 0
255/3812
| Feature_locale | 0
|
| Feature_subquery | 0
|
| Feature_timezone | 0
|
| Feature_trigger | 0
|
| Feature_xml | 0
|
| Flush_commands | 1
|
| Handler_commit | 1
|
| Handler_delete | 0
|
| Handler_discover | 0
|
| Handler_external_lock | 0
|
| Handler_icp_attempts | 0
|
| Handler_icp_match | 0
|
| Handler_mrr_init | 0
|
| Handler_mrr_key_refills | 0
|
| Handler_mrr_rowid_refills | 0
|
| Handler_prepare | 0
|
| Handler_read_first | 3
|
| Handler_read_key | 0
|
| Handler_read_last | 0
|
| Handler_read_next | 0
|
| Handler_read_prev | 0
|
| Handler_read_retry | 0
|
| Handler_read_rnd | 0
|
| Handler_read_rnd_deleted | 0
|
| Handler_read_rnd_next | 537
|
| Handler_rollback | 0
|
| Handler_savepoint | 0
|
| Handler_savepoint_rollback | 0
|
| Handler_tmp_update | 0
|
| Handler_tmp_write | 516
|
| Handler_update | 0
|
| Handler_write | 0
|
| Innodb_available_undo_logs | 128
|
| Innodb_background_log_sync | 222
|
| Innodb_buffer_pool_bytes_data | 2523136
|
| Innodb_buffer_pool_bytes_dirty | 0
|
| Innodb_buffer_pool_dump_status | Dumping buffer pool(s) not yet started
|
| Innodb_buffer_pool_load_status | Loading buffer pool(s) not yet started
|
| Innodb_buffer_pool_pages_data | 154
|
| Innodb_buffer_pool_pages_dirty | 0
|
| Innodb_buffer_pool_pages_flushed | 1
|
| Innodb_buffer_pool_pages_free | 8037 256/3812
| Innodb_buffer_pool_pages_free | 8037
|
| Innodb_buffer_pool_pages_lru_flushed | 0
|
| Innodb_buffer_pool_pages_made_not_young | 0
|
| Innodb_buffer_pool_pages_made_young | 0
|
| Innodb_buffer_pool_pages_misc | 0
|
| Innodb_buffer_pool_pages_old | 0
|
| Innodb_buffer_pool_pages_total | 8191
|
| Innodb_buffer_pool_read_ahead | 0
|
| Innodb_buffer_pool_read_ahead_evicted | 0
|
| Innodb_buffer_pool_read_ahead_rnd | 0
|
| Innodb_buffer_pool_read_requests | 558
|
| Innodb_buffer_pool_reads | 155
|
| Innodb_buffer_pool_wait_free | 0
|
| Innodb_buffer_pool_write_requests | 1
|
| Innodb_checkpoint_age | 0
|
| Innodb_checkpoint_max_age | 80826164
|
| Innodb_data_fsyncs | 5
|
| Innodb_data_pending_fsyncs | 0
|
| Innodb_data_pending_reads | 0
|
| Innodb_data_pending_writes | 0
|
| Innodb_data_read | 2609664
|
| Innodb_data_reads | 172
|
| Innodb_data_writes | 5
|
| Innodb_data_written | 34304
|
| Innodb_dblwr_pages_written | 1
|
| Innodb_dblwr_writes | 1
|
| Innodb_deadlocks | 0
|
| Innodb_have_atomic_builtins | ON
|
| Innodb_history_list_length | 0
|
| Innodb_ibuf_discarded_delete_marks | 0
|
| Innodb_ibuf_discarded_deletes | 0
|
| Innodb_ibuf_discarded_inserts | 0
|
| Innodb_ibuf_free_list | 0
|
| Innodb_ibuf_merged_delete_marks | 0
|
| Innodb_ibuf_merged_deletes | 0
|
| Innodb_ibuf_merged_inserts | 0
|
| Innodb_ibuf_merges | 0
|
| Innodb_ibuf_segment_size | 2
|
| Innodb_ibuf_size | 1
|
| Innodb_log_waits | 0
|
| Innodb_log_write_requests | 0
|
257/3812
|
| Innodb_log_writes | 1
|
| Innodb_lsn_current | 1616829
|
| Innodb_lsn_flushed | 1616829
|
| Innodb_lsn_last_checkpoint | 1616829
|
| Innodb_master_thread_active_loops | 0
|
| Innodb_master_thread_idle_loops | 222
|
| Innodb_max_trx_id | 2308
|
| Innodb_mem_adaptive_hash | 2217568
|
| Innodb_mem_dictionary | 630703
|
| Innodb_mem_total | 140771328
|
| Innodb_mutex_os_waits | 1
|
| Innodb_mutex_spin_rounds | 30
|
| Innodb_mutex_spin_waits | 1
|
| Innodb_oldest_view_low_limit_trx_id | 0
|
| Innodb_os_log_fsyncs | 3
|
| Innodb_os_log_pending_fsyncs | 0
|
| Innodb_os_log_pending_writes | 0
|
| Innodb_os_log_written | 512
|
| Innodb_page_size | 16384
|
| Innodb_pages_created | 0
|
| Innodb_pages_read | 154
|
| Innodb_pages_written | 1
|
| Innodb_purge_trx_id | 0
|
| Innodb_purge_undo_no | 0
|
| Innodb_read_views_memory | 88
|
| Innodb_row_lock_current_waits | 0
|
| Innodb_row_lock_time | 0
|
| Innodb_row_lock_time_avg | 0
|
| Innodb_row_lock_time_max | 0
|
| Innodb_row_lock_waits | 0
|
| Innodb_rows_deleted | 0
|
| Innodb_rows_inserted | 0
|
| Innodb_rows_read | 0
|
| Innodb_rows_updated | 0
|
| Innodb_system_rows_deleted | 0
|
| Innodb_system_rows_inserted | 0
|
| Innodb_system_rows_read | 0
|
| Innodb_system_rows_updated | 0
|
| Innodb_s_lock_os_waits | 2
|
| Innodb_s_lock_spin_rounds | 60
|
| Innodb_s_lock_spin_waits | 2
| 258/3812
|
| Innodb_truncated_status_writes | 0
|
| Innodb_x_lock_os_waits | 0
|
| Innodb_x_lock_spin_rounds | 0
|
| Innodb_x_lock_spin_waits | 0
|
| Innodb_page_compression_saved | 0
|
| Innodb_page_compression_trim_sect512 | 0
|
| Innodb_page_compression_trim_sect1024 | 0
|
| Innodb_page_compression_trim_sect2048 | 0
|
| Innodb_page_compression_trim_sect4096 | 0
|
| Innodb_page_compression_trim_sect8192 | 0
|
| Innodb_page_compression_trim_sect16384 | 0
|
| Innodb_page_compression_trim_sect32768 | 0
|
| Innodb_num_index_pages_written | 0
|
| Innodb_num_non_index_pages_written | 5
|
| Innodb_num_pages_page_compressed | 0
|
| Innodb_num_page_compressed_trim_op | 0
|
| Innodb_num_page_compressed_trim_op_saved | 0
|
| Innodb_num_pages_page_decompressed | 0
|
| Innodb_num_pages_page_compression_error | 0
|
| Innodb_num_pages_encrypted | 0
|
| Innodb_num_pages_decrypted | 0
|
| Innodb_have_lz4 | OFF
|
| Innodb_have_lzo | OFF
|
| Innodb_have_lzma | OFF
|
| Innodb_have_bzip2 | OFF
|
| Innodb_have_snappy | OFF
|
| Innodb_defragment_compression_failures | 0
|
| Innodb_defragment_failures | 0
|
| Innodb_defragment_count | 0
|
| Innodb_onlineddl_rowlog_rows | 0
|
| Innodb_onlineddl_rowlog_pct_used | 0
|
| Innodb_onlineddl_pct_progress | 0
|
| Innodb_secondary_index_triggered_cluster_reads | 0
|
| Innodb_secondary_index_triggered_cluster_reads_avoided | 0
|
| Innodb_encryption_rotation_pages_read_from_cache | 0
|
| Innodb_encryption_rotation_pages_read_from_disk | 0
|
| Innodb_encryption_rotation_pages_modified | 0
|
| Innodb_encryption_rotation_pages_flushed | 0
|
| Innodb_encryption_rotation_estimated_iops | 0
|
| Innodb_scrub_background_page_reorganizations | 0
|
| Innodb_scrub_background_page_splits | 0
259/3812
|
| Innodb_scrub_background_page_split_failures_underflow | 0
|
| Innodb_scrub_background_page_split_failures_out_of_filespace | 0
|
| Innodb_scrub_background_page_split_failures_missing_index | 0
|
| Innodb_scrub_background_page_split_failures_unknown | 0
|
| Key_blocks_not_flushed | 0
|
| Key_blocks_unused | 107163
|
| Key_blocks_used | 0
|
| Key_blocks_warm | 0
|
| Key_read_requests | 0
|
| Key_reads | 0
|
| Key_write_requests | 0
|
| Key_writes | 0
|
| Last_query_cost | 0.000000
|
| Master_gtid_wait_count | 0
|
| Master_gtid_wait_time | 0
|
| Master_gtid_wait_timeouts | 0
|
| Max_statement_time_exceeded | 0
|
| Max_used_connections | 1
|
| Memory_used | 273614696
|
| Not_flushed_delayed_rows | 0
|
| Open_files | 25
|
| Open_streams | 0
|
| Open_table_definitions | 18
|
| Open_tables | 11
|
| Opened_files | 77
|
| Opened_plugin_libraries | 0
|
| Opened_table_definitions | 18
|
| Opened_tables | 18
|
| Opened_views | 0
|
| Performance_schema_accounts_lost | 0
|
| Performance_schema_cond_classes_lost | 0
|
| Performance_schema_cond_instances_lost | 0
|
| Performance_schema_digest_lost | 0
|
| Performance_schema_file_classes_lost | 0
|
| Performance_schema_file_handles_lost | 0
|
| Performance_schema_file_instances_lost | 0
|
| Performance_schema_hosts_lost | 0
|
| Performance_schema_locker_lost | 0
|
| Performance_schema_mutex_classes_lost | 0
|
| Performance_schema_mutex_instances_lost | 0
|
| Performance_schema_rwlock_classes_lost | 0
260/3812
| Performance_schema_rwlock_classes_lost | 0
|
| Performance_schema_rwlock_instances_lost | 0
|
| Performance_schema_session_connect_attrs_lost | 0
|
| Performance_schema_socket_classes_lost | 0
|
| Performance_schema_socket_instances_lost | 0
|
| Performance_schema_stage_classes_lost | 0
|
| Performance_schema_statement_classes_lost | 0
|
| Performance_schema_table_handles_lost | 0
|
| Performance_schema_table_instances_lost | 0
|
| Performance_schema_thread_classes_lost | 0
|
| Performance_schema_thread_instances_lost | 0
|
| Performance_schema_users_lost | 0
|
| Prepared_stmt_count | 0
|
| Qcache_free_blocks | 1
|
| Qcache_free_memory | 1031336
|
| Qcache_hits | 0
|
| Qcache_inserts | 0
|
| Qcache_lowmem_prunes | 0
|
| Qcache_not_cached | 0
|
| Qcache_queries_in_cache | 0
|
| Qcache_total_blocks | 1
|
| Queries | 4
|
| Questions | 4
|
| Rows_read | 10
|
| Rows_sent | 517
|
| Rows_tmp_read | 516
|
| Rpl_status | AUTH_MASTER
|
| Select_full_join | 0
|
| Select_full_range_join | 0
|
| Select_range | 0
|
| Select_range_check | 0
|
| Select_scan | 2
|
| Slave_connections | 0
|
| Slave_heartbeat_period | 0.000
|
| Slave_open_temp_tables | 0
|
| Slave_received_heartbeats | 0
|
| Slave_retried_transactions | 0
|
| Slave_running | OFF
|
| Slave_skipped_errors | 0
|
| Slaves_connected | 0
|
| Slaves_running | 0
|
| Slow_launch_threads | 0 261/3812
| Slow_launch_threads | 0
|
| Slow_queries | 0
|
| Sort_merge_passes | 0
|
| Sort_priority_queue_sorts | 0
|
| Sort_range | 0
|
| Sort_rows | 0
|
| Sort_scan | 0
|
| Ssl_accept_renegotiates | 0
|
| Ssl_accepts | 0
|
| Ssl_callback_cache_hits | 0
|
| Ssl_cipher |
|
| Ssl_cipher_list |
|
| Ssl_client_connects | 0
|
| Ssl_connect_renegotiates | 0
|
| Ssl_ctx_verify_depth | 0
|
| Ssl_ctx_verify_mode | 0
|
| Ssl_default_timeout | 0
|
| Ssl_finished_accepts | 0
|
| Ssl_finished_connects | 0
|
| Ssl_server_not_after |
|
| Ssl_server_not_before |
|
| Ssl_session_cache_hits | 0
|
| Ssl_session_cache_misses | 0
|
| Ssl_session_cache_mode | NONE
|
| Ssl_session_cache_overflows | 0
|
| Ssl_session_cache_size | 0
|
| Ssl_session_cache_timeouts | 0
|
| Ssl_sessions_reused | 0
|
| Ssl_used_session_cache_entries | 0
|
| Ssl_verify_depth | 0
|
| Ssl_verify_mode | 0
|
| Ssl_version |
|
| Subquery_cache_hit | 0
|
| Subquery_cache_miss | 0
|
| Syncs | 2
|
| Table_locks_immediate | 21
|
| Table_locks_waited | 0
|
| Tc_log_max_pages_used | 0
|
| Tc_log_page_size | 4096
|
| Tc_log_page_waits | 0
|
| Threadpool_idle_threads | 0
|
262/3812
| Threadpool_threads | 0
|
| Threads_cached | 0
|
| Threads_connected | 1
|
| Threads_created | 2
|
| Threads_running | 1
|
| Update_scan | 0
|
| Uptime | 223
|
| Uptime_since_flush_status | 223
|
| wsrep_cluster_conf_id | 18446744073709551615
|
| wsrep_cluster_size | 0
|
| wsrep_cluster_state_uuid |
|
| wsrep_cluster_status | Disconnected
|
| wsrep_connected | OFF
|
| wsrep_local_bf_aborts | 0
|
| wsrep_local_index | 18446744073709551615
|
| wsrep_provider_name |
|
| wsrep_provider_vendor |
|
| wsrep_provider_version |
|
| wsrep_ready | OFF
|
| wsrep_thread_count | 0
|
+--------------------------------------------------------------+---------------------------------------
-+
516 rows in set (0.00 sec)

Example of filtered output:

SHOW STATUS LIKE 'Key%';


+------------------------+--------+
| Variable_name | Value |
+------------------------+--------+
| Key_blocks_not_flushed | 0 |
| Key_blocks_unused | 107163 |
| Key_blocks_used | 0 |
| Key_blocks_warm | 0 |
| Key_read_requests | 0 |
| Key_reads | 0 |
| Key_write_requests | 0 |
| Key_writes | 0 |
+------------------------+--------+
8 rows in set (0.00 sec)

1.1.1.2.8.52 SHOW TABLE STATUS


Syntax
SHOW TABLE STATUS [{FROM | IN} db_name]
[LIKE 'pattern' | WHERE expr]

Contents
1. Syntax
2. Description
3. Views
4. Example

263/3812
Description
SHOW TABLE STATUS works like SHOW TABLES , but provides more extensive information about each non- TEMPORARY
table.
The LIKE clause, if present on its own, indicates which table names to match. The WHERE and LIKE clauses can be
given to select rows using more general conditions, as discussed in Extended SHOW.
The following information is returned:

Column Description
Name Table name.
Engine Table storage engine.
Version Version number from the table's .frm file.
Row_format Row format (see InnoDB, Aria and MyISAM row formats).
Rows Number of rows in the table. Some engines, such as XtraDB and InnoDB may store an estimate.
Avg_row_length Average row length in the table.
For InnoDB/XtraDB, the index size, in pages, multiplied by the page size. For Aria and MyISAM,
Data_length
length of the data file, in bytes. For MEMORY, the approximate allocated memory.
Maximum length of the data file, ie the total number of bytes that could be stored in the table. Not
Max_data_length
used in XtraDB and InnoDB.
Index_length Length of the index file.
Bytes allocated but unused. For InnoDB tables in a shared tablespace, the free space of the
Data_free shared tablespace with small safety margin. An estimate in the case of partitioned tables - see the
PARTITIONS table.

Auto_increment Next AUTO_INCREMENT value.


Time the table was created. Some engines just return the ctime information from the file system
Create_time layer here, in that case the value is not necessarily the table creation time but rather the time the
file system metadata for it had last changed.
Time the table was last updated. On Windows, the timestamp is not updated on update, so
MyISAM values will be inaccurate. In InnoDB, if shared tablespaces are used, will be NULL , while
Update_time
buffering can also delay the update, so the value will differ from the actual time of the last
UPDATE , INSERT or DELETE .

Check_time Time the table was last checked. Not kept by all storage engines, in which case will be NULL .
Collation Character set and collation.
Checksum Live checksum value, if any.
Create_options Extra CREATE TABLE options.
Comment Table comment provided when MariaDB created the table.
Max_index_length Maximum index length (supported by MyISAM and Aria tables). Added in MariaDB 10.3.5.
Placeholder to signal that a table is a temporary table. Currently always "N", except "Y" for
Temporary
generated information_schema tables and NULL for views. Added in MariaDB 10.3.5.

Similar information can be found in the information_schema.TABLES table as well as by using mysqlshow :

mysqlshow --status db_name

Views
For views, all columns in SHOW TABLE STATUS are NULL except 'Name' and 'Comment'

Example

264/3812
show table status\G
*************************** 1. row ***************************
Name: bus_routes
Engine: InnoDB
Version: 10
Row_format: Dynamic
Rows: 5
Avg_row_length: 3276
Data_length: 16384
Max_data_length: 0
Index_length: 0
Data_free: 0
Auto_increment: NULL
Create_time: 2017-05-24 11:17:46
Update_time: NULL
Check_time: NULL
Collation: latin1_swedish_ci
Checksum: NULL
Create_options:
Comment:

1.1.1.2.8.53 SHOW TABLES


Syntax
SHOW [FULL] TABLES [FROM db_name]
[LIKE 'pattern' | WHERE expr]

Contents
1. Syntax
2. Description
3. Examples
4. See Also

Description
SHOW TABLES lists the non- TEMPORARY tables, sequences and views in a given database.

The LIKE clause, if present on its own, indicates which table names to match. The WHERE and LIKE clauses can be
given to select rows using more general conditions, as discussed in Extended SHOW. For example, when searching for
tables in the test database, the column name for use in the WHERE and LIKE clauses will be Tables_in_test
The FULL modifier is supported such that SHOW FULL TABLES displays a second output column. Values for the second
column, Table_type , are BASE TABLE for a table, VIEW for a view and SEQUENCE for a sequence.
You can also get this information using:

mysqlshow db_name

See mysqlshow for more details.


If you have no privileges for a base table or view, it does not show up in the output from SHOW TABLES or mysqlshow
db_name .
The information_schema.TABLES table, as well as the SHOW TABLE STATUS statement, provide extended
information about tables.

Examples
SHOW TABLES;
+----------------------+
| Tables_in_test |
+----------------------+
| animal_count |
| animals |
| are_the_mooses_loose |
| aria_test2 |
| t1 |
| view1 |
+----------------------+

265/3812
Showing the tables beginning with a only.

SHOW TABLES WHERE Tables_in_test LIKE 'a%';


+----------------------+
| Tables_in_test |
+----------------------+
| animal_count |
| animals |
| are_the_mooses_loose |
| aria_test2 |
+----------------------+

Showing tables and table types:

SHOW FULL TABLES;


+----------------+------------+
| Tables_in_test | Table_type |
+----------------+------------+
| s1 | SEQUENCE |
| student | BASE TABLE |
| v1 | VIEW |
+----------------+------------+

See Also
SHOW TABLE STATUS
The information_schema.TABLES table

1.1.1.2.8.54 SHOW TABLE_STATISTICS


Syntax
SHOW TABLE_STATISTICS

Description
The SHOW TABLE_STATISTICS statementis part of the User Statistics feature. It was removed as a separate statement in
MariaDB 10.1.1 , but effectively replaced by the generic SHOW information_schema_table statement. The
information_schema.TABLE_STATISTICS table shows statistics on table usage
The userstat system variable must be set to 1 to activate this feature. See the User Statistics and
information_schema.TABLE_STATISTICS articles for more information.

Example

266/3812
SHOW TABLE_STATISTICS\G
*************************** 1. row ***************************
Table_schema: mysql
Table_name: proxies_priv
Rows_read: 2
Rows_changed: 0
Rows_changed_x_#indexes: 0
*************************** 2. row ***************************
Table_schema: test
Table_name: employees_example
Rows_read: 7
Rows_changed: 0
Rows_changed_x_#indexes: 0
*************************** 3. row ***************************
Table_schema: mysql
Table_name: user
Rows_read: 16
Rows_changed: 0
Rows_changed_x_#indexes: 0
*************************** 4. row ***************************
Table_schema: mysql
Table_name: db
Rows_read: 2
Rows_changed: 0
Rows_changed_x_#indexes: 0

1.1.1.2.8.55 SHOW TRIGGERS


Syntax
SHOW TRIGGERS [FROM db_name]
[LIKE 'pattern' | WHERE expr]

Contents
1. Syntax
2. Description
3. Examples
4. See also

Description
SHOW TRIGGERS lists the triggers currently defined for tables in a database (the default database unless a FROM clause
is given). This statement requires the TRIGGER privilege (prior to MySQL 5.1.22, it required the SUPER privilege).
The LIKE clause, if present on its own, indicates which table names to match and causes the statement to display
triggers for those tables. The WHERE and LIKE clauses can be given to select rows using more general conditions, as
discussed in Extended SHOW.
Similar information is stored in the information_schema.TRIGGERS table.

MariaDB starting with 10.2.3


If there are multiple triggers for the same action, then the triggers are shown in action order.

Examples
For the trigger defined at Trigger Overview:

267/3812
SHOW triggers Like 'animals' \G
*************************** 1. row ***************************
Trigger: the_mooses_are_loose
Event: INSERT
Table: animals
Statement: BEGIN
IF NEW.name = 'Moose' THEN
UPDATE animal_count SET animal_count.animals = animal_count.animals+100;
ELSE
UPDATE animal_count SET animal_count.animals = animal_count.animals+1;
END IF;
END
Timing: AFTER
Created: 2016-09-29 13:53:34.35
sql_mode:
Definer: root@localhost
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: latin1_swedish_ci

Listing all triggers associated with a certain table:

SHOW TRIGGERS FROM test WHERE `Table` = 'user' \G


*************************** 1. row ***************************
Trigger: user_ai
Event: INSERT
Table: user
Statement: BEGIN END
Timing: AFTER
Created: 2016-09-29 13:53:34.35
sql_mode:
Definer: root@%
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: latin1_swedish_ci

SHOW triggers WHERE Event Like 'Insert' \G


*************************** 1. row ***************************
Trigger: the_mooses_are_loose
Event: INSERT
Table: animals
Statement: BEGIN
IF NEW.name = 'Moose' THEN
UPDATE animal_count SET animal_count.animals = animal_count.animals+100;
ELSE
UPDATE animal_count SET animal_count.animals = animal_count.animals+1;
END IF;
END
Timing: AFTER
Created: 2016-09-29 13:53:34.35
sql_mode:
Definer: root@localhost
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: latin1_swedish_ci

character_set_client is the session value of the character_set_client system variable when the trigger was
created.
collation_connection is the session value of the collation_connection system variable when the trigger was
created.
Database Collation is the collation of the database with which the trigger is associated.
These columns were added in MariaDB/MySQL 5.1.21.
Old triggers created before MySQL 5.7 and MariaDB 10.2.3 has NULL in the Created column.

See also
Trigger Overview
CREATE TRIGGER
DROP TRIGGER
information_schema.TRIGGERS table
SHOW CREATE TRIGGER
Trigger Limitations

268/3812
1.1.1.2.8.56 SHOW USER_STATISTICS
Syntax
SHOW USER_STATISTICS

Description
The SHOW USER_STATISTICS statement is part of the User Statistics feature. It was removed as a separate statement in
MariaDB 10.1.1 , but effectively replaced by the generic SHOW information_schema_table statement. The
information_schema.USER_STATISTICS table holds statistics about user activity. You can use this table to find out
such things as which user is causing the most load and which users are being abusive. You can also use this table to
measure how close to capacity the server may be.
The userstat system variable must be set to 1 to activate this feature. See the User Statistics and
information_schema.USER_STATISTICS table for more information.

Example
SHOW USER_STATISTICS\G
*************************** 1. row ***************************
User: root
Total_connections: 1
Concurrent_connections: 0
Connected_time: 3297
Busy_time: 0.14113400000000006
Cpu_time: 0.017637000000000003
Bytes_received: 969
Bytes_sent: 22355
Binlog_bytes_written: 0
Rows_read: 10
Rows_sent: 67
Rows_deleted: 0
Rows_inserted: 0
Rows_updated: 0
Select_commands: 7
Update_commands: 0
Other_commands: 0
Commit_transactions: 1
Rollback_transactions: 0
Denied_connections: 0
Lost_connections: 0
Access_denied: 0
Empty_queries: 7

1.1.1.2.8.57 SHOW VARIABLES


Syntax
SHOW [GLOBAL | SESSION] VARIABLES
[LIKE 'pattern' | WHERE expr]

Contents
1. Syntax
2. Description
3. Examples

Description
SHOW VARIABLES shows the values of MariaDB system variables. This information also can be obtained using the
mysqladmin variables command. The LIKE clause, if present, indicates which variable names to match. The WHERE
clause can be given to select rows using more general conditions.
With the GLOBAL modifier, SHOW VARIABLES displays the values that are used for new connections to MariaDB. With
SESSION , it displays the values that are in effect for the current connection. If no modifier is present, the default is
SESSION . LOCAL is a synonym for SESSION . With a LIKE clause, the statement displays only rows for those variables
269/3812
with names that match the pattern. To obtain the row for a specific variable, use a LIKE clause as shown:

SHOW VARIABLES LIKE 'maria_group_commit';


SHOW SESSION VARIABLES LIKE 'maria_group_commit';

To get a list of variables whose name match a pattern, use the " % " wildcard character in a LIKE clause:

SHOW VARIABLES LIKE '%maria%';


SHOW GLOBAL VARIABLES LIKE '%maria%';

Wildcard characters can be used in any position within the pattern to be matched. Strictly speaking, because " _ " is a
wildcard that matches any single character, you should escape it as " \_ " to match it literally. In practice, this is rarely
necessary.
The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in Extended
SHOW.
See SET for information on setting server system variables.
See Server System Variables for a list of all the variables that can be set.
You can also see the server variables by querying the Information Schema GLOBAL_VARIABLES and
SESSION_VARIABLES tables.

Examples
SHOW VARIABLES LIKE 'aria%';
+------------------------------------------+---------------------+
| Variable_name | Value |
+------------------------------------------+---------------------+
| aria_block_size | 8192 |
| aria_checkpoint_interval | 30 |
| aria_checkpoint_log_activity | 1048576 |
| aria_force_start_after_recovery_failures | 0 |
| aria_group_commit | none |
| aria_group_commit_interval | 0 |
| aria_log_file_size | 1073741824 |
| aria_log_purge_type | immediate |
| aria_max_sort_file_size | 9223372036853727232 |
| aria_page_checksum | ON |
| aria_pagecache_age_threshold | 300 |
| aria_pagecache_buffer_size | 134217728 |
| aria_pagecache_division_limit | 100 |
| aria_recover | NORMAL |
| aria_repair_threads | 1 |
| aria_sort_buffer_size | 134217728 |
| aria_stats_method | nulls_unequal |
| aria_sync_log_dir | NEWFILE |
| aria_used_for_temp_tables | ON |
+------------------------------------------+---------------------+

270/3812
SELECT VARIABLE_NAME, SESSION_VALUE, GLOBAL_VALUE FROM
INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE
VARIABLE_NAME LIKE 'max_error_count' OR
VARIABLE_NAME LIKE 'innodb_sync_spin_loops';
+---------------------------+---------------+--------------+
| VARIABLE_NAME | SESSION_VALUE | GLOBAL_VALUE |
+---------------------------+---------------+--------------+
| MAX_ERROR_COUNT | 64 | 64 |
| INNODB_SYNC_SPIN_LOOPS | NULL | 30 |
+---------------------------+---------------+--------------+

SET GLOBAL max_error_count=128;

SELECT VARIABLE_NAME, SESSION_VALUE, GLOBAL_VALUE FROM


INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE
VARIABLE_NAME LIKE 'max_error_count' OR
VARIABLE_NAME LIKE 'innodb_sync_spin_loops';
+---------------------------+---------------+--------------+
| VARIABLE_NAME | SESSION_VALUE | GLOBAL_VALUE |
+---------------------------+---------------+--------------+
| MAX_ERROR_COUNT | 64 | 128 |
| INNODB_SYNC_SPIN_LOOPS | NULL | 30 |
+---------------------------+---------------+--------------+

SET GLOBAL max_error_count=128;

SHOW VARIABLES LIKE 'max_error_count';


+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_error_count | 64 |
+-----------------+-------+

SHOW GLOBAL VARIABLES LIKE 'max_error_count';


+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_error_count | 128 |
+-----------------+-------+

Because the following variable only has a global scope, the global value is returned even when specifying SESSION (in
this case by default):

SHOW VARIABLES LIKE 'innodb_sync_spin_loops';


+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| innodb_sync_spin_loops | 30 |
+------------------------+-------+

1.1.1.2.8.58 SHOW WARNINGS


Syntax
SHOW WARNINGS [LIMIT [offset,] row_count]
SHOW ERRORS [LIMIT row_count OFFSET offset]
SHOW COUNT(*) WARNINGS

Contents
1. Syntax
2. Description
3. Examples
1. Stack Trace
4. See Also

Description
SHOW WARNINGS shows the error, warning, and note messages that resulted from the last statement that generated
messages in the current session. It shows nothing if the last statement used a table and generated no messages. (That
is, a statement that uses a table but generates no messages clears the message list.) Statements that do not use tables
and do not generate messages have no effect on the message list.
271/3812
A note is different to a warning in that it only appears if the sql_notes variable is set to 1 (the default), and is not
converted to an error if strict mode is enabled.
A related statement, SHOW ERRORS , shows only the errors.
The SHOW COUNT(*) WARNINGS statement displays the total number of errors, warnings, and notes. You can also
retrieve this number from the warning_count variable:

SHOW COUNT(*) WARNINGS;


SELECT @@warning_count;

The value of warning_count might be greater than the number of messages displayed by SHOW WARNINGS if the
max_error_count system variable is set so low that not all messages are stored.

The LIMIT clause has the same syntax as for the SELECT statement .
SHOW WARNINGS can be used after EXPLAIN EXTENDED to see how a query is internally rewritten by MariaDB.
If the sql_notes server variable is set to 1, Notes are included in the output of SHOW WARNINGS ; if it is set to 0, this
statement will not show (or count) Notes.
The results of SHOW WARNINGS and SHOW COUNT(*) WARNINGS are directly sent to the client. If you need to access those
information in a stored program, you can use the GET DIAGNOSTICS statement instead.
For a list of MariaDB error codes, see MariaDB Error Codes.
The mysql client also has a number of options related to warnings. The \W command will show warnings after every
statement, while \w will disable this. Starting the client with the --show-warnings option will show warnings after every
statement.
MariaDB 10.3.1 implements a stored routine error stack trace. SHOW WARNINGS can also be used to show more
information. See the example below.

Examples
SELECT 1/0;
+------+
| 1/0 |
+------+
| NULL |
+------+

SHOW COUNT(*) WARNINGS;


+-------------------------+
| @@session.warning_count |
+-------------------------+
| 1 |
+-------------------------+

SHOW WARNINGS;
+---------+------+---------------+
| Level | Code | Message |
+---------+------+---------------+
| Warning | 1365 | Division by 0 |
+---------+------+---------------+

Stack Trace
From MariaDB 10.3.1, displaying a stack trace:

272/3812
DELIMITER $$
CREATE OR REPLACE PROCEDURE p1()
BEGIN
DECLARE c CURSOR FOR SELECT * FROM not_existing;
OPEN c;
CLOSE c;
END;
$$
CREATE OR REPLACE PROCEDURE p2()
BEGIN
CALL p1;
END;
$$
DELIMITER ;
CALL p2;
ERROR 1146 (42S02): Table 'test.not_existing' doesn't exist

SHOW WARNINGS;
+-------+------+-----------------------------------------+
| Level | Code | Message |
+-------+------+-----------------------------------------+
| Error | 1146 | Table 'test.not_existing' doesn't exist |
| Note | 4091 | At line 6 in test.p1 |
| Note | 4091 | At line 4 in test.p2 |
+-------+------+-----------------------------------------+

SHOW WARNINGS displays a stack trace, showing where the error actually happened:

Line 4 in test.p1 is the OPEN command which actually raised the error
Line 3 in test.p2 is the CALL statement, calling p1 from p2.

See Also
SHOW ERRORS

1.1.1.2.8.59 SHOW WSREP_MEMBERSHIP


SHOW WSREP_MEMBERSHIP is part of the WSREP_INFO plugin.

Syntax
SHOW WSREP_MEMBERSHIP

Description
The SHOW WSREP_MEMBERSHIP statement returns Galera node cluster membership information. It returns the same
information as found in the information_schema.WSREP_MEMBERSHIP table. Only users with the SUPER privilege can
access this information.

Examples
SHOW WSREP_MEMBERSHIP;
+-------+--------------------------------------+----------+-----------------+
| Index | Uuid | Name | Address |
+-------+--------------------------------------+----------+-----------------+
| 0 | 19058073-8940-11e4-8570-16af7bf8fced | my_node1 | 10.0.2.15:16001 |
| 1 | 19f2b0e0-8942-11e4-9cb8-b39e8ee0b5dd | my_node3 | 10.0.2.15:16003 |
| 2 | d85e62db-8941-11e4-b1ef-4bc9980e476d | my_node2 | 10.0.2.15:16002 |
+-------+--------------------------------------+----------+-----------------+

1.1.1.2.8.60 SHOW WSREP_STATUS


SHOW WSREP_STATUS is part of the WSREP_INFO plugin.

Syntax
273/3812
SHOW WSREP_STATUS

Description
The SHOW WSREP_STATUS statement returns Galera node and cluster status information. It returns the same information
as found in the information_schema.WSREP_STATUS table. Only users with the SUPER privilege can access this
information.

Examples
SHOW WSREP_STATUS;
+------------+-------------+----------------+--------------+
| Node_Index | Node_Status | Cluster_Status | Cluster_Size |
+------------+-------------+----------------+--------------+
| 0 | Synced | Primary | 3 |
+------------+-------------+----------------+--------------+

1.1.1.2.9 System Tables


Information Schema
Articles about the Information Schema

Performance Schema
Monitoring server performance.

The mysql Database Tables


mysql database tables.

Sys Schema
Collection of views, functions and procedures to help administrators get in...

mariadb_schema
mariadb_schema is used to enforce MariaDB native types independent of SQL_MODE.

Writing Logs Into Tables


The general query log and the slow query log can be written into system tables

1.1.1.2.9.1 Information Schema


Articles about the Information Schema
Information Schema Tables
Tables in the Information_Schema database

Extended Show
Extended SHOW with WHERE and LIKE.

TIME_MS column in INFORMATION_SCHEMA.PROCESSLIST


Microseconds in the INFORMATION_SCHEMA.PROCESSLIST table

There are 1 related questions .

1.1.1.2.9.1.1 Information Schema Tables


Information Schema InnoDB Tables
All InnoDB-specific Information Schema tables.

Information Schema MyRocks Tables


List of Information Schema tables specifically related to MyRocks.

Information Schema XtraDB Tables


All XtraDB-specific Information Schema tables.
274/3812
ColumnStore Information Schema Tables
ColumnStore-related Information Schema tables

Information Schema ALL_PLUGINS Table


Information about server plugins, whether installed or not.

Information Schema APPLICABLE_ROLES Table


Roles available to be used.

Information Schema CHARACTER_SETS Table


Supported character sets.

Information Schema CHECK_CONSTRAINTS Table


Supported check constraints.

Information Schema CLIENT_STATISTICS Table


Statistics about client connections.

Information Schema COLLATION_CHARACTER_SET_APPLICABILITY Table


Collations and associated character sets

Information Schema COLLATIONS Table


Supported collations.

Information Schema COLUMN_PRIVILEGES Table


Column privileges

Information Schema COLUMNS Table


Information about table fields.

Information Schema DISKS Table


Plugin that allows the disk space situation to be monitored.

Information Schema ENABLED_ROLES Table


Enabled roles for the current session.

Information Schema ENGINES Table


Storage engine information.

Information Schema EVENTS Table


Server event information

Information Schema FEEDBACK Table


Contents submitted by the Feedback Plugin

Information Schema FILES Table


The FILES tables is unused in MariaDB.

Information Schema GEOMETRY_COLUMNS Table


Support for Spatial Reference systems for GIS data

Information Schema GLOBAL_STATUS and SESSION_STATUS Tables


Global and session status variables

Information Schema GLOBAL_VARIABLES and SESSION_VARIABLES Tables


Global and session system variables

Information Schema INDEX_STATISTICS Table


Statistics on index usage

Information Schema KEY_CACHES Table


Segmented key cache statistics.

Information Schema KEY_COLUMN_USAGE Table


Key columns that have constraints.

Information Schema KEYWORDS Table


MariaDB keywords.

275/3812
Information Schema LOCALES Table
Compiled-in server locales.

Information Schema METADATA_LOCK_INFO Table


Active metadata locks.

Information Schema MROONGA_STATS Table


Mroonga activities statistics.

Information Schema OPTIMIZER_TRACE Table


Contains Optimizer Trace information.

Information Schema PARAMETERS Table


Information about stored procedures and stored functions parameters.

Information Schema PARTITIONS Table


Table partition information

Information Schema PLUGINS Table


Information Schema table containing information on plugins installed on a server.

Information Schema PROCESSLIST Table


Thread information.

Information Schema PROFILING Table


Statement resource usage

Information Schema QUERY_CACHE_INFO Table


View the contents of the query cache.

Information Schema QUERY_RESPONSE_TIME Table


Query time information.

Information Schema REFERENTIAL_CONSTRAINTS Table


Foreign key information

Information Schema ROUTINES Table


Stored procedures and stored functions information

Information Schema SCHEMA_PRIVILEGES Table


Database privilege information

Information Schema SCHEMATA Table


Information about databases.

Information Schema SPATIAL_REF_SYS Table


Information on each spatial reference system used in the database

Information Schema SPIDER_ALLOC_MEM Table


Information about Spider's memory usage.

Information Schema SPIDER_WRAPPER_PROTOCOLS Table


Installed along with the Spider storage engine.

Information Schema SQL_FUNCTIONS Table


Functions in MariaDB.

Information Schema STATISTICS Table


Table index information.

Information Schema SYSTEM_VARIABLES Table


Current global and session values and various metadata of all system variables.

Information Schema TABLE_CONSTRAINTS Table


Tables containing constraints.

Information Schema TABLE_PRIVILEGES Table


Table privileges

276/3812
Information Schema TABLE_STATISTICS Table
Statistics on table usage.

Information Schema TABLES Table


Database table information.

Information Schema TABLESPACES Table


Information about active tablespaces.

Information Schema THREAD_POOL_GROUPS Table


Information Schema THREAD_POOL_GROUPS Table.

Information Schema THREAD_POOL_QUEUES Table


Information Schema THREAD_POOL_QUEUES Table.

Information Schema THREAD_POOL_STATS Table


Information Schema THREAD_POOL_STATS Table.

Information Schema THREAD_POOL_WAITS Table


Information Schema THREAD_POOL_WAITS Table.

Information Schema TRIGGERS Table


Information about triggers

Information Schema USER_PRIVILEGES Table


Global user privilege information derived from the mysql.user grant table

Information Schema USER_STATISTICS Table


User activity

Information Schema USER_VARIABLES Table


User-defined variable information.

Information Schema VIEWS Table


Information about views.

Information Schema WSREP_MEMBERSHIP Table


Galera node cluster membership information.

Information Schema WSREP_STATUS Table


Galera node cluster status information.

There are 2 related questions .

1.1.1.2.9.1.1.1 Information Schema InnoDB


Tables
List of Information Schema tables specifically related to InnoDB. Tables that are specific to XtraDB shares with InnoDB
are listed in Information Schema XtraDB Tables .
Information Schema INNODB_BUFFER_PAGE Table
Buffer pool page information.

Information Schema INNODB_BUFFER_PAGE_LRU Table


Buffer pool pages and their eviction order.

Information Schema INNODB_BUFFER_POOL_PAGES Table


XtraDB buffer pool page information.

Information Schema INNODB_BUFFER_POOL_PAGES_BLOB Table


XtraDB buffer pool blob pages.

Information Schema INNODB_BUFFER_POOL_PAGES_INDEX Table


XtraDB buffer pool index pages.

277/3812
Information Schema INNODB_BUFFER_POOL_STATS Table
InnoDB buffer pool information.

Information Schema INNODB_CHANGED_PAGES Table


Modified pages from the bitmap file data.

Information Schema INNODB_CMP and INNODB_CMP_RESET Tables


XtraDB/InnoDB compression performances with different page sizes.

Information Schema INNODB_CMPMEM and INNODB_CMPMEM_RESET Tables


Number of InnoDB compressed pages of different page sizes.

Information Schema INNODB_CMP_PER_INDEX and


INNODB_CMP_PER_INDEX_RESET Tables
XtraDB/InnoDB compression performances for different indexes and tables.

Information Schema INNODB_FT_BEING_DELETED Table


Fulltext being deleted.

Information Schema INNODB_FT_CONFIG Table


InnoDB fulltext metadata.

Information Schema INNODB_FT_DEFAULT_STOPWORD Table


Default InnoDB stopwords.

Information Schema INNODB_FT_DELETED Table


Deleted InnoDB fulltext rows.

Information Schema INNODB_FT_INDEX_CACHE Table


Newly added fulltext row information.

Information Schema INNODB_FT_INDEX_TABLE Table


InnoDB fulltext information.

Information Schema INNODB_LOCK_WAITS Table


Blocked InnoDB transactions.

Information Schema INNODB_LOCKS Table


2 InnoDB lock information.

Information Schema INNODB_METRICS Table


InnoDB performance metrics.

Information Schema INNODB_MUTEXES Table


Monitor mutex waits.

Information Schema INNODB_SYS_COLUMNS Table


InnoDB column information.

Information Schema INNODB_SYS_DATAFILES Table


InnoDB tablespace paths.

Information Schema INNODB_SYS_FIELDS Table


Fields part of an InnoDB index.

Information Schema INNODB_SYS_FOREIGN Table


InnoDB foreign key information.

Information Schema INNODB_SYS_FOREIGN_COLS Table


Foreign key column information.

Information Schema INNODB_SYS_INDEXES Table


InnoDB index information.

Information Schema INNODB_SYS_SEMAPHORE_WAITS Table


Information about current semaphore waits.

278/3812
Information Schema INNODB_SYS_TABLES Table
InnoDB table information.

Information Schema INNODB_SYS_TABLESPACES Table


InnoDB tablespace information.

Information Schema INNODB_SYS_TABLESTATS Table


InnoDB status for high-level performance monitoring.

Information Schema INNODB_SYS_VIRTUAL Table


Information about base columns of virtual columns.

Information Schema INNODB_TABLESPACES_ENCRYPTION Table


Encryption metadata for InnoDB tablespaces.

Information Schema INNODB_TABLESPACES_SCRUBBING Table


Data scrubbing information.

Information Schema INNODB_TRX Table


Currently-executing InnoDB locks.

Information Schema TEMP_TABLES_INFO Table


Information about active InnoDB temporary tables.

1.1.1.2.9.1.1.1.1 Information Schema


INNODB_BUFFER_PAGE Table
The Information Schema INNODB_BUFFER_PAGE table contains information about pages in the buffer pool.
The PROCESS privilege is required to view the table.
It has the following columns:

Column Description
Buffer Pool identifier. From MariaDB 10.5.1 returns a value of 0, since multiple InnoDB buffer
POOL_ID
pool instances has been removed.
BLOCK_ID Buffer Pool Block identifier.
SPACE Tablespace identifier. Matches the SPACE value in the INNODB_SYS_TABLES table.
PAGE_NUMBER Buffer pool page number.
Page type; one of allocated (newly-allocated page), index (B-tree node), undo_log
(undo log page), inode (index node), ibuf_free_list (insert buffer free list), ibuf_bitmap
(insert buffer bitmap), system (system page), trx_system (transaction system data),
PAGE_TYPE
file_space_header (file space header), extent_descriptor (extent descriptor page), blob
(uncompressed blob page), compressed_blob (first compressed blob page),
compressed_blob2 (subsequent compressed blob page) or unknown .

FLUSH_TYPE Flush type.

Count of the threads using this block in the buffer pool. When it is zero, the block can be
FIX_COUNT
evicted from the buffer pool.
IS_HASHED Whether or not a hash index has been built on this page.
NEWEST_MODIFICATION Most recent modification's Log Sequence Number.
OLDEST_MODIFICATION Oldest modification's Log Sequence Number.
ACCESS_TIME Abstract number representing the time the page was first accessed.
TABLE_NAME Table that the page belongs to.
INDEX_NAME Index that the page belongs to, either a clustered index or a secondary index.
NUMBER_RECORDS Number of records the page contains.
DATA_SIZE Size in bytes of all the records contained in the page.
COMPRESSED_SIZE Compressed size in bytes of the page, or NULL for pages that aren't compressed.

279/3812
Page state; one of FILE_PAGE (page from a file) or MEMORY (page from an in-memory object)
PAGE_STATE
for valid data, or one of NULL , READY_FOR_USE , NOT_USED , REMOVE_HASH .
Whether there is I/O pending for the page; one of IO_NONE (no pending I/O), IO_READ (read
IO_FIX
pending), IO_WRITE (write pending).
IS_OLD Whether the page is old or not.
Freed_page_clock counter, which tracks the number of blocks removed from the end of the
FREE_PAGE_CLOCK
least recently used (LRU) list, at the time the block was last placed at the head of the list.

The related INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU table contains the same information, but with an
LRU (least recently used) position rather than block id.

Examples
DESC information_schema.innodb_buffer_page;
+---------------------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------------+---------------------+------+-----+---------+-------+
| POOL_ID | bigint(21) unsigned | NO | | 0 | |
| BLOCK_ID | bigint(21) unsigned | NO | | 0 | |
| SPACE | bigint(21) unsigned | NO | | 0 | |
| PAGE_NUMBER | bigint(21) unsigned | NO | | 0 | |
| PAGE_TYPE | varchar(64) | YES | | NULL | |
| FLUSH_TYPE | bigint(21) unsigned | NO | | 0 | |
| FIX_COUNT | bigint(21) unsigned | NO | | 0 | |
| IS_HASHED | varchar(3) | YES | | NULL | |
| NEWEST_MODIFICATION | bigint(21) unsigned | NO | | 0 | |
| OLDEST_MODIFICATION | bigint(21) unsigned | NO | | 0 | |
| ACCESS_TIME | bigint(21) unsigned | NO | | 0 | |
| TABLE_NAME | varchar(1024) | YES | | NULL | |
| INDEX_NAME | varchar(1024) | YES | | NULL | |
| NUMBER_RECORDS | bigint(21) unsigned | NO | | 0 | |
| DATA_SIZE | bigint(21) unsigned | NO | | 0 | |
| COMPRESSED_SIZE | bigint(21) unsigned | NO | | 0 | |
| PAGE_STATE | varchar(64) | YES | | NULL | |
| IO_FIX | varchar(64) | YES | | NULL | |
| IS_OLD | varchar(3) | YES | | NULL | |
| FREE_PAGE_CLOCK | bigint(21) unsigned | NO | | 0 | |
+---------------------+---------------------+------+-----+---------+-------+

SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE\G


...
*************************** 6. row ***************************
POOL_ID: 0
BLOCK_ID: 5
SPACE: 0
PAGE_NUMBER: 11
PAGE_TYPE: INDEX
FLUSH_TYPE: 1
FIX_COUNT: 0
IS_HASHED: NO
NEWEST_MODIFICATION: 2046835
OLDEST_MODIFICATION: 0
ACCESS_TIME: 2585566280
TABLE_NAME: `SYS_INDEXES`
INDEX_NAME: CLUST_IND
NUMBER_RECORDS: 57
DATA_SIZE: 4016
COMPRESSED_SIZE: 0
PAGE_STATE: FILE_PAGE
IO_FIX: IO_NONE
IS_OLD: NO
FREE_PAGE_CLOCK: 0
...

1.1.1.2.9.1.1.1.2 Information Schema


INNODB_BUFFER_PAGE_LRU Table
The Information Schema INNODB_BUFFER_PAGE_LRU table contains information about pages in the buffer pool and how
they are ordered for eviction purposes.
The PROCESS privilege is required to view the table.
280/3812
It has the following columns:

Column Description
Buffer Pool identifier. From MariaDB 10.5.1 returns a value of 0, since multiple InnoDB buffer
POOL_ID
pool instances has been removed.
LRU_POSITION LRU (Least recently-used), for determining eviction order from the buffer pool.
SPACE Tablespace identifier. Matches the SPACE value on the INNODB_SYS_TABLES table.
PAGE_NUMBER Buffer pool page number.
Page type; one of allocated (newly-allocated page), index (B-tree node), undo_log
(undo log page), inode (index node), ibuf_free_list (insert buffer free list), ibuf_bitmap
(insert buffer bitmap), system (system page), trx_system (transaction system data),
PAGE_TYPE
file_space_header (file space header), extent_descriptor (extent descriptor page), blob
(uncompressed blob page), compressed_blob (first compressed blob page),
compressed_blob2 (subsequent compressed blob page) or unknown .

FLUSH_TYPE Flush type.


Count of the threads using this block in the buffer pool. When it is zero, the block can be
FIX_COUNT
evicted from the buffer pool.
IS_HASHED Whether or not a hash index has been built on this page.
NEWEST_MODIFICATION Most recent modification's Log Sequence Number.
OLDEST_MODIFICATION Oldest modification's Log Sequence Number.
ACCESS_TIME Abstract number representing the time the page was first accessed.
TABLE_NAME Table that the page belongs to.
INDEX_NAME Index that the page belongs to, either a clustered index or a secondary index.
NUMBER_RECORDS Number of records the page contains.
DATA_SIZE Size in bytes of all the records contained in the page.
COMPRESSED_SIZE Compressed size in bytes of the page, or NULL for pages that aren't compressed.
Page state; one of FILE_PAGE (page from a file) or MEMORY (page from an in-memory object)
PAGE_STATE
for valid data, or one of NULL , READY_FOR_USE , NOT_USED , REMOVE_HASH .
Whether there is I/O pending for the page; one of IO_NONE (no pending I/O), IO_READ (read
IO_FIX
pending), IO_WRITE (write pending).
IS_OLD Whether the page is old or not.
Freed_page_clock counter, which tracks the number of blocks removed from the end of the
FREE_PAGE_CLOCK
LRU list, at the time the block was last placed at the head of the list.

The related INFORMATION_SCHEMA.INNODB_BUFFER_PAGE table contains the same information, but with a block
id rather than LRU position.

Example

281/3812
DESC information_schema.innodb_buffer_page_lru;
+---------------------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------------+---------------------+------+-----+---------+-------+
| POOL_ID | bigint(21) unsigned | NO | | 0 | |
| LRU_POSITION | bigint(21) unsigned | NO | | 0 | |
| SPACE | bigint(21) unsigned | NO | | 0 | |
| PAGE_NUMBER | bigint(21) unsigned | NO | | 0 | |
| PAGE_TYPE | varchar(64) | YES | | NULL | |
| FLUSH_TYPE | bigint(21) unsigned | NO | | 0 | |
| FIX_COUNT | bigint(21) unsigned | NO | | 0 | |
| IS_HASHED | varchar(3) | YES | | NULL | |
| NEWEST_MODIFICATION | bigint(21) unsigned | NO | | 0 | |
| OLDEST_MODIFICATION | bigint(21) unsigned | NO | | 0 | |
| ACCESS_TIME | bigint(21) unsigned | NO | | 0 | |
| TABLE_NAME | varchar(1024) | YES | | NULL | |
| INDEX_NAME | varchar(1024) | YES | | NULL | |
| NUMBER_RECORDS | bigint(21) unsigned | NO | | 0 | |
| DATA_SIZE | bigint(21) unsigned | NO | | 0 | |
| COMPRESSED_SIZE | bigint(21) unsigned | NO | | 0 | |
| COMPRESSED | varchar(3) | YES | | NULL | |
| IO_FIX | varchar(64) | YES | | NULL | |
| IS_OLD | varchar(3) | YES | | NULL | |
| FREE_PAGE_CLOCK | bigint(21) unsigned | NO | | 0 | |
+---------------------+---------------------+------+-----+---------+-------+

SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU\G


...
*************************** 6. row ***************************
POOL_ID: 0
LRU_POSITION: 5
SPACE: 0
PAGE_NUMBER: 11
PAGE_TYPE: INDEX
FLUSH_TYPE: 1
FIX_COUNT: 0
IS_HASHED: NO
NEWEST_MODIFICATION: 2046835
OLDEST_MODIFICATION: 0
ACCESS_TIME: 2585566280
TABLE_NAME: `SYS_INDEXES`
INDEX_NAME: CLUST_IND
NUMBER_RECORDS: 57
DATA_SIZE: 4016
COMPRESSED_SIZE: 0
COMPRESSED: NO
IO_FIX: IO_NONE
IS_OLD: NO
FREE_PAGE_CLOCK: 0
...

1.1.1.2.9.1.1.1.3 Information Schema


INNODB_BUFFER_POOL_PAGES Table
The Information Schema INNODB_BUFFER_POOL_PAGES table is a Percona enhancement, and is only available for
XtraDB, not InnoDB (see XtraDB and InnoDB). It contains a record for each page in the buffer pool.
It has the following columns:

Column Description
Type of page; one of index , undo_log , inode , ibuf_free_list , allocated, bitmap , sys ,
PAGE_TYPE
trx_sys , fsp_hdr , xdes , blob , zblob , zblob2 and unknown .

SPACE_ID Tablespace ID.


PAGE_NO Page offset within tablespace.
LRU_POSITION Page position in the LRU (least-recently-used) list.
Page reference count, incremented each time the page is accessed. 0 if the page is not currently
FIX_COUNT
being accessed.
FLUSH_TYPE Flush type of the most recent flush. 0 (LRU), 2 (flush_list)

282/3812
1.1.1.2.9.1.1.1.4 Information Schema
INNODB_BUFFER_POOL_PAGES_BLOB
Table
The Information Schema INNODB_BUFFER_POOL_PAGES_BLOB table is a Percona enchancement, and is only available for
XtraDB, not InnoDB (see XtraDB and InnoDB). It contains information about buffer pool blob pages.
It has the following columns:

Column Description
SPACE_ID Tablespace ID.
PAGE_NO Page offset within tablespace.
COMPRESSED 1 if the blob contains compressed data, 0 if not.

PART_LEN Page data length.


NEXT_PAGE_NO Next page number.
LRU_POSITION Page position in the LRU (least-recently-used) list.
Page reference count, incremented each time the page is accessed. 0 if the page is not currently
FIX_COUNT
being accessed.
FLUSH_TYPE Flush type of the most recent flush. 0 (LRU), 2 (flush_list)

1.1.1.2.9.1.1.1.5 Information Schema


INNODB_BUFFER_POOL_PAGES_INDEX
Table
The Information Schema INNODB_BUFFER_POOL_PAGES table is a Percona enhancement, and is only available for
XtraDB, not InnoDB (see XtraDB and InnoDB). It contains information about buffer pool index pages.
It has the following columns:

Column Description
INDEX_ID Index name
SPACE_ID Tablespace ID
PAGE_NO Page offset within tablespace.
N_RECS Number of user records on the page.
DATA_SIZE Total data size in bytes of records in the page.
HASHED 1 if the block is in the adaptive hash index, 0 if not.

ACCESS_TIME Page's last access time.


MODIFIED 1 if the page has been modified since being loaded, 0 if not.

DIRTY 1 if the page has been modified since it was last flushed, 0 if not

OLD 1 if the page in the in the old blocks of the LRU (least-recently-used) list, 0 if not.

LRU_POSITION Position in the LRU (least-recently-used) list.


Page reference count, incremented each time the page is accessed. 0 if the page is not currently
FIX_COUNT
being accessed.
FLUSH_TYPE Flush type of the most recent flush. 0 (LRU), 2 (flush_list)

1.1.1.2.9.1.1.1.6 Information Schema


INNODB_BUFFER_POOL_STATS Table
The Information Schema INNODB_BUFFER_POOL_STATS table contains information about pages in the buffer pool, similar
to what is returned with the SHOW ENGINE INNODB STATUS statement.
The PROCESS privilege is required to view the table.

283/3812
It has the following columns:

Column Description
Buffer Pool identifier. From MariaDB 10.5.1 returns a value of 0, since multiple
POOL_ID
InnoDB buffer pool instances has been removed.
POOL_SIZE Size in pages of the buffer pool.
FREE_BUFFERS Number of free pages in the buffer pool.
DATABASE_PAGES Total number of pages in the buffer pool.
OLD_DATABASE_PAGES Number of pages in the old sublist.
MODIFIED_DATABASE_PAGES Number of dirty pages.
PENDING_DECOMPRESS Number of pages pending decompression.
PENDING_READS Pending buffer pool level reads.
PENDING_FLUSH_LRU Number of pages in the LRU pending flush.
PENDING_FLUSH_LIST Number of pages in the flush list pending flush.
PAGES_MADE_YOUNG Pages moved from the old sublist to the new sublist.
PAGES_NOT_MADE_YOUNG Pages that have remained in the old sublist without moving to the new sublist.
PAGES_MADE_YOUNG_RATE Hits that cause blocks to move to the top of the new sublist.
Hits that do not cause blocks to move to the top of the new sublist due to the
PAGES_MADE_NOT_YOUNG_RATE
innodb_old_blocks delay not being met.

NUMBER_PAGES_READ Number of pages read.


NUMBER_PAGES_CREATED Number of pages created.
NUMBER_PAGES_WRITTEN Number of pages written.
Number of pages read since the last printout divided by the time elapsed,
PAGES_READ_RATE
giving pages read per second.
Number of pages created since the last printout divided by the time elapsed,
PAGES_CREATE_RATE
giving pages created per second.
Number of pages written since the last printout divided by the time elapsed,
PAGES_WRITTEN_RATE
giving pages written per second.
NUMBER_PAGES_GET Number of logical read requests.
HIT_RATE Buffer pool hit rate.
YOUNG_MAKE_PER_THOUSAND_GETS For every 1000 gets, the number of pages made young.
NOT_YOUNG_MAKE_PER_THOUSAND_GETS For every 1000 gets, the number of pages not made young.
NUMBER_PAGES_READ_AHEAD Number of pages read ahead.
Number of pages read ahead by the read-ahead thread that were later evicted
NUMBER_READ_AHEAD_EVICTED
without being accessed by any queries.
Pages read ahead since the last printout divided by the time elapsed, giving
READ_AHEAD_RATE
read-ahead rate per second.
Read-ahead pages not accessed since the last printout divided by time
READ_AHEAD_EVICTED_RATE elapsed, giving the number of read-ahead pages evicted without access per
second.
LRU_IO_TOTAL Total least-recently used I/O.
LRU_IO_CURRENT Least-recently used I/O for the current interval.
UNCOMPRESS_TOTAL Total number of pages decompressed.
UNCOMPRESS_CURRENT Number of pages decompressed in the current interval

Examples

284/3812
DESC information_schema.innodb_buffer_pool_stats;
+----------------------------------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------------------------+---------------------+------+-----+---------+-------+
| POOL_ID | bigint(21) unsigned | NO | | 0 | |
| POOL_SIZE | bigint(21) unsigned | NO | | 0 | |
| FREE_BUFFERS | bigint(21) unsigned | NO | | 0 | |
| DATABASE_PAGES | bigint(21) unsigned | NO | | 0 | |
| OLD_DATABASE_PAGES | bigint(21) unsigned | NO | | 0 | |
| MODIFIED_DATABASE_PAGES | bigint(21) unsigned | NO | | 0 | |
| PENDING_DECOMPRESS | bigint(21) unsigned | NO | | 0 | |
| PENDING_READS | bigint(21) unsigned | NO | | 0 | |
| PENDING_FLUSH_LRU | bigint(21) unsigned | NO | | 0 | |
| PENDING_FLUSH_LIST | bigint(21) unsigned | NO | | 0 | |
| PAGES_MADE_YOUNG | bigint(21) unsigned | NO | | 0 | |
| PAGES_NOT_MADE_YOUNG | bigint(21) unsigned | NO | | 0 | |
| PAGES_MADE_YOUNG_RATE | double | NO | | 0 | |
| PAGES_MADE_NOT_YOUNG_RATE | double | NO | | 0 | |
| NUMBER_PAGES_READ | bigint(21) unsigned | NO | | 0 | |
| NUMBER_PAGES_CREATED | bigint(21) unsigned | NO | | 0 | |
| NUMBER_PAGES_WRITTEN | bigint(21) unsigned | NO | | 0 | |
| PAGES_READ_RATE | double | NO | | 0 | |
| PAGES_CREATE_RATE | double | NO | | 0 | |
| PAGES_WRITTEN_RATE | double | NO | | 0 | |
| NUMBER_PAGES_GET | bigint(21) unsigned | NO | | 0 | |
| HIT_RATE | bigint(21) unsigned | NO | | 0 | |
| YOUNG_MAKE_PER_THOUSAND_GETS | bigint(21) unsigned | NO | | 0 | |
| NOT_YOUNG_MAKE_PER_THOUSAND_GETS | bigint(21) unsigned | NO | | 0 | |
| NUMBER_PAGES_READ_AHEAD | bigint(21) unsigned | NO | | 0 | |
| NUMBER_READ_AHEAD_EVICTED | bigint(21) unsigned | NO | | 0 | |
| READ_AHEAD_RATE | double | NO | | 0 | |
| READ_AHEAD_EVICTED_RATE | double | NO | | 0 | |
| LRU_IO_TOTAL | bigint(21) unsigned | NO | | 0 | |
| LRU_IO_CURRENT | bigint(21) unsigned | NO | | 0 | |
| UNCOMPRESS_TOTAL | bigint(21) unsigned | NO | | 0 | |
| UNCOMPRESS_CURRENT | bigint(21) unsigned | NO | | 0 | |
+----------------------------------+---------------------+------+-----+---------+-------+

1.1.1.2.9.1.1.1.7 Information Schema


INNODB_CHANGED_PAGES Table
The Information Schema INNODB_CHANGED_PAGES Table contains data about modified pages from the bitmap file. It is
updated at checkpoints by the log tracking thread parsing the log, so does not contain real-time data.
The number of records is limited by the value of the innodb_max_changed_pages system variable.
The PROCESS privilege is required to view the table.
It has the following columns:

Column Description
SPACE_ID Modified page space id
PAGE_ID Modified page id
START_LSN Interval start after which page was changed (equal to checkpoint LSN)
END_LSN Interval end before which page was changed (equal to checkpoint LSN)

1.1.1.2.9.1.1.1.8 Information Schema


INNODB_CMP and INNODB_CMP_RESET
Tables
The INNODB_CMP and INNODB_CMP_RESET tables contain status information on compression operations related to
compressed XtraDB/InnoDB tables.
The PROCESS privilege is required to query this table.
These tables contain the following columns:

Column Name Description

285/3812
Compressed page size, in bytes. This value is unique in the table; other values are totals which
PAGE_SIZE
refer to pages of this size.

How many times a page of the size PAGE_SIZE has been compressed. This happens when a new
COMPRESS_OPS page is created because the compression log runs out of space. This value includes both
successful operations and compression failures.
How many times a page of the size PAGE_SIZE has been successfully compressed. This value
COMPRESS_OPS_OK should be as close as possible to COMPRESS_OPS . If it is notably lower, either avoid compressing
some tables, or increase the KEY_BLOCK_SIZE for some compressed tables.
Time (in seconds) spent to compress pages of the size PAGE_SIZE . This value includes time
COMPRESS_TIME
spent in compression failures.
How many times a page of the size PAGE_SIZE has been uncompressed. This happens when an
UNCOMPRESS_OPS uncompressed version of a page is created in the buffer pool, or when a compression failure
occurs.
UNCOMPRESS_TIME Time (in seconds) spent to uncompress pages of the size PAGE_SIZE .

These tables can be used to measure the effectiveness of XtraDB/InnoDB table compression. When you have to decide
a value for KEY_BLOCK_SIZE , you can create more than one version of the table (one for each candidate value) and run
a realistic workload on them. Then, these tables can be used to see how the operations performed with different page
sizes.
INNODB_CMP and INNODB_CMP_RESET have the same columns and always contain the same values, but when
INNODB_CMP_RESET is queried, both the tables are cleared. INNODB_CMP_RESET can be used, for example, if a script
periodically logs the performances of compression in the last period of time. INNODB_CMP can be used to see the
cumulated statistics.

Examples
SELECT * FROM information_schema.INNODB_CMP\G
**************************** 1. row *****************************
page_size: 1024
compress_ops: 0
compress_ops_ok: 0
compress_time: 0
uncompress_ops: 0
uncompress_time: 0
...

See Also
Other tables that can be used to monitor XtraDB/InnoDB compressed tables:
INNODB_CMP_PER_INDEX and INNODB_CMP_PER_INDEX_RESET
INNODB_CMPMEM and INNODB_CMPMEM_RESET

1.1.1.2.9.1.1.1.9 Information Schema


INNODB_CMPMEM and
INNODB_CMPMEM_RESET Tables
The INNODB_CMPMEM and INNODB_CMPMEM_RESET tables contain status information on compressed pages in the buffer
pool (see InnoDB COMPRESSED format).
The PROCESS privilege is required to query this table.
These tables contain the following columns:

Column Name Description


Compressed page size, in bytes. This value is unique in the table; other values are totals
PAGE_SIZE
which refer to pages of this size.
Buffer Pool identifier. From MariaDB 10.5.1 returns a value of 0, since multiple InnoDB
BUFFER_POOL_INSTANCE
buffer pool instances has been removed.
PAGES_USED Number of pages of the size PAGE_SIZE which are currently in the buffer pool.

286/3812
Number of pages of the size PAGE_SIZE which are currently free, and thus are available for
PAGES_FREE allocation. This value represents the buffer pool's fragmentation. A totally unfragmented
buffer pool has at most 1 free page.
How many times a page of the size PAGE_SIZE has been relocated. This happens when
RELOCATION_OPS data exceeds a page (because a row must be copied into a new page) and when two pages
are merged (because their data shrunk and can now be contained in one page).
Time (in seconds) spent in relocation operations for pages of the size PAGE_SIZE . This
RELOCATION_TIME
column is reset when the INNODB_CMPMEM_RESET table is queried.

These tables can be used to measure the effectiveness of InnoDB table compression. When you have to decide a value
for KEY_BLOCK_SIZE , you can create more than one version of the table (one for each candidate value) and run a
realistic workload on them. Then, these tables can be used to see how the operations performed with different page
sizes.
INNODB_CMPMEM and INNODB_CMPMEM_RESET have the same columns and always contain the same values, but when
INNODB_CMPMEM_RESET is queried, the RELOCATION_TIME column from both the tables are cleared.
INNODB_CMPMEM_RESET can be used, for example, if a script periodically logs the performances of compression in the
last period of time. INNODB_CMPMEM can be used to see the cumulated statistics.

Example
SELECT * FROM information_schema.INNODB_CMPMEM\G
********************** 1. row **********************
page_size: 1024
buffer_pool_instance: 0
pages_used: 0
pages_free: 0
reloacation_ops: 0
relocation_time: 0

See Also
Other tables that can be used to monitor InnoDB compressed tables:
INNODB_CMP and INNODB_CMP_RESET
INNODB_CMP_PER_INDEX and INNODB_CMP_PER_INDEX_RESET

1.1.1.2.9.1.1.1.10 Information Schema


INNODB_CMP_PER_INDEX and
INNODB_CMP_PER_INDEX_RESET Tables
The INNODB_CMP_PER_INDEX and INNODB_CMP_PER_INDEX_RESET tables contain status information on compression
operations related to compressed XtraDB/InnoDB tables, grouped by individual indexes. These tables are only
populated if the innodb_cmp_per_index_enabled system variable is set to ON .
The PROCESS privilege is required to query this table.
These tables contains the following columns:

Column Name Description


DATABASE_NAME Database containing the index.
TABLE_NAME Table containing the index.
INDEX_NAME Other values are totals which refer to this index's compression.
How many times a page of INDEX_NAME has been compressed. This happens when a new page
COMPRESS_OPS is created because the compression log runs out of space. This value includes both successful
operations and compression failures.
How many times a page of INDEX_NAME has been successfully compressed. This value should be
COMPRESS_OPS_OK as close as possible to COMPRESS_OPS . If it is notably lower, either avoid compressing some
tables, or increase the KEY_BLOCK_SIZE for some compressed tables.
Time (in seconds) spent to compress pages of the size PAGE_SIZE . This value includes time
COMPRESS_TIME
spent in compression failures.

287/3812
How many times a page of INDEX_NAME has been uncompressed. This happens when an
UNCOMPRESS_OPS uncompressed version of a page is created in the buffer pool, or when a compression failure
occurs.
UNCOMPRESS_TIME Time (in seconds) spent to uncompress pages of INDEX_NAME .

These tables can be used to measure the effectiveness of XtraDB/InnoDB compression, per table or per index. The
values in these tables show which tables perform better with index compression, and which tables cause too many
compression failures or perform too many compression/uncompression operations. When compression performs badly
for a table, this might mean that you should change its KEY_BLOCK_SIZE , or that the table should not be compressed.
INNODB_CMP_PER_INDEX and INNODB_CMP_PER_INDEX_RESET have the same columns and always contain the same
values, but when INNODB_CMP_PER_INDEX_RESET is queried, both the tables are cleared. INNODB_CMP_PER_INDEX_RESET
can be used, for example, if a script periodically logs the performances of compression in the last period of time.
INNODB_CMP_PER_INDEX can be used to see the cumulated statistics.

See Also
Other tables that can be used to monitor XtraDB/InnoDB compressed tables:
INNODB_CMP and INNODB_CMP_RESET
INNODB_CMPMEM and INNODB_CMPMEM_RESET

1.1.1.2.9.1.1.1.11 Information Schema


INNODB_FT_BEING_DELETED Table
The Information Schema INNODB_FT_BEING_DELETED table is only used while document ID's in the related
INNODB_FT_DELETED are being removed from an InnoDB fulltext index while an OPTIMIZE TABLE is underway. At
all other times the table will be empty.
The SUPER privilege is required to view the table, and it also requires the innodb_ft_aux_table system variable to be
set.
It has the following column:

Column Description
Document ID of the row being deleted. Either an underlying ID value, or a sequence value generated by
DOC_ID
InnoDB if no usable option exists.

1.1.1.2.9.1.1.1.12 Information Schema


INNODB_FT_CONFIG Table
The Information Schema INNODB_FT_CONFIG table contains InnoDB fulltext index metadata.
The SUPER privilege is required to view the table, and it also requires the innodb_ft_aux_table system variable to be
set.
It has the following columns:

Column Description

KEY Metadata item name.

VALUE Associated value.

Example

288/3812
SELECT * FROM INNODB_FT_CONFIG;
+---------------------------+-------+
| KEY | VALUE |
+---------------------------+-------+
| optimize_checkpoint_limit | 180 |
| synced_doc_id | 6 |
| last_optimized_word | |
| deleted_doc_count | 0 |
| total_word_count | |
| optimize_start_time | |
| optimize_end_time | |
| stopword_table_name | |
| use_stopword | 1 |
| table_state | 0 |
+---------------------------+-------+

1.1.1.2.9.1.1.1.13 Information Schema


INNODB_FT_DEFAULT_STOPWORD Table
The Information Schema INNODB_FT_DEFAULT_STOPWORD table contains a list of default stopwords used when creating
an InnoDB fulltext index.
The PROCESS privilege is required to view the table.
It has the following column:

Column Description
Default stopword for an InnoDB fulltext index. Setting either the innodb_ft_server_stopword_table or the
VALUE
innodb_ft_user_stopword_table system variable will override this.

Example
SELECT * FROM information_schema.INNODB_FT_DEFAULT_STOPWORD\G
*************************** 1. row ***************************
value: a
*************************** 2. row ***************************
value: about
*************************** 3. row ***************************
value: an
*************************** 4. row ***************************
value: are
...
*************************** 36. row ***************************
value: www

1.1.1.2.9.1.1.1.14 Information Schema


INNODB_FT_DELETED Table
The Information Schema INNODB_FT_DELETED table contains rows that have been deleted from an InnoDB fulltext index.
This information is then used to filter results on subsequent searches, removing the need to expensively reorganise the
index each time a row is deleted.
The fulltext index is then only reorganized when an OPTIMIZE TABLE statement is underway. The related
INNODB_FT_BEING_DELETED table contains rows being deleted while an OPTIMIZE TABLE is in the process of
running.
The SUPER privilege is required to view the table, and it also requires the innodb_ft_aux_table system variable to be
set.
It has the following column:

Column Description
Document ID of the deleted row deleted. Either an underlying ID value, or a sequence value generated by
DOC_ID
InnoDB if no usable option exists.

Example
289/3812
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DELETED;
+--------+
| DOC_ID |
+--------+
| 2 |
+--------+

DELETE FROM test.ft_innodb LIMIT 1;

SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DELETED;


+--------+
| DOC_ID |
+--------+
| 2 |
| 3 |
+--------+

1.1.1.2.9.1.1.1.15 Information Schema


INNODB_FT_INDEX_CACHE Table
The Information Schema INNODB_FT_INDEX_CACHE table contains information about rows that have recently been
inserted into an InnoDB fulltext index. To avoid re-organizing the fulltext index each time a change is made, which would
be very expensive, new changes are stored separately and only integrated when an OPTIMIZE TABLE is run.
The SUPER privilege is required to view the table, and it also requires the innodb_ft_aux_table system variable to be
set.
It has the following columns:

Column Description
Word from the text of a newly added row. Words can appear multiple times in the table, once per
WORD
DOC_ID and POSITION combination.

FIRST_DOC_ID First document ID where this word appears in the index.


LAST_DOC_ID Last document ID where this word appears in the index.
DOC_COUNT Number of rows containing this word in the index.
DOC_ID Document ID of the newly added row, either an appropriate ID column or an internal InnoDB value.
Position of this word instance within the DOC_ID , as an offset added to the previous POSITION
POSITION
instance.

Note that for OPTIMIZE TABLE to process InnoDB fulltext index data, the innodb_optimize_fulltext_only system variable
needs to be set to 1 . When this is done, and an OPTIMIZE TABLE statement run, the INNODB_FT_INDEX_CACHE table
will be emptied, and the INNODB_FT_INDEX_TABLE table will be updated.

Examples

290/3812
SELECT * FROM INNODB_FT_INDEX_CACHE;
+------------+--------------+-------------+-----------+--------+----------+
| WORD | FIRST_DOC_ID | LAST_DOC_ID | DOC_COUNT | DOC_ID | POSITION |
+------------+--------------+-------------+-----------+--------+----------+
| and | 4 | 4 | 1 | 4 | 0 |
| arrived | 4 | 4 | 1 | 4 | 20 |
| ate | 1 | 1 | 1 | 1 | 4 |
| everybody | 1 | 1 | 1 | 1 | 8 |
| goldilocks | 4 | 4 | 1 | 4 | 9 |
| hungry | 3 | 3 | 1 | 3 | 8 |
| then | 4 | 4 | 1 | 4 | 4 |
| wicked | 2 | 2 | 1 | 2 | 4 |
| witch | 2 | 2 | 1 | 2 | 11 |
+------------+--------------+-------------+-----------+--------+----------+
9 rows in set (0.00 sec)

INSERT INTO test.ft_innodb VALUES(3,'And she ate a pear');

SELECT * FROM INNODB_FT_INDEX_CACHE;


+------------+--------------+-------------+-----------+--------+----------+
| WORD | FIRST_DOC_ID | LAST_DOC_ID | DOC_COUNT | DOC_ID | POSITION |
+------------+--------------+-------------+-----------+--------+----------+
| and | 4 | 5 | 2 | 4 | 0 |
| and | 4 | 5 | 2 | 5 | 0 |
| arrived | 4 | 4 | 1 | 4 | 20 |
| ate | 1 | 5 | 2 | 1 | 4 |
| ate | 1 | 5 | 2 | 5 | 8 |
| everybody | 1 | 1 | 1 | 1 | 8 |
| goldilocks | 4 | 4 | 1 | 4 | 9 |
| hungry | 3 | 3 | 1 | 3 | 8 |
| pear | 5 | 5 | 1 | 5 | 14 |
| she | 5 | 5 | 1 | 5 | 4 |
| then | 4 | 4 | 1 | 4 | 4 |
| wicked | 2 | 2 | 1 | 2 | 4 |
| witch | 2 | 2 | 1 | 2 | 11 |
+------------+--------------+-------------+-----------+--------+----------+

OPTIMIZE TABLE test.ft_innodb\G


*************************** 1. row ***************************
Table: test.ft_innodb
Op: optimize
Msg_type: note
Msg_text: Table does not support optimize, doing recreate + analyze instead
*************************** 2. row ***************************
Table: test.ft_innodb
Op: optimize
Msg_type: status
Msg_text: OK
2 rows in set (2.24 sec)

SELECT * FROM INNODB_FT_INDEX_CACHE;


+------------+--------------+-------------+-----------+--------+----------+
| WORD | FIRST_DOC_ID | LAST_DOC_ID | DOC_COUNT | DOC_ID | POSITION |
+------------+--------------+-------------+-----------+--------+----------+
| and | 4 | 5 | 2 | 4 | 0 |
| and | 4 | 5 | 2 | 5 | 0 |
| arrived | 4 | 4 | 1 | 4 | 20 |
| ate | 1 | 5 | 2 | 1 | 4 |
| ate | 1 | 5 | 2 | 5 | 8 |
| everybody | 1 | 1 | 1 | 1 | 8 |
| goldilocks | 4 | 4 | 1 | 4 | 9 |
| hungry | 3 | 3 | 1 | 3 | 8 |
| pear | 5 | 5 | 1 | 5 | 14 |
| she | 5 | 5 | 1 | 5 | 4 |
| then | 4 | 4 | 1 | 4 | 4 |
| wicked | 2 | 2 | 1 | 2 | 4 |
| witch | 2 | 2 | 1 | 2 | 11 |
+------------+--------------+-------------+-----------+--------+----------+
13 rows in set (0.00 sec)

The OPTIMIZE TABLE statement has no effect, because the innodb_optimize_fulltext_only variable wasn't set:

291/3812
SHOW VARIABLES LIKE 'innodb_optimize_fulltext_only';
+-------------------------------+-------+
| Variable_name | Value |
+-------------------------------+-------+
| innodb_optimize_fulltext_only | OFF |
+-------------------------------+-------+

SET GLOBAL innodb_optimize_fulltext_only =1;

OPTIMIZE TABLE test.ft_innodb;


+----------------+----------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+----------------+----------+----------+----------+
| test.ft_innodb | optimize | status | OK |
+----------------+----------+----------+----------+

SELECT * FROM INNODB_FT_INDEX_CACHE;


Empty set (0.00 sec)

1.1.1.2.9.1.1.1.16 Information Schema


INNODB_FT_INDEX_TABLE Table
The Information Schema INNODB_FT_INDEX_TABLE table contains information about InnoDB fulltext indexes. To avoid re-
organizing the fulltext index each time a change is made, which would be very expensive, new changes are stored
separately and only integrated when an OPTIMIZE TABLE is run. See the INNODB_FT_INDEX_CACHE table.
The SUPER privilege is required to view the table, and it also requires the innodb_ft_aux_table system variable to be
set.
It has the following columns:

Column Description
Word from the text of a column with a fulltext index. Words can appear multiple times in the table,
WORD
once per DOC_ID and POSITION combination.
FIRST_DOC_ID First document ID where this word appears in the index.
LAST_DOC_ID Last document ID where this word appears in the index.
DOC_COUNT Number of rows containing this word in the index.
DOC_ID Document ID of the newly added row, either an appropriate ID column or an internal InnoDB value.
Position of this word instance within the DOC_ID , as an offset added to the previous POSITION
POSITION
instance.

Note that for OPTIMIZE TABLE to process InnoDB fulltext index data, the innodb_optimize_fulltext_only system variable
needs to be set to 1 . When this is done, and an OPTIMIZE TABLE statement run, the INNODB_FT_INDEX_CACHE
table will be emptied, and the INNODB_FT_INDEX_TABLE table will be updated.

Examples

292/3812
SELECT * FROM INNODB_FT_INDEX_TABLE;
Empty set (0.00 sec)

SET GLOBAL innodb_optimize_fulltext_only =1;

OPTIMIZE TABLE test.ft_innodb;


+----------------+----------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+----------------+----------+----------+----------+
| test.ft_innodb | optimize | status | OK |
+----------------+----------+----------+----------+

SELECT * FROM INNODB_FT_INDEX_TABLE;


+------------+--------------+-------------+-----------+--------+----------+
| WORD | FIRST_DOC_ID | LAST_DOC_ID | DOC_COUNT | DOC_ID | POSITION |
+------------+--------------+-------------+-----------+--------+----------+
| and | 4 | 5 | 2 | 4 | 0 |
| and | 4 | 5 | 2 | 5 | 0 |
| arrived | 4 | 4 | 1 | 4 | 20 |
| ate | 1 | 5 | 2 | 1 | 4 |
| ate | 1 | 5 | 2 | 5 | 8 |
| everybody | 1 | 1 | 1 | 1 | 8 |
| goldilocks | 4 | 4 | 1 | 4 | 9 |
| hungry | 3 | 3 | 1 | 3 | 8 |
| pear | 5 | 5 | 1 | 5 | 14 |
| she | 5 | 5 | 1 | 5 | 4 |
| then | 4 | 4 | 1 | 4 | 4 |
| wicked | 2 | 2 | 1 | 2 | 4 |
| witch | 2 | 2 | 1 | 2 | 11 |
+------------+--------------+-------------+-----------+--------+----------+

1.1.1.2.9.1.1.1.17 Information Schema


INNODB_LOCK_WAITS Table
The Information Schema INNODB_LOCK_WAITS table contains information about blocked InnoDB transactions. The
PROCESS privilege is required to view the table.

It contains the following columns:

Column Description
REQUESTING_TRX_ID Requesting transaction ID from the INNODB_TRX table.
REQUESTED_LOCK_ID Lock ID from the INNODB.LOCKS table for the waiting transaction.
BLOCKING_TRX_ID Blocking transaction ID from the INNODB_TRX table.
Lock ID from the INNODB.LOCKS table of a lock held by a transaction that is blocking another
BLOCKING_LOCK_ID
transaction.

The table is often used in conjunction with the INNODB_LOCKS and INNODB_TRX tables to diagnose problematic
locks and transactions.

1.1.1.2.9.1.1.1.18 Information Schema


INNODB_LOCKS Table
The Information Schema INNODB_LOCKS table stores information about locks that InnoDB transactions have requested
but not yet acquired, or that are blocking another transaction.
It has the following columns:

Column Description
LOCK_ID Lock ID number - the format is not fixed, so do not rely upon the number for information.
LOCK_TRX_ID Lock's transaction ID. Matches the INNODB_TRX.TRX_ID column.
Lock mode. One of S (shared), X (exclusive), IS (intention shared), IX (intention exclusive row
LOCK_MODE lock), S_GAP (shared gap lock), X_GAP (exclusive gap lock), IS_GAP (intention shared gap lock),
IX_GAP (intention exclusive gap lock) or AUTO_INC (auto-increment table level lock).

LOCK_TYPE Whether the lock is RECORD (row level) or TABLE level.


LOCK_TABLE Name of the locked table,or table containing locked rows.

293/3812
LOCK_INDEX Index name if a RECORD LOCK_TYPE , or NULL if not.
LOCK_SPACE Tablespace ID if a RECORD LOCK_TYPE , or NULL if not.
LOCK_PAGE Locked record page number if a RECORD LOCK_TYPE , or NULL if not.
LOCK_REC Locked record heap number if a RECORD LOCK_TYPE , or NULL if not.
Locked record primary key as an SQL string if a RECORD LOCK_TYPE , or NULL if not. If no primary key
LOCK_DATA exists, the internal InnoDB row_id number is instead used. To avoid unnecessary IO, also NULL if the
locked record page is not in the buffer pool

The table is often used in conjunction with the INNODB_LOCK_WAITS and INNODB_TRX tables to diagnose
problematic locks and transactions

Example
-- session 1
START TRANSACTION;
UPDATE t SET id = 15 WHERE id = 10;

-- session 2
DELETE FROM t WHERE id = 10;

-- session 1
USE information_schema;
SELECT l.*, t.*
FROM information_schema.INNODB_LOCKS l
JOIN information_schema.INNODB_TRX t
ON l.lock_trx_id = t.trx_id
WHERE trx_state = 'LOCK WAIT' \G
*************************** 1. row ***************************
lock_id: 840:40:3:2
lock_trx_id: 840
lock_mode: X
lock_type: RECORD
lock_table: `test`.`t`
lock_index: PRIMARY
lock_space: 40
lock_page: 3
lock_rec: 2
lock_data: 10
trx_id: 840
trx_state: LOCK WAIT
trx_started: 2019-12-23 18:43:46
trx_requested_lock_id: 840:40:3:2
trx_wait_started: 2019-12-23 18:43:46
trx_weight: 2
trx_mysql_thread_id: 46
trx_query: DELETE FROM t WHERE id = 10
trx_operation_state: starting index read
trx_tables_in_use: 1
trx_tables_locked: 1
trx_lock_structs: 2
trx_lock_memory_bytes: 1136
trx_rows_locked: 1
trx_rows_modified: 0
trx_concurrency_tickets: 0
trx_isolation_level: REPEATABLE READ
trx_unique_checks: 1
trx_foreign_key_checks: 1
trx_last_foreign_key_error: NULL
trx_is_read_only: 0
trx_autocommit_non_locking: 0

1.1.1.2.9.1.1.1.19 Information Schema


INNODB_METRICS Table

294/3812
Contents
1. Enabling and Disabling Counters
2. Resetting Counters
3. Simplifying from MariaDB 10.6
4. Examples

The Information Schema INNODB_METRICS table contains a list of useful InnoDB performance metrics. Each row in the
table represents an instrumented counter that can be stopped, started and reset, and which can be grouped together by
module.
The PROCESS privilege is required to view the table.
It has the following columns:

Column Description
NAME Unique counter name.
InnoDB subsystem. See below for the matching module to use to enable/disable monitoring this
SUBSYSTEM
subsytem with the innodb_monitor_enable and innodb_monitor_disable system variables.
COUNT Count since being enabled.
MAX_COUNT Maximum value since being enabled.
MIN_COUNT Minimum value since being enabled.
AVG_COUNT Average value since being enabled.
COUNT_RESET Count since last being reset.
MAX_COUNT_RESET Maximum value since last being reset.
MIN_COUNT_RESET Minimum value since last being reset.
AVG_COUNT_RESET Average value since last being reset.
TIME_ENABLED Time last enabled.
TIME_DISABLED Time last disabled
TIME_ELAPSED Time since enabled
TIME_RESET Time last reset.
STATUS Whether the counter is currently enabled to disabled.
TYPE Item type; one of counter , value , status_counter , set_owner , set_member .
COMMENT Counter description.

Enabling and Disabling Counters


Most of the counters are disabled by default. To enable them, use the innodb_monitor_enable system variable. You can
either enable a variable by its name, for example:

SET GLOBAL innodb_monitor_enable = icp_match;

or enable a number of counters grouped by module. The SUBSYSTEM field indicates which counters are grouped
together, but the following module names need to be used:

Module Name Subsytem Field


module_metadata metadata

module_lock lock

module_buffer buffer

module_buf_page buffer_page_io

module_os os

module_trx transaction

module_purge purge

module_compress compression

module_file file_system

295/3812
module_index index

adaptive_hash_index From MariaDB 10.6.2, if innodb_adaptive_hash_index is disabled


module_adaptive_hash
(the default), adaptive_hash_index will not be updated.
module_ibuf_system change_buffer

module_srv server

module_ddl ddl

module_dml dml

module_log recovery

module_icp icp

There are four counters in the icp subsystem:

SELECT NAME, SUBSYSTEM FROM INNODB_METRICS WHERE SUBSYSTEM='icp';


+------------------+-----------+
| NAME | SUBSYSTEM |
+------------------+-----------+
| icp_attempts | icp |
| icp_no_match | icp |
| icp_out_of_range | icp |
| icp_match | icp |
+------------------+-----------+

To enable them all, use the associated module name from the table above, module_icp .

SET GLOBAL innodb_monitor_enable = module_icp;

The % wildcard, used to represent any number of characters, can also be used when naming counters, for example:

SET GLOBAL innodb_monitor_enable = 'buffer%'

To disable counters, use the innodb_monitor_disable system variable, using the same naming rules as described above
for enabling.
Counter status is not persistent, and will be reset when the server restarts. It is possible to use the options on the
command line, or the innodb_monitor_enable option only in a configuration file.

Resetting Counters
Counters can also be reset. Resetting sets all the *_COUNT_RESET values to zero, while leaving the *_COUNT values,
which perform counts since the counter was enabled, untouched. Resetting is performed with the innodb_monitor_reset
(for individual counters) and innodb_monitor_reset_all (for all counters) system variables.

Simplifying from MariaDB 10.6


MariaDB starting with 10.6
From MariaDB 10.6, the interface was simplified by removing the following:
buffer_LRU_batches_flush
buffer_LRU_batch_flush_pages
buffer_LRU_batches_evict
buffer_LRU_batch_evict_pages
and by making the following reflect the status variables:
buffer_LRU_batch_flush_total_pages: innodb_buffer_pool_pages_LRU_flushed
buffer_LRU_batch_evict_total_pages: innodb_buffer_pool_pages_LRU_freed
The intention is to eventually remove the interface entirely (see MDEV-15706 ).

Examples
MariaDB 10.8:

296/3812
SELECT name,subsystem,type,comment FROM INFORMATION_SCHEMA.INNODB_METRICS\G
*************************** 1. row ***************************
name: metadata_table_handles_opened
subsystem: metadata
type: counter
comment: Number of table handles opened
*************************** 2. row ***************************
name: lock_deadlocks
subsystem: lock
type: value
comment: Number of deadlocks
*************************** 3. row ***************************
name: lock_timeouts
subsystem: lock
type: value
comment: Number of lock timeouts
*************************** 4. row ***************************
name: lock_rec_lock_waits
subsystem: lock
type: counter
comment: Number of times enqueued into record lock wait queue
*************************** 5. row ***************************
name: lock_table_lock_waits
subsystem: lock
type: counter
comment: Number of times enqueued into table lock wait queue
*************************** 6. row ***************************
name: lock_rec_lock_requests
subsystem: lock
type: counter
comment: Number of record locks requested
*************************** 7. row ***************************
name: lock_rec_lock_created
subsystem: lock
type: counter
comment: Number of record locks created
*************************** 8. row ***************************
name: lock_rec_lock_removed
subsystem: lock
type: counter
comment: Number of record locks removed from the lock queue
*************************** 9. row ***************************
name: lock_rec_locks
subsystem: lock
type: counter
comment: Current number of record locks on tables
*************************** 10. row ***************************
name: lock_table_lock_created
subsystem: lock
type: counter
comment: Number of table locks created

...

*************************** 207. row ***************************


name: icp_attempts
subsystem: icp
type: counter
comment: Number of attempts for index push-down condition checks
*************************** 208. row ***************************
name: icp_no_match
subsystem: icp
type: counter
comment: Index push-down condition does not match
*************************** 209. row ***************************
name: icp_out_of_range
subsystem: icp
type: counter
comment: Index push-down condition out of range
*************************** 210. row ***************************
name: icp_match
subsystem: icp
type: counter
comment: Index push-down condition matches

1.1.1.2.9.1.1.1.20 Information Schema


297/3812
INNODB_MUTEXES Table
The INNODB_MUTEXES table monitors mutex and rw locks waits. It has the following columns:

Column Description
NAME Name of the lock, as it appears in the source code.
CREATE_FILE File name of the mutex implementation.
CREATE_LINE Line number of the mutex implementation.
OS_WAITS How many times the mutex occurred.

The CREATE_FILE and CREATE_LINE columns depend on the InnoDB/XtraDB version.


Note that since MariaDB 10.2.2 , the table has only been providing information about rw_lock_t, not any mutexes.
From MariaDB 10.2.2 until MariaDB 10.2.32 , MariaDB 10.3.23, MariaDB 10.4.13 and MariaDB 10.5.1, the NAME
column was not populated (MDEV-21636 ).
The SHOW ENGINE INNODB STATUS statement provides similar information.

Examples
SELECT * FROM INNODB_MUTEXES;
+------------------------------+---------------------+-------------+----------+
| NAME | CREATE_FILE | CREATE_LINE | OS_WAITS |
+------------------------------+---------------------+-------------+----------+
| &dict_sys->mutex | dict0dict.cc | 989 | 2 |
| &buf_pool->flush_state_mutex | buf0buf.cc | 1388 | 1 |
| &log_sys->checkpoint_lock | log0log.cc | 1014 | 2 |
| &block->lock | combined buf0buf.cc | 1120 | 1 |
+------------------------------+---------------------+-------------+----------+

1.1.1.2.9.1.1.1.21 Information Schema


INNODB_SYS_COLUMNS Table
The Information Schema INNODB_SYS_COLUMNS table contains information about InnoDB fields.
The PROCESS privilege is required to view the table.
It has the following columns:

Column Description
TABLE_ID Table identifier, matching the value from INNODB_SYS_TABLES.TABLE_ID.
NAME Column name.
Ordinal position of the column in the table, starting from 0 . This value is adjusted when columns are
POS
added or removed.
MTYPE Numeric column type identifier, (see the table below for an explanation of its values).
PRTYPE Binary value of the InnoDB precise type, representing the data type, character set code and nullability.
LEN Column length. For multi-byte character sets, represents the length in bytes.

The column MTYPE uses a numeric column type identifier, which has the following values:

Column Type Identifier Description


1 VARCHAR

2 CHAR

3 FIXBINARY

4 BINARY

5 BLOB

6 INT

7 SYS_CHILD

8 SYS

298/3812
9 FLOAT

10 DOUBLE

11 DECIMAL

12 VARMYSQL

13 MYSQL

Example
SELECT * FROM information_schema.INNODB_SYS_COLUMNS LIMIT 3\G
*************************** 1. row ***************************
TABLE_ID: 11
NAME: ID
POS: 0
MTYPE: 1
PRTYPE: 524292
LEN: 0
*************************** 2. row ***************************
TABLE_ID: 11
NAME: FOR_NAME
POS: 0
MTYPE: 1
PRTYPE: 524292
LEN: 0
*************************** 3. row ***************************
TABLE_ID: 11
NAME: REF_NAME
POS: 0
MTYPE: 1
PRTYPE: 524292
LEN: 0
3 rows in set (0.00 sec)

1.1.1.2.9.1.1.1.22 Information Schema


INNODB_SYS_DATAFILES Table
MariaDB until 10.5
The INNODB_SYS_DATAFILES table was added in MariaDB 10.0.4 , and removed in MariaDB 10.6.0.

The Information Schema INNODB_SYS_DATAFILES table contains information about InnoDB datafile paths. It was
intended to provide metadata for tablespaces inside InnoDB tables, which was never implemented in MariaDB and was
removed in MariaDB 10.6. The PROCESS privilege is required to view the table.
It contains the following columns:

Column Description
SPACE Numeric tablespace. Matches the INNODB_SYS_TABLES.SPACE value.
PATH Tablespace datafile path.

Example
SELECT * FROM INNODB_SYS_DATAFILES;
+-------+--------------------------------+
| SPACE | PATH |
+-------+--------------------------------+
| 19 | ./test/t2.ibd |
| 20 | ./test/t3.ibd |
...
| 68 | ./test/animals.ibd |
| 69 | ./test/animal_count.ibd |
| 70 | ./test/t.ibd |
+-------+--------------------------------+

299/3812
1.1.1.2.9.1.1.1.23 Information Schema
INNODB_SYS_FIELDS Table
The Information Schema INNODB_SYS_FIELDS table contains information about fields that are part of an InnoDB index.
The PROCESS privilege is required to view the table.
It has the following columns:

Column Description
INDEX_ID Index identifier, matching the value from INNODB_SYS_INDEXES.INDEX_ID.
NAME Field name, matching the value from INNODB_SYS_COLUMNS.NAME.
POS Ordinal position of the field within the index, starting from 0 . This is adjusted as columns are removed.

Example
SELECT * FROM information_schema.INNODB_SYS_FIELDS LIMIT 3\G
*************************** 1. row ***************************
INDEX_ID: 11
NAME: ID
POS: 0
*************************** 2. row ***************************
INDEX_ID: 12
NAME: FOR_NAME
POS: 0
*************************** 3. row ***************************
INDEX_ID: 13
NAME: REF_NAME
POS: 0
3 rows in set (0.00 sec)

1.1.1.2.9.1.1.1.24 Information Schema


INNODB_SYS_FOREIGN Table
The Information Schema INNODB_SYS_FOREIGN table contains information about InnoDB foreign keys.
The PROCESS privilege is required to view the table.
It has the following columns:

Column Description
ID Database name and foreign key name.
FOR_NAME Database and table name of the foreign key child.
REF_NAME Database and table name of the foreign key parent.
N_COLS Number of foreign key index columns.
TYPE Bit flag providing information about the foreign key.

The TYPE column provides a bit flag with information about the foreign key. This information is OR 'ed together to read:

Bit Flag Description


1 ON DELETE CASCADE

2 ON UPDATE SET NULL

4 ON UPDATE CASCADE

8 ON UPDATE SET NULL

16 ON DELETE NO ACTION

32 ON UPDATE NO ACTION

Example

300/3812
SELECT * FROM INNODB_SYS_FOREIGN\G
*************************** 1. row ***************************
ID: mysql/innodb_index_stats_ibfk_1
FOR_NAME: mysql/innodb_index_stats
REF_NAME: mysql/innodb_table_stats
N_COLS: 2
TYPE: 0
...

1.1.1.2.9.1.1.1.25 Information Schema


INNODB_SYS_FOREIGN_COLS Table
The Information Schema INNODB_SYS_FOREIGN_COLS table contains information about InnoDB foreign key columns.
The PROCESS privilege is required to view the table.
It has the following columns:

Column Description
ID Foreign key index associated with this column, matching the INNODB_SYS_FOREIGN.ID field.
FOR_COL_NAME Child column name.
REF_COL_NAME Parent column name.
POS Ordinal position of the column in the table, starting from 0.

1.1.1.2.9.1.1.1.26 Information Schema


INNODB_SYS_INDEXES Table
The Information Schema INNODB_SYS_INDEXES table contains information about InnoDB indexes.
The PROCESS privilege is required to view the table.
It has the following columns:

Field Type Null Key Default Description


bigint(21)
INDEX_ID NO 0 A unique index identifier.
unsigned
Index name, lowercase for all user-created indexes, or
uppercase for implicitly-created indexes; PRIMARY
NAME varchar(64) NO (primary key), GEN_CLUST_INDEX (index representing
primary key where there isn't one), ID_IND , FOR_IND
(validating foreign key constraint) , REF_IND .
bigint(21) Table identifier, matching the value from
TABLE_ID NO 0
unsigned INNODB_SYS_TABLES.TABLE_ID.
Numeric type identifier; one of 0 (secondary index), 1
TYPE int(11) NO 0 (clustered index), 2 (unique index), 3 (primary index),
32 (full-text index).

Number of columns in the index. GEN_CLUST_INDEX's


N_FIELDS int(11) NO 0 have a value of 0 as the index is not based on an actual
column in the table.
Index B-tree's root page number. -1 (unused) for full-
PAGE_NO int(11) NO 0 text indexes, as they are laid out over several auxiliary
tables.
Tablespace identifier where the index resides. 0
represents the InnoDB system tablespace, while any
other value represents a table created in file-per-table
SPACE int(11) NO 0
mode (see the innodb_file_per_table system variable).
Remains unchanged after a TRUNCATE TABLE
statement, and not necessarily unique.
MERGE_THRESHOLD int(11) NO 0

Example
301/3812
SELECT * FROM information_schema.INNODB_SYS_INDEXES LIMIT 3\G
*************************** 1. row ***************************
INDEX_ID: 11
NAME: ID_IND
TABLE_ID: 11
TYPE: 3
N_FIELDS: 1
PAGE_NO: 302
SPACE: 0
MERGE_THRESHOLD: 50
*************************** 2. row ***************************
INDEX_ID: 12
NAME: FOR_IND
TABLE_ID: 11
TYPE: 0
N_FIELDS: 1
PAGE_NO: 303
SPACE: 0
MERGE_THRESHOLD: 50
*************************** 3. row ***************************
INDEX_ID: 13
NAME: REF_IND
TABLE_ID: 11
TYPE: 3
N_FIELDS: 1
PAGE_NO: 304
SPACE: 0
MERGE_THRESHOLD: 50
3 rows in set (0.00 sec)

1.1.1.2.9.1.1.1.27 Information Schema


INNODB_SYS_SEMAPHORE_WAITS Table
The Information Schema INNODB_SYS_SEMAPHORE_WAITS table is meant to contain information about current
semaphore waits. At present it is not correctly populated. See MDEV-21330 .
The PROCESS privilege is required to view the table.
It contains the following columns:

Column Description

THREAD_ID Thread id waiting for semaphore


OBJECT_NAME Semaphore name
FILE File name where semaphore was requested
LINE Line number on above file
WAIT_TIME Wait time
WAIT_OBJECT
WAIT_TYPE Object type (mutex, rw-lock)
HOLDER_THREAD_ID Holder thread id
HOLDER_FILE File name where semaphore was acquired
HOLDER_LINE Line number for above
CREATED_FILE Creation file name
CREATED_LINE Line number for above
WRITER_THREAD Last write request thread id
RESERVATION_MODE Reservation mode (shared, exclusive)

READERS Number of readers if only shared mode


WAITERS_FLAG Flags
LOCK_WORD Lock word (for developers)
LAST_READER_FILE Removed
LAST_READER_LINE Removed

302/3812
LAST_WRITER_FILE Last writer file name
LAST_WRITER_LINE Above line number
OS_WAIT_COUNT Wait count

1.1.1.2.9.1.1.1.28 Information Schema


INNODB_SYS_TABLES Table
The Information Schema INNODB_SYS_TABLES table contains information about InnoDB tables.
The PROCESS privilege is required to view the table.
It has the following columns:

Field Type Null Key Default Description


TABLE_ID bigint(21) unsigned NO 0 Unique InnoDB table identifier.
Database and table name, or the uppercase
NAME varchar(655) NO
InnoDB system table name.
FLAG int(11) NO 0 See Flag below
int(11) unsigned (>=
MariaDB 10.5)
N_COLS NO 0 Number of columns in the table.
int(11) (<= MariaDB
10.4)
Tablespace identifier where the index resides. 0
int(11) unsigned (>= represents the InnoDB system tablespace, while
MariaDB 10.5) any other value represents a table created in file-
SPACE NO 0
int(11) (<= MariaDB per-table mode (see the innodb_file_per_table
10.4) system variable). Remains unchanged after a
TRUNCATE TABLE statement.

InnoDB file format (Antelope or Barracuda).


FILE_FORMAT varchar(10) YES NULL
Removed in MariaDB 10.3.
enum('Redundant',
'Compact',
'Compressed',
InnoDB storage format (Compact, Redundant,
ROW_FORMAT 'Dynamic') (>= YES NULL
Dynamic, or Compressed).
MariaDB 10.5)
varchar(12) (<=
MariaDB 10.4)
ZIP_PAGE_SIZE int(11) unsigned NO 0 For Compressed tables, the zipped page size.
enum('Single','System')
(>= MariaDB 10.5)
SPACE_TYPE YES NULL
varchar(10) (<=
MariaDB 10.4)

Flag
The flag field returns the dict_table_t::flags that correspond to the data dictionary record.

Bit Description
0 Set if ROW_FORMAT is not REDUNDANT.
1
0 , except for ROW_FORMAT=COMPRESSED, where they will determine the KEY_BLOCK_SIZE (the
to
compressed page size).
4

5 Set for ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED.


6 Set if the DATA DIRECTORY attribute was present when the table was originally created.
7 Set if the page_compressed attribute is present.
8
to Determine the page_compression_level.
11

303/3812
12 Normally 00 , but 11 for "no-rollback tables" (MariaDB 10.3 CREATE SEQUENCE). In MariaDB 10.1, these
13 bits could be 01 or 10 for ATOMIC_WRITES=ON or ATOMIC_WRITES=OFF.

Note that the table flags returned here are not the same as tablespace flags (FSP_SPACE_FLAGS).

Example
SELECT * FROM information_schema.INNODB_SYS_TABLES LIMIT 2\G
*************************** 1. row ***************************
TABLE_ID: 14
NAME: SYS_DATAFILES
FLAG: 0
N_COLS: 5
SPACE: 0
ROW_FORMAT: Redundant
ZIP_PAGE_SIZE: 0
SPACE_TYPE: System
*************************** 2. row ***************************
TABLE_ID: 11
NAME: SYS_FOREIGN
FLAG: 0
N_COLS: 7
SPACE: 0
ROW_FORMAT: Redundant
ZIP_PAGE_SIZE: 0
SPACE_TYPE: System
2 rows in set (0.00 sec)

See Also
InnoDB Data Dictionary Troubleshooting

1.1.1.2.9.1.1.1.29 Information Schema


INNODB_SYS_TABLESPACES Table
The Information Schema INNODB_SYS_TABLESPACES table contains information about InnoDB tablespaces. Until
MariaDB 10.5 it was based on the internal SYS_TABLESPACES table. This internal table was removed in MariaDB 10.6.0,
so this Information Schema table has been repurposed to directly reflect the filesystem (fil_system.space_list).
The PROCESS privilege is required to view the table.
It has the following columns:

Column Description
SPACE Unique InnoDB tablespace identifier.
NAME Database and table name separated by a backslash, or the uppercase InnoDB system table name.
FLAG 1 if a DATA DIRECTORY option has been specified in CREATE TABLE , otherwise 0 .

FILE_FORMAT InnoDB file format. Removed in MariaDB 10.3.1


InnoDB storage format used for this tablespace. If the Antelope file format is used, this value is
ROW_FORMAT
always Compact or Redundant .
Page size in bytes for this tablespace. Until MariaDB 10.5.0, this was the value of the
PAGE_SIZE innodb_page_size variable. From MariaDB 10.6.0, contains the physical page size of a page
(previously ZIP_PAGE_SIZE ).
ZIP_PAGE_SIZE Zip page size for this tablespace. Removed in MariaDB 10.6.0.
Tablespace type. Can be General for general tablespaces or Single for file-per-table
SPACE_TYPE
tablespaces. Introduced MariaDB 10.2.1 . Removed MariaDB 10.5.0.

FS_BLOCK_SIZE File system block size. Introduced MariaDB 10.2.1 .

FILE_SIZE Maximum size of the file, uncompressed. Introduced MariaDB 10.2.1 .


ALLOCATED_SIZE Actual size of the file as per space allocated on disk. Introduced MariaDB 10.2.1 .
Tablespace datafile path, previously part of the INNODB_SYS_DATAFILES table. Added in
FILENAME
MariaDB 10.6.0.

304/3812
Examples
MariaDB 10.4:

DESC information_schema.innodb_sys_tablespaces;
+----------------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+---------------------+------+-----+---------+-------+
| SPACE | int(11) unsigned | NO | | 0 | |
| NAME | varchar(655) | NO | | | |
| FLAG | int(11) unsigned | NO | | 0 | |
| ROW_FORMAT | varchar(22) | YES | | NULL | |
| PAGE_SIZE | int(11) unsigned | NO | | 0 | |
| ZIP_PAGE_SIZE | int(11) unsigned | NO | | 0 | |
| SPACE_TYPE | varchar(10) | YES | | NULL | |
| FS_BLOCK_SIZE | int(11) unsigned | NO | | 0 | |
| FILE_SIZE | bigint(21) unsigned | NO | | 0 | |
| ALLOCATED_SIZE | bigint(21) unsigned | NO | | 0 | |
+----------------+---------------------+------+-----+---------+-------+

From MariaDB 10.4:

SELECT * FROM information_schema.INNODB_SYS_TABLESPACES LIMIT 2\G


*************************** 1. row ***************************
SPACE: 2
NAME: mysql/innodb_table_stats
FLAG: 33
ROW_FORMAT: Dynamic
PAGE_SIZE: 16384
ZIP_PAGE_SIZE: 0
SPACE_TYPE: Single
FS_BLOCK_SIZE: 4096
FILE_SIZE: 98304
ALLOCATED_SIZE: 98304
*************************** 2. row ***************************
SPACE: 3
NAME: mysql/innodb_index_stats
FLAG: 33
ROW_FORMAT: Dynamic
PAGE_SIZE: 16384
ZIP_PAGE_SIZE: 0
SPACE_TYPE: Single
FS_BLOCK_SIZE: 4096
FILE_SIZE: 98304
ALLOCATED_SIZE: 98304

1.1.1.2.9.1.1.1.30 Information Schema


INNODB_SYS_TABLESTATS Table
The Information Schema INNODB_SYS_TABLESTATS table contains InnoDB status information. It can be used for
developing new performance-related extensions, or high-level performance monitoring.
The PROCESS privilege is required to view the table.
Note that the MySQL InnoDB and Percona XtraDB versions of the tables differ (see XtraDB and InnoDB).
It contains the following columns:

Column Description
TABLE_ID Table ID, matching the INNODB_SYS_TABLES.TABLE_ID value.
SCHEMA Database name (XtraDB only).
NAME Table name, matching the INNODB_SYS_TABLES.NAME value.
STATS_INITIALIZED Initialized if statistics have already been collected, otherwise Uninitialized .

Estimated number of rows currently in the table. Updated after each statement modifying the
NUM_ROWS
data, but uncommited transactions mean it may not be accurate.
Number of pages on disk storing the clustered index, holding InnoDB table data in primary
CLUST_INDEX_SIZE key order, or NULL if not statistics yet collected.

Number of pages on disk storing secondary indexes for the table, or NULL if not statistics
OTHER_INDEX_SIZE
yet collected.
305/3812
MODIFIED_COUNTER Number of rows modified by statements modifying data.
AUTOINC Auto_increment value.
Countdown to zero, when table metadata can be removed from the table cache. (InnoDB
REF_COUNT
only)
MYSQL_HANDLES_OPENED (XtraDB only).

1.1.1.2.9.1.1.1.31 Information Schema


INNODB_SYS_VIRTUAL Table
MariaDB starting with 10.2
The INNODB_SYS_VIRTUAL table was added in MariaDB 10.2.

The Information Schema INNODB_SYS_VIRTUAL table contains information about base columns of virtual columns. The
PROCESS privilege is required to view the table.

It contains the following columns:

Field Type Null Key Default Description


TABLE_ID bigint(21) unsigned NO 0
POS int(11) unsigned NO 0
BASE_POS int(11) unsigned NO 0

1.1.1.2.9.1.1.1.32 Information Schema


INNODB_TABLESPACES_ENCRYPTION
Table
The Information Schema INNODB_TABLESPACES_ENCRYPTION table contains metadata about encrypted InnoDB
tablespaces. When you enable encryption for an InnoDB tablespace, an entry for the tablespace is added to this table.
If you later disable encryption for the InnoDB tablespace, then the row still remains in this table, but the
ENCRYPTION_SCHEME and CURRENT_KEY_VERSION columns will be set to 0 .

Viewing this table requires the PROCESS privilege, although a bug in versions before MariaDB 10.1.46 , 10.2.33 ,
10.3.24, 10.4.14 and 10.5.5 mean the SUPER privilege was required (MDEV-23003 ).
It has the following columns:

Column Description Added


SPACE InnoDB tablespace ID.
NAME Path to the InnoDB tablespace file, without the extension.
Key derivation algorithm. Only 1 is currently used to represent
ENCRYPTION_SCHEME an algorithm. If this value is 0 , then the tablespace is
unencrypted.
Number of times InnoDB has had to request a key from the
KEYSERVER_REQUESTS encryption key management plugin. The three most recent keys
are cached internally.
Minimum key version used to encrypt a page in the tablespace.
MIN_KEY_VERSION
Different pages may be encrypted with different key versions.
Key version that will be used to encrypt pages. If this value is 0 ,
CURRENT_KEY_VERSION
then the tablespace is unencrypted.

Page that a background encryption thread is currently rotating. If


KEY_ROTATION_PAGE_NUMBER
key rotation is not enabled, then the value will be NULL .
When a background encryption thread starts rotating a
KEY_ROTATION_MAX_PAGE_NUMBER tablespace, the field contains its current size. If key rotation is not
enabled, then the value will be NULL .
MariaDB
CURRENT_KEY_ID Key ID for the encryption key currently in use.
10.1.13

306/3812
MariaDB
Current key rotation status. If this value is 1 , then the
10.2.5 ,
ROTATING_OR_FLUSHING background encryption threads are working on the tablespace.
MariaDB
See MDEV-11738 .
10.1.23

When the InnoDB system tablespace is encrypted, it is represented in this table with the special name: innodb_system .

Example
SELECT * FROM information_schema.INNODB_TABLESPACES_ENCRYPTION
WHERE NAME LIKE 'db_encrypt%';
+-------+----------------------------------------------+-------------------+--------------------+------
-----------+---------------------+--------------------------+------------------------------+
| SPACE | NAME | ENCRYPTION_SCHEME | KEYSERVER_REQUESTS |
MIN_KEY_VERSION | CURRENT_KEY_VERSION | KEY_ROTATION_PAGE_NUMBER | KEY_ROTATION_MAX_PAGE_NUMBER |
+-------+----------------------------------------------+-------------------+--------------------+------
-----------+---------------------+--------------------------+------------------------------+
| 18 | db_encrypt/t_encrypted_existing_key | 1 | 1 |
1 | 1 | NULL | NULL |
| 19 | db_encrypt/t_not_encrypted_existing_key | 1 | 0 |
1 | 1 | NULL | NULL |
| 20 | db_encrypt/t_not_encrypted_non_existing_key | 1 | 0 |
4294967295 | 4294967295 | NULL | NULL |
| 21 | db_encrypt/t_default_encryption_existing_key | 1 | 1 |
1 | 1 | NULL | NULL |
| 22 | db_encrypt/t_encrypted_default_key | 1 | 1 |
1 | 1 | NULL | NULL |
| 23 | db_encrypt/t_not_encrypted_default_key | 1 | 0 |
1 | 1 | NULL | NULL |
| 24 | db_encrypt/t_defaults | 1 | 1 |
1 | 1 | NULL | NULL |
+-------+----------------------------------------------+-------------------+--------------------+------
-----------+---------------------+--------------------------+------------------------------+
7 rows in set (0.00 sec)

See Also
Encrypting Data for InnoDB / XtraDB
Data at Rest Encryption
Why Encrypt MariaDB Data?
Encryption Key Management

1.1.1.2.9.1.1.1.33 Information Schema


INNODB_TABLESPACES_SCRUBBING Table
MariaDB 10.1.3 - 10.5.1
InnoDB and XtraDB data scrubbing was introduced in MariaDB 10.1.3 . The table was removed in MariaDB 10.5.2 -
see MDEV-15528 .

The Information Schema INNODB_TABLESPACES_SCRUBBING table contains data scrubbing information.


The PROCESS privilege is required to view the table.
It has the following columns:

Column Description
SPACE InnoDB table space id number.
NAME Path to the table space file, without the extension.
COMPRESSED The compressed page size, or zero if uncompressed.
Date and time when the last scrub was completed, or NULL if never been
LAST_SCRUB_COMPLETED
performed.
CURRENT_SCRUB_STARTED Date and time when the current scrub started, or NULL if never been performed.
CURRENT_SCRUB_ACTIVE_THREADS Number of threads currently scrubbing the tablespace.
CURRENT_SCRUB_PAGE_NUMBER Page that the scrubbing thread is currently scrubbing, or NULL if not enabled.

307/3812
When a scrubbing starts rotating a table space, the field contains its current size.
CURRENT_SCRUB_MAX_PAGE_NUMBER
NULL if not enabled.

The field contains 1 when MariaDB detects that the table space is on a SSD
ON_SSD
based storage. 0 if not SSD or it could not be determined (since MariaDB 10.4.4)

Example
SELECT * FROM information_schema.INNODB_TABLESPACES_SCRUBBING LIMIT 1\G
*************************** 1. row ***************************
SPACE: 1
NAME: mysql/innodb_table_stats
COMPRESSED: 0
LAST_SCRUB_COMPLETED: NULL
CURRENT_SCRUB_STARTED: NULL
CURRENT_SCRUB_PAGE_NUMBER: NULL
CURRENT_SCRUB_MAX_PAGE_NUMBER: 0
ROTATING_OR_FLUSHING: 0
1 rows in set (0.00 sec)

1.1.1.2.9.1.1.1.34 Information Schema


INNODB_TRX Table
The Information Schema INNODB_TRX table stores information about all currently executing InnoDB transactions.
It has the following columns:

Column Description
TRX_ID Unique transaction ID number.
Transaction execution state; one of RUNNING , LOCK WAIT , ROLLING BACK or
TRX_STATE
COMMITTING .

TRX_STARTED Time that the transaction started.


If TRX_STATE is LOCK_WAIT , the INNODB_LOCKS.LOCK_ID value of the lock being
TRX_REQUESTED_LOCK_ID
waited on. NULL if any other state.
If TRX_STATE is LOCK_WAIT , the time the transaction started waiting for the lock,
TRX_WAIT_STARTED
otherwise NULL .
Transaction weight, based on the number of locked rows and the number of altered
rows. To resolve deadlocks, lower weighted transactions are rolled back first.
TRX_WEIGHT
Transactions that have affected non-transactional tables are always treated as
having a heavier weight.
Thread ID from the PROCESSLIST table (note that the locking and transaction
TRX_MYSQL_THREAD_ID information schema tables use a different snapshot from the processlist, so records
may appear in one but not the other).
TRX_QUERY SQL that the transaction is currently running.
TRX_OPERATION_STATE Transaction's current state, or NULL .
Number of InnoDB tables currently being used for processing the current SQL
TRX_TABLES_IN_USE
statement.
TRX_TABLES_LOCKED Number of InnoDB tables that that have row locks held by the current SQL statement.
TRX_LOCK_STRUCTS Number of locks reserved by the transaction.
Total size in bytes of the memory used to hold the lock structures for the current
TRX_LOCK_MEMORY_BYTES
transaction in memory.
Number of rows the current transaction has locked. locked by this transaction. An
TRX_ROWS_LOCKED approximation, and may include rows not visible to the current transaction that are
delete-marked but physically present.
TRX_ROWS_MODIFIED Number of rows added or changed in the current transaction.
Indicates how much work the current transaction can do before being swapped out,
TRX_CONCURRENCY_TICKETS
see the innodb_concurrency_tickets system variable.
TRX_ISOLATION_LEVEL Isolation level of the current transaction.

308/3812
Whether unique checks are on or off for the current transaction. Bulk data are a
TRX_UNIQUE_CHECKS
case where unique checks would be off.
Whether foreign key checks are on or off for the current transaction. Bulk data are
TRX_FOREIGN_KEY_CHECKS
a case where foreign keys checks would be off.
TRX_LAST_FOREIGN_KEY_ERROR Error message for the most recent foreign key error, or NULL if none.
Whether the adaptive hash index is locked by the current transaction or not. One
TRX_ADAPTIVE_HASH_LATCHED
transaction at a time can change the adaptive hash index.
Whether the adaptive hash index search latch shoild be relinquished immediately or
reserved across all MariaDB calls. 0 if there is no contention on the adaptive hash
TRX_ADAPTIVE_HASH_TIMEOUT
index, in which case the latch is reserved until completion, otherwise counts down to
zero and the latch is released after each row lookup.
TRX_IS_READ_ONLY 1 if a read-only transaction, otherwise 0 .

1 if the transaction only contains this one statement, that is, a SELECT statement not
using FOR UPDATE or LOCK IN SHARED MODE , and with autocommit on. If this and
TRX_AUTOCOMMIT_NON_LOCKING
TRX_IS_READ_ONLY are both 1, the transaction can be optimized by the storrage
engine to reduce some overheads

The table is often used in conjunction with the INNODB_LOCKS and INNODB_LOCK_WAITS tables to diagnose
problematic locks and transactions.
XA transactions are not stored in this table. To see them, XA RECOVER can be used.

Example
-- session 1
START TRANSACTION;
UPDATE t SET id = 15 WHERE id = 10;

-- session 2
DELETE FROM t WHERE id = 10;

-- session 1
USE information_schema;
SELECT l.*, t.*
FROM information_schema.INNODB_LOCKS l
JOIN information_schema.INNODB_TRX t
ON l.lock_trx_id = t.trx_id
WHERE trx_state = 'LOCK WAIT' \G
*************************** 1. row ***************************
lock_id: 840:40:3:2
lock_trx_id: 840
lock_mode: X
lock_type: RECORD
lock_table: `test`.`t`
lock_index: PRIMARY
lock_space: 40
lock_page: 3
lock_rec: 2
lock_data: 10
trx_id: 840
trx_state: LOCK WAIT
trx_started: 2019-12-23 18:43:46
trx_requested_lock_id: 840:40:3:2
trx_wait_started: 2019-12-23 18:43:46
trx_weight: 2
trx_mysql_thread_id: 46
trx_query: DELETE FROM t WHERE id = 10
trx_operation_state: starting index read
trx_tables_in_use: 1
trx_tables_locked: 1
trx_lock_structs: 2
trx_lock_memory_bytes: 1136
trx_rows_locked: 1
trx_rows_modified: 0
trx_concurrency_tickets: 0
trx_isolation_level: REPEATABLE READ
trx_unique_checks: 1
trx_foreign_key_checks: 1
trx_last_foreign_key_error: NULL
trx_is_read_only: 0
trx_autocommit_non_locking: 0

309/3812
1.1.1.2.9.1.1.1.35 Information Schema
TEMP_TABLES_INFO Table
MariaDB 10.2.2 - 10.2.3
The TEMP_TABLES_INFO table was introduced in MariaDB 10.2.2 and was removed in MariaDB 10.2.4 . See
MDEV-12459 progress on an alternative.

The Information Schema TEMP_TABLES_INFO table contains information about active InnoDB temporary tables. All user
and system-created temporary tables are reported when querying this table, with the exception of optimized internal
temporary tables. The data is stored in memory.
Previously, InnoDB temp table metadata was rather stored in InnoDB system tables.
It has the following columns:

Column Description
TABLE_ID Table ID.
NAME Table name.
Number of columns in the temporary table, including three hidden columns that InnoDB
N_COLS
creates ( DB_ROW_ID , DB_TRX_ID , and DB_ROLL_PTR ).
Numerical identifier for the tablespace identifier holding the temporary table. Compressed
temporary tables are stored by default in separate per-table tablespaces in the temporary
SPACE
file directory. For non-compressed tables, the shared temporary table is named ibtmp1 ,
found in the data directory. Always a non-zero value, and regenerated on server restart.
If TRUE , the temporary table resides in a separate per-table tablespace. If FALSE , it resides
PER_TABLE_TABLESPACE
in the shared temporary tablespace.
IS_COMPRESSED TRUE if the table is compressed.

The PROCESS privilege is required to view the table.

Examples
CREATE TEMPORARY TABLE t (i INT) ENGINE=INNODB;

SELECT * FROM INFORMATION_SCHEMA.INNODB_TEMP_TABLE_INFO;


+----------+--------------+--------+-------+----------------------+---------------+
| TABLE_ID | NAME | N_COLS | SPACE | PER_TABLE_TABLESPACE | IS_COMPRESSED |
+----------+--------------+--------+-------+----------------------+---------------+
| 39 | #sql1c93_3_1 | 4 | 64 | FALSE | FALSE |
+----------+--------------+--------+-------+----------------------+---------------+

Adding a compressed table:

SET GLOBAL innodb_file_format="Barracuda";

CREATE TEMPORARY TABLE t2 (i INT) ROW_FORMAT=COMPRESSED ENGINE=INNODB;

SELECT * FROM INFORMATION_SCHEMA.INNODB_TEMP_TABLE_INFO;


+----------+--------------+--------+-------+----------------------+---------------+
| TABLE_ID | NAME | N_COLS | SPACE | PER_TABLE_TABLESPACE | IS_COMPRESSED |
+----------+--------------+--------+-------+----------------------+---------------+
| 40 | #sql1c93_3_3 | 4 | 65 | TRUE | TRUE |
| 39 | #sql1c93_3_1 | 4 | 64 | FALSE | FALSE |
+----------+--------------+--------+-------+----------------------+---------------+

1.1.1.2.9.1.1.2 Information Schema MyRocks


Tables
List of Information Schema tables specifically related to MyRocks.
Information Schema ROCKSDB_CFSTATS Table
The Information Schema ROCKSDB_CFSTATS table is included as part of the MyR...

310/3812
Information Schema ROCKSDB_CF_OPTIONS Table
Information about MyRocks Column Families.

Information Schema ROCKSDB_COMPACTION_STATS Table


The Information Schema ROCKSDB_COMPACTION_STATS table is included as part o...

Information Schema ROCKSDB_DBSTATS Table


The Information Schema ROCKSDB_DBSTATS table is included as part of the MyR...

Information Schema ROCKSDB_DDL Table


The Information Schema ROCKSDB_DDL table is included as part of the MyRocks...

Information Schema ROCKSDB_DEADLOCK Table


The Information Schema ROCKSDB_DEADLOCK table is included as part of the My...

Information Schema ROCKSDB_GLOBAL_INFO Table


The Information Schema ROCKSDB_GLOBAL_INFO table is included as part of the...

Information Schema ROCKSDB_INDEX_FILE_MAP Table


The Information Schema ROCKSDB_INDEX_FILE_MAP table is included as part of ...

Information Schema ROCKSDB_LOCKS Table


The Information Schema ROCKSDB_LOCKS table is included as part of the MyRoc...

Information Schema ROCKSDB_PERF_CONTEXT Table


Per-table/partition counters.

Information Schema ROCKSDB_PERF_CONTEXT_GLOBAL Table


Global counters.

Information Schema ROCKSDB_SST_PROPS Table


The Information Schema ROCKSDB_SST_PROPS table is included as part of the M...

Information Schema ROCKSDB_TRX Table


The Information Schema ROCKSDB_TRX table is included as part of the MyRocks...

1.1.1.2.9.1.1.2.1 Information Schema


ROCKSDB_CFSTATS Table
The Information Schema ROCKSDB_CFSTATS table is included as part of the MyRocks storage engine.
The PROCESS privilege is required to view the table.
It contains the following columns:

Column Description
CF_NAME

STAT_TYPE

VALUE

1.1.1.2.9.1.1.2.2 Information Schema


ROCKSDB_CF_OPTIONS Table
The Information Schema ROCKSDB_CF_OPTIONS table is included as part of the MyRocks storage engine, and contains
infomation about MyRocks column families.
The PROCESS privilege is required to view the table.
It contains the following columns:

Column Description
CF_NAME Column family name.
OPTION_TYPE

VALUE
311/3812
1.1.1.2.9.1.1.2.3 Information Schema
ROCKSDB_COMPACTION_STATS Table
The Information Schema ROCKSDB_COMPACTION_STATS table is included as part of the MyRocks storage engine.
The PROCESS privilege is required to view the table.
It contains the following columns:

Column Description
CF_NAME

LEVEL

TYPE

VALUE

1.1.1.2.9.1.1.2.4 Information Schema


ROCKSDB_DBSTATS Table
The Information Schema ROCKSDB_DBSTATS table is included as part of the MyRocks storage engine.
The PROCESS privilege is required to view the table.
It contains the following columns:

Column Description
STAT_TYPE

VALUE

1.1.1.2.9.1.1.2.5 Information Schema


ROCKSDB_DDL Table
The Information Schema ROCKSDB_DDL table is included as part of the MyRocks storage engine.
The PROCESS privilege is required to view the table.
It contains the following columns:

Column Description
TABLE_SCHEMA

TABLE_NAME

PARTITION_NAME

INDEX_NAME

COLUMN_FAMILY

INDEX_NUMBER

INDEX_TYPE

KV_FORMAT_VERSION

TTL_DURATION

INDEX_FLAGS

CF

AUTO_INCREMENT

1.1.1.2.9.1.1.2.6 Information Schema


ROCKSDB_DEADLOCK Table
The Information Schema ROCKSDB_DEADLOCK table is included as part of the MyRocks storage engine.
312/3812
The PROCESS privilege is required to view the table.
It contains the following columns:

Column Description
DEADLOCK_ID

TIMESTAMP

TRANSACTION_ID

CF_NAME

WAITING_KEY

LOCK_TYPE

INDEX_NAME

TABLE_NAME

ROLLED_BACK

1.1.1.2.9.1.1.2.7 Information Schema


ROCKSDB_GLOBAL_INFO Table
The Information Schema ROCKSDB_GLOBAL_INFO table is included as part of the MyRocks storage engine.
The PROCESS privilege is required to view the table.
It contains the following columns:

Column Description
TYPE

NAME

VALUE

1.1.1.2.9.1.1.2.8 Information Schema


ROCKSDB_INDEX_FILE_MAP Table
The Information Schema ROCKSDB_INDEX_FILE_MAP table is included as part of the MyRocks storage engine.
The PROCESS privilege is required to view the table.
It contains the following columns:

Column Description
COLUMN_FAMILY

INDEX_NUMBER

SST_NAME

NUM_ROWS

DATA_SIZE

ENTRY_DELETES

ENTRY_SINGLEDELETES

ENTRY_MERGES

ENTRY_OTHERS

DISTINCT_KEYS_PREFIX

1.1.1.2.9.1.1.2.9 Information Schema


ROCKSDB_LOCKS Table
The Information Schema ROCKSDB_LOCKS table is included as part of the MyRocks storage engine.

313/3812
The PROCESS privilege is required to view the table.
It contains the following columns:

Column Description
COLUMN_FAMILY_ID

TRANSACTION_ID

KEY

MODE

1.1.1.2.9.1.1.2.10 Information Schema


ROCKSDB_PERF_CONTEXT Table
The Information Schema ROCKSDB_PERF_CONTEXT table is included as part of the MyRocks storage engine and includes
per-table/partition counters .
The PROCESS privilege is required to view the table.
It contains the following columns:

Column Description
TABLE_SCHEMA

TABLE_NAME

PARTITION_NAME

STAT_TYPE

VALUE

Note: for multi-table queries, all counter increments are "billed" to the first table in the query:
https://github.com/facebook/mysql-5.6/issues/1018

1.1.1.2.9.1.1.2.11 Information Schema


ROCKSDB_PERF_CONTEXT_GLOBAL Table
The Information Schema ROCKSDB_PERF_CONTEXT_GLOBAL table is included as part of the MyRocks storage engine and
includes global counter information.
The PROCESS privilege is required to view the table.
It contains the following columns:

Column Description
STAT_TYPE

VALUE

1.1.1.2.9.1.1.2.12 Information Schema


ROCKSDB_SST_PROPS Table
The Information Schema ROCKSDB_SST_PROPS table is included as part of the MyRocks storage engine.
The PROCESS privilege is required to view the table.
It contains the following columns:

Column Description

SST_NAME

COLUMN_FAMILY

DATA_BLOCKS

ENTRIES

RAW_KEY_SIZE
314/3812
RAW_VALUE_SIZE

DATA_BLOCK_SIZE

INDEX_BLOCK_SIZE

INDEX_PARTITIONS

TOP_LEVEL_INDEX_SIZE

FILTER_BLOCK_SIZE

COMPRESSION_ALGO

CREATION_TIME

1.1.1.2.9.1.1.2.13 Information Schema


ROCKSDB_TRX Table
The Information Schema ROCKSDB_TRX table is included as part of the MyRocks storage engine.
The PROCESS privilege is required to view the table.
It contains the following columns:

Column Description
TRANSACTION_ID

STATE

NAME

WRITE_COUNT

LOCK_COUNT

TIMEOUT_SEC

WAITING_KEY

WAITING_COLUMN_FAMILY_ID

IS_REPLICATION

SKIP_TRX_API

READ_ONLY

HAS_DEADLOCK_DETECTION

NUM_ONGOING_BULKLOAD

THREAD_ID

QUERY

1.1.1.2.9.1.1.3 ColumnStore Information


Schema Tables
1. COLUMNSTORE_TABLES
2. COLUMNSTORE_COLUMNS
3. COLUMNSTORE_EXTENTS
4. COLUMNSTORE_FILES
5. Stored Procedures
1. total_usage()
2. table_usage()
3. compression_ratio()

MariaDB ColumnStore has four Information Schema tables that expose information about the table and column storage.
These tables were added in version 1.0.5 of ColumnStore and were heavily modified for 1.0.6.

COLUMNSTORE_TABLES
The first table is the INFORMATION_SCHEMA.COLUMNSTORE_TABLES. This contains information about the tables
inside ColumnStore. The table layout is as follows:
315/3812
Column Description
TABLE_SCHEMA The database schema for the table
TABLE_NAME The table name
OBJECT_ID The ColumnStore object ID for the table
CREATION_DATE The date the table was created
COLUMN_COUNT The number of columns in the table
AUTOINCREMENT The start autoincrement value for the table set during CREATE TABLE

Note: Tables created with ColumnStore 1.0.4 or lower will have the year field of the creation data set incorrectly by
1900 years.

COLUMNSTORE_COLUMNS
The INFORMATION_SCHEMA.COLUMNSTORE_COLUMNS table contains information about every single column
inside ColumnStore. The table layout is as follows:

Column Description
TABLE_SCHEMA The database schema for the table
TABLE_NAME The table name for the column
COLUMN_NAME The column name
OBJECT_ID The object ID for the column
DICTIONARY_OBJECT_ID The dictionary object ID for the column (NULL if there is no dictionary object
LIST_OBJECT_ID Placeholder for future information
TREE_OBJECT_ID Placeholder for future information
DATA_TYPE The data type for the column
COLUMN_LENGTH The data length for the column
COLUMN_POSITION The position of the column in the table, starting at 0
COLUMN_DEFAULT The default value for the column
IS_NULLABLE Whether or not the column can be set to NULL
NUMERIC_PRECISION The numeric precision for the column
NUMERIC_SCALE The numeric scale for the column
IS_AUTOINCREMENT Set to 1 if the column is an autoincrement column
COMPRESSION_TYPE The type of compression (either "None" or "Snappy")

COLUMNSTORE_EXTENTS
This table displays the extent map in a user consumable form. An extent is a collection of details about a section of data
related to a columnstore column. A majority of columns in ColumnStore will have multiple extents and the columns table
above can be joined to this one to filter results by table or column. The table layout is as follows:

Column Description
OBJECT_ID The object ID for the extent
OBJECT_TYPE Whether this is a "Column" or "Dictionary" extent
LOGICAL_BLOCK_START ColumnStore's internal start LBID for this extent
LOGICAL_BLOCK_END ColumnStore's internal end LBID for this extent
MIN_VALUE This minimum value stored in this extent
MAX_VALUE The maximum value stored in this extent
WIDTH The data width for the extent
DBROOT The DBRoot number for the extent

316/3812
PARTITION_ID The parition ID for the extent
SEGMENT_ID The segment ID for the extent
BLOCK_OFFSET The block offset for the data file, each data file can contain multiple extents for a column
MAX_BLOCKS The maximum number of blocks for the extent
HIGH_WATER_MARK The last block committed to the extent (starting at 0)
STATE The state of the extent (see below)
The availability status for the column which is either "Available", "Unavailable" or "Out of
STATUS
service"
DATA_SIZE The uncompressed data size for the extent calculated as (HWM + 1) * BLOCK_SIZE

Notes:
1. The state is "Valid" for a normal state, "Invalid" if a cpimport has completed but the table has not yet been
accessed (min/max values will be invalid) or "Updating" if there is a DML statement writing to the column
2. In ColumnStore the block size is 8192 bytes
3. By default ColumnStore will write create an extent file of 256*1024*WIDTH bytes for the first partition, if this
is too small then for uncompressed data it will create a file of the maximum size for the extent (MAX_BLOCKS
* BLOCK_SIZE). Snappy always compression adds a header block.
4. Object IDs of less than 3000 are for internal tables and will not appear in any of the information schema
tables
5. Prior to 1.0.12 / 1.1.2 DATA_SIZE was incorrectly calculated
6. HWM is set to zero for the lower segments when there are multiple segments in an extent file, these can be
observed when BLOCK_OFFSET > 0
7. When HWM is 0 the DATA_SIZE will show 0 instead of 8192 to avoid confusion when there is multiple
segments in an extent file

COLUMNSTORE_FILES
The columnstore_files table provides information about each file associated with extensions. Each extension can reuse
a file at different block offsets so this is not a 1:1 relationship to the columnstore_extents table.

Column Description
OBJECT_ID The object ID for the extent
SEGMENT_ID The segment ID for the extent
PARTITION_ID The partition ID for the extent
The full path and filename for the extent file, multiple extents for the same column can
FILENAME
point to this file with different BLOCK_OFFSETs
FILE_SIZE The disk file size for the extent
COMPRESSED_DATA_SIZE The amount of the compressed file used, NULL if this is an uncompressed file

Stored Procedures
A few stored procedures were added in 1.0.6 to provide summaries based on the information schema tables. These can
be accessed from the COLUMNSTORE_INFO schema.

total_usage()
The total_usage() procedure gives a total disk usage summary for all the columns in ColumnStore with the exception of
the columns used for internal maintenance. It is executed using the following query:

> call columnstore_info.total_usage();

table_usage()
The table_usage() procedure gives a the total data disk usage, dictionary disk usage and grand total disk usage per-
table. It can be called in several ways, the first gives a total for each table:

> call columnstore_info.table_usage(NULL, NULL);

Or for a specific table, my_table in my_schema in this example:


317/3812
> call columnstore_info.table_usage('my_schema', 'my_table');

You can also request all tables for a specified schema:

> call columnstore_info.table_usage('my_schema', NULL);

Note: The quotes around the table name are required, an error will occur without them.

compression_ratio()
The compression_ratio() procedure calculates the average compression ratio across all the compressed extents in
ColumnStore. It is called using:

> call columnstore_info.compression_ratio();

Note: The compression ratio is incorrectly calculated before versions 1.0.12 / 1.1.2

1.1.1.2.9.1.1.4 Information Schema


ALL_PLUGINS Table
Description
The Information Schema ALL_PLUGINS table contains information about server plugins, whether installed or not.
It contains the following columns:

Column Description
PLUGIN_NAME Name of the plugin.
PLUGIN_VERSION Version from the plugin's general type descriptor.
PLUGIN_STATUS Plugin status, one of ACTIVE , INACTIVE , DISABLED , DELETED or NOT INSTALLED .
Plugin type; STORAGE ENGINE , INFORMATION_SCHEMA , AUTHENTICATION , REPLICATION ,
PLUGIN_TYPE
DAEMON or AUDIT .

PLUGIN_TYPE_VERSION Version from the plugin's type-specific descriptor.


Plugin's shared object file name, located in the directory specified by the plugin_dir
PLUGIN_LIBRARY system variable, and used by the INSTALL PLUGIN and UNINSTALL PLUGIN statements.
NULL if the plugin is complied in and cannot be uninstalled.

PLUGIN_LIBRARY_VERSION Version from the plugin's API interface.


PLUGIN_AUTHOR Author of the plugin.
PLUGIN_DESCRIPTION Description.
PLUGIN_LICENSE Plugin's licence.
How the plugin was loaded; one of OFF , ON , FORCE or FORCE_PLUS_PERMANENT . See
LOAD_OPTION
Installing Plugins.
Plugin's maturity level; one of Unknown , Experimental , Alpha , Beta , 'Gamma , and
PLUGIN_MATURITY
Stable .

PLUGIN_AUTH_VERSION Plugin's version as determined by the plugin author. An example would be '0.99 beta 1'.

It provides a superset of the information shown by the SHOW PLUGINS SONAME statement, as well as the
information_schema.PLUGINS table. For specific information about storage engines (a particular type of plugin), see
the Information Schema ENGINES table and the SHOW ENGINES statement.
The table is not a standard Information Schema table, and is a MariaDB extension.

Example
318/3812
SELECT * FROM information_schema.all_plugins\G
*************************** 1. row ***************************
PLUGIN_NAME: binlog
PLUGIN_VERSION: 1.0
PLUGIN_STATUS: ACTIVE
PLUGIN_TYPE: STORAGE ENGINE
PLUGIN_TYPE_VERSION: 100314.0
PLUGIN_LIBRARY: NULL
PLUGIN_LIBRARY_VERSION: NULL
PLUGIN_AUTHOR: MySQL AB
PLUGIN_DESCRIPTION: This is a pseudo storage engine to represent the binlog in a transaction
PLUGIN_LICENSE: GPL
LOAD_OPTION: FORCE
PLUGIN_MATURITY: Stable
PLUGIN_AUTH_VERSION: 1.0
*************************** 2. row ***************************
PLUGIN_NAME: mysql_native_password
PLUGIN_VERSION: 1.0
PLUGIN_STATUS: ACTIVE
PLUGIN_TYPE: AUTHENTICATION
PLUGIN_TYPE_VERSION: 2.1
PLUGIN_LIBRARY: NULL
PLUGIN_LIBRARY_VERSION: NULL
PLUGIN_AUTHOR: R.J.Silk, Sergei Golubchik
PLUGIN_DESCRIPTION: Native MySQL authentication
PLUGIN_LICENSE: GPL
LOAD_OPTION: FORCE
PLUGIN_MATURITY: Stable
PLUGIN_AUTH_VERSION: 1.0
*************************** 3. row ***************************
PLUGIN_NAME: mysql_old_password
PLUGIN_VERSION: 1.0
PLUGIN_STATUS: ACTIVE
PLUGIN_TYPE: AUTHENTICATION
PLUGIN_TYPE_VERSION: 2.1
PLUGIN_LIBRARY: NULL
PLUGIN_LIBRARY_VERSION: NULL
PLUGIN_AUTHOR: R.J.Silk, Sergei Golubchik
PLUGIN_DESCRIPTION: Old MySQL-4.0 authentication
PLUGIN_LICENSE: GPL
LOAD_OPTION: FORCE
PLUGIN_MATURITY: Stable
PLUGIN_AUTH_VERSION: 1.0
...
*************************** 104. row ***************************
PLUGIN_NAME: WSREP_MEMBERSHIP
PLUGIN_VERSION: 1.0
PLUGIN_STATUS: NOT INSTALLED
PLUGIN_TYPE: INFORMATION SCHEMA
PLUGIN_TYPE_VERSION: 100314.0
PLUGIN_LIBRARY: wsrep_info.so
PLUGIN_LIBRARY_VERSION: 1.13
PLUGIN_AUTHOR: Nirbhay Choubey
PLUGIN_DESCRIPTION: Information about group members
PLUGIN_LICENSE: GPL
LOAD_OPTION: OFF
PLUGIN_MATURITY: Stable
PLUGIN_AUTH_VERSION: 1.0
*************************** 105. row ***************************
PLUGIN_NAME: WSREP_STATUS
PLUGIN_VERSION: 1.0
PLUGIN_STATUS: NOT INSTALLED
PLUGIN_TYPE: INFORMATION SCHEMA
PLUGIN_TYPE_VERSION: 100314.0
PLUGIN_LIBRARY: wsrep_info.so
PLUGIN_LIBRARY_VERSION: 1.13
PLUGIN_AUTHOR: Nirbhay Choubey
PLUGIN_DESCRIPTION: Group view information
PLUGIN_LICENSE: GPL
LOAD_OPTION: OFF
PLUGIN_MATURITY: Stable

1.1.1.2.9.1.1.5 Information Schema


APPLICABLE_ROLES Table
The Information Schema APPLICABLE_ROLES table shows the role authorizations that the current user may use.

319/3812
It contains the following columns:

Column Description Added


GRANTEE Account that the role was granted to.
ROLE_NAME Name of the role.
IS_GRANTABLE Whether the role can be granted or not.
IS_DEFAULT Whether the role is the user's default role or not MariaDB 10.1.3

The current role is in the ENABLED_ROLES Information Schema table.

Example
SELECT * FROM information_schema.APPLICABLE_ROLES;
+----------------+-------------+--------------+------------+
| GRANTEE | ROLE_NAME | IS_GRANTABLE | IS_DEFAULT |
+----------------+-------------+--------------+------------+
| root@localhost | journalist | YES | NO |
| root@localhost | staff | YES | NO |
| root@localhost | dd | YES | NO |
| root@localhost | dog | YES | NO |
+----------------+-------------+--------------+------------+

1.1.1.2.9.1.1.6 Information Schema


CHARACTER_SETS Table
The Information Schema CHARACTER_SETS table contains a list of supported character sets, their default collations and
maximum lengths.
It contains the following columns:

Column Description
CHARACTER_SET_NAME Name of the character set.
DEFAULT_COLLATE_NAME Default collation used.
DESCRIPTION Character set description.
MAXLEN Maximum length.

The SHOW CHARACTER SET statement returns the same results (although in a different order), and both can be
refined in the same way. For example, the following two statements return the same results:

SHOW CHARACTER SET WHERE Maxlen LIKE '2';

and

SELECT * FROM information_schema.CHARACTER_SETS


WHERE MAXLEN LIKE '2';

See Setting Character Sets and Collations for details on specifying the character set at the server, database, table and
column levels, and Supported Character Sets and Collations for a full list of supported characters sets and collations.

Example
SELECT CHARACTER_SET_NAME FROM information_schema.CHARACTER_SETS
WHERE DEFAULT_COLLATE_NAME LIKE '%chinese%';
+--------------------+
| CHARACTER_SET_NAME |
+--------------------+
| big5 |
| gb2312 |
| gbk |
+--------------------+

1.1.1.2.9.1.1.7 Information Schema


320/3812
CHECK_CONSTRAINTS Table
MariaDB starting with 10.2.22
The Information Schema CHECK_CONSTRAINTS Table was introduced in MariaDB 10.3.10 and MariaDB 10.2.22
.

The Information Schema CHECK_CONSTRAINTS table stores metadata about the constraints defined for tables in all
databases.
It contains the following columns:

Column Description
CONSTRAINT_CATALOG Always contains the string 'def'.
CONSTRAINT_SCHEMA Database name.
CONSTRAINT_NAME Constraint name.
TABLE_NAME Table name.
LEVEL Type of the constraint ('Column' or 'Table'). From MariaDB 10.5.10
CHECK_CLAUSE Constraint clause.

Example
A table with a numeric table check constraint and with a default check constraint name:

CREATE TABLE t ( a int, CHECK (a>10));

To see check constraint call check_constraints table from information schema.

SELECT * from INFORMATION_SCHEMA.CHECK_CONSTRAINTS\G

*************************** 1. row ***************************


CONSTRAINT_CATALOG: def
CONSTRAINT_SCHEMA: test
CONSTRAINT_NAME: CONSTRAINT_1
TABLE_NAME: t
CHECK_CLAUSE: `a` > 10

A new table check constraint called a_upper :

ALTER TABLE t ADD CONSTRAINT a_upper CHECK (a<100);

SELECT * from INFORMATION_SCHEMA.CHECK_CONSTRAINTS\G

*************************** 1. row ***************************


CONSTRAINT_CATALOG: def
CONSTRAINT_SCHEMA: test
CONSTRAINT_NAME: CONSTRAINT_1
TABLE_NAME: t
CHECK_CLAUSE: `a` > 10
*************************** 2. row ***************************
CONSTRAINT_CATALOG: def
CONSTRAINT_SCHEMA: test
CONSTRAINT_NAME: a_upper
TABLE_NAME: t
CHECK_CLAUSE: `a` < 100

A new table tt with a field check constraint called b , as well as a table check constraint called b_upper :

321/3812
CREATE TABLE tt(b int CHECK(b>0),CONSTRAINT b_upper CHECK(b<50));

SELECT * from INFORMATION_SCHEMA.CHECK_CONSTRAINTS;


+--------------------+-------------------+-----------------+------------+--------------+
| CONSTRAINT_CATALOG | CONSTRAINT_SCHEMA | CONSTRAINT_NAME | TABLE_NAME | CHECK_CLAUSE |
+--------------------+-------------------+-----------------+------------+--------------+
| def | test | b | tt | `b` > 0 |
| def | test | b_upper | tt | `b` < 50 |
| def | test | CONSTRAINT_1 | t | `a` > 10 |
| def | test | a_upper | t | `a` < 100 |
+--------------------+-------------------+-----------------+------------+--------------+

Note: The name of the field constraint is the same as the field name.
After dropping the default table constraint called CONSTRAINT_1 :

ALTER TABLE t DROP CONSTRAINT CONSTRAINT_1;

SELECT * from INFORMATION_SCHEMA.CHECK_CONSTRAINTS;


+--------------------+-------------------+-----------------+------------+--------------+
| CONSTRAINT_CATALOG | CONSTRAINT_SCHEMA | CONSTRAINT_NAME | TABLE_NAME | CHECK_CLAUSE |
+--------------------+-------------------+-----------------+------------+--------------+
| def | test | b | tt | `b` > 0 |
| def | test | b_upper | tt | `b` < 50 |
| def | test | a_upper | t | `a` < 100 |
+--------------------+-------------------+-----------------+------------+--------------+

Trying to insert invalid arguments into table t and tt generates an error.

INSERT INTO t VALUES (10),(20),(100);


ERROR 4025 (23000): CONSTRAINT `a_upper` failed for `test`.`t`

INSERT INTO tt VALUES (10),(-10),(100);


ERROR 4025 (23000): CONSTRAINT `b` failed for `test`.`tt`

INSERT INTO tt VALUES (10),(20),(100);


ERROR 4025 (23000): CONSTRAINT `b_upper` failed for `test`.`tt`

From MariaDB 10.5.10:

322/3812
create table majra(check(x>0), x int, y int check(y < 0), z int,
constraint z check(z>0), constraint xyz check(x<10 and y<10 and z<10));
Query OK, 0 rows affected (0.036 sec)

show create table majra;


+-------+----------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------
----+
| Table | Create Table
|
+-------+----------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------
----+
| majra | CREATE TABLE `majra` (
`x` int(11) DEFAULT NULL,
`y` int(11) DEFAULT NULL CHECK (`y` < 0),
`z` int(11) DEFAULT NULL,
CONSTRAINT `CONSTRAINT_1` CHECK (`x` > 0),
CONSTRAINT `z` CHECK (`z` > 0),
CONSTRAINT `xyz` CHECK (`x` < 10 and `y` < 10 and `z` < 10)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+-------+----------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------
----+
1 row in set (0.000 sec)

select * from information_schema.check_constraints where table_name='majra';


+--------------------+-------------------+------------+-----------------+--------+---------------------
---------------+
| CONSTRAINT_CATALOG | CONSTRAINT_SCHEMA | TABLE_NAME | CONSTRAINT_NAME | LEVEL | CHECK_CLAUSE
|
+--------------------+-------------------+------------+-----------------+--------+---------------------
---------------+
| def | test | majra | y | Column | `y` < 0
|
| def | test | majra | CONSTRAINT_1 | Table | `x` > 0
|
| def | test | majra | z | Table | `z` > 0
|
| def | test | majra | xyz | Table | `x` < 10 and `y` <
10 and `z` < 10 |
+--------------------+-------------------+------------+-----------------+--------+---------------------
---------------+
4 rows in set (0.001 sec)

1.1.1.2.9.1.1.8 Information Schema


CLIENT_STATISTICS Table
The Information Schema CLIENT_STATISTICS table holds statistics about client connections. This is part of the User
Statistics feature, which is not enabled by default.
It contains the following columns:

Field Type Notes


CLIENT VARCHAR(64) The IP address or hostname the connection originated from.
TOTAL_CONNECTIONS INT(21) The number of connections created for this client.
CONCURRENT_CONNECTIONS INT(21) The number of concurrent connections for this client.
The cumulative number of seconds elapsed while there were
CONNECTED_TIME INT(21)
connections from this client.

The cumulative number of seconds there was activity on


BUSY_TIME DOUBLE
connections from this client.
The cumulative CPU time elapsed while servicing this client's
connections. Note that this number may be wrong on SMP system if
CPU_TIME DOUBLE
there was a CPU migration for the thread during the execution of the
query.

323/3812
BYTES_RECEIVED INT(21) The number of bytes received from this client's connections.
BYTES_SENT INT(21) The number of bytes sent to this client's connections.
The number of bytes written to the binary log from this client's
BINLOG_BYTES_WRITTEN INT(21)
connections.
ROWS_READ INT(21) The number of rows read by this client's connections.
ROWS_SENT INT(21) The number of rows sent by this client's connections.
ROWS_DELETED INT(21) The number of rows deleted by this client's connections.
ROWS_INSERTED INT(21) The number of rows inserted by this client's connections.
ROWS_UPDATED INT(21) The number of rows updated by this client's connections.
The number of SELECT commands executed from this client's
SELECT_COMMANDS INT(21)
connections.
The number of UPDATE commands executed from this client's
UPDATE_COMMANDS INT(21)
connections.
The number of other commands executed from this client's
OTHER_COMMANDS INT(21)
connections.
The number of COMMIT commands issued by this client's
COMMIT_TRANSACTIONS INT(21)
connections.
The number of ROLLBACK commands issued by this client's
ROLLBACK_TRANSACTIONS INT(21)
connections.
DENIED_CONNECTIONS INT(21) The number of connections denied to this client.
The number of this client's connections that were terminated
LOST_CONNECTIONS INT(21)
uncleanly.
The number of times this client's connections issued commands that
ACCESS_DENIED INT(21)
were denied.
The number of times this client's connections sent queries that
EMPTY_QUERIES INT(21)
returned no results to the server.
The number of TLS connections created for this client. (>= MariaDB
TOTAL_SSL_CONNECTIONS INT(21)
10.1.1 )
The number of times a statement was aborted, because it was
MAX_STATEMENT_TIME_EXCEEDED INT(21) executed longer than its MAX_STATEMENT_TIME threshold. (>=
MariaDB 10.1.1 )

Example

SELECT * FROM information_schema.CLIENT_STATISTICS\G


*************************** 1. row ***************************
CLIENT: localhost
TOTAL_CONNECTIONS: 3
CONCURRENT_CONNECTIONS: 0
CONNECTED_TIME: 4883
BUSY_TIME: 0.009722
CPU_TIME: 0.0102131
BYTES_RECEIVED: 841
BYTES_SENT: 13897
BINLOG_BYTES_WRITTEN: 0
ROWS_READ: 0
ROWS_SENT: 214
ROWS_DELETED: 0
ROWS_INSERTED: 207
ROWS_UPDATED: 0
SELECT_COMMANDS: 10
UPDATE_COMMANDS: 0
OTHER_COMMANDS: 13
COMMIT_TRANSACTIONS: 0
ROLLBACK_TRANSACTIONS: 0
DENIED_CONNECTIONS: 0
LOST_CONNECTIONS: 0
ACCESS_DENIED: 0
EMPTY_QUERIES: 1

324/3812
1.1.1.2.9.1.1.9 Information Schema
COLLATION_CHARACTER_SET_APPLICABILITY
Table
The Information Schema COLLATION_CHARACTER_SET_APPLICABILITY table shows which character sets are associated
with which collations.
It contains the following columns:

Column Description
COLLATION_NAME Collation name.
CHARACTER_SET_NAME Name of the associated character set.

COLLATION_CHARACTER_SET_APPLICABILITY is essentially a subset of the COLLATIONS table.

SELECT COLLATION_NAME,CHARACTER_SET_NAME FROM information_schema.COLLATIONS;

and

SELECT * FROM information_schema.COLLATION_CHARACTER_SET_APPLICABILITY;

will return identical results.


See Setting Character Sets and Collations for details on specifying the character set at the server, database, table and
column levels.

Example
SELECT * FROM information_schema.COLLATION_CHARACTER_SET_APPLICABILITY
WHERE CHARACTER_SET_NAME='utf32';
+---------------------+--------------------+
| COLLATION_NAME | CHARACTER_SET_NAME |
+---------------------+--------------------+
| utf32_general_ci | utf32 |
| utf32_bin | utf32 |
| utf32_unicode_ci | utf32 |
| utf32_icelandic_ci | utf32 |
| utf32_latvian_ci | utf32 |
| utf32_romanian_ci | utf32 |
| utf32_slovenian_ci | utf32 |
| utf32_polish_ci | utf32 |
| utf32_estonian_ci | utf32 |
| utf32_spanish_ci | utf32 |
| utf32_swedish_ci | utf32 |
| utf32_turkish_ci | utf32 |
| utf32_czech_ci | utf32 |
| utf32_danish_ci | utf32 |
| utf32_lithuanian_ci | utf32 |
| utf32_slovak_ci | utf32 |
| utf32_spanish2_ci | utf32 |
| utf32_roman_ci | utf32 |
| utf32_persian_ci | utf32 |
| utf32_esperanto_ci | utf32 |
| utf32_hungarian_ci | utf32 |
| utf32_sinhala_ci | utf32 |
| utf32_german2_ci | utf32 |
| utf32_croatian_ci | utf32 |
+---------------------+--------------------+

1.1.1.2.9.1.1.10 Information Schema


COLLATIONS Table
Contents
1. NO PAD collations
2. Example
3. See Also

325/3812
The Information Schema COLLATIONS table contains a list of supported collations.
It contains the following columns:

Column Description
COLLATION_NAME Name of the collation.
CHARACTER_SET_NAME Associated character set.
ID Collation id.
IS_DEFAULT Whether the collation is the character set's default.
IS_COMPILED Whether the collation is compiled into the server.
SORTLEN Sort length, used for determining the memory used to sort strings in this collation.

The SHOW COLLATION statement returns the same results and both can be reduced in a similar way.
For example, in MariaDB Server 10.6, the following two statements return the same results:

SHOW COLLATION WHERE Charset LIKE 'utf8mb3';

and

SELECT * FROM information_schema.COLLATIONS


WHERE CHARACTER_SET_NAME LIKE 'utf8mb3';

In MariaDB Server 10.5 and before, utf8 should be specified instead of utf8mb3 .

NO PAD collations
MariaDB starting with 10.2
NO PAD collations regard trailing spaces as normal characters. You can get a list of all NO PAD collations as follows:

SELECT collation_name FROM information_schema.COLLATIONS


WHERE collation_name LIKE "%nopad%";
+------------------------------+
| collation_name |
+------------------------------+
| big5_chinese_nopad_ci |
| big5_nopad_bin |
...

Example
SELECT * FROM information_schema.COLLATIONS;
+------------------------------+--------------------+------+------------+-------------+---------+
| COLLATION_NAME | CHARACTER_SET_NAME | ID | IS_DEFAULT | IS_COMPILED | SORTLEN |
+------------------------------+--------------------+------+------------+-------------+---------+
| big5_chinese_ci | big5 | 1 | Yes | Yes | 1 |
| big5_bin | big5 | 84 | | Yes | 1 |
| big5_chinese_nopad_ci | big5 | 1025 | | Yes | 1 |
| big5_nopad_bin | big5 | 1108 | | Yes | 1 |
| dec8_swedish_ci | dec8 | 3 | Yes | Yes | 1 |
| dec8_bin | dec8 | 69 | | Yes | 1 |
| dec8_swedish_nopad_ci | dec8 | 1027 | | Yes | 1 |
| dec8_nopad_bin | dec8 | 1093 | | Yes | 1 |
| cp850_general_ci | cp850 | 4 | Yes | Yes | 1 |
| cp850_bin | cp850 | 80 | | Yes | 1 |
...

See Also
Setting Character Sets and Collations - specifying the character set at the server, database, table and column
levels
Supported Character Sets and Collations - full list of supported characters sets and collations.

1.1.1.2.9.1.1.11 Information Schema


326/3812
COLUMN_PRIVILEGES Table
The Information Schema COLUMN_PRIVILEGES table contains column privilege information derived from the
mysql.columns_priv grant table.
It has the following columns:

Column Description
GRANTEE In the format user_name@host_name .
TABLE_CATALOG Always def .
TABLE_SCHEMA Database name.
TABLE_NAME Table name.
COLUMN_NAME Column name.
PRIVILEGE_TYPE One of SELECT , INSERT , UPDATE or REFERENCES .
IS_GRANTABLE Whether the user has the GRANT OPTION for this privilege.

Similar information can be accessed with the SHOW FULL COLUMNS and SHOW GRANTS statements. See the GRANT article
for more about privileges.
This information is also stored in the columns_priv table, in the mysql system database.
For a description of the privileges that are shown in this table, see column privileges.

Example
In the following example, no column-level privilege has been explicitly assigned:

SELECT * FROM information_schema.COLUMN_PRIVILEGES;


Empty set

1.1.1.2.9.1.1.12 Information Schema


COLUMNS Table
The Information Schema COLUMNS table provides information about columns in each table on the server.
It contains the following columns:

Column Description Introduced


TABLE_CATALOG Always contains the string 'def'.
TABLE_SCHEMA Database name.
TABLE_NAME Table name.
COLUMN_NAME Column name.
ORDINAL_POSITION Column position in the table. Can be used for ordering.
Default value for the column. From MariaDB 10.2.7 , literals are quoted
to distinguish them from expressions. NULL means that the column has
COLUMN_DEFAULT no default. In MariaDB 10.2.6 and earlier, no quotes were used for any
type of default and NULL can either mean that there is no default, or that
the default column value is NULL .
IS_NULLABLE Whether the column can contain NULL s.
DATA_TYPE The column's data type.
CHARACTER_MAXIMUM_LENGTH Maximum length.
Same as the CHARACTER_MAXIMUM_LENGTH except for multi-byte character
CHARACTER_OCTET_LENGTH
sets.
For numeric types, the precision (number of significant digits) for the
NUMERIC_PRECISION
column. NULL if not a numeric field.
For numeric types, the scale (significant digits to the right of the decimal
NUMERIC_SCALE
point). NULL if not a numeric field.
DATETIME_PRECISION Fractional-seconds precision, or NULL if not a time data type.
327/3812
CHARACTER_SET_NAME Character set if a non-binary string data type, otherwise NULL.
COLLATION_NAME Collation if a non-binary string data type, otherwise NULL.
COLUMN_TYPE Column definition, a MySQL and MariaDB extension.
Index type. PRI for primary key, UNI for unique index, MUL for multiple
COLUMN_KEY
index. A MySQL and MariaDB extension.
Additional information about a column, for example whether the column is
an invisible column, or, from MariaDB 10.3.6, WITHOUT SYSTEM
EXTRA
VERSIONING if the table is not a system-versioned table. A MySQL and
MariaDB extension.
Which privileges you have for the column. A MySQL and MariaDB
PRIVILEGES
extension.
COLUMN_COMMENT Column comments.
Indicates whether the column value is generated (virtual, or computed). MariaDB
IS_GENERATED
Can be ALWAYS or NEVER . 10.2.5
The expression used for computing the column value in a generated MariaDB
GENERATION_EXPRESSION
(virtual, or computed) column. 10.2.5

It provides information similar to, but more complete, than SHOW COLUMNS and mysqlshow .

Examples
SELECT * FROM information_schema.COLUMNS\G
...
*************************** 9. row ***************************
TABLE_CATALOG: def
TABLE_SCHEMA: test
TABLE_NAME: t2
COLUMN_NAME: j
ORDINAL_POSITION: 1
COLUMN_DEFAULT: NULL
IS_NULLABLE: YES
DATA_TYPE: longtext
CHARACTER_MAXIMUM_LENGTH: 4294967295
CHARACTER_OCTET_LENGTH: 4294967295
NUMERIC_PRECISION: NULL
NUMERIC_SCALE: NULL
DATETIME_PRECISION: NULL
CHARACTER_SET_NAME: utf8mb4
COLLATION_NAME: utf8mb4_bin
COLUMN_TYPE: longtext
COLUMN_KEY:
EXTRA:
PRIVILEGES: select,insert,update,references
COLUMN_COMMENT:
IS_GENERATED: NEVER
GENERATION_EXPRESSION: NULL
...

CREATE TABLE t (
s1 VARCHAR(20) DEFAULT 'ABC',
s2 VARCHAR(20) DEFAULT (concat('A','B')),
s3 VARCHAR(20) DEFAULT ("concat('A','B')"),
s4 VARCHAR(20),
s5 VARCHAR(20) DEFAULT NULL,
s6 VARCHAR(20) NOT NULL,
s7 VARCHAR(20) DEFAULT 'NULL' NULL,
s8 VARCHAR(20) DEFAULT 'NULL' NOT NULL
);

SELECT
table_name,
column_name,
ordinal_position,
column_default,
column_default IS NULL
FROM information_schema.COLUMNS
WHERE table_schema=DATABASE()
AND TABLE_NAME='t';

328/3812
From MariaDB 10.2.7 :

+------------+-------------+------------------+-----------------------+------------------------+
| table_name | column_name | ordinal_position | column_default | column_default IS NULL |
+------------+-------------+------------------+-----------------------+------------------------+
| t | s1 | 1 | 'ABC' | 0 |
| t | s2 | 2 | concat('A','B') | 0 |
| t | s3 | 3 | 'concat(''A'',''B'')' | 0 |
| t | s4 | 4 | NULL | 0 |
| t | s5 | 5 | NULL | 0 |
| t | s6 | 6 | NULL | 1 |
| t | s7 | 7 | 'NULL' | 0 |
| t | s8 | 8 | 'NULL' | 0 |
+------------+-------------+------------------+-----------------------+------------------------+

In the results above, the two single quotes in concat(''A'',''B'') indicate an escaped single quote - see string-
literals. Note that while mysql-command-line-client appears to show the same default value for columns s5 and s6 , the
first is a 4-character string "NULL", while the second is the SQL NULL value.
MariaDB 10.2.6 and before:

+------------+-------------+------------------+-----------------+------------------------+
| table_name | column_name | ordinal_position | column_default | column_default IS NULL |
+------------+-------------+------------------+-----------------+------------------------+
| t | s1 | 1 | ABC | 0 |
| t | s2 | 2 | concat('A','B') | 0 |
| t | s3 | 3 | concat('A','B') | 0 |
| t | s4 | 4 | NULL | 1 |
| t | s5 | 5 | NULL | 1 |
| t | s6 | 6 | NULL | 1 |
| t | s7 | 7 | NULL | 0 |
| t | s8 | 8 | NULL | 0 |
+------------+-------------+------------------+-----------------+------------------------+

1.1.1.2.9.1.1.13 Information Schema DISKS


Table
MariaDB 10.1.32
The DISKS table was introduced in MariaDB 10.1.32 , MariaDB 10.2.14 , and MariaDB 10.3.6 as part of the
DISKS plugin.

Contents
1. Description
2. Example
3. See Also

Description
The DISKS table is created when the DISKS plugin is enabled, and shows metadata about disks on the system.
Before MariaDB 10.4.7, MariaDB 10.3.17, MariaDB 10.2.26 and MariaDB 10.1.41 , this plugin did not check user
privileges. When it is enabled, any user can query the INFORMATION_SCHEMA.DISKS table and see all the information it
provides.
Since MariaDB 10.4.7, MariaDB 10.3.17, MariaDB 10.2.26 and MariaDB 10.1.41 , it requires the FILE privilege.
The plugin only works on Linux.
The table contains the following columns:

Column Description
DISK Name of the disk itself.
PATH Mount point of the disk.
TOTAL Total space in KiB.
USED Used amount of space in KiB.
AVAILABLE Amount of space in KiB available to non-root users.

Note that as the amount of space available to root (OS user) may be more that what is available to non-root users,
329/3812
'available' + 'used' may be less than 'total'.
All paths to which a particular disk has been mounted are reported. The rationale is that someone might want to take
different action e.g. depending on which disk is relevant for a particular path. This leads to the same disk being reported
multiple times.

Example
SELECT * FROM information_schema.DISKS;

+-----------+-------+----------+---------+-----------+
| Disk | Path | Total | Used | Available |
+-----------+-------+----------+---------+-----------+
| /dev/vda1 | / | 26203116 | 2178424 | 24024692 |
| /dev/vda1 | /boot | 26203116 | 2178424 | 24024692 |
| /dev/vda1 | /etc | 26203116 | 2178424 | 24024692 |
+-----------+-------+----------+---------+-----------+

See Also
Disks Plugin for details on installing, options
Plugin Overview for details on managing plugins.

1.1.1.2.9.1.1.14 Information Schema


ENABLED_ROLES Table
The Information Schema ENABLED_ROLES table shows the enabled roles for the current session.
It contains the following column:

Column Description
ROLE_NAME The enabled role name, or NULL .

This table lists all roles that are currently enabled, one role per row — the current role, roles granted to the current role,
roles granted to these roles and so on. If no role is set, the row contains a NULL value.
The roles that the current user can enable are listed in the APPLICABLE_ROLES Information Schema table.
See also CURRENT_ROLE().

Examples
SELECT * FROM information_schema.ENABLED_ROLES;
+-----------+
| ROLE_NAME |
+-----------+
| NULL |
+-----------+

SET ROLE staff;

SELECT * FROM information_schema.ENABLED_ROLES;


+-----------+
| ROLE_NAME |
+-----------+
| staff |
+-----------+

1.1.1.2.9.1.1.15 Information Schema ENGINES


Table
The Information Schema ENGINES table displays status information about the server's storage engines.
It contains the following columns:

Column Description
ENGINE
Name of the storage engine.

330/3812
SUPPORT Whether the engine is the default, or is supported or not.
COMMENT Storage engine comments.
TRANSACTIONS Whether or not the engine supports transactions.
XA Whether or not the engine supports XA transactions.
SAVEPOINTS Whether or not savepoints are supported.

It provides identical information to the SHOW ENGINES statement. Since storage engines are plugins, different information
about them is also shown in the information_schema.PLUGINS table and by the SHOW PLUGINS statement.
The table is not a standard Information Schema table, and is a MySQL and MariaDB extension.
Note that both MySQL's InnoDB and Percona's XtraDB replacement are labeled as InnoDB . However, if XtraDB is in
use, it will be specified in the COMMENT field. See XtraDB and InnoDB. The same applies to FederatedX .

Example

331/3812
SELECT * FROM information_schema.ENGINES\G;
*************************** 1. row ***************************
ENGINE: InnoDB
SUPPORT: DEFAULT
COMMENT: Supports transactions, row-level locking, and foreign keys
TRANSACTIONS: YES
XA: YES
SAVEPOINTS: YES
*************************** 2. row ***************************
ENGINE: CSV
SUPPORT: YES
COMMENT: CSV storage engine
TRANSACTIONS: NO
XA: NO
SAVEPOINTS: NO
*************************** 3. row ***************************
ENGINE: MyISAM
SUPPORT: YES
COMMENT: MyISAM storage engine
TRANSACTIONS: NO
XA: NO
SAVEPOINTS: NO
*************************** 4. row ***************************
ENGINE: BLACKHOLE
SUPPORT: YES
COMMENT: /dev/null storage engine (anything you write to it disappears)
TRANSACTIONS: NO
XA: NO
SAVEPOINTS: NO
*************************** 5. row ***************************
ENGINE: FEDERATED
SUPPORT: YES
COMMENT: FederatedX pluggable storage engine
TRANSACTIONS: YES
XA: NO
SAVEPOINTS: YES
*************************** 6. row ***************************
ENGINE: MRG_MyISAM
SUPPORT: YES
COMMENT: Collection of identical MyISAM tables
TRANSACTIONS: NO
XA: NO
SAVEPOINTS: NO
*************************** 7. row ***************************
ENGINE: ARCHIVE
SUPPORT: YES
COMMENT: Archive storage engine
TRANSACTIONS: NO
XA: NO
SAVEPOINTS: NO
*************************** 8. row ***************************
ENGINE: MEMORY
SUPPORT: YES
COMMENT: Hash based, stored in memory, useful for temporary tables
TRANSACTIONS: NO
XA: NO
SAVEPOINTS: NO
*************************** 9. row ***************************
ENGINE: PERFORMANCE_SCHEMA
SUPPORT: YES
COMMENT: Performance Schema
TRANSACTIONS: NO
XA: NO
SAVEPOINTS: NO
*************************** 10. row ***************************
ENGINE: Aria
SUPPORT: YES
COMMENT: Crash-safe tables with MyISAM heritage
TRANSACTIONS: NO
XA: NO
SAVEPOINTS: NO
10 rows in set (0.00 sec)

Check if a given storage engine is available:

SELECT SUPPORT FROM information_schema.ENGINES WHERE ENGINE LIKE 'tokudb';


Empty set

Check which storage engine supports XA transactions:


332/3812
SELECT ENGINE FROM information_schema.ENGINES WHERE XA = 'YES';
+--------+
| ENGINE |
+--------+
| InnoDB |
+--------+

1.1.1.2.9.1.1.16 Information Schema EVENTS


Table
The Information Schema EVENTS table stores information about Events on the server.
It contains the following columns:

Column Description
EVENT_CATALOG Always def .
EVENT_SCHEMA Database where the event was defined.
EVENT_NAME Event name.
DEFINER Event definer.
TIME_ZONE Time zone used for the event's scheduling and execution, by default SYSTEM .
EVENT_BODY SQL .

EVENT_DEFINITION The SQL defining the event.


EVENT_TYPE Either ONE TIME or RECURRING .
EXECUTE_AT DATETIME when the event is set to execute, or NULL if recurring.

INTERVAL_VALUE Numeric interval between event executions for a recurring event, or NULL if not recurring.
INTERVAL_FIELD Interval unit (e.g., HOUR )
SQL_MODE The SQL_MODE at the time the event was created.
STARTS Start DATETIME for a recurring event, NULL if not defined or not recurring.
ENDS End DATETIME for a recurring event, NULL if not defined or not recurring.
STATUS One of ENABLED , DISABLED or / SLAVESIDE_DISABLED .
ON_COMPLETION The ON COMPLETION clause, either PRESERVE or NOT PRESERVE .
CREATED When the event was created.
LAST_ALTERED When the event was last changed.
LAST_EXECUTED When the event was last run.
EVENT_COMMENT The comment provided in the CREATE EVENT statement, or an empty string if none.
ORIGINATOR MariaDB server ID on which the event was created.
CHARACTER_SET_CLIENT character_set_client system variable session value at the time the event was created.

COLLATION_CONNECTION collation_connection system variable session value at the time the event was created.
DATABASE_COLLATION Database collation with which the event is linked.

The SHOW EVENTS and SHOW CREATE EVENT statements provide similar information.

1.1.1.2.9.1.1.17 Information Schema


FEEDBACK Table
The Information Schema FEEDBACK table is created when the Feedback Plugin is enabled, and contains the complete
contents submitted by the plugin.
It contains two columns:

Column Description
VARIABLE_NAME Name of the item of information being collected.

333/3812
VARIABLE_VALUE Contents of the item of information being collected.

It is possible to disable automatic collection, by setting the feedback_url variable to an empty string, and to submit the
contents manually, as follows:

$ mysql -e 'SELECT * FROM information_schema.FEEDBACK' > report.txt

Then you can send it by opening https://mariadb.org/feedback_plugin/post in your browser, and uploading
your generated report.txt . Or you can do it from the command line with (for example):

$ curl -F [email protected] https://mariadb.org/feedback_plugin/post

Manual uploading allows you to be absolutely sure that we receive only the data shown in the
information_schema.FEEDBACK table and that no private or sensitive information is being sent.

Example
SELECT * FROM information_schema.FEEDBACK\G
...
*************************** 906. row ***************************
VARIABLE_NAME: Uname_sysname
VARIABLE_VALUE: Linux
*************************** 907. row ***************************
VARIABLE_NAME: Uname_release
VARIABLE_VALUE: 3.13.0-53-generic
*************************** 908. row ***************************
VARIABLE_NAME: Uname_version
VARIABLE_VALUE: #89-Ubuntu SMP Wed May 20 10:34:39 UTC 2015
*************************** 909. row ***************************
VARIABLE_NAME: Uname_machine
VARIABLE_VALUE: x86_64
*************************** 910. row ***************************
VARIABLE_NAME: Uname_distribution
VARIABLE_VALUE: lsb: Ubuntu 14.04.2 LTS
*************************** 911. row ***************************
VARIABLE_NAME: Collation used latin1_german1_ci
VARIABLE_VALUE: 1
*************************** 912. row ***************************
VARIABLE_NAME: Collation used latin1_swedish_ci
VARIABLE_VALUE: 18
*************************** 913. row ***************************
VARIABLE_NAME: Collation used utf8_general_ci
VARIABLE_VALUE: 567
*************************** 914. row ***************************
VARIABLE_NAME: Collation used latin1_bin
VARIABLE_VALUE: 1
*************************** 915. row ***************************
VARIABLE_NAME: Collation used binary
VARIABLE_VALUE: 16
*************************** 916. row ***************************
VARIABLE_NAME: Collation used utf8_bin
VARIABLE_VALUE: 4044

1.1.1.2.9.1.1.18 Information Schema FILES


Table
The FILES tables is unused in MariaDB. See MDEV-11426 .

1.1.1.2.9.1.1.19 Information Schema


GEOMETRY_COLUMNS Table
Description
The Information Schema GEOMETRY_COLUMNS table provides support for Spatial Reference systems for GIS data.
It contains the following columns:

Column Type Null Description


334/3812
Together with F_TABLE_SCHEMA and F_TABLE_NAME , the fully qualified
F_TABLE_CATALOG VARCHAR(512) NO
name of the featured table containing the geometry column.
Together with F_TABLE_CATALOG and F_TABLE_NAME , the fully qualified
F_TABLE_SCHEMA VARCHAR(64) NO
name of the featured table containing the geometry column.
Together with F_TABLE_CATALOG and F_TABLE_SCHEMA , the fully
F_TABLE_NAME VARCHAR(64) NO
qualified name of the featured table containing the geometry column.
F_GEOMETRY_COLUMN VARCHAR(64) NO Name of the column in the featured table that is the geometry golumn.
G_TABLE_CATALOG VARCHAR(512) NO
G_TABLE_SCHEMA VARCHAR(64) NO Database name of the table implementing the geometry column.
G_TABLE_NAME VARCHAR(64) NO Table name that is implementing the geometry column.
G_GEOMETRY_COLUMN VARCHAR(64) NO
STORAGE_TYPE TINYINT(2) NO Binary geometry implementation. Always 1 in MariaDB.
Integer reflecting the type of geometry stored in this column (see table
GEOMETRY_TYPE INT(7) NO
below).
Number of dimensions in the spatial reference system. Always 2 in
COORD_DIMENSION TINYINT(2) NO
MariaDB.
MAX_PPR TINYINT(2) NO Always 0 in MariaDB.
ID of the Spatial Reference System used for the coordinate geometry in
SRID SMALLINT(5) NO
this table. It is a foreign key reference to the SPATIAL_REF_SYS table .

Storage_type
The integers in the storage_type field match the geometry types as follows:

Integer Type
0 GEOMETRY

1 POINT

3 LINESTRING

5 POLYGON

7 MULTIPOINT

9 MULTILINESTRING

11 MULTIPOLYGON

Example
CREATE TABLE g1(g GEOMETRY(9,4) REF_SYSTEM_ID=101);

SELECT * FROM information_schema.GEOMETRY_COLUMNS\G


*************************** 1. row ***************************
F_TABLE_CATALOG: def
F_TABLE_SCHEMA: test
F_TABLE_NAME: g1
F_GEOMETRY_COLUMN:
G_TABLE_CATALOG: def
G_TABLE_SCHEMA: test
G_TABLE_NAME: g1
G_GEOMETRY_COLUMN: g
STORAGE_TYPE: 1
GEOMETRY_TYPE: 0
COORD_DIMENSION: 2
MAX_PPR: 0
SRID: 101

See also
The SPATIAL_REF_SYS table.

335/3812
1.1.1.2.9.1.1.20 Information Schema
GLOBAL_STATUS and SESSION_STATUS
Tables
The Information Schema GLOBAL_STATUS and SESSION_STATUS tables store a record of all status variables and their
global and session values respectively. This is the same information as displayed by the SHOW STATUS commands SHOW
GLOBAL STATUS and SHOW SESSION STATUS .

They contain the following columns:

Column Description

VARIABLE_NAME Status variable name.


VARIABLE_VALUE Global or session value.

Example
SELECT * FROM information_schema.GLOBAL_STATUS;
+-----------------------------------------------+--------------------+
| VARIABLE_NAME | VARIABLE_VALUE |
+-----------------------------------------------+--------------------+
...
| BINLOG_SNAPSHOT_FILE | mariadb-bin.000208 |
| BINLOG_SNAPSHOT_POSITION | 369 |
...
| THREADS_CONNECTED | 1 |
| THREADS_CREATED | 1 |
| THREADS_RUNNING | 1 |
| UPTIME | 57358 |
| UPTIME_SINCE_FLUSH_STATUS | 57358 |
+-----------------------------------------------+--------------------+

1.1.1.2.9.1.1.21 Information Schema


GLOBAL_VARIABLES and
SESSION_VARIABLES Tables
The Information Schema GLOBAL_VARIABLES and SESSION_VARIABLES tables stores a record of all system variables and
their global and session values respectively. This is the same information as displayed by the SHOW VARIABLES
commands SHOW GLOBAL VARIABLES and SHOW SESSION VARIABLES .
It contains the following columns:

Column Description
VARIABLE_NAME System variable name.
VARIABLE_VALUE Global or session value.

Example

336/3812
SELECT * FROM information_schema.GLOBAL_VARIABLES ORDER BY VARIABLE_NAME\G
*************************** 1. row *****************************
VARIABLE_NAME: ARIA_BLOCK_SIZE
VARIABLE_VALUE: 8192
*************************** 2. row *****************************
VARIABLE_NAME: ARIA_CHECKPOINT_LOG_ACTIVITY
VARIABLE_VALUE: 1048576
*************************** 3. row *****************************
VARIABLE_NAME: ARIA_CHECKPOINT_INTERVAL
VARIABLE_VALUE: 30
...
*************************** 455. row ***************************
VARIABLE_NAME: VERSION_COMPILE_MACHINE
VARIABLE_VALUE: x86_64
*************************** 456. row ***************************
VARIABLE_NAME: VERSION_COMPILE_OS
VARIABLE_VALUE: debian-linux-gnu
*************************** 457. row ***************************
VARIABLE_NAME: WAIT_TIMEOUT
VARIABLE_VALUE: 600

1.1.1.2.9.1.1.22 Information Schema


INDEX_STATISTICS Table
The Information Schema INDEX_STATISTICS table shows statistics on index usage and makes it possible to do such
things as locating unused indexes and generating the commands to remove them.
This is part of the User Statistics feature, which is not enabled by default.
It contains the following columns:

Field Type Notes


TABLE_SCHEMA VARCHAR(192) The schema (database) name.
TABLE_NAME VARCHAR(192) The table name.
INDEX_NAME VARCHAR(192) The index name (as visible in SHOW CREATE TABLE ).
ROWS_READ INT(21) The number of rows read from this index.

Example
SELECT * FROM information_schema.INDEX_STATISTICS
WHERE TABLE_NAME = "author";
+--------------+------------+------------+-----------+
| TABLE_SCHEMA | TABLE_NAME | INDEX_NAME | ROWS_READ |
+--------------+------------+------------+-----------+
| books | author | by_name | 15 |
+--------------+------------+------------+-----------+

1.1.1.2.9.1.1.23 Information Schema


KEY_CACHES Table
The Information Schema KEY_CACHES table shows statistics about the segmented key cache,.
It contains the following columns:

Column Name Description


KEY_CACHE_NAME The name of the key cache
SEGMENTS total number of segments (set to NULL for regular key caches)
segment number (set to NULL for any regular key caches and for rows containing aggregation
SEGMENT_NUMBER
statistics for segmented key caches)
FULL_SIZE memory for cache buffers/auxiliary structures
BLOCK_SIZE size of the blocks
USED_BLOCKS number of currently used blocks

337/3812
UNUSED_BLOCKS number of currently unused blocks
DIRTY_BLOCKS number of currently dirty blocks
READ_REQUESTS number of read requests
READS number of actual reads from files into buffers
WRITE_REQUESTS number of write requests
WRITES number of actual writes from buffers into files

Example
SELECT * FROM information_schema.KEY_CACHES \G
********************** 1. row **********************
KEY_CACHE_NAME: default
SEGMENTS: NULL
SEGMENT_NUMBER: NULL
FULL_SIZE: 134217728
BLOCK_SIZE: 1024
USED_BLOCKS: 36
UNUSED_BLOCKS: 107146
DIRTY_BLOCKS: 0
READ_REQUESTS: 40305
READS: 21
WRITE_REQUESTS: 19239
WRITES: 358

1.1.1.2.9.1.1.24 Information Schema


KEY_COLUMN_USAGE Table
The Information Schema KEY_COLUMN_USAGE table shows which key columns have constraints.
It contains the following columns:

Column Description
CONSTRAINT_CATALOG Always def .
CONSTRAINT_SCHEMA Database name of the constraint.
CONSTRAINT_NAME Name of the constraint ( PRIMARY for the primary key).
TABLE_CATALOG Always #def .
TABLE_SCHEMA Database name of the column constraint.
TABLE_NAME Table name of the column constraint.
COLUMN_NAME Column name of the constraint.
ORDINAL_POSITION Position of the column within the constraint.
POSITION_IN_UNIQUE_CONSTRAINT For foreign keys, the position in the unique constraint.
REFERENCED_TABLE_SCHEMA For foreign keys, the referenced database name.
REFERENCED_TABLE_NAME For foreign keys, the referenced table name.
REFERENCED_COLUMN_NAME For foreign keys, the referenced column name.

Example

338/3812
SELECT * FROM information_schema.KEY_COLUMN_USAGE LIMIT 1 \G
********************** 1. row **********************
CONSTRAINT_CATALOG: def
CONSTRAINT_SCHEMA: my_website
CONSTRAINT_NAME: PRIMARY
TABLE_CATALOG: def
TABLE_SCHEMA: users
COLUMN_NAME: user_id
ORDINAL_POSITION: 1
POSITION_IN_UNIQUE_CONSTRAINT: NULL
REFERENCED_TABLE_SCHEMA: NULL
REFERENCED_TABLE_NAME: NULL
REFERENCED_COLUMN_NAME: NULL

See Also
Finding Tables Without Primary Keys

1.1.1.2.9.1.1.25 Information Schema


KEYWORDS Table
MariaDB starting with 10.6.3
The KEYWORDS table was added in MariaDB 10.6.3.

Description
The Information Schema KEYWORDS table contains the list of MariaDB keywords.
It contains a single column:

Column Description
WORD Keyword

The table is not a standard Information Schema table, and is a MariaDB extension.

Example
SELECT * FROM INFORMATION_SCHEMA.KEYWORDS;
+-------------------------------+
| WORD |
+-------------------------------+
| && |
| <= |
| <> |
| != |
| >= |
| << |
| >> |
| <=> |
| ACCESSIBLE |
| ACCOUNT |
| ACTION |
| ADD |
| ADMIN |
| AFTER |
| AGAINST |
| AGGREGATE |
| ALL |
| ALGORITHM |
| ALTER |
| ALWAYS |
| ANALYZE |
| AND |
| ANY |
| AS |
| ASC |
| ASCII |
| ASENSITIVE |
| AT |
| ATOMIC |
| AUTHORS | 339/3812
| AUTHORS |
| AUTO_INCREMENT |
| AUTOEXTEND_SIZE |
| AUTO |
| AVG |
| AVG_ROW_LENGTH |
| BACKUP |
| BEFORE |
| BEGIN |
| BETWEEN |
| BIGINT |
| BINARY |
| BINLOG |
| BIT |
| BLOB |
| BLOCK |
| BODY |
| BOOL |
| BOOLEAN |
| BOTH |
| BTREE |
| BY |
| BYTE |
| CACHE |
| CALL |
| CASCADE |
| CASCADED |
| CASE |
| CATALOG_NAME |
| CHAIN |
| CHANGE |
| CHANGED |
| CHAR |
| CHARACTER |
| CHARSET |
| CHECK |
| CHECKPOINT |
| CHECKSUM |
| CIPHER |
| CLASS_ORIGIN |
| CLIENT |
| CLOB |
| CLOSE |
| COALESCE |
| CODE |
| COLLATE |
| COLLATION |
| COLUMN |
| COLUMN_NAME |
| COLUMNS |
| COLUMN_ADD |
| COLUMN_CHECK |
| COLUMN_CREATE |
| COLUMN_DELETE |
| COLUMN_GET |
| COMMENT |
| COMMIT |
| COMMITTED |
| COMPACT |
| COMPLETION |
| COMPRESSED |
| CONCURRENT |
| CONDITION |
| CONNECTION |
| CONSISTENT |
| CONSTRAINT |
| CONSTRAINT_CATALOG |
| CONSTRAINT_NAME |
| CONSTRAINT_SCHEMA |
| CONTAINS |
| CONTEXT |
| CONTINUE |
| CONTRIBUTORS |
| CONVERT |
| CPU |
| CREATE |
| CROSS |
| CUBE |
| CURRENT |
| CURRENT_DATE |
| CURRENT_POS |
| CURRENT_ROLE |
340/3812
| CURRENT_TIME |
| CURRENT_TIMESTAMP |
| CURRENT_USER |
| CURSOR |
| CURSOR_NAME |
| CYCLE |
| DATA |
| DATABASE |
| DATABASES |
| DATAFILE |
| DATE |
| DATETIME |
| DAY |
| DAY_HOUR |
| DAY_MICROSECOND |
| DAY_MINUTE |
| DAY_SECOND |
| DEALLOCATE |
| DEC |
| DECIMAL |
| DECLARE |
| DEFAULT |
| DEFINER |
| DELAYED |
| DELAY_KEY_WRITE |
| DELETE |
| DELETE_DOMAIN_ID |
| DESC |
| DESCRIBE |
| DES_KEY_FILE |
| DETERMINISTIC |
| DIAGNOSTICS |
| DIRECTORY |
| DISABLE |
| DISCARD |
| DISK |
| DISTINCT |
| DISTINCTROW |
| DIV |
| DO |
| DOUBLE |
| DO_DOMAIN_IDS |
| DROP |
| DUAL |
| DUMPFILE |
| DUPLICATE |
| DYNAMIC |
| EACH |
| ELSE |
| ELSEIF |
| ELSIF |
| EMPTY |
| ENABLE |
| ENCLOSED |
| END |
| ENDS |
| ENGINE |
| ENGINES |
| ENUM |
| ERROR |
| ERRORS |
| ESCAPE |
| ESCAPED |
| EVENT |
| EVENTS |
| EVERY |
| EXAMINED |
| EXCEPT |
| EXCHANGE |
| EXCLUDE |
| EXECUTE |
| EXCEPTION |
| EXISTS |
| EXIT |
| EXPANSION |
| EXPIRE |
| EXPORT |
| EXPLAIN |
| EXTENDED |
| EXTENT_SIZE |
| FALSE |
| FAST |
341/3812
| FAST |
| FAULTS |
| FEDERATED |
| FETCH |
| FIELDS |
| FILE |
| FIRST |
| FIXED |
| FLOAT |
| FLOAT4 |
| FLOAT8 |
| FLUSH |
| FOLLOWING |
| FOLLOWS |
| FOR |
| FORCE |
| FOREIGN |
| FORMAT |
| FOUND |
| FROM |
| FULL |
| FULLTEXT |
| FUNCTION |
| GENERAL |
| GENERATED |
| GET_FORMAT |
| GET |
| GLOBAL |
| GOTO |
| GRANT |
| GRANTS |
| GROUP |
| HANDLER |
| HARD |
| HASH |
| HAVING |
| HELP |
| HIGH_PRIORITY |
| HISTORY |
| HOST |
| HOSTS |
| HOUR |
| HOUR_MICROSECOND |
| HOUR_MINUTE |
| HOUR_SECOND |
| ID |
| IDENTIFIED |
| IF |
| IGNORE |
| IGNORED |
| IGNORE_DOMAIN_IDS |
| IGNORE_SERVER_IDS |
| IMMEDIATE |
| IMPORT |
| INTERSECT |
| IN |
| INCREMENT |
| INDEX |
| INDEXES |
| INFILE |
| INITIAL_SIZE |
| INNER |
| INOUT |
| INSENSITIVE |
| INSERT |
| INSERT_METHOD |
| INSTALL |
| INT |
| INT1 |
| INT2 |
| INT3 |
| INT4 |
| INT8 |
| INTEGER |
| INTERVAL |
| INVISIBLE |
| INTO |
| IO |
| IO_THREAD |
| IPC |
| IS |
| ISOLATION |
| ISOPEN | 342/3812
| ISOPEN |
| ISSUER |
| ITERATE |
| INVOKER |
| JOIN |
| JSON |
| JSON_TABLE |
| KEY |
| KEYS |
| KEY_BLOCK_SIZE |
| KILL |
| LANGUAGE |
| LAST |
| LAST_VALUE |
| LASTVAL |
| LEADING |
| LEAVE |
| LEAVES |
| LEFT |
| LESS |
| LEVEL |
| LIKE |
| LIMIT |
| LINEAR |
| LINES |
| LIST |
| LOAD |
| LOCAL |
| LOCALTIME |
| LOCALTIMESTAMP |
| LOCK |
| LOCKED |
| LOCKS |
| LOGFILE |
| LOGS |
| LONG |
| LONGBLOB |
| LONGTEXT |
| LOOP |
| LOW_PRIORITY |
| MASTER |
| MASTER_CONNECT_RETRY |
| MASTER_DELAY |
| MASTER_GTID_POS |
| MASTER_HOST |
| MASTER_LOG_FILE |
| MASTER_LOG_POS |
| MASTER_PASSWORD |
| MASTER_PORT |
| MASTER_SERVER_ID |
| MASTER_SSL |
| MASTER_SSL_CA |
| MASTER_SSL_CAPATH |
| MASTER_SSL_CERT |
| MASTER_SSL_CIPHER |
| MASTER_SSL_CRL |
| MASTER_SSL_CRLPATH |
| MASTER_SSL_KEY |
| MASTER_SSL_VERIFY_SERVER_CERT |
| MASTER_USER |
| MASTER_USE_GTID |
| MASTER_HEARTBEAT_PERIOD |
| MATCH |
| MAX_CONNECTIONS_PER_HOUR |
| MAX_QUERIES_PER_HOUR |
| MAX_ROWS |
| MAX_SIZE |
| MAX_STATEMENT_TIME |
| MAX_UPDATES_PER_HOUR |
| MAX_USER_CONNECTIONS |
| MAXVALUE |
| MEDIUM |
| MEDIUMBLOB |
| MEDIUMINT |
| MEDIUMTEXT |
| MEMORY |
| MERGE |
| MESSAGE_TEXT |
| MICROSECOND |
| MIDDLEINT |
| MIGRATE |
| MINUS |
343/3812
| MINUS |
| MINUTE |
| MINUTE_MICROSECOND |
| MINUTE_SECOND |
| MINVALUE |
| MIN_ROWS |
| MOD |
| MODE |
| MODIFIES |
| MODIFY |
| MONITOR |
| MONTH |
| MUTEX |
| MYSQL |
| MYSQL_ERRNO |
| NAME |
| NAMES |
| NATIONAL |
| NATURAL |
| NCHAR |
| NESTED |
| NEVER |
| NEW |
| NEXT |
| NEXTVAL |
| NO |
| NOMAXVALUE |
| NOMINVALUE |
| NOCACHE |
| NOCYCLE |
| NO_WAIT |
| NOWAIT |
| NODEGROUP |
| NONE |
| NOT |
| NOTFOUND |
| NO_WRITE_TO_BINLOG |
| NULL |
| NUMBER |
| NUMERIC |
| NVARCHAR |
| OF |
| OFFSET |
| OLD_PASSWORD |
| ON |
| ONE |
| ONLINE |
| ONLY |
| OPEN |
| OPTIMIZE |
| OPTIONS |
| OPTION |
| OPTIONALLY |
| OR |
| ORDER |
| ORDINALITY |
| OTHERS |
| OUT |
| OUTER |
| OUTFILE |
| OVER |
| OVERLAPS |
| OWNER |
| PACKAGE |
| PACK_KEYS |
| PAGE |
| PAGE_CHECKSUM |
| PARSER |
| PARSE_VCOL_EXPR |
| PATH |
| PERIOD |
| PARTIAL |
| PARTITION |
| PARTITIONING |
| PARTITIONS |
| PASSWORD |
| PERSISTENT |
| PHASE |
| PLUGIN |
| PLUGINS |
| PORT |
| PORTION |
| PRECEDES |
344/3812
| PRECEDES |
| PRECEDING |
| PRECISION |
| PREPARE |
| PRESERVE |
| PREV |
| PREVIOUS |
| PRIMARY |
| PRIVILEGES |
| PROCEDURE |
| PROCESS |
| PROCESSLIST |
| PROFILE |
| PROFILES |
| PROXY |
| PURGE |
| QUARTER |
| QUERY |
| QUICK |
| RAISE |
| RANGE |
| RAW |
| READ |
| READ_ONLY |
| READ_WRITE |
| READS |
| REAL |
| REBUILD |
| RECOVER |
| RECURSIVE |
| REDO_BUFFER_SIZE |
| REDOFILE |
| REDUNDANT |
| REFERENCES |
| REGEXP |
| RELAY |
| RELAYLOG |
| RELAY_LOG_FILE |
| RELAY_LOG_POS |
| RELAY_THREAD |
| RELEASE |
| RELOAD |
| REMOVE |
| RENAME |
| REORGANIZE |
| REPAIR |
| REPEATABLE |
| REPLACE |
| REPLAY |
| REPLICA |
| REPLICAS |
| REPLICA_POS |
| REPLICATION |
| REPEAT |
| REQUIRE |
| RESET |
| RESIGNAL |
| RESTART |
| RESTORE |
| RESTRICT |
| RESUME |
| RETURNED_SQLSTATE |
| RETURN |
| RETURNING |
| RETURNS |
| REUSE |
| REVERSE |
| REVOKE |
| RIGHT |
| RLIKE |
| ROLE |
| ROLLBACK |
| ROLLUP |
| ROUTINE |
| ROW |
| ROWCOUNT |
| ROWNUM |
| ROWS |
| ROWTYPE |
| ROW_COUNT |
| ROW_FORMAT |
| RTREE |
| SAVEPOINT | 345/3812
| SAVEPOINT |
| SCHEDULE |
| SCHEMA |
| SCHEMA_NAME |
| SCHEMAS |
| SECOND |
| SECOND_MICROSECOND |
| SECURITY |
| SELECT |
| SENSITIVE |
| SEPARATOR |
| SEQUENCE |
| SERIAL |
| SERIALIZABLE |
| SESSION |
| SERVER |
| SET |
| SETVAL |
| SHARE |
| SHOW |
| SHUTDOWN |
| SIGNAL |
| SIGNED |
| SIMPLE |
| SKIP |
| SLAVE |
| SLAVES |
| SLAVE_POS |
| SLOW |
| SNAPSHOT |
| SMALLINT |
| SOCKET |
| SOFT |
| SOME |
| SONAME |
| SOUNDS |
| SOURCE |
| STAGE |
| STORED |
| SPATIAL |
| SPECIFIC |
| REF_SYSTEM_ID |
| SQL |
| SQLEXCEPTION |
| SQLSTATE |
| SQLWARNING |
| SQL_BIG_RESULT |
| SQL_BUFFER_RESULT |
| SQL_CACHE |
| SQL_CALC_FOUND_ROWS |
| SQL_NO_CACHE |
| SQL_SMALL_RESULT |
| SQL_THREAD |
| SQL_TSI_SECOND |
| SQL_TSI_MINUTE |
| SQL_TSI_HOUR |
| SQL_TSI_DAY |
| SQL_TSI_WEEK |
| SQL_TSI_MONTH |
| SQL_TSI_QUARTER |
| SQL_TSI_YEAR |
| SSL |
| START |
| STARTING |
| STARTS |
| STATEMENT |
| STATS_AUTO_RECALC |
| STATS_PERSISTENT |
| STATS_SAMPLE_PAGES |
| STATUS |
| STOP |
| STORAGE |
| STRAIGHT_JOIN |
| STRING |
| SUBCLASS_ORIGIN |
| SUBJECT |
| SUBPARTITION |
| SUBPARTITIONS |
| SUPER |
| SUSPEND |
| SWAPS |
| SWITCHES |
346/3812
| SWITCHES |
| SYSDATE |
| SYSTEM |
| SYSTEM_TIME |
| TABLE |
| TABLE_NAME |
| TABLES |
| TABLESPACE |
| TABLE_CHECKSUM |
| TEMPORARY |
| TEMPTABLE |
| TERMINATED |
| TEXT |
| THAN |
| THEN |
| TIES |
| TIME |
| TIMESTAMP |
| TIMESTAMPADD |
| TIMESTAMPDIFF |
| TINYBLOB |
| TINYINT |
| TINYTEXT |
| TO |
| TRAILING |
| TRANSACTION |
| TRANSACTIONAL |
| THREADS |
| TRIGGER |
| TRIGGERS |
| TRUE |
| TRUNCATE |
| TYPE |
| TYPES |
| UNBOUNDED |
| UNCOMMITTED |
| UNDEFINED |
| UNDO_BUFFER_SIZE |
| UNDOFILE |
| UNDO |
| UNICODE |
| UNION |
| UNIQUE |
| UNKNOWN |
| UNLOCK |
| UNINSTALL |
| UNSIGNED |
| UNTIL |
| UPDATE |
| UPGRADE |
| USAGE |
| USE |
| USER |
| USER_RESOURCES |
| USE_FRM |
| USING |
| UTC_DATE |
| UTC_TIME |
| UTC_TIMESTAMP |
| VALUE |
| VALUES |
| VARBINARY |
| VARCHAR |
| VARCHARACTER |
| VARCHAR2 |
| VARIABLES |
| VARYING |
| VIA |
| VIEW |
| VIRTUAL |
| VISIBLE |
| VERSIONING |
| WAIT |
| WARNINGS |
| WEEK |
| WEIGHT_STRING |
| WHEN |
| WHERE |
| WHILE |
| WINDOW |
| WITH |
| WITHIN |
| WITHOUT | 347/3812
| WITHOUT |
| WORK |
| WRAPPER |
| WRITE |
| X509 |
| XOR |
| XA |
| XML |
| YEAR |
| YEAR_MONTH |
| ZEROFILL |
| || |
+-------------------------------+
694 rows in set (0.000 sec)

See Also
Reserved Words

1.1.1.2.9.1.1.26 Information Schema LOCALES


Table
Description
The Information Schema LOCALES table contains a list of all compiled-in locales. It is only available if the LOCALES
plugin has been installed.
It contains the following columns:

Column Description
ID Row ID.
NAME Locale name, for example en_GB .
DESCRIPTION Locale description, for example English - United Kingdom .
MAX_MONTH_NAME_LENGTH Numeric length of the longest month in the locale
MAX_DAY_NAME_LENGTH Numeric length of the longest day name in the locale.
DECIMAL_POINT Decimal point character (some locales use a comma).
THOUSAND_SEP Thousand's character separator,
ERROR_MESSAGE_LANGUAGE Error message language.

The table is not a standard Information Schema table, and is a MariaDB extension.
The SHOW LOCALES statement returns a subset of the information.

Example

348/3812
SELECT * FROM information_schema.LOCALES;
+-----+-------+-------------------------------------+-----------------------+---------------------+----
-----------+--------------+------------------------+
| ID | NAME | DESCRIPTION | MAX_MONTH_NAME_LENGTH | MAX_DAY_NAME_LENGTH |
DECIMAL_POINT | THOUSAND_SEP | ERROR_MESSAGE_LANGUAGE |
+-----+-------+-------------------------------------+-----------------------+---------------------+----
-----------+--------------+------------------------+
| 0 | en_US | English - United States | 9 | 9 | .
| , | english |
| 1 | en_GB | English - United Kingdom | 9 | 9 | .
| , | english |
| 2 | ja_JP | Japanese - Japan | 3 | 3 | .
| , | japanese |
| 3 | sv_SE | Swedish - Sweden | 9 | 7 | ,
| | swedish |
| 4 | de_DE | German - Germany | 9 | 10 | ,
| . | german |
| 5 | fr_FR | French - France | 9 | 8 | ,
| | french |
| 6 | ar_AE | Arabic - United Arab Emirates | 6 | 8 | .
| , | english |
| 7 | ar_BH | Arabic - Bahrain | 6 | 8 | .
| , | english |
| 8 | ar_JO | Arabic - Jordan | 12 | 8 | .
| , | english |
...
| 106 | no_NO | Norwegian - Norway | 9 | 7 | ,
| . | norwegian |
| 107 | sv_FI | Swedish - Finland | 9 | 7 | ,
| | swedish |
| 108 | zh_HK | Chinese - Hong Kong SAR | 3 | 3 | .
| , | english |
| 109 | el_GR | Greek - Greece | 11 | 9 | ,
| . | greek |
+-----+-------+-------------------------------------+-----------------------+---------------------+----
-----------+--------------+------------------------+

1.1.1.2.9.1.1.27 Information Schema


METADATA_LOCK_INFO Table
The Information Schema METADATA_LOCK_INFO table is created by the metadata_lock_info plugin. It shows active
metadata locks and user locks (the locks acquired with GET_LOCK).
It has the following columns:

Column Description
THREAD_ID

One of MDL_INTENTION_EXCLUSIVE , MDL_SHARED , MDL_SHARED_HIGH_PRIO , MDL_SHARED_READ ,


LOCK_MODE MDL_SHARED_READ_ONLY , MDL_SHARED_WRITE , MDL_SHARED_NO_WRITE , MDL_SHARED_NO_READ_WRITE ,
MDL_SHARED_UPGRADABLE or MDL_EXCLUSIVE .

LOCK_DURATION One of MDL_STATEMENT , MDL_TRANSACTION or MDL_EXPLICIT


One of Global read lock , Schema metadata lock , Table metadata lock , Stored function
LOCK_TYPE metadata lock , Stored procedure metadata lock , Trigger metadata lock , Event metadata
lock , Commit lock or User lock .

TABLE_SCHEMA

TABLE_NAME

"LOCK_MODE" Descriptions
The LOCK_MODE column can have the following values:

Value Description
An intention exclusive metadata lock (IX). Used only for scoped locks. Owner of this
type of lock can acquire upgradable exclusive locks on individual objects. Compatible
MDL_INTENTION_EXCLUSIVE with other IX locks, but is incompatible with scoped S and X locks. IX lock is taken in
SCHEMA namespace when we intend to modify object metadata. Object may refer
table, stored procedure, trigger, view/etc.

349/3812
A shared metadata lock (S). To be used in cases when we are interested in object
metadata only and there is no intention to access object data (e.g. for stored routines or
during preparing prepared statements). We also mis-use this type of lock for open
HANDLERs, since lock acquired by this statement has to be compatible with lock
acquired by LOCK TABLES ... WRITE statement, i.e. SNRW (We can't get by by
acquiring S lock at HANDLER ... OPEN time and upgrading it to SR lock for HANDLER
... READ as it doesn't solve problem with need to abort DML statements which wait on
table level lock while having open HANDLER in the same connection). To avoid
MDL_SHARED
deadlock which may occur when SNRW lock is being upgraded to X lock for table on
which there is an active S lock which is owned by thread which waits in its turn for
table-level lock owned by thread performing upgrade we have to use
thr_abort_locks_for_thread() facility in such situation. This problem does not arise for
locks on stored routines as we don't use SNRW locks for them. It also does not arise
when S locks are used during PREPARE calls as table-level locks are not acquired in
this case. This lock is taken for global read lock, when caching a stored procedure in
memory for the duration of the transaction and for tables used by prepared statements.
A high priority shared metadata lock. Used for cases when there is no intention to
access object data (i.e. data in the table). "High priority" means that, unlike other
shared locks, it is granted ignoring pending requests for exclusive locks. Intended for
use in cases when we only need to access metadata and not data, e.g. when filling an
INFORMATION_SCHEMA table. Since SH lock is compatible with SNRW lock, the
MDL_SHARED_HIGH_PRIO
connection that holds SH lock lock should not try to acquire any kind of table-level or
row-level lock, as this can lead to a deadlock. Moreover, after acquiring SH lock, the
connection should not wait for any other resource, as it might cause starvation for X
locks and a potential deadlock during upgrade of SNW or SNRW to X lock (e.g. if the
upgrading connection holds the resource that is being waited for).
A shared metadata lock (SR) for cases when there is an intention to read data from
table. A connection holding this kind of lock can read table metadata and read table
data (after acquiring appropriate table and row-level locks). This means that one can
MDL_SHARED_READ
only acquire TL_READ, TL_READ_NO_INSERT, and similar table-level locks on table
if one holds SR MDL lock on it. To be used for tables in SELECTs, subqueries, and
LOCK TABLE ... READ statements.
A shared metadata lock (SW) for cases when there is an intention to modify (and not
just read) data in the table. A connection holding SW lock can read table metadata and
MDL_SHARED_WRITE modify or read table data (after acquiring appropriate table and row-level locks). To be
used for tables to be modified by INSERT, UPDATE, DELETE statements, but not
LOCK TABLE ... WRITE or DDL). Also taken by SELECT ... FOR UPDATE.
An upgradable shared metadata lock for cases when there is an intention to modify
(and not just read) data in the table. Can be upgraded to MDL_SHARED_NO_WRITE
MDL_SHARED_UPGRADABLE and MDL_EXCLUSIVE. A connection holding SU lock can read table metadata and
modify or read table data (after acquiring appropriate table and row-level locks). To be
used for the first phase of ALTER TABLE.
A shared metadata lock for cases when we need to read data from table and block all
MDL_SHARED_READ_ONLY concurrent modifications to it (for both data and metadata). Used by LOCK TABLES
READ statement.
An upgradable shared metadata lock which blocks all attempts to update table data,
allowing reads. A connection holding this kind of lock can read table metadata and read
table data. Can be upgraded to X metadata lock. Note, that since this type of lock is not
MDL_SHARED_NO_WRITE compatible with SNRW or SW lock types, acquiring appropriate engine-level locks for
reading (TL_READ* for MyISAM, shared row locks in InnoDB) should be contention-
free. To be used for the first phase of ALTER TABLE, when copying data between
tables, to allow concurrent SELECTs from the table, but not UPDATEs.
An upgradable shared metadata lock which allows other connections to access table
metadata, but not data. It blocks all attempts to read or update table data, while
allowing INFORMATION_SCHEMA and SHOW queries. A connection holding this kind
MDL_SHARED_NO_READ_WRITE
of lock can read table metadata modify and read table data. Can be upgraded to X
metadata lock. To be used for LOCK TABLES WRITE statement. Not compatible with
any other lock type except S and SH.
An exclusive metadata lock (X). A connection holding this lock can modify both table's
metadata and data. No other type of metadata lock can be granted while this lock is
MDL_EXCLUSIVE held. To be used for CREATE/DROP/RENAME TABLE statements and for execution of
certain phases of other DDL statements.

Examples
350/3812
User lock:

SELECT GET_LOCK('abc',1000);
+----------------------+
| GET_LOCK('abc',1000) |
+----------------------+
| 1 |
+----------------------+

SELECT * FROM information_schema.METADATA_LOCK_INFO;


+-----------+--------------------------+---------------+-----------+--------------+------------+
| THREAD_ID | LOCK_MODE | LOCK_DURATION | LOCK_TYPE | TABLE_SCHEMA | TABLE_NAME |
+-----------+--------------------------+---------------+-----------+--------------+------------+
| 61 | MDL_SHARED_NO_READ_WRITE | MDL_EXPLICIT | User lock | abc | |
+-----------+--------------------------+---------------+-----------+--------------+------------+

Table metadata lock:

START TRANSACTION;

INSERT INTO t VALUES (1,2);

SELECT * FROM information_schema.METADATA_LOCK_INFO \G


*************************** 1. row ***************************
THREAD_ID: 4
LOCK_MODE: MDL_SHARED_WRITE
LOCK_DURATION: MDL_TRANSACTION
LOCK_TYPE: Table metadata lock
TABLE_SCHEMA: test
TABLE_NAME: t

SELECT * FROM information_schema.METADATA_LOCK_INFO;


+-----------+--------------------------+---------------+----------------------+-----------------+------
-------+
| THREAD_ID | LOCK_MODE | LOCK_DURATION | LOCK_TYPE | TABLE_SCHEMA | TABLE_NAME |
+-----------+--------------------------+---------------+----------------------+-----------------+------
-------+
| 31 | MDL_INTENTION_EXCLUSIVE | MDL_EXPLICIT | Global read lock | | |
| 31 | MDL_INTENTION_EXCLUSIVE | MDL_EXPLICIT | Commit lock | | |
| 31 | MDL_INTENTION_EXCLUSIVE | MDL_EXPLICIT | Schema metadata lock | dbname | |
| 31 | MDL_SHARED_NO_READ_WRITE | MDL_EXPLICIT | Table metadata lock | dbname | exotics |
+-----------+--------------------------+---------------+----------------------+-----------------+------
-------+

See Also
metadata locks
Performance Schema metadata_locks table
GET_LOCK).

1.1.1.2.9.1.1.28 Information Schema


MROONGA_STATS Table
The Information Schema MROONGA_STATS table only exists if the Mroonga storage engine is installed, and contains
information about its activities.

Column Description
VERSION Mroonga version.
rows_written Number of rows written into Mroonga tables.
rows_read Number of rows read from all Mroonga tables.

This table always contains 1 row.

1.1.1.2.9.1.1.29 Information Schema


OPTIMIZER_TRACE Table
MariaDB starting with 10.4.3
351/3812
Optimizer Trace was introduced in MariaDB 10.4.3.

Description
The Information Schema OPTIMIZER_TRACE table contains Optimizer Trace information.
It contains the following columns:

Column Description
QUERY Displays the query that was asked to be traced.
TRACE A JSON document displaying the stats we collected when the query was run.
For huge trace, where the trace is truncated due to the
MISSING_BYTES_BEYOND_MAX_MEM_SIZE optimizer_trace_max_mem_size limit being reached, displays the bytes that
are missing in the trace
Set to 1 if the user running the trace does not have the privileges to see the
INSUFFICENT_PRIVILEGES
trace.

Structure:

SHOW CREATE TABLE INFORMATION_SCHEMA.OPTIMIZER_TRACE \G


*************************** 1. row ***************************
Table: OPTIMIZER_TRACE
Create Table: CREATE TEMPORARY TABLE `OPTIMIZER_TRACE` (
`QUERY` longtext NOT NULL DEFAULT '',
`TRACE` longtext NOT NULL DEFAULT '',
`MISSING_BYTES_BEYOND_MAX_MEM_SIZE` int(20) NOT NULL DEFAULT 0,
`INSUFFICIENT_PRIVILEGES` tinyint(1) NOT NULL DEFAULT 0
) ENGINE=Aria DEFAULT CHARSET=utf8 PAGE_CHECKSUM=0

1.1.1.2.9.1.1.30 Information Schema


PARAMETERS Table
The Information Schema PARAMETERS table stores information about stored procedures and stored functions
parameters.
It contains the following columns:

Column Description
SPECIFIC_CATALOG Always def .
SPECIFIC_SCHEMA Database name containing the stored routine parameter.
SPECIFIC_NAME Stored routine name.
ORDINAL_POSITION Ordinal position of the parameter, starting at 1 . 0 for a function RETURNS clause.
PARAMETER_MODE One of IN , OUT , INOUT or NULL for RETURNS.
PARAMETER_NAME Name of the parameter, or NULL for RETURNS.
DATA_TYPE The column's data type.
CHARACTER_MAXIMUM_LENGTH Maximum length.
CHARACTER_OCTET_LENGTH Same as the CHARACTER_MAXIMUM_LENGTH except for multi-byte character sets.
For numeric types, the precision (number of significant digits) for the column. NULL if
NUMERIC_PRECISION
not a numeric field.
For numeric types, the scale (significant digits to the right of the decimal point). NULL if
NUMERIC_SCALE not a numeric field.

DATETIME_PRECISION Fractional-seconds precision, or NULL if not a time data type.


CHARACTER_SET_NAME Character set if a non-binary string data type, otherwise NULL .
COLLATION_NAME Collation if a non-binary string data type, otherwise NULL .
DTD_IDENTIFIER Description of the data type.
ROUTINE_TYPE PROCEDURE or FUNCTION .

Information from this table is similar to that found in the param_list column in the mysql.proc table, and the output of
352/3812
the SHOW CREATE PROCEDURE and SHOW CREATE FUNCTION statements.
To obtain information about the routine itself, you can query the Information Schema ROUTINES table.

Example
SELECT * FROM information_schema.PARAMETERS
LIMIT 1 \G
********************** 1. row **********************
SPECIFIC_CATALOG: def
SPECIFIC_SCHEMA: accounts
SPECIFIC_NAME: user_counts
ORDINAL_POSITION: 1
PARAMETER_MODE: IN
PARAMETER_NAME: user_order
DATA_TYPE: varchar
CHARACTER_MAXIMUM_LENGTH: 255
CHARACTER_OCTET_LENGTH: 765
NUMERIC_PRECISION: NULL
NUMERIC_SCALE: NULL
DATETIME_PRECISION: NULL
CHARACTER_SET_NAME: utf8
COLLATION_NAME: utf8_general_ci
DTD_IDENTIFIER: varchar(255)
ROUTINE_TYPE: PROCEDURE

1.1.1.2.9.1.1.31 Information Schema


PARTITIONS Table
The Information Schema PARTITIONS contains information about table partitions, with each record corresponding to a
single partition or subpartition of a partitioned table. Each non-partitioned table also has a record in the PARTITIONS
table, but most of the values are NULL .
It contains the following columns:

Column Description
TABLE_CATALOG Always def .
TABLE_SCHEMA Database name.
TABLE_NAME Table name containing the partition.
PARTITION_NAME Partition name.
SUBPARTITION_NAME Subpartition name, or NULL if not a subpartition.
PARTITION_ORDINAL_POSITION Order of the partition starting from 1.
SUBPARTITION_ORDINAL_POSITION Order of the subpartition starting from 1.
The partitioning type; one of RANGE , LIST , HASH , LINEAR HASH , KEY or LINEAR
PARTITION_METHOD
KEY .

Subpartition type; one of HASH , LINEAR HASH , KEY or LINEAR KEY , or NULL if
SUBPARTITION_METHOD
not a subpartition.
Expression used to create the partition by the CREATE TABLE or ALTER TABLE
PARTITION_EXPRESSION
statement.
Expression used to create the subpartition by the CREATE TABLE or ALTER TABLE
SUBPARTITION_EXPRESSION
statement, or NULL if not a subpartition.
For a RANGE partition, contains either MAXINTEGER or an integer, as set in the
PARTITION_DESCRIPTION VALUES LESS THAN clause. For a LIST partition, contains a comma-separated list
of integers, as set in the VALUES IN . NULL if another type of partition.
TABLE_ROWS Number of rows in the table (may be an estimate for some storage engines).
AVG_ROW_LENGTH Average row length, that is DATA_LENGTH divided by TABLE_ROWS
DATA_LENGTH Total number of bytes stored in all rows of the partition.
MAX_DATA_LENGTH Maximum bytes that could be stored in the partition.
INDEX_LENGTH Size in bytes of the partition index file.
DATA_FREE Unused bytes allocated to the partition.
353/3812
CREATE_TIME Time the partition was created
UPDATE_TIME Time the partition was last modified.
Time the partition was last checked, or NULL for storage engines that don't
CHECK_TIME
record this information.
CHECKSUM Checksum value, or NULL if none.
PARTITION_COMMENT Partition comment, truncated to 80 characters, or an empty string if no comment.
NODEGROUP Node group, only used for MySQL Cluster, defaults to 0 .
TABLESPACE_NAME Always default .

1.1.1.2.9.1.1.32 Information Schema PLUGINS


Table
The Information Schema PLUGINS table contains information about server plugins.
It contains the following columns:

Column Description
PLUGIN_NAME Name of the plugin.
PLUGIN_VERSION Version from the plugin's general type descriptor.
PLUGIN_STATUS Plugin status, one of ACTIVE , INACTIVE , DISABLED or DELETED .
Plugin type; STORAGE ENGINE , INFORMATION_SCHEMA , AUTHENTICATION , REPLICATION ,
PLUGIN_TYPE
DAEMON or AUDIT .

PLUGIN_TYPE_VERSION Version from the plugin's type-specific descriptor.


Plugin's shared object file name, located in the directory specified by the plugin_dir
PLUGIN_LIBRARY system variable, and used by the INSTALL PLUGIN and UNINSTALL PLUGIN
statements. NULL if the plugin is complied in and cannot be uninstalled.
PLUGIN_LIBRARY_VERSION Version from the plugin's API interface.
PLUGIN_AUTHOR Author of the plugin.
PLUGIN_DESCRIPTION Description.
PLUGIN_LICENSE Plugin's licence.
How the plugin was loaded; one of OFF , ON , FORCE or FORCE_PLUS_PERMANENT . See
LOAD_OPTION
Installing Plugins.
Plugin's maturity level; one of Unknown , Experimental , Alpha , Beta , 'Gamma , and
PLUGIN_MATURITY
Stable .

PLUGIN_AUTH_VERSION Plugin's version as determined by the plugin author. An example would be '0.99 beta 1'.

It provides a superset of the information shown by the SHOW PLUGINS statement. For specific information about
storage engines (a particular type of plugins), see the information_schema.ENGINES table and the SHOW ENGINES
statement.
This table provides a subset of the Information Schema information_schema.ALL_PLUGINS table, which contains all
available plugins, installed or not.
The table is not a standard Information Schema table, and is a MariaDB extension.

Examples
The easiest way to get basic information on plugins is with SHOW PLUGINS:

354/3812
SHOW PLUGINS;

+----------------------------+----------+--------------------+-------------+---------+
| Name | Status | Type | Library | License |
+----------------------------+----------+--------------------+-------------+---------+
| binlog | ACTIVE | STORAGE ENGINE | NULL | GPL |
| mysql_native_password | ACTIVE | AUTHENTICATION | NULL | GPL |
| mysql_old_password | ACTIVE | AUTHENTICATION | NULL | GPL |
| MRG_MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| CSV | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MEMORY | ACTIVE | STORAGE ENGINE | NULL | GPL |
| FEDERATED | ACTIVE | STORAGE ENGINE | NULL | GPL |
| PERFORMANCE_SCHEMA | ACTIVE | STORAGE ENGINE | NULL | GPL |
| Aria | ACTIVE | STORAGE ENGINE | NULL | GPL |
| InnoDB | ACTIVE | STORAGE ENGINE | NULL | GPL |
| INNODB_TRX | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_LOCKS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_LOCK_WAITS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMP | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMP_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMPMEM | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMPMEM_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_BUFFER_PAGE | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_BUFFER_PAGE_LRU | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_BUFFER_POOL_STATS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_METRICS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_DEFAULT_STOPWORD | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_INSERTED | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_DELETED | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_BEING_DELETED | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_CONFIG | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_INDEX_CACHE | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_INDEX_TABLE | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_TABLES | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_TABLESTATS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_INDEXES | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_COLUMNS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_FIELDS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_FOREIGN | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_FOREIGN_COLS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| SPHINX | ACTIVE | STORAGE ENGINE | NULL | GPL |
| ARCHIVE | ACTIVE | STORAGE ENGINE | NULL | GPL |
| BLACKHOLE | ACTIVE | STORAGE ENGINE | NULL | GPL |
| FEEDBACK | DISABLED | INFORMATION SCHEMA | NULL | GPL |
| partition | ACTIVE | STORAGE ENGINE | NULL | GPL |
| pam | ACTIVE | AUTHENTICATION | auth_pam.so | GPL |
+----------------------------+----------+--------------------+-------------+---------+

SELECT LOAD_OPTION
FROM INFORMATION_SCHEMA.PLUGINS
WHERE PLUGIN_NAME LIKE 'tokudb';
Empty set

The equivalent SELECT query would be:

SELECT PLUGIN_NAME, PLUGIN_STATUS,


PLUGIN_TYPE, PLUGIN_LIBRARY, PLUGIN_LICENSE
FROM INFORMATION_SCHEMA.PLUGINS;

Other SELECT queries can be used to see additional information. For example:

355/3812
SELECT PLUGIN_NAME, PLUGIN_DESCRIPTION,
PLUGIN_MATURITY, PLUGIN_AUTH_VERSION
FROM INFORMATION_SCHEMA.PLUGINS
WHERE PLUGIN_TYPE='STORAGE ENGINE'
ORDER BY PLUGIN_MATURITY \G

*************************** 1. row ***************************


PLUGIN_NAME: FEDERATED
PLUGIN_DESCRIPTION: FederatedX pluggable storage engine
PLUGIN_MATURITY: Beta
PLUGIN_AUTH_VERSION: 2.1
*************************** 2. row ***************************
PLUGIN_NAME: Aria
PLUGIN_DESCRIPTION: Crash-safe tables with MyISAM heritage
PLUGIN_MATURITY: Gamma
PLUGIN_AUTH_VERSION: 1.5
*************************** 3. row ***************************
PLUGIN_NAME: PERFORMANCE_SCHEMA
PLUGIN_DESCRIPTION: Performance Schema
PLUGIN_MATURITY: Gamma
PLUGIN_AUTH_VERSION: 0.1
*************************** 4. row ***************************
PLUGIN_NAME: binlog
PLUGIN_DESCRIPTION: This is a pseudo storage engine to represent the binlog in a transaction
PLUGIN_MATURITY: Stable
PLUGIN_AUTH_VERSION: 1.0
*************************** 5. row ***************************
PLUGIN_NAME: MEMORY
PLUGIN_DESCRIPTION: Hash based, stored in memory, useful for temporary tables
PLUGIN_MATURITY: Stable
PLUGIN_AUTH_VERSION: 1.0
*************************** 6. row ***************************
PLUGIN_NAME: MyISAM
PLUGIN_DESCRIPTION: MyISAM storage engine
PLUGIN_MATURITY: Stable
PLUGIN_AUTH_VERSION: 1.0
*************************** 7. row ***************************
PLUGIN_NAME: MRG_MyISAM
PLUGIN_DESCRIPTION: Collection of identical MyISAM tables
PLUGIN_MATURITY: Stable
PLUGIN_AUTH_VERSION: 1.0
*************************** 8. row ***************************
PLUGIN_NAME: CSV
PLUGIN_DESCRIPTION: CSV storage engine
PLUGIN_MATURITY: Stable
PLUGIN_AUTH_VERSION: 1.0
*************************** 9. row ***************************
PLUGIN_NAME: InnoDB
PLUGIN_DESCRIPTION: Supports transactions, row-level locking, and foreign keys
PLUGIN_MATURITY: Stable
PLUGIN_AUTH_VERSION: 1.2.5
*************************** 10. row ***************************
PLUGIN_NAME: BLACKHOLE
PLUGIN_DESCRIPTION: /dev/null storage engine (anything you write to it disappears)
PLUGIN_MATURITY: Stable
PLUGIN_AUTH_VERSION: 1.0
*************************** 11. row ***************************
PLUGIN_NAME: ARCHIVE
PLUGIN_DESCRIPTION: Archive storage engine
PLUGIN_MATURITY: Stable
PLUGIN_AUTH_VERSION: 1.0
*************************** 12. row ***************************
PLUGIN_NAME: partition
PLUGIN_DESCRIPTION: Partition Storage Engine Helper
PLUGIN_MATURITY: Stable
PLUGIN_AUTH_VERSION: 1.0

Check if a given plugin is available:

SELECT LOAD_OPTION
FROM INFORMATION_SCHEMA.PLUGINS
WHERE PLUGIN_NAME LIKE 'tokudb';
Empty set

Show authentication plugins:

356/3812
SELECT PLUGIN_NAME, LOAD_OPTION
FROM INFORMATION_SCHEMA.PLUGINS
WHERE PLUGIN_TYPE LIKE 'authentication' \G

*************************** 1. row ***************************


PLUGIN_NAME: mysql_native_password
LOAD_OPTION: FORCE
*************************** 2. row ***************************
PLUGIN_NAME: mysql_old_password
LOAD_OPTION: FORCE

See Also
List of Plugins
Plugin Overview
SHOW PLUGINS
INSTALL PLUGIN
INSTALL SONAME
UNINSTALL PLUGIN
UNINSTALL SONAME

1.1.1.2.9.1.1.33 Information Schema


PROCESSLIST Table
Contents
1. Example
2. See Also

The Information Schema PROCESSLIST table contains information about running threads.
Similar information can also be returned with the SHOW [FULL] PROCESSLIST statement, or the mysqladmin
processlist command.
It contains the following columns:

Column Description
ID Connection identifier.
USER MariaDB User.
The hostname from which this thread is connected.

HOST For Unix socket connections, localhost . For TCP/IP connections, the TCP port is appended (e.g.
192.168.1.17:58061 or other-host.company.com:58061 ). For system user , this column is blank
( '' ).
DB Default database, or NULL if none.
Type of command running, corresponding to the Com_ status variables. See Thread Command
COMMAND
Values.
TIME Seconds that the thread has spent on the current COMMAND so far.
STATE Current state of the thread. See Thread States.
INFO Statement the thread is executing, or NULL if none.
Time in milliseconds with microsecond precision that the thread has spent on the current COMMAND
TIME_MS
so far (see more).
STAGE The stage the process is currently in.
MAX_STAGE The maximum number of stages.
PROGRESS The progress of the process within the current stage (0-100%).
MEMORY_USED Memory in bytes used by the thread.
Rows examined by the thread. Only updated by UPDATE, DELETE, and similar statements. For
EXAMINED_ROWS
SELECT and other statements, the value remains zero.
QUERY_ID Query ID.
INFO_BINARY Binary data information

357/3812
TID Thread ID (MDEV-6756 )

Note that as a difference to MySQL, in MariaDB the TIME column (and also the TIME_MS column) are not affected by
any setting of @TIMESTAMP . This means that it can be reliably used also for threads that change @TIMESTAMP (such as
the replication SQL thread). See also MySQL Bug #22047 .
As a consequence of this, the TIME column of SHOW FULL PROCESSLIST and INFORMATION_SCHEMA.PROCESSLIST can
not be used to determine if a slave is lagging behind. For this, use instead the Seconds_Behind_Master column in the
output of SHOW SLAVE STATUS.
Note that the PROGRESS field from the information schema, and the PROGRESS field from SHOW PROCESSLIST display
different results. SHOW PROCESSLIST shows the total progress, while the information schema shows the progress for the
current stage only.. To retrieve a similar "total" Progress value from information_schema.PROCESSLIST as the one from
SHOW PROCESSLIST , use

SELECT CASE WHEN Max_Stage < 2 THEN Progress ELSE (Stage-1)/Max_Stage*100+Progress/Max_Stage END
AS Progress FROM INFORMATION_SCHEMA.PROCESSLIST;

Example
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST\G
*************************** 1. row ***************************
ID: 9
USER: msandbox
HOST: localhost
DB: NULL
COMMAND: Query
TIME: 0
STATE: Filling schema table
INFO: SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
TIME_MS: 0.351
STAGE: 0
MAX_STAGE: 0
PROGRESS: 0.000
MEMORY_USED: 85392
EXAMINED_ROWS: 0
QUERY_ID: 15
INFO_BINARY: SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
TID: 11838
*************************** 2. row ***************************
ID: 5
USER: system user
HOST:
DB: NULL
COMMAND: Daemon
TIME: 0
STATE: InnoDB shutdown handler
INFO: NULL
TIME_MS: 0.000
STAGE: 0
MAX_STAGE: 0
PROGRESS: 0.000
MEMORY_USED: 24160
EXAMINED_ROWS: 0
QUERY_ID: 0
INFO_BINARY: NULL
TID: 3856
...

See Also
TIME_MS column in Information Schema SHOW PROCESSLIST

1.1.1.2.9.1.1.34 Information Schema


PROFILING Table
The Information Schema PROFILING table contains information about statement resource usage. Profiling information is
only recorded if the profiling session variable is set to 1.
It contains the following columns:

Column Name Description

358/3812
QUERY_ID Query_ID.

SEQ Sequence number showing the display order for rows with the same QUERY_ID .
STATE Profiling state.
DURATION Time in seconds that the statement has been in the current state.
CPU_USER User CPU usage in seconds.
CPU_SYSTEM System CPU usage in seconds.
CONTEXT_VOLUNTARY Number of voluntary context switches.
CONTEXT_INVOLUNTARY Number of involuntary context switches.
BLOCK_OPS_IN Number of block input operations.
BLOCK_OPS_OUT Number of block output operations.
MESSAGES_SENT Number of communications sent.
MESSAGES_RECEIVED Number of communications received.
PAGE_FAULTS_MAJOR Number of major page faults.
PAGE_FAULTS_MINOR Number of minor page faults.
SWAPS Number of swaps.
SOURCE_FUNCTION Function in the source code executed by the profiled state.
SOURCE_FILE File in the source code executed by the profiled state.
SOURCE_LINE Line in the source code executed by the profiled state.

It contains similar information to the SHOW PROFILE and SHOW PROFILES statements.
Profiling is enabled per session. When a session ends, its profiling information is lost.

1.1.1.2.9.1.1.35 Information Schema


QUERY_CACHE_INFO Table
Description
The table is not a standard Information Schema table, and is a MariaDB extension.
The QUERY_CACHE_INFO table is created by the QUERY_CACHE_INFO plugin, and allows you to see the contents of
the query cache. It creates a table in the information_schema database that shows all queries that are in the cache. You
must have the PROCESS privilege (see GRANT) to use this table.
It contains the following columns:

Column Description
STATEMENT_SCHEMA Database used when query was included
STATEMENT_TEXT Query text
RESULT_BLOCKS_COUNT Number of result blocks
RESULT_BLOCKS_SIZE Size in bytes of result blocks
RESULT_BLOCKS_SIZE_USED Size in bytes of used blocks
LIMIT Added MariaDB 10.1.8 .
MAX_SORT_LENGTH Added MariaDB 10.1.8 .
GROUP_CONCAT_MAX_LENGTH Added MariaDB 10.1.8 .
CHARACTER_SET_CLIENT Added MariaDB 10.1.8 .
CHARACTER_SET_RESULT Added MariaDB 10.1.8 .
COLLATION Added MariaDB 10.1.8 .
TIMEZONE Added MariaDB 10.1.8 .
DEFAULT_WEEK_FORMAT Added MariaDB 10.1.8 .

359/3812
DIV_PRECISION_INCREMENT Added MariaDB 10.1.8 .
SQL_MODE Added MariaDB 10.1.8 .
LC_TIME_NAMES Added MariaDB 10.1.8 .
CLIENT_LONG_FLAG Added MariaDB 10.1.8 .
CLIENT_PROTOCOL_41 Added MariaDB 10.1.8 .
PROTOCOL_TYPE Added MariaDB 10.1.8 .
MORE_RESULTS_EXISTS Added MariaDB 10.1.8 .
IN_TRANS Added MariaDB 10.1.8 .
AUTOCOMMIT Added MariaDB 10.1.8 .
PACKET_NUMBER Added MariaDB 10.1.8 .
HITS Incremented each time the query cache is hit. Added MariaDB 10.3.2.

For example:

SELECT * FROM information_schema.QUERY_CACHE_INFO;


+------------------+-----------------+---------------------+--------------------+----------------------
---+
| STATEMENT_SCHEMA | STATEMENT_TEXT | RESULT_BLOCKS_COUNT | RESULT_BLOCKS_SIZE |
RESULT_BLOCKS_SIZE_USED |
+------------------+-----------------+---------------------+--------------------+----------------------
---+
...
| test | SELECT * FROM a | 1 | 512 |
143 |
| test | select * FROM a | 1 | 512 |
143 |
...
+------------------+-----------------+---------------------+--------------------+----------------------
---

1.1.1.2.9.1.1.36 Information Schema


QUERY_RESPONSE_TIME Table
Description
The Information Schema QUERY_RESPONSE_TIME table contains information about queries that take a long time to
execute . It is only available if the QUERY_RESPONSE_TIME plugin has been installed.
It contains the following columns:

Column Description
TIME Time interval
COUNT Count of queries falling into the time interval
TOTAL Total execution time of all queries for this interval

See QUERY_RESPONSE_TIME plugin for a full description.


The table is not a standard Information Schema table, and is a MariaDB extension.
SHOW QUERY_RESPONSE_TIME is available from MariaDB 10.1.1 as an alternative for retrieving the data.

Example

360/3812
SELECT * FROM information_schema.QUERY_RESPONSE_TIME;
+----------------+-------+----------------+
| TIME | COUNT | TOTAL |
+----------------+-------+----------------+
| 0.000001 | 0 | 0.000000 |
| 0.000010 | 17 | 0.000094 |
| 0.000100 | 4301 0.236555 |
| 0.001000 | 1499 | 0.824450 |
| 0.010000 | 14851 | 81.680502 |
| 0.100000 | 8066 | 443.635693 |
| 1.000000 | 0 | 0.000000 |
| 10.000000 | 0 | 0.000000 |
| 100.000000 | 1 | 55.937094 |
| 1000.000000 | 0 | 0.000000 |
| 10000.000000 | 0 | 0.000000 |
| 100000.000000 | 0 | 0.000000 |
| 1000000.000000 | 0 | 0.000000 |
| TOO LONG | 0 | TOO LONG |
+----------------+-------+----------------+

1.1.1.2.9.1.1.37 Information Schema


REFERENTIAL_CONSTRAINTS Table
The Information Schema REFERENTIAL_CONSTRAINTS table contains information about foreign keys. The single columns
are listed in the KEY_COLUMN_USAGE table.
It has the following columns:

Column Description
CONSTRAINT_CATALOG Always def .
CONSTRAINT_SCHEMA Database name, together with CONSTRAINT_NAME identifies the foreign key.
CONSTRAINT_NAME Foreign key name, together with CONSTRAINT_SCHEMA identifies the foreign key.
UNIQUE_CONSTRAINT_CATALOG Always def .
Database name, together with UNIQUE_CONSTRAINT_NAME and
UNIQUE_CONSTRAINT_SCHEMA
REFERENCED_TABLE_NAME identifies the referenced key.

Referenced key name, together with UNIQUE_CONSTRAINT_SCHEMA and


UNIQUE_CONSTRAINT_NAME
REFERENCED_TABLE_NAME identifies the referenced key.

MATCH_OPTION Always NONE .


UPDATE_RULE The Update Rule; one of CASCADE , SET NULL , SET DEFAULT , RESTRICT , NO ACTION .
DELETE_RULE The Delete Rule; one of CASCADE , SET NULL , SET DEFAULT , RESTRICT , NO ACTION .
TABLE_NAME Table name from the TABLE_CONSTRAINTS table.
Referenced key table name, together with UNIQUE_CONSTRAINT_SCHEMA and
REFERENCED_TABLE_NAME
UNIQUE_CONSTRAINT_NAME identifies the referenced key.

1.1.1.2.9.1.1.38 Information Schema


ROUTINES Table
The Information Schema ROUTINES table stores information about stored procedures and stored functions.
It contains the following columns:

Column Description
SPECIFIC_NAME

ROUTINE_CATALOG Always def .


ROUTINE_SCHEMA Database name associated with the routine.
ROUTINE_NAME Name of the routine.
ROUTINE_TYPE Whether the routine is a PROCEDURE or a FUNCTION .
DATA_TYPE The return value's data type (for stored functions).

361/3812
CHARACTER_MAXIMUM_LENGTH Maximum length.
CHARACTER_OCTET_LENGTH Same as the CHARACTER_MAXIMUM_LENGTH except for multi-byte character sets.
For numeric types, the precision (number of significant digits) for the column. NULL if
NUMERIC_PRECISION
not a numeric field.
For numeric types, the scale (significant digits to the right of the decimal point). NULL if
NUMERIC_SCALE
not a numeric field.
DATETIME_PRECISION Fractional-seconds precision, or NULL if not a time data type.
CHARACTER_SET_NAME Character set if a non-binary string data type, otherwise NULL .
COLLATION_NAME Collation if a non-binary string data type, otherwise NULL.
DATA_TYPE The column's data type.
ROUTINE_BODY Always SQL .
ROUTINE_DEFINITION Definition of the routine.
EXTERNAL_NAME Always NULL .
EXTERNAL_LANGUAGE Always SQL .
PARAMETER_STYLE Always SQL .
Whether the routine is deterministic (can produce only one result for a given list of
IS_DETERMINISTIC
parameters) or not.
SQL_DATA_ACCESS One of READS SQL DATA , MODIFIES SQL DATA , CONTAINS SQL , or NO SQL .
SQL_PATH Always NULL .
SECURITY_TYPE INVOKER or DEFINER . Indicates which user's privileges apply to this routine.

CREATED Date and time the routine was created.


LAST_ALTERED Date and time the routine was last changed.
SQL_MODE The SQL_MODE at the time the routine was created.
ROUTINE_COMMENT Comment associated with the routine.
DEFINER If the SECURITY_TYPE is DEFINER , this value indicates which user defined this routine.
CHARACTER_SET_CLIENT The character set used by the client that created the routine.
COLLATION_CONNECTION The collation (and character set) used by the connection that created the routine.
The default collation (and character set) for the database, at the time the routine was
DATABASE_COLLATION
created.

It provides information similar to, but more complete, than the SHOW PROCEDURE STATUS and SHOW FUNCTION STATUS
statements.
For information about the parameters accepted by the routine, you can query the information_schema.PARAMETERS
table.

See also
Stored Function Overview
Stored Procedure Overview

1.1.1.2.9.1.1.39 Information Schema


SCHEMA_PRIVILEGES Table
The Information Schema SCHEMA_PRIVILEGES table contains information about database privileges.
It contains the following columns:

Column Description
GRANTEE Account granted the privilege in the format user_name@host_name .
TABLE_CATALOG Always def
TABLE_SCHEMA Database name.

362/3812
PRIVILEGE_TYPE The granted privilege.

IS_GRANTABLE Whether the privilege can be granted.

The same information in a different format can be found in the mysql.db table.

1.1.1.2.9.1.1.40 Information Schema


SCHEMATA Table
The Information Schema SCHEMATA table stores information about databases on the server.
It contains the following columns:

Column Description
CATALOG_NAME Always def .
SCHEMA_NAME Database name.
DEFAULT_CHARACTER_SET_NAME Default character set for the database.
DEFAULT_COLLATION_NAME Default collation.
SQL_PATH Always NULL .
SCHEMA_COMMENT Database comment. From MariaDB 10.5.0.

Example
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA\G
*************************** 1. row ***************************
CATALOG_NAME: def
SCHEMA_NAME: information_schema
DEFAULT_CHARACTER_SET_NAME: utf8
DEFAULT_COLLATION_NAME: utf8_general_ci
SQL_PATH: NULL
*************************** 2. row ***************************
CATALOG_NAME: def
SCHEMA_NAME: mysql
DEFAULT_CHARACTER_SET_NAME: latin1
DEFAULT_COLLATION_NAME: latin1_swedish_ci
SQL_PATH: NULL
*************************** 3. row ***************************
CATALOG_NAME: def
SCHEMA_NAME: performance_schema
DEFAULT_CHARACTER_SET_NAME: utf8
DEFAULT_COLLATION_NAME: utf8_general_ci
SQL_PATH: NULL
*************************** 4. row ***************************
CATALOG_NAME: def
SCHEMA_NAME: test
DEFAULT_CHARACTER_SET_NAME: latin1
DEFAULT_COLLATION_NAME: latin1_swedish_ci
SQL_PATH: NULL
...

From MariaDB 10.5.0:

SELECT * FROM INFORMATION_SCHEMA.SCHEMATA\G


...
*************************** 2. row ***************************
CATALOG_NAME: def
SCHEMA_NAME: presentations
DEFAULT_CHARACTER_SET_NAME: latin1
DEFAULT_COLLATION_NAME: latin1_swedish_ci
SQL_PATH: NULL
SCHEMA_COMMENT: Presentations for conferences
...

See Also
CREATE DATABASE
ALTER DATABASE
DROP DATABASE
363/3812
SHOW CREATE DATABASE
SHOW DATABASES
Character Sets and Collations

1.1.1.2.9.1.1.41 Information Schema


SPATIAL_REF_SYS Table
MariaDB starting with 10.1.2
The SPATIAL_REF_SYS table was introduced in MariaDB 10.1.2

Description
The Information Schema SPATIAL_REF_SYS table stores information on each spatial reference system used in the
database.
It contains the following columns:

Column Type Null Description


An integer value that uniquely identifies each Spatial Reference System within a
SRID smallint(5) NO
database.
The name of the standard or standards body that is being cited for this reference
AUTH_NAME varchar(512) NO
system.
AUTH_SRID smallint(5) NO The numeric ID of the coordinate system in the above authority's catalog.
SRTEXT varchar(2048) NO The Well-known Text Representation of the Spatial Reference System.

Note: See MDEV-7540 .

See also
information_schema.GEOMETRY_COLUMNS table.

1.1.1.2.9.1.1.42 Information Schema


SPIDER_ALLOC_MEM Table
The Information Schema SPIDER_ALLOC_MEM table is installed along with the Spider storage engine. It shows information
about Spider's memory usage.
It contains the following columns:

Column Description
ID

FUNC_NAME

FILE_NAME

LINE_NO

TOTAL_ALLOC_MEM

CURRENT_ALLOC_MEM

ALLOC_MEM_COUNT

FREE_MEM_COUNT

1.1.1.2.9.1.1.43 Information Schema


SPIDER_WRAPPER_PROTOCOLS Table
MariaDB starting with 10.5.4
The Information Schema SPIDER_WRAPPER_PROTOCOLS table is installed along with the Spider storage engine from
MariaDB 10.5.4.
364/3812
It contains the following columns:

Column Type Description


WRAPPER_NAME varchar(64)
WRAPPER_VERSION varchar(20)
WRAPPER_DESCRIPTION longtext
WRAPPER_MATURITY varchar(12)

1.1.1.2.9.1.1.44 Information Schema


SQL_FUNCTIONS Table
MariaDB starting with 10.6.3
The SQL_FUNCTIONS table was added in MariaDB 10.6.3.

Description
The Information Schema SQL_FUNCTIONS table contains the list of MariaDB functions.
It contains a single column:

Column Description
FUNCTION Function name

The table is not a standard Information Schema table, and is a MariaDB extension.

Example
SELECT * FROM INFORMATION_SCHEMA.SQL_FUNCTIONS;
+---------------------------+
| FUNCTION |
+---------------------------+
| ADDDATE |
| ADD_MONTHS |
| BIT_AND |
| BIT_OR |
| BIT_XOR |
| CAST |
| COUNT |
| CUME_DIST |
| CURDATE |
| CURTIME |
| DATE_ADD |
| DATE_SUB |
| DATE_FORMAT |
| DECODE |
| DENSE_RANK |
| EXTRACT |
| FIRST_VALUE |
| GROUP_CONCAT |
| JSON_ARRAYAGG |
| JSON_OBJECTAGG |
| LAG |
| LEAD |
| MAX |
| MEDIAN |
| MID |
| MIN |
| NOW |
| NTH_VALUE |
| NTILE |
| POSITION |
| PERCENT_RANK |
| PERCENTILE_CONT |
| PERCENTILE_DISC |
| RANK |
| ROW_NUMBER |
| SESSION_USER |
| STD |
| STDDEV |
365/3812
| STDDEV_POP |
| STDDEV_SAMP |
| SUBDATE |
| SUBSTR |
| SUBSTRING |
| SUM |
| SYSTEM_USER |
| TRIM |
| TRIM_ORACLE |
| VARIANCE |
| VAR_POP |
| VAR_SAMP |
| ABS |
| ACOS |
| ADDTIME |
| AES_DECRYPT |
| AES_ENCRYPT |
| ASIN |
| ATAN |
| ATAN2 |
| BENCHMARK |
| BIN |
| BINLOG_GTID_POS |
| BIT_COUNT |
| BIT_LENGTH |
| CEIL |
| CEILING |
| CHARACTER_LENGTH |
| CHAR_LENGTH |
| CHR |
| COERCIBILITY |
| COLUMN_CHECK |
| COLUMN_EXISTS |
| COLUMN_LIST |
| COLUMN_JSON |
| COMPRESS |
| CONCAT |
| CONCAT_OPERATOR_ORACLE |
| CONCAT_WS |
| CONNECTION_ID |
| CONV |
| CONVERT_TZ |
| COS |
| COT |
| CRC32 |
| DATEDIFF |
| DAYNAME |
| DAYOFMONTH |
| DAYOFWEEK |
| DAYOFYEAR |
| DEGREES |
| DECODE_HISTOGRAM |
| DECODE_ORACLE |
| DES_DECRYPT |
| DES_ENCRYPT |
| ELT |
| ENCODE |
| ENCRYPT |
| EXP |
| EXPORT_SET |
| EXTRACTVALUE |
| FIELD |
| FIND_IN_SET |
| FLOOR |
| FORMAT |
| FOUND_ROWS |
| FROM_BASE64 |
| FROM_DAYS |
| FROM_UNIXTIME |
| GET_LOCK |
| GREATEST |
| HEX |
| IFNULL |
| INSTR |
| ISNULL |
| IS_FREE_LOCK |
| IS_USED_LOCK |
| JSON_ARRAY |
| JSON_ARRAY_APPEND |
| JSON_ARRAY_INSERT |
| JSON_COMPACT |
| JSON_CONTAINS |
366/3812
| JSON_CONTAINS |
| JSON_CONTAINS_PATH |
| JSON_DEPTH |
| JSON_DETAILED |
| JSON_EXISTS |
| JSON_EXTRACT |
| JSON_INSERT |
| JSON_KEYS |
| JSON_LENGTH |
| JSON_LOOSE |
| JSON_MERGE |
| JSON_MERGE_PATCH |
| JSON_MERGE_PRESERVE |
| JSON_QUERY |
| JSON_QUOTE |
| JSON_OBJECT |
| JSON_REMOVE |
| JSON_REPLACE |
| JSON_SET |
| JSON_SEARCH |
| JSON_TYPE |
| JSON_UNQUOTE |
| JSON_VALID |
| JSON_VALUE |
| LAST_DAY |
| LAST_INSERT_ID |
| LCASE |
| LEAST |
| LENGTH |
| LENGTHB |
| LN |
| LOAD_FILE |
| LOCATE |
| LOG |
| LOG10 |
| LOG2 |
| LOWER |
| LPAD |
| LPAD_ORACLE |
| LTRIM |
| LTRIM_ORACLE |
| MAKEDATE |
| MAKETIME |
| MAKE_SET |
| MASTER_GTID_WAIT |
| MASTER_POS_WAIT |
| MD5 |
| MONTHNAME |
| NAME_CONST |
| NVL |
| NVL2 |
| NULLIF |
| OCT |
| OCTET_LENGTH |
| ORD |
| PERIOD_ADD |
| PERIOD_DIFF |
| PI |
| POW |
| POWER |
| QUOTE |
| REGEXP_INSTR |
| REGEXP_REPLACE |
| REGEXP_SUBSTR |
| RADIANS |
| RAND |
| RELEASE_ALL_LOCKS |
| RELEASE_LOCK |
| REPLACE_ORACLE |
| REVERSE |
| ROUND |
| RPAD |
| RPAD_ORACLE |
| RTRIM |
| RTRIM_ORACLE |
| SEC_TO_TIME |
| SHA |
| SHA1 |
| SHA2 |
| SIGN |
| SIN |
| SLEEP |
| SOUNDEX | 367/3812
| SOUNDEX |
| SPACE |
| SQRT |
| STRCMP |
| STR_TO_DATE |
| SUBSTR_ORACLE |
| SUBSTRING_INDEX |
| SUBTIME |
| SYS_GUID |
| TAN |
| TIMEDIFF |
| TIME_FORMAT |
| TIME_TO_SEC |
| TO_BASE64 |
| TO_CHAR |
| TO_DAYS |
| TO_SECONDS |
| UCASE |
| UNCOMPRESS |
| UNCOMPRESSED_LENGTH |
| UNHEX |
| UNIX_TIMESTAMP |
| UPDATEXML |
| UPPER |
| UUID |
| UUID_SHORT |
| VERSION |
| WEEKDAY |
| WEEKOFYEAR |
| WSREP_LAST_WRITTEN_GTID |
| WSREP_LAST_SEEN_GTID |
| WSREP_SYNC_WAIT_UPTO_GTID |
| YEARWEEK |
+---------------------------+
234 rows in set (0.001 sec)

See Also
Reserved Words

1.1.1.2.9.1.1.45 Information Schema


STATISTICS Table
The Information Schema STATISTICS table provides information about table indexes.
It contains the following columns:

Column Description
TABLE_CATALOG Always def .
TABLE_SCHEMA Database name.
TABLE_NAME Table name.
NON_UNIQUE 1 if the index can have duplicates, 0 if not.

INDEX_SCHEMA Database name.


INDEX_NAME Index name. The primary key is always named PRIMARY .
SEQ_IN_INDEX The column sequence number, starting at 1.
COLUMN_NAME Column name.
COLLATION A for sorted in ascending order, or NULL for unsorted.

Estimate of the number of unique values stored in the index based on statistics stored as integers.
CARDINALITY Higher cardinalities usually mean a greater chance of the index being used in a join. Updated by the
ANALYZE TABLE statement or myisamchk -a.
SUB_PART NULL if the whole column is indexed, or the number of indexed characters if partly indexed.

PACKED NULL if not packed, otherwise how the index is packed.

NULLABLE YES if the column may contain NULLs, empty string if not.

INDEX_TYPE Index type, one of BTREE , RTREE , HASH or FULLTEXT . See Storage Engine Index Types.

368/3812
COMMENT Index comments from the CREATE INDEX statement.
Whether or not an index will be ignored by the optimizer. See Ignored Indexes. From MariaDB
IGNORED
10.6.0.

The SHOW INDEX statement produces similar output.

Example
SELECT * FROM INFORMATION_SCHEMA.STATISTICS\G
...
*************************** 85. row ***************************
TABLE_CATALOG: def
TABLE_SCHEMA: test
TABLE_NAME: table1
NON_UNIQUE: 1
INDEX_SCHEMA: test
INDEX_NAME: col2
SEQ_IN_INDEX: 1
COLUMN_NAME: col2
COLLATION: A
CARDINALITY: 6
SUB_PART: NULL
PACKED: NULL
NULLABLE:
INDEX_TYPE: BTREE
COMMENT:
INDEX_COMMENT:
...

1.1.1.2.9.1.1.46 Information Schema


SYSTEM_VARIABLES Table
MariaDB starting with 10.1.1
The information_schema.SYSTEM_VARIABLES table was introduced in MariaDB 10.1.1

The Information Schema SYSTEM_VARIABLES table shows current values and various metadata of all system variables.
It contains the following columns:

Column Description
VARIABLE_NAME System variable name.
SESSION_VALUE Session value of the variable or NULL if the variable only has a global scope.
GLOBAL_VALUE Global value of the variable or NULL if the variable only has a session scope.
How the global value was set — a compile-time default, auto-configured by the server,
GLOBAL_VALUE_ORIGIN
configuration file (or a command line), with the SQL statement.
DEFAULT_VALUE Compile-time default value of the variable.
VARIABLE_SCOPE Global, session, or session-only.
VARIABLE_TYPE Data type of the variable value.
VARIABLE_COMMENT Help text, usually shown in mysqld --help --verbose .
NUMERIC_MIN_VALUE For numeric variables — minimal allowed value.
NUMERIC_MAX_VALUE For numeric variables — maximal allowed value.
NUMERIC_BLOCK_SIZE For numeric variables — a valid value must be a multiple of the "block size".
ENUM_VALUE_LIST For ENUM , SET , and FLAGSET variables — the list of recognized values.
Whether a variable can be set with the SQL statement. Note that many "read only"
READ_ONLY
variables can still be set on the command line.
Whether an argument is required when setting the variable on the command line. NULL
COMMAND_LINE_ARGUMENT
when a variable can not be set on the command line.
Which config file the variable got its value from. NULL if not set in any config file. Added in
GLOBAL_VALUE_PATH
MariaDB 10.5.0.
369/3812
Example
SELECT * FROM information_schema.SYSTEM_VARIABLES
WHERE VARIABLE_NAME='JOIN_BUFFER_SIZE'\G
*************************** 1. row *****************************
VARIABLE_NAME: JOIN_BUFFER_SIZE
SESSION_VALUE: 131072
GLOBAL_VALUE: 131072
GLOBAL_VALUE_ORIGIN: COMPILE-TIME
DEFAULT_VALUE: 131072
VARIABLE_SCOPE: SESSION
VARIABLE_TYPE: BIGINT UNSIGNED
VARIABLE_COMMENT: The size of the buffer that is used for joins
NUMERIC_MIN_VALUE: 128
NUMERIC_MAX_VALUE: 18446744073709551615
NUMERIC_BLOCK_SIZE: 128
ENUM_VALUE_LIST: NULL
READ_ONLY: NO
COMMAND_LINE_ARGUMENT: REQUIRED

1.1.1.2.9.1.1.47 Information Schema


TABLE_CONSTRAINTS Table
The Information Schema TABLE_CONSTRAINTS table contains information about tables that have constraints.
It has the following columns:

Column Description
CONSTRAINT_CATALOG Always def .
CONSTRAINT_SCHEMA Database name containing the constraint.
CONSTRAINT_NAME Constraint name.
TABLE_SCHEMA Database name.
TABLE_NAME Table name.
CONSTRAINT_TYPE Type of constraint; one of UNIQUE , PRIMARY KEY , FOREIGN KEY or CHECK .

The REFERENTIAL_CONSTRAINTS table has more information about foreign keys.

1.1.1.2.9.1.1.48 Information Schema


TABLE_PRIVILEGES Table
The Information Schema TABLE_PRIVILEGES table contains table privilege information derived from the
mysql.tables_priv grant table.

It has the following columns:

Column Description
GRANTEE In the format user_name@host_name .
TABLE_CATALOG Always def .
TABLE_SCHEMA Database name.
TABLE_NAME Table name.
PRIVILEGE_TYPE One of SELECT , INSERT , UPDATE , REFERENCES , ALTER , INDEX , DROP or CREATE VIEW .
IS_GRANTABLE Whether the user has the GRANT OPTION for this privilege.

Similar information can be accessed with the SHOW GRANTS statement. See the GRANT article for more about privileges.
For a description of the privileges that are shown in this table, see table privileges.

1.1.1.2.9.1.1.49 Information Schema


TABLE_STATISTICS Table
The Information Schema TABLE_STATISTICS table shows statistics on table usage.
370/3812
This is part of the User Statistics feature, which is not enabled by default.
It contains the following columns:

Field Type Notes


TABLE_SCHEMA varchar(192) The schema (database) name.
TABLE_NAME varchar(192) The table name.
ROWS_READ int(21) The number of rows read from the table.
ROWS_CHANGED int(21) The number of rows changed in the table.
The number of rows changed in the table, multiplied by the number of
ROWS_CHANGED_X_INDEXES int(21)
indexes changed.

Example
SELECT * FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='user';
+--------------+------------+-----------+--------------+------------------------+
| TABLE_SCHEMA | TABLE_NAME | ROWS_READ | ROWS_CHANGED | ROWS_CHANGED_X_INDEXES |
+--------------+------------+-----------+--------------+------------------------+
| mysql | user | 5 | 2 | 2 |
+--------------+------------+-----------+--------------+------------------------+

1.1.1.2.9.1.1.50 Information Schema TABLES


Table
Contents
1. Examples
1. View Tables in Order of Size
2. See Also

The Information Schema table shows information about the various non- TEMPORARY tables (except tables from the
Information Schema database) and views on the server.
It contains the following columns:

Column Description
TABLE_CATALOG Always def .
TABLE_SCHEMA Database name.
TABLE_NAME Table name.
One of BASE TABLE for a regular table, VIEW for a view, SYSTEM VIEW for Information Schema
TABLE_TYPE
tables, SYSTEM VERSIONED for system-versioned tables or SEQUENCE for sequences.
ENGINE Storage Engine.
VERSION Version number from the table's .frm file
ROW_FORMAT Row format (see InnoDB, Aria and MyISAM row formats).
TABLE_ROWS Number of rows in the table. Some engines, such as XtraDB and InnoDB may store an estimate.
AVG_ROW_LENGTH Average row length in the table.
For InnoDB/XtraDB, the index size, in pages, multiplied by the page size. For Aria and MyISAM,
DATA_LENGTH
length of the data file, in bytes. For MEMORY, the approximate allocated memory.
Maximum length of the data file, ie the total number of bytes that could be stored in the table. Not
MAX_DATA_LENGTH
used in XtraDB and InnoDB.
INDEX_LENGTH Length of the index file.
Bytes allocated but unused. For InnoDB tables in a shared tablespace, the free space of the
DATA_FREE shared tablespace with small safety margin. An estimate in the case of partitioned tables - see
the PARTITIONS table.

AUTO_INCREMENT Next AUTO_INCREMENT value.


Time the table was created. Some engines just return the ctime information from the file system
CREATE_TIME layer here, in that case the value is not necessarily the table creation time but rather the time the
file system metadata for it had last changed.
371/3812
Time the table was last updated. On Windows, the timestamp is not updated on update, so
MyISAM values will be inaccurate. In InnoDB, if shared tablespaces are used, will be NULL,
UPDATE_TIME
while buffering can also delay the update, so the value will differ from the actual time of the last
UPDATE , INSERT or DELETE .

CHECK_TIME Time the table was last checked. Not kept by all storage engines, in which case will be NULL .
TABLE_COLLATION Character set and collation.
CHECKSUM Live checksum value, if any.
CREATE_OPTIONS Extra CREATE TABLE options.
TABLE_COMMENT Table comment provided when MariaDB created the table.
MAX_INDEX_LENGTH Maximum index length (supported by MyISAM and Aria tables). Added in MariaDB 10.3.5.
Placeholder to signal that a table is a temporary table. Currently always "N", except "Y" for
TEMPORARY
generated information_schema tables and NULL for views. Added in MariaDB 10.3.5.

Although the table is standard in the Information Schema, all but TABLE_CATALOG , TABLE_SCHEMA , TABLE_NAME ,
TABLE_TYPE , ENGINE and VERSION are MySQL and MariaDB extensions.

SHOW TABLES lists all tables in a database.

Examples
From MariaDB 10.3.5:

SELECT * FROM information_schema.tables WHERE table_schema='test'\G


*************************** 1. row ***************************
TABLE_CATALOG: def
TABLE_SCHEMA: test
TABLE_NAME: xx5
TABLE_TYPE: BASE TABLE
ENGINE: InnoDB
VERSION: 10
ROW_FORMAT: Dynamic
TABLE_ROWS: 0
AVG_ROW_LENGTH: 0
DATA_LENGTH: 16384
MAX_DATA_LENGTH: 0
INDEX_LENGTH: 0
DATA_FREE: 0
AUTO_INCREMENT: NULL
CREATE_TIME: 2020-11-18 15:57:10
UPDATE_TIME: NULL
CHECK_TIME: NULL
TABLE_COLLATION: latin1_swedish_ci
CHECKSUM: NULL
CREATE_OPTIONS:
TABLE_COMMENT:
MAX_INDEX_LENGTH: 0
TEMPORARY: N
*************************** 2. row ***************************
TABLE_CATALOG: def
TABLE_SCHEMA: test
TABLE_NAME: xx4
TABLE_TYPE: BASE TABLE
ENGINE: MyISAM
VERSION: 10
ROW_FORMAT: Fixed
TABLE_ROWS: 0
AVG_ROW_LENGTH: 0
DATA_LENGTH: 0
MAX_DATA_LENGTH: 1970324836974591
INDEX_LENGTH: 1024
DATA_FREE: 0
AUTO_INCREMENT: NULL
CREATE_TIME: 2020-11-18 15:56:57
UPDATE_TIME: 2020-11-18 15:56:57
CHECK_TIME: NULL
TABLE_COLLATION: latin1_swedish_ci
CHECKSUM: NULL
CREATE_OPTIONS:
TABLE_COMMENT:
MAX_INDEX_LENGTH: 17179868160
TEMPORARY: N
...

372/3812
Example with temporary = 'y', from MariaDB 10.3.5:

SELECT * FROM information_schema.tables WHERE temporary='y'\G


*************************** 1. row ***************************
TABLE_CATALOG: def
TABLE_SCHEMA: information_schema
TABLE_NAME: INNODB_FT_DELETED
TABLE_TYPE: SYSTEM VIEW
ENGINE: MEMORY
VERSION: 11
ROW_FORMAT: Fixed
TABLE_ROWS: NULL
AVG_ROW_LENGTH: 9
DATA_LENGTH: 0
MAX_DATA_LENGTH: 9437184
INDEX_LENGTH: 0
DATA_FREE: 0
AUTO_INCREMENT: NULL
CREATE_TIME: 2020-11-17 21:54:02
UPDATE_TIME: NULL
CHECK_TIME: NULL
TABLE_COLLATION: utf8_general_ci
CHECKSUM: NULL
CREATE_OPTIONS: max_rows=1864135
TABLE_COMMENT:
MAX_INDEX_LENGTH: 0
TEMPORARY: Y
...

View Tables in Order of Size


Returns a list of all tables in the database, ordered by size:

SELECT table_schema as `DB`, table_name AS `Table`,


ROUND(((data_length + index_length) / 1024 / 1024), 2) `Size (MB)`
FROM information_schema.TABLES
ORDER BY (data_length + index_length) DESC;

+--------------------+---------------------------------------+-----------+
| DB | Table | Size (MB) |
+--------------------+---------------------------------------+-----------+
| wordpress | wp_simple_history_contexts | 7.05 |
| wordpress | wp_posts | 6.59 |
| wordpress | wp_simple_history | 3.05 |
| wordpress | wp_comments | 2.73 |
| wordpress | wp_commentmeta | 2.47 |
| wordpress | wp_simple_login_log | 2.03 |
...

See Also
mysqlshow
SHOW TABLE STATUS
Finding Tables Without Primary Keys

1.1.1.2.9.1.1.51 Information Schema


TABLESPACES Table
The Information Schema TABLESPACES table contains information about active tablespaces..
The table is a MariaDB and MySQL extension, and does not include information about InnoDB tablespaces.

Column Description
TABLESPACE_NAME

ENGINE

TABLESPACE_TYPE

LOGFILE_GROUP_NAME

EXTENT_SIZE

AUTOEXTEND_SIZE

373/3812
MAXIMUM_SIZE

NODEGROUP_ID

TABLESPACE_COMMENT

1.1.1.2.9.1.1.52 Information Schema


THREAD_POOL_GROUPS Table
MariaDB starting with 10.5
The Information Schema THREAD_POOL_GROUPS table was introduced in MariaDB 10.5.0.

The table provides information about thread pool groups, and contains the following columns:

Column Description
GROUP_ID

CONNECTIONS

THREADS

ACTIVE_THREADS

STANDBY_THREADS

QUEUE_LENGTH

HAS_LISTENER

IS_STALLED

Setting thread_pool_dedicated_listener will give each group its own dedicated listener, and the listener thread will not
pick up work items. As a result, the actual queue size in the table will be more exact, since IO requests are immediately
dequeued from poll, without delay.

1.1.1.2.9.1.1.53 Information Schema


THREAD_POOL_QUEUES Table
MariaDB starting with 10.5
The Information Schema THREAD_POOL_QUEUES table was introduced in MariaDB 10.5.0.

The table provides information about thread pool queues, and contains the following columns:

Column Description
POSITION

PRIORITY

CONNECTION_ID

QUEUEING_TIME_MICROSECONDS

Setting thread_poll_exact_stats will provides better queueing time statistics by using a high precision timestamp, at a
small performance cost, for the time when the connection was added to the queue. This timestamp helps calculate the
queuing time shown in the table.
Setting thread_pool_dedicated_listener will give each group its own dedicated listener, and the listener thread will not
pick up work items. As a result, the queueing time in the table will be more exact, since IO requests are immediately
dequeued from poll, without delay.

1.1.1.2.9.1.1.54 Information Schema


THREAD_POOL_STATS Table
MariaDB starting with 10.5
The Information Schema THREAD_POOL_STATS table was introduced in MariaDB 10.5.0.

374/3812
The table provides performance counter information for the thread pool, and contains the following columns:

Column Description
GROUP_ID

THREAD_CREATIONS

THREAD_CREATIONS_DUE_TO_STALL

WAKES

WAKES_DUE_TO_STALL

THROTTLES

STALLS

POLLS_BY_LISTENER

POLLS_BY_WORKER

DEQUEUES_BY_LISTENER

DEQUEUES_BY_WORKER

1.1.1.2.9.1.1.55 Information Schema


THREAD_POOL_WAITS Table
MariaDB starting with 10.5
The Information Schema THREAD_POOL_WAITS table was introduced in MariaDB 10.5.0.

The table provides wait counters for the thread pool, and contains the following columns:

Column Description
REASON

COUNT

1.1.1.2.9.1.1.56 Information Schema


TRIGGERS Table
Contents
1. See also

The Information Schema TRIGGERS table contains information about triggers.


It has the following columns:

Column Description
TRIGGER_CATALOG Always def .
TRIGGER_SCHEMA Database name in which the trigger occurs.
TRIGGER_NAME Name of the trigger.
EVENT_MANIPULATION The event that activates the trigger. One of INSERT , UPDATE or 'DELETE .
EVENT_OBJECT_CATALOG Always def .
EVENT_OBJECT_SCHEMA Database name on which the trigger acts.
EVENT_OBJECT_TABLE Table name on which the trigger acts.
Indicates the order that the action will be performed in (of the list of a table's triggers
ACTION_ORDER with identical EVENT_MANIPULATION and ACTION_TIMING values). Before MariaDB
10.2.3 introduced the FOLLOWS and PRECEDES clauses, always 0
ACTION_CONDITION NULL

ACTION_STATEMENT Trigger body, UTF-8 encoded.


ACTION_ORIENTATION Always ROW .

375/3812
ACTION_TIMING Whether the trigger acts BEFORE or AFTER the event that triggers it.
ACTION_REFERENCE_OLD_TABLE Always NULL .
ACTION_REFERENCE_NEW_TABLE Always NULL .
ACTION_REFERENCE_OLD_ROW Always OLD .
ACTION_REFERENCE_NEW_ROW Always NEW .
CREATED Always NULL .
SQL_MODE The SQL_MODE when the trigger was created, and which it uses for execution.
DEFINER The account that created the trigger, in the form user_name@host_name
The client character set when the trigger was created, from the session value of the
CHARACTER_SET_CLIENT
character_set_client system variable.

The client collation when the trigger was created, from the session value of the
COLLATION_CONNECTION
collation_connection system variable.
DATABASE_COLLATION Collation of the associated database.

Queries to the TRIGGERS table will return information only for databases and tables for which you have the TRIGGER
privilege. Similar information is returned by the SHOW TRIGGERS statement.

See also
Trigger Overview
CREATE TRIGGER
DROP TRIGGER
SHOW TRIGGERS
SHOW CREATE TRIGGER
Trigger Limitations

1.1.1.2.9.1.1.57 Information Schema


USER_PRIVILEGES Table
The Information Schema USER_PRIVILEGES table contains global user privilege information derived from the
mysql.user grant table.

It contains the following columns:

Column Description
GRANTEE In the format user_name@host_name .
TABLE_CATALOG Always def .
PRIVILEGE_TYPE The specific privilege, for example SELECT , INSERT , UPDATE or REFERENCES .
IS_GRANTABLE Whether the user has the GRANT OPTION for this privilege.

Similar information can be accessed with the SHOW GRANTS statement. See the GRANT article for more about privileges.
This information is also stored in the user table, in the mysql system database.

1.1.1.2.9.1.1.58 Information Schema


USER_STATISTICS Table
The Information Schema USER_STATISTICS table holds statistics about user activity. This is part of the User Statistics
feature, which is not enabled by default.
You can use this table to find out such things as which user is causing the most load and which users are being
abusive. You can also use this table to measure how close to capacity the server may be.
It contains the following columns:

Field Type Notes


The username. The value '#mysql_system_user#' appears when
USER varchar(48)
there is no username (such as for the slave SQL thread).
TOTAL_CONNECTIONS int(21) The number of connections created for this user.

376/3812
CONCURRENT_CONNECTIONS int(21) The number of concurrent connections for this user.
The cumulative number of seconds elapsed while there were
CONNECTED_TIME int(21)
connections from this user.
The cumulative number of seconds there was activity on
BUSY_TIME double
connections from this user.
The cumulative CPU time elapsed while servicing this user's
CPU_TIME double
connections.
BYTES_RECEIVED int(21) The number of bytes received from this user's connections.
BYTES_SENT int(21) The number of bytes sent to this user's connections.
The number of bytes written to the binary log from this user's
BINLOG_BYTES_WRITTEN int(21)
connections.
ROWS_READ int(21) The number of rows read by this user's connections.
ROWS_SENT int(21) The number of rows sent by this user's connections.
ROWS_DELETED int(21) The number of rows deleted by this user's connections.
ROWS_INSERTED int(21) The number of rows inserted by this user's connections.
ROWS_UPDATED int(21) The number of rows updated by this user's connections.
The number of SELECT commands executed from this user's
SELECT_COMMANDS int(21)
connections.
The number of UPDATE commands executed from this user's
UPDATE_COMMANDS int(21)
connections.
The number of other commands executed from this user's
OTHER_COMMANDS int(21)
connections.
The number of COMMIT commands issued by this user's
COMMIT_TRANSACTIONS int(21)
connections.
The number of ROLLBACK commands issued by this user's
ROLLBACK_TRANSACTIONS int(21)
connections.
DENIED_CONNECTIONS int(21) The number of connections denied to this user.
The number of this user's connections that were terminated
LOST_CONNECTIONS int(21)
uncleanly.
The number of times this user's connections issued commands that
ACCESS_DENIED int(21)
were denied.
The number of times this user's connections sent empty queries to
EMPTY_QUERIES int(21)
the server.
The number of TLS connections created for this user. (>= MariaDB
TOTAL_SSL_CONNECTIONS int(21)
10.1.1 )
The number of times a statement was aborted, because it was
MAX_STATEMENT_TIME_EXCEEDED int(21) executed longer than its MAX_STATEMENT_TIME threshold. (>=
MariaDB 10.1.1 )

Example

377/3812
SELECT * FROM information_schema.USER_STATISTICS\G
*************************** 1. row ***************************
USER: root
TOTAL_CONNECTIONS: 1
CONCURRENT_CONNECTIONS: 0
CONNECTED_TIME: 297
BUSY_TIME: 0.001725
CPU_TIME: 0.001982
BYTES_RECEIVED: 388
BYTES_SENT: 2327
BINLOG_BYTES_WRITTEN: 0
ROWS_READ: 0
ROWS_SENT: 12
ROWS_DELETED: 0
ROWS_INSERTED: 13
ROWS_UPDATED: 0
SELECT_COMMANDS: 4
UPDATE_COMMANDS: 0
OTHER_COMMANDS: 3
COMMIT_TRANSACTIONS: 0
ROLLBACK_TRANSACTIONS: 0
DENIED_CONNECTIONS: 0
LOST_CONNECTIONS: 0
ACCESS_DENIED: 0
EMPTY_QUERIES: 1

1.1.1.2.9.1.1.59 Information Schema


USER_VARIABLES Table
MariaDB 10.2.0
The USER_VARIABLES table was introduced in MariaDB 10.2.0 as part of the user_variables plugin.

Description
The USER_VARIABLES table is created when the user_variables plugin is enabled, and contains information about user-
defined variables.
The table contains the following columns:

Column Description
VARIABLE_NAME Variable name.
VARIABLE_VALUE Variable value.
VARIABLE_TYPE Variable type.
CHARACTER_SET_NAME Character set.

User variables are reset and the table emptied with the FLUSH USER_VARIABLES statement.

Example
SELECT * FROM information_schema.USER_VARIABLES ORDER BY VARIABLE_NAME;
+---------------+----------------+---------------+--------------------+
| VARIABLE_NAME | VARIABLE_VALUE | VARIABLE_TYPE | CHARACTER_SET_NAME |
+---------------+----------------+---------------+--------------------+
| var | 0 | INT | utf8 |
| var2 | abc | VARCHAR | utf8 |
+---------------+----------------+---------------+--------------------+

See Also
User-defined variables
Performance Schema user_variables_by_thread Table

1.1.1.2.9.1.1.60 Information Schema VIEWS


378/3812
Table
The Information Schema VIEWS table contains information about views. The SHOW VIEW privilege is required to view
the table.
It has the following columns:

Column Description
TABLE_CATALOG Aways def .
TABLE_SCHEMA Database name containing the view.
TABLE_NAME View table name.
VIEW_DEFINITION Definition of the view.
CHECK_OPTION YES if the WITH CHECK_OPTION clause has been specified, NO otherwise.

IS_UPDATABLE Whether the view is updatable or not.


DEFINER Account specified in the DEFINER clause (or the default when created).
SECURITY_TYPE SQL SECURITY characteristic, either DEFINER or INVOKER .

The client character set when the view was created, from the session value of the
CHARACTER_SET_CLIENT
character_set_client system variable.
The client collation when the view was created, from the session value of the
COLLATION_CONNECTION
collation_connection system variable.
ALGORITHM The algorithm used in the view. See View Algorithms.

Example
SELECT * FROM information_schema.VIEWS\G
*************************** 1. row ***************************
TABLE_CATALOG: def
TABLE_SCHEMA: test
TABLE_NAME: v
VIEW_DEFINITION: select `test`.`t`.`qty` AS `qty`,`test`.`t`.`price` AS `price`,(`test`.`t`.`qty`
* `test`.`t`.`price`) AS `value` from `test`.`t`
CHECK_OPTION: NONE
IS_UPDATABLE: YES
DEFINER: root@localhost
SECURITY_TYPE: DEFINER
CHARACTER_SET_CLIENT: utf8
COLLATION_CONNECTION: utf8_general_ci
ALGORITHM: UNDEFINED

See Also
CREATE VIEW
ALTER VIEW
DROP VIEW
SHOW CREATE VIEWS

1.1.1.2.9.1.1.61 Information Schema


WSREP_MEMBERSHIP Table
The WSREP_STATUS table makes Galera node cluster membership information available through the Information
Schema. The same information can be returned using the SHOW WSREP_MEMBERSHIP statement. Only users with
the SUPER can access information from this table.
The WSREP_MEMBERSHIP table is part of the WSREP_INFO plugin.

Example

379/3812
SELECT * FROM information_schema.WSREP_MEMBERSHIP;
+-------+--------------------------------------+-------+-----------------+
| INDEX | UUID | NAME | ADDRESS |
+-------+--------------------------------------+-------+-----------------+
| 0 | 46da96e3-6e9e-11e4-95a2-f609aa5444b3 | node1 | 10.0.2.15:16000 |
| 1 | 5f6bc72a-6e9e-11e4-84ed-57ec6780a3d3 | node2 | 10.0.2.15:16001 |
| 2 | 7473fd75-6e9e-11e4-91de-0b541ad91bd0 | node3 | 10.0.2.15:16002 |
+-------+--------------------------------------+-------+-----------------+

1.1.1.2.9.1.1.62 Information Schema


WSREP_STATUS Table
The WSREP_STATUS table makes Galera node cluster status information available through the Information Schema.
The same information can be returned using the SHOW WSREP_STATUS statement. Only users with the SUPER
privilege can access information from this table.
The WSREP_STATUS table is part of the WSREP_INFO plugin.

Example
SELECT * FROM information_schema.WSREP_STATUS\G
*************************** 1. row ***************************
NODE_INDEX: 0
NODE_STATUS: Synced
CLUSTER_STATUS: Primary
CLUSTER_SIZE: 3
CLUSTER_STATE_UUID: 00b0fbad-6e84-11e4-8a8b-376f19ce8ee7
CLUSTER_STATE_SEQNO: 2
CLUSTER_CONF_ID: 3
GAP: NO
PROTOCOL_VERSION: 3

1.1.1.2.9.1.2 Extended SHOW


1.1.1.2.9.1.3 TIME_MS column in
INFORMATION_SCHEMA.PROCESSLIST
In MariaDB, an extra column TIME_MS has been added to the INFORMATION_SCHEMA.PROCESSLIST table. This
column shows the same information as the column ' TIME ', but in units of milliseconds with microsecond precision (the
unit and precision of the TIME column is one second).
For details about microseconds support in MariaDB, see microseconds in MariaDB.
The value displayed in the TIME and TIME_MS columns is the period of time that the given thread has been in its
current state. Thus it can be used to check for example how long a thread has been executing the current query, or for
how long it has been idle.

select id, time, time_ms, command, state from


information_schema.processlist, (select sleep(2)) t;
+----+------+----------+---------+-----------+
| id | time | time_ms | command | state |
+----+------+----------+---------+-----------+
| 37 | 2 | 2000.493 | Query | executing |
+----+------+----------+---------+-----------+

Note that as a difference to MySQL, in MariaDB the TIME column (and also the TIME_MS column) are not affected by
any setting of @TIMESTAMP. This means that it can be reliably used also for threads that change @TIMESTAMP (such
as the replication SQL thread). See also MySQL Bug #22047 .
As a consequence of this, the TIME column of SHOW FULL PROCESSLIST and INFORMATION_SCHEMA.PROCESSLIST can
not be used to determine if a slave is lagging behind. For this, use instead the Seconds_Behind_Master column in the
output of SHOW SLAVE STATUS.
The addition of the TIME_MS column is based on the microsec_process patch, developed by Percona .

1.1.1.2.9.2 Performance Schema


380/3812
The MariaDB Performance Schema is a feature for monitoring the performance of your MariaDB server.
Performance Schema Tables
Tables making up the MariaDB Performance Schema.

Performance Schema Overview


Quick overview of the Performance Schema.

Performance Schema Status Variables


Performance Schema status variables.

Performance Schema System Variables


Performance Schema system variables.

Performance Schema Digests


Normalized statements with data values removed

PERFORMANCE_SCHEMA Storage Engine


2 PERFORMANCE_SCHEMA storage engine, a mechanism for implementing the feature.

There are 4 related questions .

1.1.1.2.9.2.1 Performance Schema Tables


Tables that are part of the MariaDB Performance Schema, a feature for monitoring the performance of MariaDB server.
List of Performance Schema Tables
List and short description of all performance_schema tables.

Performance Schema accounts Table


Account connection information.

Performance Schema cond_instances Table


List of instrumented condition objects.

Performance Schema events_stages_current Table


Current stage events.

Performance Schema events_stages_history Table


Most recent stage events per thread.

Performance Schema events_stages_history_long Table


Most recent completed stage events.

Performance Schema events_stages_summary_by_account_by_event_name


Table
Stage events, summarized by account and event name.

Performance Schema events_stages_summary_by_host_by_event_name Table


Stage events summarized by host and event name.

Performance Schema events_stages_summary_by_thread_by_event_name


Table
Stage events summarized by thread and event name.

Performance Schema events_stages_summary_by_user_by_event_name Table


Stage events summarized by user and event name.

Performance Schema events_stages_summary_global_by_event_name Table


Event summaries.

Performance Schema events_statements_current Table


Current statement events.

Performance Schema events_statements_history Table


Most recent statement events per thread

381/3812
Performance Schema events_statements_history_long Table
Most recent statement events.

Performance Schema
events_statements_summary_by_account_by_event_name Table
Statement events summarized by account and event name.

Performance Schema events_statements_summary_by_digest Table


Statement events summarized by schema and digest.

Performance Schema events_statements_summary_by_host_by_event_name


Table
Statement events summarized by host and event name.

Performance Schema events_statements_summary_by_program Table


Summarizes events for a particular stored program.

Performance Schema events_statements_summary_by_thread_by_event_name


Table
Statement events summarized by thread and event name.

Performance Schema events_statements_summary_by_user_by_event_name


Table
Statement events summarized by user and event name.

Performance Schema events_statements_summary_global_by_event_name


Table
Statement events summarized by event name.

Performance Schema events_transactions_current Table


Current transaction events for each thread.

Performance Schema events_transactions_history Table


Most recent completed transaction events for each thread.

Performance Schema events_transactions_history_long Table


Most recent completed transaction events that have ended globally.

Performance Schema
events_transactions_summary_by_account_by_event_name Table
Transaction events aggregated by account and event name.

Performance Schema events_transactions_summary_by_host_by_event_name


Table
Transaction events aggregated by host and event name.

Performance Schema
events_transactions_summary_by_thread_by_event_name Table
Transaction events aggregated by thread and event name.

Performance Schema events_transactions_summary_by_user_by_event_name


Table
Transaction events aggregated by user and event name.

Performance Schema events_transactions_summary_global_by_event_name


Table
Transaction events aggregated by event name.

Performance Schema events_waits_current Table


Current wait events

Performance Schema events_waits_history Table


Most recent wait events per thread

Performance Schema events_waits_history_long Table


Most recent completed wait events

Performance Schema events_waits_summary_by_account_by_event_name


Table
Wait events summarized by account and event name.
382/3812
Performance Schema events_waits_summary_by_host_by_event_name Table
Wait events summarized by host and event name.

Performance Schema events_waits_summary_by_instance Table


Wait events summarized by instance

Performance Schema events_waits_summary_by_thread_by_event_name Table


Wait events summarized by thread and event name.

Performance Schema events_waits_summary_by_user_by_event_name Table


Wait events summarized by user and event name.

Performance Schema events_waits_summary_global_by_event_name Table


Wait events summarized by event name.

Performance Schema file_instances Table


List of file instruments.

Performance Schema file_summary_by_event_name Table


File events summarized by event name.

Performance Schema file_summary_by_instance Table


File events summarized by instance.

Performance Schema global_status Table


Status variables and their global values.

Performance Schema hosts Table


Hosts used to connect to the server.

Performance Schema host_cache Table


Host_cache information.

Performance Schema memory_summary_by_account_by_event_name Table


Memory usage statistics aggregated by account and event.

Performance Schema memory_summary_by_host_by_event_name Table


Memory usage statistics aggregated by host and event.

Performance Schema memory_summary_by_thread_by_event_name Table


Memory usage statistics aggregated by thread and event.

Performance Schema memory_summary_by_user_by_event_name Table


Memory usage statistics aggregated by user and event.

Performance Schema memory_summary_global_by_event_name Table


Memory usage statistics aggregated by event and event.

Performance Schema metadata_locks Table


Metadata lock information.

Performance Schema mutex_instances Table


Seen mutexes

Performance Schema objects_summary_global_by_type Table


Aggregates object wait events.

Performance Schema performance_timers Table


Available event timers

Performance Schema prepared_statements_instances Table


Aggregated statistics of prepared statements.

Performance Schema replication_applier_configuration Table


Configuration settings affecting replica transactions.

Performance Schema replication_applier_status Table


Information about the general transaction execution status on the slave.

383/3812
Performance Schema replication_applier_status_by_coordinator Table
Coordinator thread status used in multi-threaded replicas to manage multiple workers.

Performance Schema replication_applier_status_by_worker Table


Slave worker thread specific information.

Performance Schema replication_connection_configuration Table


Replica configuration settings used for connecting to the primary.

Performance Schema rwlock_instances Table


Seen read-write locks

Performance Schema session_account_connect_attrs Table


Connection attributes for the current session.

Performance Schema session_connect_attrs Table


Connection attributes for all sessions.

Performance Schema session_status Table


Status variables and their session values.

Performance Schema setup_actors Table


Determines whether monitoring is enabled for host/user combinations.

Performance Schema setup_consumers Table


Lists the types of consumers for which event information is available.

Performance Schema setup_instruments Table


List of instrumented object classes

Performance Schema setup_objects Table


Which objects are monitored.

Performance Schema setup_timers Table


Currently selected event timers

Performance Schema socket_instances Table


Active server connections.

Performance Schema socket_summary_by_event_name Table


Aggregates timer and byte count statistics for all socket I/O operations by socket instrument.

Performance Schema socket_summary_by_instance Table


Aggregates timer and byte count statistics for all socket I/O operations by socket instance.

Performance Schema status_by_account Table


Status variable information by user/host account.

Performance Schema status_by_host Table


Status variable information by host.

Performance Schema status_by_thread Table


Status variable information about active foreground threads.

Performance Schema status_by_user Table


Status variable information by user.

Performance Schema table_handles Table


Table lock information.

Performance Schema table_io_waits_summary_by_index_usage Table


Table I/O waits by index.

Performance Schema table_io_waits_summary_by_table Table


Table I/O waits by table.

Performance Schema table_lock_waits_summary_by_table Table


Table lock waits by table.

384/3812
Performance Schema threads Table
Each server thread is represented as a row in the threads table.

Performance Schema users Table


User connection information.

Performance Schema user_variables_by_thread Table


User-defined variables and the threads that defined them.

1.1.1.2.9.2.1.1 List of Performance Schema


Tables
Below is a list of all Performance Schema tables as well as a brief description of each of them.

Table Description
accounts Client account connection statistics.
cond_instances Synchronization object instances.
events_stages_current Current stage events.
events_stages_history Ten most recent stage events per thread.
events_stages_history_long Ten thousand most recent stage events.
events_stages_summary_by_account_by_event_name Summarized stage events per account and event name.
events_stages_summary_by_host_by_event_name Summarized stage events per host and event name.
events_stages_summary_by_thread_by_event_name Summarized stage events per thread and event name.
Summarized stage events per user name and event
events_stages_summary_by_user_by_event_name
name.
events_stages_summary_global_by_event_name Summarized stage events per event name.
events_statements_current Current statement events.
events_statements_history Ten most recent events per thread.
events_statements_history_long Ten thousand most recent stage events.
Summarized statement events per account and event
events_statements_summary_by_account_by_event_name
name.
events_statements_summary_by_digest Summarized statement events by scheme and digest.
events_statements_summary_by_host_by_event_name Summarized statement events by host and event name.
events_statements_summary_by_program Events for a particular stored program.
Summarized statement events by thread and event
events_statements_summary_by_thread_by_event_name
name.
events_statements_summary_by_user_by_event_name Summarized statement events by user and event name.
events_statements_summary_global_by_event_name Summarized statement events by event name.
events_transactions_current Current transaction events for each thread.
Most recent completed transaction events for each
events_transactions_history
thread.
Most recent completed transaction events that have
events_transactions_history_long
ended globally.
events_transactions_summary_by_account_by_event_name Transaction events aggregated by account and event.
events_transactions_summary_by_host_by_event_name Transaction events aggregated by host and event..

events_transactions_summary_by_thread_by_event_name Transaction events aggregated by thread and event..


events_transactions_summary_by_user_by_event_name Transaction events aggregated by user and event..
events_transactions_summary_global_by_event_name Transaction events aggregated by event name.
events_waits_current Current wait events.
events_waits_history Ten most recent wait events per thread.

385/3812
events_waits_history_long Ten thousand most recent wait events per thread.
events_waits_summary_by_account_by_event_name Summarized wait events by account and event name.
events_waits_summary_by_host_by_event_name Summarized wait events by host and event name.
events_waits_summary_by_instance Summarized wait events by instance.
events_waits_summary_by_thread_by_event_name Summarized wait events by thread and event name.
events_waits_summary_by_user_by_event_name Summarized wait events by user and event name.
events_waits_summary_global_by_event_name Summarized wait events by event name.
file_instances Seen files.
file_summary_by_event_name File events summarized by event name.
file_summary_by_instance File events summarized by instance.
global_status Global status variables and values.
host_cache Host and IP information.
hosts Connections by host.
Memory usage statistics aggregated by account and
memory_summary_by_account_by_event_name
event.
Memory usage statistics aggregated by host. and
memory_summary_by_host_by_event_name
event.
Memory usage statistics aggregated by thread and
memory_summary_by_thread_by_event_name
event..
Memory usage statistics aggregated by user and
memory_summary_by_user_by_event_name
event..
memory_summary_global_by_event_name Memory usage statistics aggregated by event.
metadata_locks Metadata locks.
mutex_instances Seen mutexes.
objects_summary_global_by_type Object wait events.
performance_timers Available event timers.
prepared_statements_instances Aggregate statistics of prepared statements.
replication_applier_configuration Configuration settings affecting replica transactions.
replication_applier_status General transaction execution status on the replica.
replication_applier_status_by_coordinator Coordinator thread specific information.
replication_applier_status_by_worker Replica worker thread specific information.
Rreplica's configuration settings used for connecting to
replication_connection_configuration
the primary.
rwlock_instances Seen read-write locks.
session_account_connect_attrs Current session connection attributes.
session_connect_attrs All session connection attributes.
session_status Session status variables and values.
setup_actors Details on foreground thread monitoring.
setup_consumers Consumers for which event information is stored.
setup_instruments Instrumented objects for which events are collected.
setup_objects Objects to be monitored.
setup_timers Currently selected event timers.
socket_instances Active connections.
socket_summary_by_event_name Timer and byte count statistics by socket instrument.
socket_summary_by_instance Timer and byte count statistics by socket instance.
status_by_account Status variable info by host/user account.

386/3812
status_by_host Status variable info by host.
status_by_thread Status variable info about active foreground threads.
status_by_user Status variable info by user.
table_handles Table lock information.
table_io_waits_summary_by_index_usage Aggregate table I/O wait events by index.
table_io_waits_summary_by_table Aggregate table I/O wait events by table.
table_lock_waits_summary_by_table Aggregate table lock wait events by table.
threads Server thread information.
user_variables_by_thread User-defined variables by thread.
users Connection statistics by user.

1.1.1.2.9.2.1.2 Performance Schema accounts


Table
Description
Each account that connects to the server is stored as a row in the accounts table, along with current and total
connections.
The table size is determined at startup by the value of the performance_schema_accounts_size system variable. If this
is set to 0, account statistics will be disabled.

Column Description
USER The connection's client user name for the connection, or NULL if an internal thread.
HOST The connection client's host name, or NULL if an internal thread.
CURRENT_CONNECTIONS Current connections for the account.
TOTAL_CONNECTIONS Total connections for the account.

The USER and HOST values shown here are the username and host used for user connections, not the patterns used
to check permissions.

Example
SELECT * FROM performance_schema.accounts;
+------------------+-----------+---------------------+-------------------+
| USER | HOST | CURRENT_CONNECTIONS | TOTAL_CONNECTIONS |
+------------------+-----------+---------------------+-------------------+
| root | localhost | 1 | 2 |
| NULL | NULL | 20 | 23 |
| debian-sys-maint | localhost | 0 | 35 |
+------------------+-----------+---------------------+-------------------+

1.1.1.2.9.2.1.3 Performance Schema


cond_instances Table
Description
The cond_instances table lists all conditions while the server is executing. A condition, or instrumented condition
object, is an internal code mechanism used for signalling that a specific event has occurred so that any threads waiting
for this condition can continue.
The maximum number of conditions stored in the performance schema is determined by the
performance_schema_max_cond_instances system variable.

Column Description
NAME Client user name for the connection, or NULL if an internal thread.

387/3812
OBJECT_INSTANCE_BEGIN Address in memory of the instrumented condition.

1.1.1.2.9.2.1.4 Performance Schema


events_stages_current Table
The events_stages_current table contains current stage events, with each row being a record of a thread and its most
recent stage event.
The table contains the following columns:

Column Description
THREAD_ID Thread associated with the event. Together with EVENT_ID uniquely identifies the row.
Thread's current event number at the start of the event. Together with THREAD_ID uniquely
EVENT_ID
identifies the row.
END_EVENT_ID NULL when the event starts, set to the thread's current event number at the end of the event.

EVENT_NAME Event instrument name and a NAME from the setup_instruments table
Name and line number of the source file containing the instrumented code that produced the
SOURCE
event.
TIMER_START Value in picoseconds when the event timing started or NULL if timing is not collected.
Value in picoseconds when the event timing ended, or NULL if the event has not ended or
TIMER_END
timing is not collected.
Value in picoseconds of the event's duration or NULL if the event has not ended or timing is
TIMER_WAIT
not collected.
NESTING_EVENT_ID EVENT_ID of event within which this event nests.

NESTING_EVENT_TYPE Nesting event type. One of transaction , statement , stage or wait .

It is possible to empty this table with a TRUNCATE TABLE statement.


The related tables, events_stages_history and events_stages_history_long derive their values from the current events.

1.1.1.2.9.2.1.5 Performance Schema


events_stages_history Table
The events_stages_history table by default contains the ten most recent completed stage events per thread. This
number can be adjusted by setting the performance_schema_events_stages_history_size system variable when the
server starts up.
The table structure is identical to the events_stage_current table structure, and contains the following columns:

Column Description
THREAD_ID Thread associated with the event. Together with EVENT_ID uniquely identifies the row.
Thread's current event number at the start of the event. Together with THREAD_ID uniquely
EVENT_ID
identifies the row.
END_EVENT_ID NULL when the event starts, set to the thread's current event number at the end of the event.

EVENT_NAME Event instrument name and a NAME from the setup_instruments table
Name and line number of the source file containing the instrumented code that produced the
SOURCE
event.
TIMER_START Value in picoseconds when the event timing started or NULL if timing is not collected.
TIMER_END Value in picoseconds when the event timing ended, or NULL if timing is not collected.
TIMER_WAIT Value in picoseconds of the event's duration or NULL if timing is not collected.
NESTING_EVENT_ID EVENT_ID of event within which this event nests.

NESTING_EVENT_TYPE Nesting event type. One of transaction , statement , stage or wait .

It is possible to empty this table with a TRUNCATE TABLE statement.


events_stages_current and events_stages_history_long are related tables.

388/3812
1.1.1.2.9.2.1.6 Performance Schema
events_stages_history_long Table
The events_stages_history_long table by default contains the ten thousand most recent completed stage events.
This number can be adjusted by setting the performance_schema_events_stages_history_long_size system variable
when the server starts up.
The table structure is identical to the events_stage_current table structure, and contains the following columns:

Column Description
THREAD_ID Thread associated with the event. Together with EVENT_ID uniquely identifies the row.
Thread's current event number at the start of the event. Together with THREAD_ID uniquely
EVENT_ID
identifies the row.
END_EVENT_ID NULL when the event starts, set to the thread's current event number at the end of the event.

EVENT_NAME Event instrument name and a NAME from the setup_instruments table
Name and line number of the source file containing the instrumented code that produced the
SOURCE
event.
TIMER_START Value in picoseconds when the event timing started or NULL if timing is not collected.
TIMER_END Value in picoseconds when the event timing ended, or NULL if timing is not collected.
TIMER_WAIT Value in picoseconds of the event's duration or NULL if timing is not collected.
NESTING_EVENT_ID EVENT_ID of event within which this event nests.

NESTING_EVENT_TYPE Nesting event type. One of transaction , statement , stage or wait .

It is possible to empty this table with a TRUNCATE TABLE statement.


events_stages_current and events_stages_history are related tables.

1.1.1.2.9.2.1.7 Performance Schema


events_stages_summary_by_account_by_event_name
Table
The table lists stage events, summarized by account and event name.
It contains the following columns:

Column Description
USER User. Used together with HOST and EVENT_NAME for grouping events.
HOST Host. Used together with USER and EVENT_NAME for grouping events.
EVENT_NAME Event name. Used together with USER and HOST for grouping events.
COUNT_STAR Number of summarized events, which includes all timed and untimed events.
SUM_TIMER_WAIT Total wait time of the timed summarized events.
MIN_TIMER_WAIT Minimum wait time of the timed summarized events.
AVG_TIMER_WAIT Average wait time of the timed summarized events.
MAX_TIMER_WAIT Maximum wait time of the timed summarized events.

Example

389/3812
SELECT * FROM events_stages_summary_by_account_by_event_name\G
...
*************************** 325. row ***************************
USER: NULL
HOST: NULL
EVENT_NAME: stage/sql/Waiting for event metadata lock
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
*************************** 326. row ***************************
USER: NULL
HOST: NULL
EVENT_NAME: stage/sql/Waiting for commit lock
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
*************************** 327. row ***************************
USER: NULL
HOST: NULL
EVENT_NAME: stage/aria/Waiting for a resource
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0

1.1.1.2.9.2.1.8 Performance Schema


events_stages_summary_by_host_by_event_name
Table
The table lists stage events, summarized by host and event name.
It contains the following columns:

Column Description
HOST Host. Used together with EVENT_NAME for grouping events.
EVENT_NAME Event name. Used together with HOST for grouping events.
COUNT_STAR Number of summarized events, which includes all timed and untimed events.
SUM_TIMER_WAIT Total wait time of the timed summarized events.
MIN_TIMER_WAIT Minimum wait time of the timed summarized events.
AVG_TIMER_WAIT Average wait time of the timed summarized events.
MAX_TIMER_WAIT Maximum wait time of the timed summarized events.

Example

390/3812
SELECT * FROM events_stages_summary_by_host_by_event_name\G
...
*************************** 216. row ***************************
HOST: NULL
EVENT_NAME: stage/sql/Waiting for event metadata lock
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
*************************** 217. row ***************************
HOST: NULL
EVENT_NAME: stage/sql/Waiting for commit lock
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
*************************** 218. row ***************************
HOST: NULL
EVENT_NAME: stage/aria/Waiting for a resource
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0

1.1.1.2.9.2.1.9 Performance Schema


events_stages_summary_by_thread_by_event_name
Table
The table lists stage events, summarized by thread and event name.
It contains the following columns:

Column Description
THREAD_ID Thread associated with the event. Together with EVENT_NAME uniquely identifies the row.
EVENT_NAME Event name. Used together with THREAD_ID for grouping events.
COUNT_STAR Number of summarized events, which includes all timed and untimed events.
SUM_TIMER_WAIT Total wait time of the timed summarized events.
MIN_TIMER_WAIT Minimum wait time of the timed summarized events.
AVG_TIMER_WAIT Average wait time of the timed summarized events.
MAX_TIMER_WAIT Maximum wait time of the timed summarized events.

Example

391/3812
SELECT * FROM events_stages_summary_by_thread_by_event_name\G
...
*************************** 2287. row ***************************
THREAD_ID: 64
EVENT_NAME: stage/sql/Waiting for event metadata lock
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
*************************** 2288. row ***************************
THREAD_ID: 64
EVENT_NAME: stage/sql/Waiting for commit lock
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
*************************** 2289. row ***************************
THREAD_ID: 64
EVENT_NAME: stage/aria/Waiting for a resource
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0

1.1.1.2.9.2.1.10 Performance Schema


events_stages_summary_by_user_by_event_name
Table
The table lists stage events, summarized by user and event name.
It contains the following columns:

Column Description
USER User. Used together with EVENT_NAME for grouping events.
EVENT_NAME Event name. Used together with USER for grouping events.
COUNT_STAR Number of summarized events, which includes all timed and untimed events.
SUM_TIMER_WAIT Total wait time of the timed summarized events.
MIN_TIMER_WAIT Minimum wait time of the timed summarized events.
AVG_TIMER_WAIT Average wait time of the timed summarized events.
MAX_TIMER_WAIT Maximum wait time of the timed summarized events.

Example

392/3812
SELECT * FROM events_stages_summary_by_user_by_event_name\G
...
*************************** 325. row ***************************
USER: NULL
EVENT_NAME: stage/sql/Waiting for event metadata lock
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
*************************** 326. row ***************************
USER: NULL
EVENT_NAME: stage/sql/Waiting for commit lock
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
*************************** 327. row ***************************
USER: NULL
EVENT_NAME: stage/aria/Waiting for a resource
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0

1.1.1.2.9.2.1.11 Performance Schema


events_stages_summary_global_by_event_name
Table
The table lists stage events, summarized by thread and event name.
It contains the following columns:

Column Description
EVENT_NAME Event name.
COUNT_STAR Number of summarized events, which includes all timed and untimed events.
SUM_TIMER_WAIT Total wait time of the timed summarized events.
MIN_TIMER_WAIT Minimum wait time of the timed summarized events.
AVG_TIMER_WAIT Average wait time of the timed summarized events.
MAX_TIMER_WAIT Maximum wait time of the timed summarized events.

Example

393/3812
SELECT * FROM events_stages_summary_global_by_event_name\G
...
*************************** 106. row ***************************
EVENT_NAME: stage/sql/Waiting for trigger metadata lock
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
*************************** 107. row ***************************
EVENT_NAME: stage/sql/Waiting for event metadata lock
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
*************************** 108. row ***************************
EVENT_NAME: stage/sql/Waiting for commit lock
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
*************************** 109. row ***************************
EVENT_NAME: stage/aria/Waiting for a resource
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0

1.1.1.2.9.2.1.12 Performance Schema


events_statements_current Table
The events_statements_current table contains current statement events, with each row being a record of a thread
and its most recent statement event.
The table contains the following columns:

Column Description
THREAD_ID Thread associated with the event. Together with EVENT_ID uniquely identifies the row.
Thread's current event number at the start of the event. Together with THREAD_ID
EVENT_ID
uniquely identifies the row.
NULL when the event starts, set to the thread's current event number at the end of the
END_EVENT_ID
event.
EVENT_NAME Event instrument name and a NAME from the setup_instruments table
Name and line number of the source file containing the instrumented code that produced
SOURCE
the event.
TIMER_START Value in picoseconds when the event timing started or NULL if timing is not collected.
Value in picoseconds when the event timing ended, or NULL if the event has not ended
TIMER_END
or timing is not collected.
Value in picoseconds of the event's duration or NULL if the event has not ended or
TIMER_WAIT
timing is not collected.
Time in picoseconds spent waiting for locks. The time is calculated in microseconds but
LOCK_TIME
stored in picoseconds for compatibility with other timings.
SQL_TEXT The SQL statement, or NULL if the command is not associated with an SQL statement.
DIGEST Statement digest.
DIGEST_TEXT Statement digest text.
CURRENT_SCHEMA Statement's default database for the statement, or NULL if there was none.
OBJECT_SCHEMA Reserved, currently NULL
OBJECT_NAME Reserved, currently NULL
OBJECT_TYPE Reserved, currently NULL

394/3812
OBJECT_INSTANCE_BEGIN Address in memory of the statement object.
MYSQL_ERRNO Error code. See MariaDB Error Codes for a full list.
RETURNED_SQLSTATE The SQLSTATE value.
MESSAGE_TEXT Statement error message. See MariaDB Error Codes.
ERRORS 0 if SQLSTATE signifies completion (starting with 00) or warning (01), otherwise 1 .

WARNINGS Number of warnings from the diagnostics area.


ROWS_AFFECTED Number of rows affected the statement affected.
ROWS_SENT Number of rows returned.
ROWS_EXAMINED Number of rows read during the statement's execution.
CREATED_TMP_DISK_TABLES Number of on-disk temp tables created by the statement.
CREATED_TMP_TABLES Number of temp tables created by the statement.
SELECT_FULL_JOIN Number of joins performed by the statement which did not use an index.
SELECT_FULL_RANGE_JOIN Number of joins performed by the statement which used a range search of the first table.
SELECT_RANGE Number of joins performed by the statement which used a range of the first table.
Number of joins without keys performed by the statement that check for key usage after
SELECT_RANGE_CHECK
each row.
SELECT_SCAN Number of joins performed by the statement which used a full scan of the first table.
Number of merge passes by the sort algorithm performed by the statement. If too high,
SORT_MERGE_PASSES
you may need to increase the sort_buffer_size.
SORT_RANGE Number of sorts performed by the statement which used a range.
SORT_ROWS Number of rows sorted by the statement.
SORT_SCAN Number of sorts performed by the statement which used a full table scan.
NO_INDEX_USED 0 if the statement performed a table scan with an index, 1 if without an index.

0 if a good index was found for the statement, 1 if no good index was found. See the
NO_GOOD_INDEX_USED
Range checked for each record description in the EXPLAIN article.

NESTING_EVENT_ID Reserved, currently NULL .


NESTING_EVENT_TYPE Reserved, currently NULL .

It is possible to empty this table with a TRUNCATE TABLE statement.


The related tables, events_statements_history and events_statements_history_long derive their values from the current
events table.

1.1.1.2.9.2.1.13 Performance Schema


events_statements_history Table
The events_statements_history table by default contains the ten most recent completed statement events per thread.
This number can be adjusted by setting the performance_schema_events_statements_history_size system variable
when the server starts up.
The table structure is identical to the events_statements_current table structure, and contains the following columns:
The table contains the following columns:

Column Description
THREAD_ID Thread associated with the event. Together with EVENT_ID uniquely identifies the row.
Thread's current event number at the start of the event. Together with THREAD_ID
EVENT_ID
uniquely identifies the row.
NULL when the event starts, set to the thread's current event number at the end of the
END_EVENT_ID
event.
EVENT_NAME Event instrument name and a NAME from the setup_instruments table

Name and line number of the source file containing the instrumented code that produced
SOURCE
the event.

395/3812
TIMER_START Value in picoseconds when the event timing started or NULL if timing is not collected.
TIMER_END Value in picoseconds when the event timing ended, or NULL if timing is not collected.
TIMER_WAIT Value in picoseconds of the event's duration or NULL if timing is not collected.
Time in picoseconds spent waiting for locks. The time is calculated in microseconds but
LOCK_TIME
stored in picoseconds for compatibility with other timings.
SQL_TEXT The SQL statement, or NULL if the command is not associated with an SQL statement.
DIGEST Statement digest.
DIGEST_TEXT Statement digest text.
CURRENT_SCHEMA Statement's default database for the statement, or NULL if there was none.
OBJECT_SCHEMA Reserved, currently NULL
OBJECT_NAME Reserved, currently NULL
OBJECT_TYPE Reserved, currently NULL
OBJECT_INSTANCE_BEGIN Address in memory of the statement object.
MYSQL_ERRNO Error code. See MariaDB Error Codes for a full list.
RETURNED_SQLSTATE The SQLSTATE value.
MESSAGE_TEXT Statement error message. See MariaDB Error Codes.
ERRORS 0 if SQLSTATE signifies completion (starting with 00) or warning (01), otherwise 1 .

WARNINGS Number of warnings from the diagnostics area.


ROWS_AFFECTED Number of rows affected the statement affected.
ROWS_SENT Number of rows returned.
ROWS_EXAMINED Number of rows read during the statement's execution.
CREATED_TMP_DISK_TABLES Number of on-disk temp tables created by the statement.
CREATED_TMP_TABLES Number of temp tables created by the statement.
SELECT_FULL_JOIN Number of joins performed by the statement which did not use an index.
SELECT_FULL_RANGE_JOIN Number of joins performed by the statement which used a range search of the first table.
SELECT_RANGE Number of joins performed by the statement which used a range of the first table.
Number of joins without keys performed by the statement that check for key usage after
SELECT_RANGE_CHECK
each row.
SELECT_SCAN Number of joins performed by the statement which used a full scan of the first table.
Number of merge passes by the sort algorithm performed by the statement. If too high,
SORT_MERGE_PASSES
you may need to increase the sort_buffer_size.
SORT_RANGE Number of sorts performed by the statement which used a range.
SORT_ROWS Number of rows sorted by the statement.
SORT_SCAN Number of sorts performed by the statement which used a full table scan.
NO_INDEX_USED 0 if the statement performed a table scan with an index, 1 if without an index.

0 if a good index was found for the statement, 1 if no good index was found. See the
NO_GOOD_INDEX_USED
Range checked for each record description in the EXPLAIN article.

NESTING_EVENT_ID Reserved, currently NULL .


NESTING_EVENT_TYPE Reserved, currently NULL .

It is possible to empty this table with a TRUNCATE TABLE statement.


events_statements_current and events_statements_history_long are related tables.

1.1.1.2.9.2.1.14 Performance Schema


events_statements_history_long Table
The events_statements_history_long table by default contains the ten thousand most recent completed statement
events. This number can be adjusted by setting the performance_schema_events_statements_history_long_size

396/3812
system variable when the server starts up.
The table structure is identical to the events_statements_current table structure, and contains the following columns:

Column Description
THREAD_ID Thread associated with the event. Together with EVENT_ID uniquely identifies the row.
Thread's current event number at the start of the event. Together with THREAD_ID
EVENT_ID
uniquely identifies the row.
NULL when the event starts, set to the thread's current event number at the end of the
END_EVENT_ID
event.
EVENT_NAME Event instrument name and a NAME from the setup_instruments table
Name and line number of the source file containing the instrumented code that produced
SOURCE
the event.
TIMER_START Value in picoseconds when the event timing started or NULL if timing is not collected.
TIMER_END Value in picoseconds when the event timing ended, or NULL if timing is not collected.
TIMER_WAIT Value in picoseconds of the event's duration or NULL if timing is not collected.
Time in picoseconds spent waiting for locks. The time is calculated in microseconds but
LOCK_TIME
stored in picoseconds for compatibility with other timings.
SQL_TEXT The SQL statement, or NULL if the command is not associated with an SQL statement.
DIGEST Statement digest.
DIGEST_TEXT Statement digest text.
CURRENT_SCHEMA Statement's default database for the statement, or NULL if there was none.
OBJECT_SCHEMA Reserved, currently NULL
OBJECT_NAME Reserved, currently NULL
OBJECT_TYPE Reserved, currently NULL
OBJECT_INSTANCE_BEGIN Address in memory of the statement object.
MYSQL_ERRNO Error code. See MariaDB Error Codes for a full list.
RETURNED_SQLSTATE The SQLSTATE value.
MESSAGE_TEXT Statement error message. See MariaDB Error Codes.
ERRORS 0 if SQLSTATE signifies completion (starting with 00) or warning (01), otherwise 1 .

WARNINGS Number of warnings from the diagnostics area.


ROWS_AFFECTED Number of rows affected the statement affected.
ROWS_SENT Number of rows returned.
ROWS_EXAMINED Number of rows read during the statement's execution.
CREATED_TMP_DISK_TABLES Number of on-disk temp tables created by the statement.
CREATED_TMP_TABLES Number of temp tables created by the statement.
SELECT_FULL_JOIN Number of joins performed by the statement which did not use an index.
SELECT_FULL_RANGE_JOIN Number of joins performed by the statement which used a range search of the first table.
SELECT_RANGE Number of joins performed by the statement which used a range of the first table.
Number of joins without keys performed by the statement that check for key usage after
SELECT_RANGE_CHECK
each row.
SELECT_SCAN Number of joins performed by the statement which used a full scan of the first table.
Number of merge passes by the sort algorithm performed by the statement. If too high,
SORT_MERGE_PASSES
you may need to increase the sort_buffer_size.
SORT_RANGE Number of sorts performed by the statement which used a range.
SORT_ROWS Number of rows sorted by the statement.
SORT_SCAN Number of sorts performed by the statement which used a full table scan.
NO_INDEX_USED 0 if the statement performed a table scan with an index, 1 if without an index.

397/3812
0 if a good index was found for the statement, 1 if no good index was found. See the
NO_GOOD_INDEX_USED
Range checked for each record description in the EXPLAIN article.

NESTING_EVENT_ID Reserved, currently NULL .


NESTING_EVENT_TYPE Reserved, currently NULL .

It is possible to empty this table with a TRUNCATE TABLE statement.


events_statements_current and events_statements_history are related tables.

1.1.1.2.9.2.1.15 Performance Schema


events_statements_summary_by_account_by_event_nam
Table
The Performance Schema events_statements_summary_by_account_by_event_name table contains statement events
summarized by account and event name. It contains the following columns:

Column Description
USER User. Used together with HOST and EVENT_NAME for grouping events.
HOST Host. Used together with USER and EVENT_NAME for grouping events.
EVENT_NAME Event name. Used together with USER and HOST for grouping events.
COUNT_STAR Number of summarized events
SUM_TIMER_WAIT Total wait time of the summarized events that are timed.
MIN_TIMER_WAIT Minimum wait time of the summarized events that are timed.
AVG_TIMER_WAIT Average wait time of the summarized events that are timed.
MAX_TIMER_WAIT Maximum wait time of the summarized events that are timed.
SUM_LOCK_TIME Sum of the LOCK_TIME column in the events_statements_current table.
SUM_ERRORS Sum of the ERRORS column in the events_statements_current table.
SUM_WARNINGS Sum of the WARNINGS column in the events_statements_current table.
SUM_ROWS_AFFECTED Sum of the ROWS_AFFECTED column in the events_statements_current table.
SUM_ROWS_SENT Sum of the ROWS_SENT column in the events_statements_current table.
SUM_ROWS_EXAMINED Sum of the ROWS_EXAMINED column in the events_statements_current table.
Sum of the CREATED_TMP_DISK_TABLES column in the events_statements_current
SUM_CREATED_TMP_DISK_TABLES
table.
SUM_CREATED_TMP_TABLES Sum of the CREATED_TMP_TABLES column in the events_statements_current table.
SUM_SELECT_FULL_JOIN Sum of the SELECT_FULL_JOIN column in the events_statements_current table.
Sum of the SELECT_FULL_RANGE_JOIN column in the events_statements_current
SUM_SELECT_FULL_RANGE_JOIN
table.
SUM_SELECT_RANGE Sum of the SELECT_RANGE column in the events_statements_current table.
SUM_SELECT_RANGE_CHECK Sum of the SELECT_RANGE_CHECK column in the events_statements_current table.
SUM_SELECT_SCAN Sum of the SELECT_SCAN column in the events_statements_current table.
SUM_SORT_MERGE_PASSES Sum of the SORT_MERGE_PASSES column in the events_statements_current table.
SUM_SORT_RANGE Sum of the SORT_RANGE column in the events_statements_current table.
SUM_SORT_ROWS Sum of the SORT_ROWS column in the events_statements_current table.
SUM_SORT_SCAN Sum of the SORT_SCAN column in the events_statements_current table.
SUM_NO_INDEX_USED Sum of the NO_INDEX_USED column in the events_statements_current table.
SUM_NO_GOOD_INDEX_USED Sum of the NO_GOOD_INDEX_USED column in the events_statements_current table.

The *_TIMER_WAIT columns only calculate results for timed events, as non-timed events have a NULL wait time.

Example
398/3812
SELECT * FROM events_statements_summary_by_account_by_event_name\G
...
*************************** 521. row ***************************
USER: NULL
HOST: NULL
EVENT_NAME: statement/com/Error
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
SUM_LOCK_TIME: 0
SUM_ERRORS: 0
SUM_WARNINGS: 0
SUM_ROWS_AFFECTED: 0
SUM_ROWS_SENT: 0
SUM_ROWS_EXAMINED: 0
SUM_CREATED_TMP_DISK_TABLES: 0
SUM_CREATED_TMP_TABLES: 0
SUM_SELECT_FULL_JOIN: 0
SUM_SELECT_FULL_RANGE_JOIN: 0
SUM_SELECT_RANGE: 0
SUM_SELECT_RANGE_CHECK: 0
SUM_SELECT_SCAN: 0
SUM_SORT_MERGE_PASSES: 0
SUM_SORT_RANGE: 0
SUM_SORT_ROWS: 0
SUM_SORT_SCAN: 0
SUM_NO_INDEX_USED: 0
SUM_NO_GOOD_INDEX_USED: 0
*************************** 522. row ***************************
USER: NULL
HOST: NULL
EVENT_NAME: statement/com/
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
SUM_LOCK_TIME: 0
SUM_ERRORS: 0
SUM_WARNINGS: 0
SUM_ROWS_AFFECTED: 0
SUM_ROWS_SENT: 0
SUM_ROWS_EXAMINED: 0
SUM_CREATED_TMP_DISK_TABLES: 0
SUM_CREATED_TMP_TABLES: 0
SUM_SELECT_FULL_JOIN: 0
SUM_SELECT_FULL_RANGE_JOIN: 0
SUM_SELECT_RANGE: 0
SUM_SELECT_RANGE_CHECK: 0
SUM_SELECT_SCAN: 0
SUM_SORT_MERGE_PASSES: 0
SUM_SORT_RANGE: 0
SUM_SORT_ROWS: 0
SUM_SORT_SCAN: 0
SUM_NO_INDEX_USED: 0
SUM_NO_GOOD_INDEX_USED: 0

1.1.1.2.9.2.1.16 Performance Schema


events_statements_summary_by_digest Table
The Performance Schema digest is a hashed, normalized form of a statement with the specific data values removed. It
allows statistics to be gathered for similar kinds of statements.
The Performance Schema events_statements_summary_by_digest table records statement events summarized by
schema and digest. It contains the following columns:

Column Description
SCHEMA NAME Database name. Records are summarised together with DIGEST .
DIGEST Performance Schema digest. Records are summarised together with SCHEMA NAME .
DIGEST TEXT The unhashed form of the digest.

COUNT_STAR Number of summarized events


399/3812
SUM_TIMER_WAIT Total wait time of the summarized events that are timed.
MIN_TIMER_WAIT Minimum wait time of the summarized events that are timed.
AVG_TIMER_WAIT Average wait time of the summarized events that are timed.
MAX_TIMER_WAIT Maximum wait time of the summarized events that are timed.
SUM_LOCK_TIME Sum of the LOCK_TIME column in the events_statements_current table.
SUM_ERRORS Sum of the ERRORS column in the events_statements_current table.
SUM_WARNINGS Sum of the WARNINGS column in the events_statements_current table.
SUM_ROWS_AFFECTED Sum of the ROWS_AFFECTED column in the events_statements_current table.
SUM_ROWS_SENT Sum of the ROWS_SENT column in the events_statements_current table.
SUM_ROWS_EXAMINED Sum of the ROWS_EXAMINED column in the events_statements_current table.
Sum of the CREATED_TMP_DISK_TABLES column in the events_statements_current
SUM_CREATED_TMP_DISK_TABLES
table.
SUM_CREATED_TMP_TABLES Sum of the CREATED_TMP_TABLES column in the events_statements_current table.
SUM_SELECT_FULL_JOIN Sum of the SELECT_FULL_JOIN column in the events_statements_current table.
Sum of the SELECT_FULL_RANGE_JOIN column in the events_statements_current
SUM_SELECT_FULL_RANGE_JOIN
table.
SUM_SELECT_RANGE Sum of the SELECT_RANGE column in the events_statements_current table.
SUM_SELECT_RANGE_CHECK Sum of the SELECT_RANGE_CHECK column in the events_statements_current table.
SUM_SELECT_SCAN Sum of the SELECT_SCAN column in the events_statements_current table.
SUM_SORT_MERGE_PASSES Sum of the SORT_MERGE_PASSES column in the events_statements_current table.
SUM_SORT_RANGE Sum of the SORT_RANGE column in the events_statements_current table.
SUM_SORT_ROWS Sum of the SORT_ROWS column in the events_statements_current table.
SUM_SORT_SCAN
Sum of the SORT_SCAN column in the events_statements_current table.

SUM_NO_INDEX_USED Sum of the NO_INDEX_USED column in the events_statements_current table.


SUM_NO_GOOD_INDEX_USED Sum of the NO_GOOD_INDEX_USED column in the events_statements_current table.
FIRST_SEEN Time at which the digest was first seen.
LAST_SEEN Time at which the digest was most recently seen.

The *_TIMER_WAIT columns only calculate results for timed events, as non-timed events have a NULL wait time.
The events_statements_summary_by_digest table is limited in size by the performance_schema_digests_size system
variable. Once the limit has been reached and the table is full, all entries are aggregated in a row with a NULL digest.
The COUNT_STAR value of this NULL row indicates how many digests are recorded in the row and therefore gives an
indication of whether performance_schema_digests_size should be increased to provide more accurate statistics.

1.1.1.2.9.2.1.17 Performance Schema


events_statements_summary_by_host_by_event_name
Table
The Performance Schema events_statements_summary_by_host_by_event_name table contains statement events
summarized by host and event name. It contains the following columns:

Column Description
HOST Host. Used together with EVENT_NAME for grouping events.
EVENT_NAME Event name. Used together with HOST for grouping events.
COUNT_STAR Number of summarized events
SUM_TIMER_WAIT Total wait time of the summarized events that are timed.
MIN_TIMER_WAIT Minimum wait time of the summarized events that are timed.

AVG_TIMER_WAIT Average wait time of the summarized events that are timed.

400/3812
MAX_TIMER_WAIT Maximum wait time of the summarized events that are timed.
SUM_LOCK_TIME Sum of the LOCK_TIME column in the events_statements_currentd table.
SUM_ERRORS Sum of the ERRORS column in the events_statements_current table.
SUM_WARNINGS Sum of the WARNINGS column in the events_statements_current table.
SUM_ROWS_AFFECTED Sum of the ROWS_AFFECTED column in the events_statements_current table.
SUM_ROWS_SENT Sum of the ROWS_SENT column in the events_statements_current table.
SUM_ROWS_EXAMINED Sum of the ROWS_EXAMINED column in the events_statements_current table.
Sum of the CREATED_TMP_DISK_TABLES column in the events_statements_current
SUM_CREATED_TMP_DISK_TABLES
table.
SUM_CREATED_TMP_TABLES Sum of the CREATED_TMP_TABLES column in the events_statements_current table.
SUM_SELECT_FULL_JOIN Sum of the SELECT_FULL_JOIN column in the events_statements_current table.
Sum of the SELECT_FULL_RANGE_JOINW column in the events_statements_current
SUM_SELECT_FULL_RANGE_JOIN
table.
SUM_SELECT_RANGE Sum of the SELECT_RANGE column in the events_statements_current table.
SUM_SELECT_RANGE_CHECK Sum of the SELECT_RANGE_CHECK column in the events_statements_current table.
SUM_SELECT_SCAN Sum of the SELECT_SCAN column in the events_statements_current table.
SUM_SORT_MERGE_PASSES Sum of the SORT_MERGE_PASSES column in the events_statements_current table.
SUM_SORT_RANGE Sum of the SORT_RANGE column in the events_statements_current table.
SUM_SORT_ROWS Sum of the SORT_ROWS column in the events_statements_current table.
SUM_SORT_SCAN Sum of the SORT_SCAN column in the events_statements_current table.
SUM_NO_INDEX_USED Sum of the NO_INDEX_USED column in the events_statements_current table.
SUM_NO_GOOD_INDEX_USED
Sum of the NO_GOOD_INDEX_USED column in the events_statements_current table.

The *_TIMER_WAIT columns only calculate results for timed events, as non-timed events have a NULL wait time.

Example

401/3812
SELECT * FROM events_statements_summary_by_host_by_event_name\G
...
*************************** 347. row ***************************
HOST: NULL
EVENT_NAME: statement/com/Error
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
SUM_LOCK_TIME: 0
SUM_ERRORS: 0
SUM_WARNINGS: 0
SUM_ROWS_AFFECTED: 0
SUM_ROWS_SENT: 0
SUM_ROWS_EXAMINED: 0
SUM_CREATED_TMP_DISK_TABLES: 0
SUM_CREATED_TMP_TABLES: 0
SUM_SELECT_FULL_JOIN: 0
SUM_SELECT_FULL_RANGE_JOIN: 0
SUM_SELECT_RANGE: 0
SUM_SELECT_RANGE_CHECK: 0
SUM_SELECT_SCAN: 0
SUM_SORT_MERGE_PASSES: 0
SUM_SORT_RANGE: 0
SUM_SORT_ROWS: 0
SUM_SORT_SCAN: 0
SUM_NO_INDEX_USED: 0
SUM_NO_GOOD_INDEX_USED: 0
*************************** 348. row ***************************
HOST: NULL
EVENT_NAME: statement/com/
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
SUM_LOCK_TIME: 0
SUM_ERRORS: 0
SUM_WARNINGS: 0
SUM_ROWS_AFFECTED: 0
SUM_ROWS_SENT: 0
SUM_ROWS_EXAMINED: 0
SUM_CREATED_TMP_DISK_TABLES: 0
SUM_CREATED_TMP_TABLES: 0
SUM_SELECT_FULL_JOIN: 0
SUM_SELECT_FULL_RANGE_JOIN: 0
SUM_SELECT_RANGE: 0
SUM_SELECT_RANGE_CHECK: 0
SUM_SELECT_SCAN: 0
SUM_SORT_MERGE_PASSES: 0
SUM_SORT_RANGE: 0
SUM_SORT_ROWS: 0
SUM_SORT_SCAN: 0
SUM_NO_INDEX_USED: 0
SUM_NO_GOOD_INDEX_USED: 0

1.1.1.2.9.2.1.18 Performance Schema


events_statements_summary_by_program
Table
MariaDB starting with 10.5.2
The events_statements_summary_by_program table, along with many other new Performance Schema tables, was
added in MariaDB 10.5.2.

Each row in the the Performance Schema events_statements_summary_by_program table summarizes events for a
particular stored program (stored procedure, stored function, trigger or event).
It contains the following fields.

Column Type Null Description

402/3812
enum('EVENT',
'FUNCTION',
OBJECT_TYPE 'PROCEDURE', YES Object type for which the summary is generated.
'TABLE',
'TRIGGER')

The schema of the object for which the summary is


OBJECT_SCHEMA varchar(64) NO
generated.
The name of the object for which the summary is
OBJECT_NAME varchar(64) NO
generated.
The number of summarized events (from
bigint(20)
COUNT_STAR NO events_statements_current). This value includes all
unsigned
events, whether timed or nontimed.
The number of summarized events (from
bigint(20)
SUM_TIMER_WAIT NO events_statements_current). This value includes all
unsigned
events, whether timed or nontimed.
bigint(20) The minimum wait time of the summarized timed
MIN_TIMER_WAIT NO
unsigned events.
bigint(20) The average wait time of the summarized timed
AVG_TIMER_WAIT NO
unsigned events.
bigint(20) The maximum wait time of the summarized timed
MAX_TIMER_WAIT NO
unsigned events.
bigint(20) Total number of nested statements invoked during
COUNT_STATEMENTS NO
unsigned stored program execution.
The total wait time of the summarized timed
statements. This value is calculated only for timed
bigint(20)
SUM_STATEMENTS_WAIT NO statements because nontimed statements have a
unsigned
wait time of NULL. The same is true for the other
xxx_STATEMENT_WAIT values.
bigint(20) The minimum wait time of the summarized timed
MIN_STATEMENTS_WAIT NO
unsigned statements.
bigint(20) The average wait time of the summarized timed
AVG_STATEMENTS_WAIT NO
unsigned statements.
bigint(20) The maximum wait time of the summarized timed
MAX_STATEMENTS_WAIT NO
unsigned statements.
bigint(20) The total time spent (in picoseconds) waiting for
SUM_LOCK_TIME NO
unsigned table locks for the summarized statements.
bigint(20) The total number of errors that occurend for the
SUM_ERRORS NO
unsigned summarized statements.

bigint(20) The total number of warnings that occurend for the


SUM_WARNINGS unsigned NO summarized statements.

bigint(20) The total number of affected rows by the


SUM_ROWS_AFFECTED NO
unsigned summarized statements.
bigint(20) The total number of rows returned by the
SUM_ROWS_SENT NO
unsigned summarized statements.
The total number of rows examined by the
bigint(20)
SUM_ROWS_EXAMINED NO summarized statements.The total number of
unsigned
affected rows by the summarized statements.
bigint(20) The total number of on-disk temporary tables
SUM_CREATED_TMP_DISK_TABLES NO
unsigned created by the summarized statements.
bigint(20) The total number of in-memory temporary tables
SUM_CREATED_TMP_TABLES NO
unsigned created by the summarized statements.
bigint(20) The total number of full joins executed by the
SUM_SELECT_FULL_JOIN NO
unsigned summarized statements.
bigint(20) The total number of range search joins executed by
SUM_SELECT_FULL_RANGE_JOIN NO
unsigned the summarized statements.

403/3812
bigint(20) The total number of joins that used ranges on the
SUM_SELECT_RANGE NO
unsigned first table executed by the summarized statements.
The total number of joins that check for key usage
bigint(20)
SUM_SELECT_RANGE_CHECK NO after each row executed by the summarized
unsigned
statements.
bigint(20) The total number of joins that did a full scan of the
SUM_SELECT_SCAN NO
unsigned first table executed by the summarized statements.
The total number of merge passes that the sort
bigint(20)
SUM_SORT_MERGE_PASSES NO algorithm has had to do for the summarized
unsigned
statements.
bigint(20) The total number of sorts that were done using
SUM_SORT_RANGE NO
unsigned ranges for the summarized statements.
bigint(20) The total number of sorted rows that were sorted by
SUM_SORT_ROWS NO
unsigned the summarized statements.
bigint(20) The total number of sorts that were done by
SUM_SORT_SCAN NO
unsigned scanning the table by the summarized statements.
bigint(20) The total number of statements that performed a
SUM_NO_INDEX_USED NO
unsigned table scan without using an index.
bigint(20) The total number of statements where no good
SUM_NO_GOOD_INDEX_USED NO
unsigned index was found.

1.1.1.2.9.2.1.19 Performance Schema


events_statements_summary_by_thread_by_event_name
Table
The Performance Schema events_statements_summary_by_thread_by_event_name table contains statement events
summarized by thread and event name. It contains the following columns:

Column Description
Thread associated with the event. Together with EVENT_NAME uniquely identifies the
THREAD_ID
row.
EVENT_NAME Event name. Used together with THREAD_ID for grouping events.
COUNT_STAR Number of summarized events
SUM_TIMER_WAIT Total wait time of the summarized events that are timed.
MIN_TIMER_WAIT Minimum wait time of the summarized events that are timed.
AVG_TIMER_WAIT Average wait time of the summarized events that are timed.
MAX_TIMER_WAIT Maximum wait time of the summarized events that are timed.
SUM_LOCK_TIME Sum of the LOCK_TIME column in the events_statements_current table.
SUM_ERRORS Sum of the ERRORS column in the events_statements_current table.
SUM_WARNINGS Sum of the WARNINGS column in the events_statements_current table.
SUM_ROWS_AFFECTED Sum of the ROWS_AFFECTED column in the events_statements_current table.
SUM_ROWS_SENT Sum of the ROWS_SENT column in the events_statements_current table.
SUM_ROWS_EXAMINED Sum of the ROWS_EXAMINED column in the events_statements_current table.
Sum of the CREATED_TMP_DISK_TABLES column in the events_statements_current
SUM_CREATED_TMP_DISK_TABLES
table.
SUM_CREATED_TMP_TABLES Sum of the CREATED_TMP_TABLES column in the events_statements_current table.
SUM_SELECT_FULL_JOIN Sum of the SELECT_FULL_JOIN column in the events_statements_current table.
Sum of the SELECT_FULL_RANGE_JOIN column in the events_statements_current
SUM_SELECT_FULL_RANGE_JOIN
table.
SUM_SELECT_RANGE Sum of the SELECT_RANGE column in the events_statements_current table.
SUM_SELECT_RANGE_CHECK Sum of the SELECT_RANGE_CHECK column in the events_statements_current table.

404/3812
SUM_SELECT_SCAN Sum of the SELECT_SCAN column in the events_statements_current table.
SUM_SORT_MERGE_PASSES Sum of the SORT_MERGE_PASSES column in the events_statements_current table.
SUM_SORT_RANGE Sum of the SORT_RANGE column in the events_statements_current table.
SUM_SORT_ROWS Sum of the SORT_ROWS column in the events_statements_current table.
SUM_SORT_SCAN Sum of the SORT_SCAN column in the events_statements_current table.
SUM_NO_INDEX_USED Sum of the NO_INDEX_USED column in the events_statements_current table.
SUM_NO_GOOD_INDEX_USED Sum of the NO_GOOD_INDEX_USED column in the events_statements_current table.

The *_TIMER_WAIT columns only calculate results for timed events, as non-timed events have a NULL wait time.

Example
SELECT * FROM events_statements_summary_by_thread_by_event_name\G
...
*************************** 3653. row ***************************
THREAD_ID: 64
EVENT_NAME: statement/com/Error
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
SUM_LOCK_TIME: 0
SUM_ERRORS: 0
SUM_WARNINGS: 0
SUM_ROWS_AFFECTED: 0
SUM_ROWS_SENT: 0
SUM_ROWS_EXAMINED: 0
SUM_CREATED_TMP_DISK_TABLES: 0
SUM_CREATED_TMP_TABLES: 0
SUM_SELECT_FULL_JOIN: 0
SUM_SELECT_FULL_RANGE_JOIN: 0
SUM_SELECT_RANGE: 0
SUM_SELECT_RANGE_CHECK: 0
SUM_SELECT_SCAN: 0
SUM_SORT_MERGE_PASSES: 0
SUM_SORT_RANGE: 0
SUM_SORT_ROWS: 0
SUM_SORT_SCAN: 0
SUM_NO_INDEX_USED: 0
SUM_NO_GOOD_INDEX_USED: 0
*************************** 3654. row ***************************
THREAD_ID: 64
EVENT_NAME: statement/com/
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
SUM_LOCK_TIME: 0
SUM_ERRORS: 0
SUM_WARNINGS: 0
SUM_ROWS_AFFECTED: 0
SUM_ROWS_SENT: 0
SUM_ROWS_EXAMINED: 0
SUM_CREATED_TMP_DISK_TABLES: 0
SUM_CREATED_TMP_TABLES: 0
SUM_SELECT_FULL_JOIN: 0
SUM_SELECT_FULL_RANGE_JOIN: 0
SUM_SELECT_RANGE: 0
SUM_SELECT_RANGE_CHECK: 0
SUM_SELECT_SCAN: 0
SUM_SORT_MERGE_PASSES: 0
SUM_SORT_RANGE: 0
SUM_SORT_ROWS: 0
SUM_SORT_SCAN: 0
SUM_NO_INDEX_USED: 0
SUM_NO_GOOD_INDEX_USED: 0

1.1.1.2.9.2.1.20 Performance Schema


405/3812
events_statements_summary_by_user_by_event_name
Table
The Performance Schema events_statements_summary_by_user_by_event_name table contains statement events
summarized by user and event name. It contains the following columns:

Column Description
USER User. Used together with EVENT_NAME for grouping events.
EVENT_NAME Event name. Used together with USER for grouping events.
COUNT_STAR Number of summarized events
SUM_TIMER_WAIT Total wait time of the summarized events that are timed.
MIN_TIMER_WAIT Minimum wait time of the summarized events that are timed.
AVG_TIMER_WAIT Average wait time of the summarized events that are timed.
MAX_TIMER_WAIT Maximum wait time of the summarized events that are timed.
SUM_LOCK_TIME Sum of the LOCK_TIME column in the events_statements_current table.
SUM_ERRORS Sum of the ERRORS column in the events_statements_current table.
SUM_WARNINGS Sum of the WARNINGS column in the events_statements_current table.
SUM_ROWS_AFFECTED Sum of the ROWS_AFFECTED column in the events_statements_current table.
SUM_ROWS_SENT Sum of the ROWS_SENT column in the events_statements_current table.
SUM_ROWS_EXAMINED Sum of the ROWS_EXAMINED column in the events_statements_current table.
Sum of the CREATED_TMP_DISK_TABLES column in the events_statements_current
SUM_CREATED_TMP_DISK_TABLES
table.
SUM_CREATED_TMP_TABLES Sum of the CREATED_TMP_TABLES column in the events_statements_current table.
SUM_SELECT_FULL_JOIN Sum of the SELECT_FULL_JOIN column in the events_statements_current table.
Sum of the SELECT_FULL_RANGE_JOIN column in the events_statements_current
SUM_SELECT_FULL_RANGE_JOIN
table.
SUM_SELECT_RANGE Sum of the SELECT_RANGE column in the events_statements_current table.
SUM_SELECT_RANGE_CHECK Sum of the SELECT_RANGE_CHECK column in the events_statements_current table.

SUM_SELECT_SCAN Sum of the SELECT_SCAN column in the events_statements_current table.

SUM_SORT_MERGE_PASSES Sum of the SORT_MERGE_PASSES column in the events_statements_current table.


SUM_SORT_RANGE Sum of the SORT_RANGE column in the events_statements_current table.
SUM_SORT_ROWS Sum of the SORT_ROWS column in the events_statements_current table.
SUM_SORT_SCAN Sum of the SORT_SCAN column in the events_statements_current table.
SUM_NO_INDEX_USED Sum of the NO_INDEX_USED column in the events_statements_current table.
SUM_NO_GOOD_INDEX_USED Sum of the NO_GOOD_INDEX_USED column in the events_statements_current table.

The *_TIMER_WAIT columns only calculate results for timed events, as non-timed events have a NULL wait time.

Example

406/3812
SELECT * FROM events_statements_summary_by_user_by_event_name\G
...
*************************** 521. row ***************************
USER: NULL
EVENT_NAME: statement/com/Error
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
SUM_LOCK_TIME: 0
SUM_ERRORS: 0
SUM_WARNINGS: 0
SUM_ROWS_AFFECTED: 0
SUM_ROWS_SENT: 0
SUM_ROWS_EXAMINED: 0
SUM_CREATED_TMP_DISK_TABLES: 0
SUM_CREATED_TMP_TABLES: 0
SUM_SELECT_FULL_JOIN: 0
SUM_SELECT_FULL_RANGE_JOIN: 0
SUM_SELECT_RANGE: 0
SUM_SELECT_RANGE_CHECK: 0
SUM_SELECT_SCAN: 0
SUM_SORT_MERGE_PASSES: 0
SUM_SORT_RANGE: 0
SUM_SORT_ROWS: 0
SUM_SORT_SCAN: 0
SUM_NO_INDEX_USED: 0
SUM_NO_GOOD_INDEX_USED: 0
*************************** 522. row ***************************
USER: NULL
EVENT_NAME: statement/com/
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
SUM_LOCK_TIME: 0
SUM_ERRORS: 0
SUM_WARNINGS: 0
SUM_ROWS_AFFECTED: 0
SUM_ROWS_SENT: 0
SUM_ROWS_EXAMINED: 0
SUM_CREATED_TMP_DISK_TABLES: 0
SUM_CREATED_TMP_TABLES: 0
SUM_SELECT_FULL_JOIN: 0
SUM_SELECT_FULL_RANGE_JOIN: 0
SUM_SELECT_RANGE: 0
SUM_SELECT_RANGE_CHECK: 0
SUM_SELECT_SCAN: 0
SUM_SORT_MERGE_PASSES: 0
SUM_SORT_RANGE: 0
SUM_SORT_ROWS: 0
SUM_SORT_SCAN: 0
SUM_NO_INDEX_USED: 0
SUM_NO_GOOD_INDEX_USED: 0

1.1.1.2.9.2.1.21 Performance Schema


events_statements_summary_global_by_event_name
Table
The Performance Schema events_statements_summary_global_by_event_name table contains statement events
summarized by event name. It contains the following columns:

Column Description
EVENT_NAME Event name.
COUNT_STAR Number of summarized events
SUM_TIMER_WAIT Total wait time of the summarized events that are timed.
MIN_TIMER_WAIT Minimum wait time of the summarized events that are timed.

AVG_TIMER_WAIT Average wait time of the summarized events that are timed.

407/3812
MAX_TIMER_WAIT Maximum wait time of the summarized events that are timed.
SUM_LOCK_TIME Sum of the LOCK_TIME column in the events_statements_current table.
SUM_ERRORS Sum of the ERRORS column in the events_statements_current table.
SUM_WARNINGS Sum of the WARNINGS column in the events_statements_current table.
SUM_ROWS_AFFECTED Sum of the ROWS_AFFECTED column in the events_statements_current table.
SUM_ROWS_SENT Sum of the ROWS_SENT column in the events_statements_current table.
SUM_ROWS_EXAMINED Sum of the ROWS_EXAMINED column in the events_statements_current table.
Sum of the CREATED_TMP_DISK_TABLES column in the events_statements_current
SUM_CREATED_TMP_DISK_TABLES
table.
SUM_CREATED_TMP_TABLES Sum of the CREATED_TMP_TABLES column in the events_statements_current table.
SUM_SELECT_FULL_JOIN Sum of the SELECT_FULL_JOIN column in the events_statements_current table.
Sum of the SELECT_FULL_RANGE_JOIN column in the events_statements_current
SUM_SELECT_FULL_RANGE_JOIN
table.
SUM_SELECT_RANGE Sum of the SELECT_RANGE column in the events_statements_current table.
SUM_SELECT_RANGE_CHECK Sum of the SELECT_RANGE_CHECK column in the events_statements_current table.
SUM_SELECT_SCAN Sum of the SELECT_SCAN column in the events_statements_current table.
SUM_SORT_MERGE_PASSES Sum of the SORT_MERGE_PASSES column in the events_statements_current table.
SUM_SORT_RANGE Sum of the SORT_RANGE column in the events_statements_current table.
SUM_SORT_ROWS Sum of the SORT_ROWS column in the events_statements_current table.
SUM_SORT_SCAN Sum of the SORT_SCAN column in the events_statements_current table.
SUM_NO_INDEX_USED Sum of the NO_INDEX_USED column in the events_statements_current table.
SUM_NO_GOOD_INDEX_USED Sum of the NO_GOOD_INDEX_USED column in the events_statements_current table.

The *_TIMER_WAIT columns only calculate results for timed events, as non-timed events have a NULL wait time.

Example

408/3812
SELECT * FROM events_statements_summary_global_by_event_name\G
...
*************************** 173. row ***************************
EVENT_NAME: statement/com/Error
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
SUM_LOCK_TIME: 0
SUM_ERRORS: 0
SUM_WARNINGS: 0
SUM_ROWS_AFFECTED: 0
SUM_ROWS_SENT: 0
SUM_ROWS_EXAMINED: 0
SUM_CREATED_TMP_DISK_TABLES: 0
SUM_CREATED_TMP_TABLES: 0
SUM_SELECT_FULL_JOIN: 0
SUM_SELECT_FULL_RANGE_JOIN: 0
SUM_SELECT_RANGE: 0
SUM_SELECT_RANGE_CHECK: 0
SUM_SELECT_SCAN: 0
SUM_SORT_MERGE_PASSES: 0
SUM_SORT_RANGE: 0
SUM_SORT_ROWS: 0
SUM_SORT_SCAN: 0
SUM_NO_INDEX_USED: 0
SUM_NO_GOOD_INDEX_USED: 0
*************************** 174. row ***************************
EVENT_NAME: statement/com/
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
SUM_LOCK_TIME: 0
SUM_ERRORS: 0
SUM_WARNINGS: 0
SUM_ROWS_AFFECTED: 0
SUM_ROWS_SENT: 0
SUM_ROWS_EXAMINED: 0
SUM_CREATED_TMP_DISK_TABLES: 0
SUM_CREATED_TMP_TABLES: 0
SUM_SELECT_FULL_JOIN: 0
SUM_SELECT_FULL_RANGE_JOIN: 0
SUM_SELECT_RANGE: 0
SUM_SELECT_RANGE_CHECK: 0
SUM_SELECT_SCAN: 0
SUM_SORT_MERGE_PASSES: 0
SUM_SORT_RANGE: 0
SUM_SORT_ROWS: 0
SUM_SORT_SCAN: 0
SUM_NO_INDEX_USED: 0
SUM_NO_GOOD_INDEX_USED: 0

1.1.1.2.9.2.1.22 Performance Schema


events_transactions_current Table
MariaDB starting with 10.5.2
The events_transactions_current table was introduced in MariaDB 10.5.2.

The events_transactions_current table contains current transaction events for each thread.
The table size cannot be figured, and always stores one row for each thread, showing the current status of the thread's
most recent monitored transaction event.
The table contains the following columns:

Column Type Description


THREAD_ID bigint(20) unsigned The thread associated with the event.
EVENT_ID bigint(20) unsigned The event id associated with the event.

409/3812
This column is set to NULL when the event
END_EVENT_ID bigint(20) unsigned starts and updated to the thread current
event number when the event ends.
The name of the instrument from which the
EVENT_NAME varchar(128) event was collected. This is a NAME value
from the setup_instruments table.
The current transaction state. The value is
enum('ACTIVE',
ACTIVE (after START TRANSACTION or
STATE 'COMMITTED',
BEGIN), COMMITTED (after COMMIT), or
'ROLLED BACK')
ROLLED BACK (after ROLLBACK).
TRX_ID bigint(20) unsigned Unused.
Transaction GTID, using the format
GTID varchar(64)
DOMAIN-SERVER_ID-SEQUENCE_NO.
XA transaction format ID for GTRID and
XID_FORMAT_ID int(11)
BQUAL values.
XID_GTRID varchar(130) XA global transaction ID.
XID_BQUAL varchar(130) XA transaction branch qualifier.
The state of the XA transaction. The value
is ACTIVE (after XA START), IDLE (after XA
XA_STATE varchar(64) END), PREPARED (after XA PREPARE),
ROLLED BACK (after XA ROLLBACK), or
COMMITTED (after XA COMMIT).
The name of the source file containing the
instrumented code that produced the event
SOURCE varchar(64)
and the line number in the file at which the
instrumentation occurs.
The unit is picoseconds. When event timing
TIMER_START bigint(20) unsigned started. NULL if event has no timing
information.
The unit is picoseconds. When event timing
TIMER_END bigint(20) unsigned ended. NULL if event has no timing
information.
The unit is picoseconds. Event duration.
TIMER_WAIT bigint(20) unsigned
NULL if event has not timing information.
enum('READ ONLY',
ACCESS_MODE Transaction access mode.
'READ WRITE')
Transaction isolation level. One of:
ISOLATION_LEVEL varchar(64) REPEATABLE READ, READ COMMITTED,
READ UNCOMMITTED, or SERIALIZABLE.
Whether autcommit mode was enabled
AUTOCOMMIT enum('YES','NO')
when the transaction started.

The number of SAVEPOINT statements


NUMBER_OF_SAVEPOINTS bigint(20) unsigned
issued during the transaction.
The number of
NUMBER_OF_ROLLBACK_TO_SAVEPOINT bigint(20) unsigned ROLLBACK_TO_SAVEPOINT statements
issued during the transaction.
The number of RELEASE_SAVEPOINT
NUMBER_OF_RELEASE_SAVEPOINT bigint(20) unsigned
statements issued during the transaction.
OBJECT_INSTANCE_BEGIN bigint(20) unsigned Unused.
The EVENT_ID value of the event within
NESTING_EVENT_ID bigint(20) unsigned
which this event is nested.
enum('TRANSACTION',
NESTING_EVENT_TYPE 'STATEMENT', The nesting event type.
'STAGE', 'WAIT')

1.1.1.2.9.2.1.23 Performance Schema


410/3812
events_transactions_history Table
MariaDB starting with 10.5.2
The events_transactions_history table was introduced in MariaDB 10.5.2.

The events_transactions_history table contains the most recent completed transaction events for each thread.
The number of records stored per thread in the table is determined by the
performance_schema_events_transactions_history_size system variable, which is autosized on startup.
If adding a completed transaction event would cause the table to exceed this limit, the oldest thread row is discarded.
All of a thread's rows are discarded when the thread ends.
The table contains the following columns:

Column Type Description


THREAD_ID bigint(20) unsigned The thread associated with the event.
EVENT_ID bigint(20) unsigned The event id associated with the event.
This column is set to NULL when the event
END_EVENT_ID bigint(20) unsigned starts and updated to the thread current
event number when the event ends.
The name of the instrument from which the
EVENT_NAME varchar(128) event was collected. This is a NAME value
from the setup_instruments table.
The current transaction state. The value is
enum('ACTIVE',
ACTIVE (after START TRANSACTION or
STATE 'COMMITTED','
BEGIN), COMMITTED (after COMMIT), or
ROLLED BACK')
ROLLED BACK (after ROLLBACK).
TRX_ID bigint(20) unsigned Unused.
Transaction GTID, using the format
GTID varchar(64)
DOMAIN-SERVER_ID-SEQUENCE_NO.
XA transaction format ID for GTRID and
XID_FORMAT_ID int(11)
BQUAL values.
XID_GTRID varchar(130) XA global transaction ID.
XID_BQUAL varchar(130) XA transaction branch qualifier.
The state of the XA transaction. The value
is ACTIVE (after XA START), IDLE (after XA
XA_STATE varchar(64) END), PREPARED (after XA PREPARE),
ROLLED BACK (after XA ROLLBACK), or
COMMITTED (after XA COMMIT).
The name of the source file containing the
instrumented code that produced the event
SOURCE varchar(64) and the line number in the file at which the
instrumentation occurs.

The unit is picoseconds. When event timing


TIMER_START bigint(20) unsigned started. NULL if event has no timing
information.
The unit is picoseconds. When event timing
TIMER_END bigint(20) unsigned ended. NULL if event has no timing
information.
The unit is picoseconds. Event duration.
TIMER_WAIT bigint(20) unsigned
NULL if event has not timing information.
enum('READ ONLY',
ACCESS_MODE Transaction access mode.
'READ WRITE')
Transaction isolation level. One of:
REPEATABLE READ, READ
ISOLATION_LEVEL varchar(64)
COMMITTED, READ UNCOMMITTED, or
SERIALIZABLE.
AUTOCOMMIT enum('YES', 'NO') NO
411/3812
The number of SAVEPOINT statements
NUMBER_OF_SAVEPOINTS bigint(20) unsigned
issued during the transaction.
The number of
NUMBER_OF_ROLLBACK_TO_SAVEPOINT bigint(20) unsigned ROLLBACK_TO_SAVEPOINT statements
issued during the transaction.
The number of RELEASE_SAVEPOINT
NUMBER_OF_RELEASE_SAVEPOINT bigint(20) unsigned
statements issued during the transaction.
OBJECT_INSTANCE_BEGIN bigint(20) unsigned Unused.
The EVENT_ID value of the event within
NESTING_EVENT_ID bigint(20) unsigned
which this event is nested.
enum('TRANSACTION','
NESTING_EVENT_TYPE STATEMENT', The nesting event type.
'STAGE', 'WAIT')

1.1.1.2.9.2.1.24 Performance Schema


events_transactions_history_long Table
MariaDB starting with 10.5.2
The events_transactions_history_long table was introduced in MariaDB 10.5.2.

The events_transactions_history_long table contains the most recent completed transaction events that have ended
globally, across all threads.
The number of records stored in the table is determined by the
performance_schema_events_transactions_history_long_size system variable, which is autosized on startup.
If adding a completed transaction would cause the table to exceed this limit, the oldest row, regardless of thread, is
discarded.
The table contains the following columns:

Column Type Description


THREAD_ID bigint(20) unsigned The thread associated with the event.
EVENT_ID bigint(20) unsigned The event id associated with the event.
This column is set to NULL when the event
END_EVENT_ID bigint(20) unsigned starts and updated to the thread current
event number when the event ends.
The name of the instrument from which the
EVENT_NAME varchar(128) event was collected. This is a NAME value
from the setup_instruments table.
The current transaction state. The value is
enum('ACTIVE',
ACTIVE (after START TRANSACTION or
STATE 'COMMITTED','
BEGIN), COMMITTED (after COMMIT), or
ROLLED BACK')
ROLLED BACK (after ROLLBACK).
TRX_ID bigint(20) unsigned Unused.
Transaction GTID, using the format
GTID varchar(64)
DOMAIN-SERVER_ID-SEQUENCE_NO.
XA transaction format ID for GTRID and
XID_FORMAT_ID int(11)
BQUAL values.
XID_GTRID varchar(130) XA global transaction ID.

XID_BQUAL varchar(130) XA transaction branch qualifier.

The state of the XA transaction. The value


is ACTIVE (after XA START), IDLE (after XA
XA_STATE varchar(64) END), PREPARED (after XA PREPARE),
ROLLED BACK (after XA ROLLBACK), or
COMMITTED (after XA COMMIT).

412/3812
The name of the source file containing the
instrumented code that produced the event
SOURCE varchar(64)
and the line number in the file at which the
instrumentation occurs.
The unit is picoseconds. When event timing
TIMER_START bigint(20) unsigned started. NULL if event has no timing
information.
The unit is picoseconds. When event timing
TIMER_END bigint(20) unsigned ended. NULL if event has no timing
information.
The unit is picoseconds. Event duration.
TIMER_WAIT bigint(20) unsigned
NULL if event has not timing information.
enum('READ ONLY',
ACCESS_MODE Transaction access mode.
'READ WRITE')
Transaction isolation level. One of:
REPEATABLE READ, READ
ISOLATION_LEVEL varchar(64)
COMMITTED, READ UNCOMMITTED, or
SERIALIZABLE.
AUTOCOMMIT enum('YES', 'NO') NO
The number of SAVEPOINT statements
NUMBER_OF_SAVEPOINTS bigint(20) unsigned
issued during the transaction.
The number of
NUMBER_OF_ROLLBACK_TO_SAVEPOINT bigint(20) unsigned ROLLBACK_TO_SAVEPOINT statements
issued during the transaction.
The number of RELEASE_SAVEPOINT
NUMBER_OF_RELEASE_SAVEPOINT bigint(20) unsigned
statements issued during the transaction.
OBJECT_INSTANCE_BEGIN bigint(20) unsigned Unused.
The EVENT_ID value of the event within
NESTING_EVENT_ID bigint(20) unsigned
which this event is nested.
enum('TRANSACTION','
NESTING_EVENT_TYPE STATEMENT', The nesting event type.
'STAGE', 'WAIT')

1.1.1.2.9.2.1.25 Performance Schema


events_transactions_summary_by_account_by_event_na
Table
MariaDB starting with 10.5.2
The events_transactions_summary_by_account_by_event_name table was introduced in MariaDB 10.5.2.

The events_transactions_summary_by_account_by_event_name table contains information on transaction events


aggregated by account and event name.
The table contains the following columns:

Column Type Description


USER char(32) User for which summary is generated.
HOST char(60) Host for which summary is generated.
EVENT_NAME varchar(128) Event name for which summary is generated.

COUNT_STAR bigint(20) The number of summarized events. This value includes all events,
unsigned whether timed or nontimed.

The total wait time of the summarized timed events. This value is
bigint(20)
SUM_TIMER_WAIT calculated only for timed events because nontimed events have a wait
unsigned
time of NULL. The same is true for the other xxx_TIMER_WAIT values.

413/3812
bigint(20)
MIN_TIMER_WAIT The minimum wait time of the summarized timed events.
unsigned
bigint(20)
AVG_TIMER_WAIT The average wait time of the summarized timed events.
unsigned
bigint(20)
MAX_TIMER_WAIT The maximum wait time of the summarized timed events.
unsigned
bigint(20)
COUNT_READ_WRITE The total number of only READ/WRITE transaction events.
unsigned
bigint(20)
SUM_TIMER_READ_WRITE The total wait time of only READ/WRITE transaction events.
unsigned
bigint(20)
MIN_TIMER_READ_WRITE The minimum wait time of only READ/WRITE transaction events.
unsigned
bigint(20)
AVG_TIMER_READ_WRITE The average wait time of only READ/WRITE transaction events.
unsigned
bigint(20)
MAX_TIMER_READ_WRITE The maximum wait time of only READ/WRITE transaction events.
unsigned
bigint(20)
COUNT_READ_ONLY The total number of only READ ONLY transaction events.
unsigned
bigint(20)
SUM_TIMER_READ_ONLY The total wait time of only READ ONLY transaction events.
unsigned
bigint(20)
MIN_TIMER_READ_ONLY The minimum wait time of only READ ONLY transaction events.
unsigned
bigint(20)
AVG_TIMER_READ_ONLY The average wait time of only READ ONLY transaction events.
unsigned
bigint(20)
MAX_TIMER_READ_ONLY The maximum wait time of only READ ONLY transaction events.
unsigned

1.1.1.2.9.2.1.26 Performance Schema


events_transactions_summary_by_host_by_event_name
Table
MariaDB starting with 10.5.2
The events_transactions_summary_by_host_by_event_name table was introduced in MariaDB 10.5.2.

The events_transactions_summary_by_host_by_event_name table contains information on transaction events


aggregated by host and event name.
The table contains the following columns:

Column Type Description


HOST char(60) Host for which summary is generated.
EVENT_NAME varchar(128) Event name for which summary is generated.
bigint(20) The number of summarized events. This value includes all events,
COUNT_STAR
unsigned whether timed or nontimed.
The total wait time of the summarized timed events. This value is
bigint(20)
SUM_TIMER_WAIT calculated only for timed events because nontimed events have a wait
unsigned
time of NULL. The same is true for the other xxx_TIMER_WAIT values.
bigint(20)
MIN_TIMER_WAIT The minimum wait time of the summarized timed events.
unsigned
bigint(20)
AVG_TIMER_WAIT The average wait time of the summarized timed events.
unsigned
bigint(20)
MAX_TIMER_WAIT The maximum wait time of the summarized timed events.
unsigned
bigint(20)
COUNT_READ_WRITE The total number of only READ/WRITE transaction events.
unsigned
414/3812
bigint(20)
SUM_TIMER_READ_WRITE The total wait time of only READ/WRITE transaction events.
unsigned
bigint(20)
MIN_TIMER_READ_WRITE The minimum wait time of only READ/WRITE transaction events.
unsigned
bigint(20)
AVG_TIMER_READ_WRITE The average wait time of only READ/WRITE transaction events.
unsigned
bigint(20)
MAX_TIMER_READ_WRITE The maximum wait time of only READ/WRITE transaction events.
unsigned
bigint(20)
COUNT_READ_ONLY The total number of only READ ONLY transaction events.
unsigned
bigint(20)
SUM_TIMER_READ_ONLY The total wait time of only READ ONLY transaction events.
unsigned
bigint(20)
MIN_TIMER_READ_ONLY The minimum wait time of only READ ONLY transaction events.
unsigned
bigint(20)
AVG_TIMER_READ_ONLY The average wait time of only READ ONLY transaction events.
unsigned
bigint(20)
MAX_TIMER_READ_ONLY The maximum wait time of only READ ONLY transaction events.
unsigned

1.1.1.2.9.2.1.27 Performance Schema


events_transactions_summary_by_thread_by_event_nam
Table
MariaDB starting with 10.5.2
The events_transactions_summary_by_thread_by_event_name table was introduced in MariaDB 10.5.2.

The events_transactions_summary_by_thread_by_event_name table contains information on transaction events


aggregated by thread and event name.
The table contains the following columns:

+----------------------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------------+---------------------+------+-----+---------+-------+
| THREAD_ID | bigint(20) unsigned | NO | | NULL | |
| EVENT_NAME | varchar(128) | NO | | NULL | |
| COUNT_STAR | bigint(20) unsigned | NO | | NULL | |
| SUM_TIMER_WAIT | bigint(20) unsigned | NO | | NULL | |
| MIN_TIMER_WAIT | bigint(20) unsigned | NO | | NULL | |
| AVG_TIMER_WAIT | bigint(20) unsigned | NO | | NULL | |
| MAX_TIMER_WAIT | bigint(20) unsigned | NO | | NULL | |
| COUNT_READ_WRITE | bigint(20) unsigned | NO | | NULL | |
| SUM_TIMER_READ_WRITE | bigint(20) unsigned | NO | | NULL | |
| MIN_TIMER_READ_WRITE | bigint(20) unsigned | NO | | NULL | |
| AVG_TIMER_READ_WRITE | bigint(20) unsigned | NO | | NULL | |
| MAX_TIMER_READ_WRITE | bigint(20) unsigned | NO | | NULL | |
| COUNT_READ_ONLY | bigint(20) unsigned | NO | | NULL | |
| SUM_TIMER_READ_ONLY | bigint(20) unsigned | NO | | NULL | |
| MIN_TIMER_READ_ONLY | bigint(20) unsigned | NO | | NULL | |
| AVG_TIMER_READ_ONLY | bigint(20) unsigned | NO | | NULL | |
| MAX_TIMER_READ_ONLY | bigint(20) unsigned | NO | | NULL | |
+----------------------+---------------------+------+-----+---------+-------+

1.1.1.2.9.2.1.28 Performance Schema


events_transactions_summary_by_user_by_event_name
Table
MariaDB starting with 10.5.2
The events_transactions_summary_by_user_by_event_name table was introduced in MariaDB 10.5.2.

415/3812
The events_transactions_summary_by_user_by_event_name table contains information on transaction events
aggregated by user and event name.
The table contains the following columns:

+----------------------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------------+---------------------+------+-----+---------+-------+
| USER | char(32) | YES | | NULL | |
| EVENT_NAME | varchar(128) | NO | | NULL | |
| COUNT_STAR | bigint(20) unsigned | NO | | NULL | |
| SUM_TIMER_WAIT | bigint(20) unsigned | NO | | NULL | |
| MIN_TIMER_WAIT | bigint(20) unsigned | NO | | NULL | |
| AVG_TIMER_WAIT | bigint(20) unsigned | NO | | NULL | |
| MAX_TIMER_WAIT | bigint(20) unsigned | NO | | NULL | |
| COUNT_READ_WRITE | bigint(20) unsigned | NO | | NULL | |
| SUM_TIMER_READ_WRITE | bigint(20) unsigned | NO | | NULL | |
| MIN_TIMER_READ_WRITE | bigint(20) unsigned | NO | | NULL | |
| AVG_TIMER_READ_WRITE | bigint(20) unsigned | NO | | NULL | |
| MAX_TIMER_READ_WRITE | bigint(20) unsigned | NO | | NULL | |
| COUNT_READ_ONLY | bigint(20) unsigned | NO | | NULL | |
| SUM_TIMER_READ_ONLY | bigint(20) unsigned | NO | | NULL | |
| MIN_TIMER_READ_ONLY | bigint(20) unsigned | NO | | NULL | |
| AVG_TIMER_READ_ONLY | bigint(20) unsigned | NO | | NULL | |
| MAX_TIMER_READ_ONLY | bigint(20) unsigned | NO | | NULL | |
+----------------------+---------------------+------+-----+---------+-------+

1.1.1.2.9.2.1.29 Performance Schema


events_transactions_summary_global_by_event_name
Table
MariaDB starting with 10.5.2
The events_transactions_summary_global_by_event_name table was introduced in MariaDB 10.5.2.

The events_transactions_summary_global_by_event_name table contains information on transaction events


aggregated by event name.
The table contains the following columns:

+----------------------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------------+---------------------+------+-----+---------+-------+
| EVENT_NAME | varchar(128) | NO | | NULL | |
| COUNT_STAR | bigint(20) unsigned | NO | | NULL | |
| SUM_TIMER_WAIT | bigint(20) unsigned | NO | | NULL | |
| MIN_TIMER_WAIT | bigint(20) unsigned | NO | | NULL | |
| AVG_TIMER_WAIT | bigint(20) unsigned | NO | | NULL | |
| MAX_TIMER_WAIT | bigint(20) unsigned | NO | | NULL | |
| COUNT_READ_WRITE | bigint(20) unsigned | NO | | NULL | |
| SUM_TIMER_READ_WRITE | bigint(20) unsigned | NO | | NULL | |
| MIN_TIMER_READ_WRITE | bigint(20) unsigned | NO | | NULL | |
| AVG_TIMER_READ_WRITE | bigint(20) unsigned | NO | | NULL | |
| MAX_TIMER_READ_WRITE | bigint(20) unsigned | NO | | NULL | |
| COUNT_READ_ONLY | bigint(20) unsigned | NO | | NULL | |
| SUM_TIMER_READ_ONLY | bigint(20) unsigned | NO | | NULL | |
| MIN_TIMER_READ_ONLY | bigint(20) unsigned | NO | | NULL | |
| AVG_TIMER_READ_ONLY | bigint(20) unsigned | NO | | NULL | |
| MAX_TIMER_READ_ONLY | bigint(20) unsigned | NO | | NULL | |
+----------------------+---------------------+------+-----+---------+-------+

1.1.1.2.9.2.1.30 Performance Schema


events_waits_current Table
The events_waits_current table contains the status of a thread's most recently monitored wait event, listing one event
per thread.
The table contains the following columns:

Column Description

416/3812
THREAD_ID Thread associated with the event. Together with EVENT_ID uniquely identifies the row.

Thread's current event number at the start of the event. Together with THREAD_ID uniquely
EVENT_ID
identifies the row.
NULL when the event starts, set to the thread's current event number at the end of the
END_EVENT_ID
event.
EVENT_NAME Event instrument name and a NAME from the setup_instruments table
Name and line number of the source file containing the instrumented code that produced
SOURCE
the event.
TIMER_START Value in picoseconds when the event timing started or NULL if timing is not collected.
Value in picoseconds when the event timing ended, or NULL if the event has not ended or
TIMER_END
timing is not collected.
Value in picoseconds of the event's duration or NULL if the event has not ended or timing
TIMER_WAIT
is not collected.
Number of spin rounds for a mutex, or NULL if spin rounds are not used, or spinning is not
SPINS
instrumented.
Name of the schema that contains the table for table I/O objects, otherwise NULL for file
OBJECT_SCHEMA
I/O and synchronization objects.
File name for file I/O objects, table name for table I/O objects, the socket's IP:PORT value
OBJECT_NAME
for a socket object or NULL for a synchronization object.
INDEX NAME Name of the index, PRIMARY for the primary key, or NULL for no index used.
FILE for a file object, TABLE or TEMPORARY TABLE for a table object, or NULL for a
OBJECT_TYPE
synchronization object.
OBJECT_INSTANCE_BEGIN Address in memory of the object.
NESTING_EVENT_ID EVENT_ID of event within which this event nests.

NESTING_EVENT_TYPE Nesting event type. Either statement , stage or wait .


OPERATION Operation type, for example read, write or lock
NUMBER_OF_BYTES Number of bytes that the operation read or wrote, or NULL for table I/O waits.
FLAGS Reserved for use in the future.

It is possible to empty this table with a TRUNCATE TABLE statement.


The related tables, events_waits_history and events_waits_history_long derive their values from the current events.

1.1.1.2.9.2.1.31 Performance Schema


events_waits_history Table
The events_waits_history table by default contains the ten most recent completed wait events per thread. This
number can be adjusted by setting the performance_schema_events_waits_history_size system variable when the
server starts up.
The table structure is identical to the events_waits_current table structure, and contains the following columns:

Column Description
THREAD_ID Thread associated with the event. Together with EVENT_ID uniquely identifies the row.
Thread's current event number at the start of the event. Together with THREAD_ID uniquely
EVENT_ID
identifies the row.
NULL when the event starts, set to the thread's current event number at the end of the
END_EVENT_ID
event.
EVENT_NAME Event instrument name and a NAME from the setup_instruments table
Name and line number of the source file containing the instrumented code that produced
SOURCE
the event.
TIMER_START Value in picoseconds when the event timing started or NULL if timing is not collected.
TIMER_END Value in picoseconds when the event timing ended, or NULL if timing is not collected.
TIMER_WAIT Value in picoseconds of the event's duration or NULL if timing is not collected.

417/3812
Number of spin rounds for a mutex, or NULL if spin rounds are not used, or spinning is not
SPINS
instrumented.
Name of the schema that contains the table for table I/O objects, otherwise NULL for file
OBJECT_SCHEMA
I/O and synchronization objects.
File name for file I/O objects, table name for table I/O objects, the socket's IP:PORT value
OBJECT_NAME
for a socket object or NULL for a synchronization object.
INDEX NAME Name of the index, PRIMARY for the primary key, or NULL for no index used.
FILE for a file object, TABLE or TEMPORARY TABLE for a table object, or NULL for a
OBJECT_TYPE
synchronization object.
OBJECT_INSTANCE_BEGIN Address in memory of the object.
NESTING_EVENT_ID EVENT_ID of event within which this event nests.
NESTING_EVENT_TYPE Nesting event type. Either statement , stage or wait .
OPERATION Operation type, for example read, write or lock
NUMBER_OF_BYTES Number of bytes that the operation read or wrote, or NULL for table I/O waits.
FLAGS Reserved for use in the future.

It is possible to empty this table with a TRUNCATE TABLE statement.


events_waits_current and events_waits_history_long are related tables.

1.1.1.2.9.2.1.32 Performance Schema


events_waits_history_long Table
The events_waits_history_long table by default contains the ten thousand most recent completed wait events. This
number can be adjusted by setting the performance_schema_events_waits_history_long_size system variable when the
server starts up.
The table structure is identical to the events_waits_current table structure, and contains the following columns:

Column Description
THREAD_ID Thread associated with the event. Together with EVENT_ID uniquely identifies the row.
Thread's current event number at the start of the event. Together with THREAD_ID uniquely
EVENT_ID
identifies the row.
NULL when the event starts, set to the thread's current event number at the end of the
END_EVENT_ID
event.
EVENT_NAME Event instrument name and a NAME from the setup_instruments table
Name and line number of the source file containing the instrumented code that produced
SOURCE
the event.
TIMER_START Value in picoseconds when the event timing started or NULL if timing is not collected.
TIMER_END Value in picoseconds when the event timing ended, or NULL if timing is not collected.
TIMER_WAIT Value in picoseconds of the event's duration or NULL if timing is not collected.
Number of spin rounds for a mutex, or NULL if spin rounds are not used, or spinning is not
SPINS
instrumented.
Name of the schema that contains the table for table I/O objects, otherwise NULL for file
OBJECT_SCHEMA
I/O and synchronization objects.
File name for file I/O objects, table name for table I/O objects, the socket's IP:PORT value
OBJECT_NAME for a socket object or NULL for a synchronization object.

INDEX_NAME Name of the index, PRIMARY for the primary key, or NULL for no index used.
FILE for a file object, TABLE or TEMPORARY TABLE for a table object, or NULL for a
OBJECT_TYPE
synchronization object.
OBJECT_INSTANCE_BEGIN Address in memory of the object.
NESTING_EVENT_ID EVENT_ID of event within which this event nests.

NESTING_EVENT_TYPE Nesting event type. Either statement , stage or wait .

418/3812
OPERATION Operation type, for example read, write or lock
NUMBER_OF_BYTES Number of bytes that the operation read or wrote, or NULL for table I/O waits.
FLAGS Reserved for use in the future.

It is possible to empty this table with a TRUNCATE TABLE statement.


events_waits_current and events_waits_history are related tables.

1.1.1.2.9.2.1.33 Performance Schema


events_waits_summary_by_account_by_event_name
Table
The Performance Schema events_waits_summary_by_account_by_event_name table contains wait events summarized
by account and event name. It contains the following columns:

Column Description
USER User. Used together with HOST and EVENT_NAME for grouping events.
HOST Host. Used together with USER and EVENT_NAME for grouping events.
EVENT_NAME Event name. Used together with USER and HOST for grouping events.
COUNT_STAR Number of summarized events
SUM_TIMER_WAIT Total wait time of the summarized events that are timed.
MIN_TIMER_WAIT Minimum wait time of the summarized events that are timed.
AVG_TIMER_WAIT Average wait time of the summarized events that are timed.
MAX_TIMER_WAIT Maximum wait time of the summarized events that are timed.

The *_TIMER_WAIT columns only calculate results for timed events, as non-timed events have a NULL wait time.

Example

419/3812
SELECT * FROM events_waits_summary_by_account_by_event_name\G
...
*************************** 915. row ***************************
USER: NULL
HOST: NULL
EVENT_NAME: wait/io/socket/sql/server_tcpip_socket
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
*************************** 916. row ***************************
USER: NULL
HOST: NULL
EVENT_NAME: wait/io/socket/sql/server_unix_socket
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
*************************** 917. row ***************************
USER: NULL
HOST: NULL
EVENT_NAME: wait/io/socket/sql/client_connection
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
*************************** 918. row ***************************
USER: NULL
HOST: NULL
EVENT_NAME: idle
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0

1.1.1.2.9.2.1.34 Performance Schema


events_waits_summary_by_host_by_event_name
Table
The Performance Schema events_waits_summary_by_host_by_event_name table contains wait events summarized by
host and event name. It contains the following columns:

Column Description
HOST Host. Used together with EVENT_NAME for grouping events.
EVENT_NAME Event name. Used together with USER and HOST for grouping events.
COUNT_STAR Number of summarized events
SUM_TIMER_WAIT Total wait time of the summarized events that are timed.
MIN_TIMER_WAIT Minimum wait time of the summarized events that are timed.
AVG_TIMER_WAIT Average wait time of the summarized events that are timed.
MAX_TIMER_WAIT Maximum wait time of the summarized events that are timed.

The *_TIMER_WAIT columns only calculate results for timed events, as non-timed events have a NULL wait time.

Example

420/3812
SELECT * FROM events_waits_summary_by_host_by_event_name\G
...
*************************** 610. row ***************************
HOST: NULL
EVENT_NAME: wait/io/socket/sql/server_unix_socket
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
*************************** 611. row ***************************
HOST: NULL
EVENT_NAME: wait/io/socket/sql/client_connection
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
*************************** 612. row ***************************
HOST: NULL
EVENT_NAME: idle
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0

1.1.1.2.9.2.1.35 Performance Schema


events_waits_summary_by_instance Table
The Performance Schema events_waits_summary_by_instance table contains wait events summarized by instance. It
contains the following columns:

Column Description
EVENT_NAME Event name. Used together with OBJECT_INSTANCE_BEGIN for grouping events.
If an instrument creates multiple instances, each instance has a unique
OBJECT_INSTANCE_BEGIN
OBJECT_INSTANCE_BEGIN value to allow for grouping by instance.

COUNT_STAR Number of summarized events


SUM_TIMER_WAIT Total wait time of the summarized events that are timed.
MIN_TIMER_WAIT Minimum wait time of the summarized events that are timed.
AVG_TIMER_WAIT Average wait time of the summarized events that are timed.
MAX_TIMER_WAIT Maximum wait time of the summarized events that are timed.

The *_TIMER_WAIT columns only calculate results for timed events, as non-timed events have a NULL wait time.

Example

421/3812
SELECT * FROM events_waits_summary_by_instance\G
...
*************************** 202. row ***************************
EVENT_NAME: wait/io/file/sql/binlog
OBJECT_INSTANCE_BEGIN: 140578961969856
COUNT_STAR: 6
SUM_TIMER_WAIT: 90478331960
MIN_TIMER_WAIT: 263344
AVG_TIMER_WAIT: 15079721848
MAX_TIMER_WAIT: 67760576376
*************************** 203. row ***************************
EVENT_NAME: wait/io/file/sql/dbopt
OBJECT_INSTANCE_BEGIN: 140578961970560
COUNT_STAR: 6
SUM_TIMER_WAIT: 39891428472
MIN_TIMER_WAIT: 387168
AVG_TIMER_WAIT: 6648571412
MAX_TIMER_WAIT: 24503293304
*************************** 204. row ***************************
EVENT_NAME: wait/io/file/sql/dbopt
OBJECT_INSTANCE_BEGIN: 140578961971264
COUNT_STAR: 6
SUM_TIMER_WAIT: 39902495024
MIN_TIMER_WAIT: 177888
AVG_TIMER_WAIT: 6650415692
MAX_TIMER_WAIT: 21026400404

1.1.1.2.9.2.1.36 Performance Schema


events_waits_summary_by_thread_by_event_name
Table
The Performance Schema events_waits_summary_by_thread_by_event_name table contains wait events summarized
by thread and event name. It contains the following columns:

Column Description
THREAD_ID Thread associated with the event. Together with EVENT_NAME uniquely identifies the row.
EVENT_NAME Event name. Used together with THREAD_ID for grouping events.
COUNT_STAR Number of summarized events
SUM_TIMER_WAIT Total wait time of the summarized events that are timed.
MIN_TIMER_WAIT Minimum wait time of the summarized events that are timed.
AVG_TIMER_WAIT Average wait time of the summarized events that are timed.
MAX_TIMER_WAIT Maximum wait time of the summarized events that are timed.

The *_TIMER_WAIT columns only calculate results for timed events, as non-timed events have a NULL wait time.

Example

422/3812
SELECT * FROM events_waits_summary_by_thread_by_event_name\G
...
*************************** 6424. row ***************************
THREAD_ID: 64
EVENT_NAME: wait/io/socket/sql/server_unix_socket
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
*************************** 6425. row ***************************
THREAD_ID: 64
EVENT_NAME: wait/io/socket/sql/client_connection
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
*************************** 6426. row ***************************
THREAD_ID: 64
EVENT_NAME: idle
COUNT_STAR: 73
SUM_TIMER_WAIT: 22005252162000000
MIN_TIMER_WAIT: 3000000
AVG_TIMER_WAIT: 301441810000000
MAX_TIMER_WAIT: 4912417573000000

1.1.1.2.9.2.1.37 Performance Schema


events_waits_summary_by_user_by_event_name
Table
The Performance Schema events_waits_summary_by_user_by_event_name table contains wait events summarized by
user and event name. It contains the following columns:

Column Description
USER User. Used together with EVENT_NAME for grouping events.
EVENT_NAME Event name. Used together with USER for grouping events.
COUNT_STAR Number of summarized events
SUM_TIMER_WAIT Total wait time of the summarized events that are timed.
MIN_TIMER_WAIT Minimum wait time of the summarized events that are timed.
AVG_TIMER_WAIT Average wait time of the summarized events that are timed.
MAX_TIMER_WAIT Maximum wait time of the summarized events that are timed.

The *_TIMER_WAIT columns only calculate results for timed events, as non-timed events have a NULL wait time.

Example

423/3812
SELECT * FROM events_waits_summary_by_user_by_event_name\G
...
*************************** 916. row ***************************
USER: NULL
EVENT_NAME: wait/io/socket/sql/server_unix_socket
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
*************************** 917. row ***************************
USER: NULL
EVENT_NAME: wait/io/socket/sql/client_connection
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
*************************** 918. row ***************************
USER: NULL
EVENT_NAME: idle
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0

1.1.1.2.9.2.1.38 Performance Schema


events_waits_summary_global_by_event_name
Table
The Performance Schema events_waits_summary_global_by_event_name table contains wait events summarized by
event name. It contains the following columns:

Column Description
EVENT_NAME Event name.
COUNT_STAR Number of summarized events
SUM_TIMER_WAIT Total wait time of the summarized events that are timed.
MIN_TIMER_WAIT Minimum wait time of the summarized events that are timed.
AVG_TIMER_WAIT Average wait time of the summarized events that are timed.
MAX_TIMER_WAIT Maximum wait time of the summarized events that are timed.

The *_TIMER_WAIT columns only calculate results for timed events, as non-timed events have a NULL wait time.

Example

424/3812
SELECT * FROM events_waits_summary_global_by_event_name\G
...
*************************** 303. row ***************************
EVENT_NAME: wait/io/socket/sql/server_tcpip_socket
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
*************************** 304. row ***************************
EVENT_NAME: wait/io/socket/sql/server_unix_socket
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
*************************** 305. row ***************************
EVENT_NAME: wait/io/socket/sql/client_connection
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
*************************** 306. row ***************************
EVENT_NAME: idle
COUNT_STAR: 265
SUM_TIMER_WAIT: 46861125181000000
MIN_TIMER_WAIT: 1000000
AVG_TIMER_WAIT: 176834434000000
MAX_TIMER_WAIT: 4912417573000000

1.1.1.2.9.2.1.39 Performance Schema


file_instances Table
Description
The file_instances table lists instances of instruments seen by the Performance Schema when executing file I/O
instrumentation, and the associated files. Only files that have been opened, and that have not been deleted, will be
listed in the table.
The performance_schema_max_file_instances system variable specifies the maximum number of instrumented file
objects.

Column Description
FILE_NAME File name.
EVENT_NAME Instrument name associated with the file.
OPEN_COUNT Open handles on the file. A value of greater than zero means that the file is currently open.

Example

425/3812
SELECT * FROM performance_schema.file_instances WHERE OPEN_COUNT>0;
+----------------------------------------------------+--------------------------------------+----------
--+
| FILE_NAME | EVENT_NAME |
OPEN_COUNT |
+----------------------------------------------------+--------------------------------------+----------
--+
| /var/log/mysql/mariadb-bin.index | wait/io/file/sql/binlog_index |
1 |
| /var/lib/mysql/ibdata1 | wait/io/file/innodb/innodb_data_file |
2 |
| /var/lib/mysql/ib_logfile0 | wait/io/file/innodb/innodb_log_file |
2 |
| /var/lib/mysql/ib_logfile1 | wait/io/file/innodb/innodb_log_file |
2 |
| /var/lib/mysql/mysql/gtid_slave_pos.ibd | wait/io/file/innodb/innodb_data_file |
3 |
| /var/lib/mysql/mysql/innodb_index_stats.ibd | wait/io/file/innodb/innodb_data_file |
3 |
| /var/lib/mysql/mysql/innodb_table_stats.ibd | wait/io/file/innodb/innodb_data_file |
3 |
...

1.1.1.2.9.2.1.40 Performance Schema


file_summary_by_event_name Table
The Performance Schema file_summary_by_event_name table contains file events summarized by event name. It
contains the following columns:

Column Description
EVENT_NAME Event name.
COUNT_STAR Number of summarized events
SUM_TIMER_WAIT Total wait time of the summarized events that are timed.
MIN_TIMER_WAIT Minimum wait time of the summarized events that are timed.
AVG_TIMER_WAIT Average wait time of the summarized events that are timed.
MAX_TIMER_WAIT Maximum wait time of the summarized events that are timed.
COUNT_READ Number of all read operations, including FGETS , FGETC , FREAD , and READ .
SUM_TIMER_READ Total wait time of all read operations that are timed.
MIN_TIMER_READ Minimum wait time of all read operations that are timed.
AVG_TIMER_READ Average wait time of all read operations that are timed.
MAX_TIMER_READ Maximum wait time of all read operations that are timed.
SUM_NUMBER_OF_BYTES_READ Bytes read by read operations.
Number of all write operations, including FPUTS , FPUTC , FPRINTF , VFPRINTF ,
COUNT_WRITE
FWRITE , and PWRITE .

SUM_TIMER_WRITE Total wait time of all write operations that are timed.
MIN_TIMER_WRITE Minimum wait time of all write operations that are timed.
AVG_TIMER_WRITE Average wait time of all write operations that are timed.
MAX_TIMER_WRITE Maximum wait time of all write operations that are timed.
SUM_NUMBER_OF_BYTES_WRITE Bytes written by write operations.
Number of all miscellaneous operations not counted above, including CREATE ,
COUNT_MISC DELETE , OPEN , CLOSE , STREAM_OPEN , STREAM_CLOSE , SEEK , TELL , FLUSH , STAT ,
FSTAT , CHSIZE , RENAME , and SYNC .

SUM_TIMER_MISC Total wait time of all miscellaneous operations that are timed.
MIN_TIMER_MISC Minimum wait time of all miscellaneous operations that are timed.
AVG_TIMER_MISC Average wait time of all miscellaneous operations that are timed.
MAX_TIMER_MISC Maximum wait time of all miscellaneous operations that are timed.

426/3812
I/O operations can be avoided by caching, in which case they will not be recorded in this table.
You can TRUNCATE the table, which will reset all counters to zero.

Example
SELECT * FROM file_summary_by_event_name\G
...
*************************** 49. row ***************************
EVENT_NAME: wait/io/file/aria/MAD
COUNT_STAR: 60
SUM_TIMER_WAIT: 397234368
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 6620224
MAX_TIMER_WAIT: 16808672
COUNT_READ: 0
SUM_TIMER_READ: 0
MIN_TIMER_READ: 0
AVG_TIMER_READ: 0
MAX_TIMER_READ: 0
SUM_NUMBER_OF_BYTES_READ: 0
COUNT_WRITE: 0
SUM_TIMER_WRITE: 0
MIN_TIMER_WRITE: 0
AVG_TIMER_WRITE: 0
MAX_TIMER_WRITE: 0
SUM_NUMBER_OF_BYTES_WRITE: 0
COUNT_MISC: 60
SUM_TIMER_MISC: 397234368
MIN_TIMER_MISC: 0
AVG_TIMER_MISC: 6620224
MAX_TIMER_MISC: 16808672
*************************** 50. row ***************************
EVENT_NAME: wait/io/file/aria/control
COUNT_STAR: 3
SUM_TIMER_WAIT: 24055778544
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 8018592848
MAX_TIMER_WAIT: 24027262400
COUNT_READ: 1
SUM_TIMER_READ: 24027262400
MIN_TIMER_READ: 0
AVG_TIMER_READ: 24027262400
MAX_TIMER_READ: 24027262400
SUM_NUMBER_OF_BYTES_READ: 52
COUNT_WRITE: 0
SUM_TIMER_WRITE: 0
MIN_TIMER_WRITE: 0
AVG_TIMER_WRITE: 0
MAX_TIMER_WRITE: 0
SUM_NUMBER_OF_BYTES_WRITE: 0
COUNT_MISC: 2
SUM_TIMER_MISC: 28516144
MIN_TIMER_MISC: 0
AVG_TIMER_MISC: 14258072
MAX_TIMER_MISC: 27262208

1.1.1.2.9.2.1.41 Performance Schema


file_summary_by_instance Table
The Performance Schema file_summary_by_instance table contains file events summarized by instance. It contains
the following columns:

Column Description
FILE_NAME File name.
EVENT_NAME Event name.
Address in memory. Together with FILE_NAME and EVENT_NAME uniquely identifies a
OBJECT_INSTANCE_BEGIN
row.
COUNT_STAR Number of summarized events
SUM_TIMER_WAIT Total wait time of the summarized events that are timed.

427/3812
MIN_TIMER_WAIT Minimum wait time of the summarized events that are timed.
AVG_TIMER_WAIT Average wait time of the summarized events that are timed.
MAX_TIMER_WAIT Maximum wait time of the summarized events that are timed.
COUNT_READ Number of all read operations, including FGETS , FGETC , FREAD , and READ .
SUM_TIMER_READ Total wait time of all read operations that are timed.
MIN_TIMER_READ Minimum wait time of all read operations that are timed.
AVG_TIMER_READ Average wait time of all read operations that are timed.
MAX_TIMER_READ Maximum wait time of all read operations that are timed.
SUM_NUMBER_OF_BYTES_READ Bytes read by read operations.
Number of all write operations, including FPUTS , FPUTC , FPRINTF , VFPRINTF ,
COUNT_WRITE
FWRITE , and PWRITE .

SUM_TIMER_WRITE Total wait time of all write operations that are timed.
MIN_TIMER_WRITE Minimum wait time of all write operations that are timed.
AVG_TIMER_WRITE Average wait time of all write operations that are timed.
MAX_TIMER_WRITE Maximum wait time of all write operations that are timed.
SUM_NUMBER_OF_BYTES_WRITE Bytes written by write operations.
Number of all miscellaneous operations not counted above, including CREATE ,
COUNT_MISC DELETE , OPEN , CLOSE , STREAM_OPEN , STREAM_CLOSE , SEEK , TELL , FLUSH , STAT ,
FSTAT , CHSIZE , RENAME , and SYNC .

SUM_TIMER_MISC Total wait time of all miscellaneous operations that are timed.
MIN_TIMER_MISC Minimum wait time of all miscellaneous operations that are timed.
AVG_TIMER_MISC Average wait time of all miscellaneous operations that are timed.
MAX_TIMER_MISC Maximum wait time of all miscellaneous operations that are timed.

I/O operations can be avoided by caching, in which case they will not be recorded in this table.
You can TRUNCATE the table, which will reset all counters to zero.

Example

428/3812
SELECT * FROM file_summary_by_instance\G
...
*************************** 204. row ***************************
FILE_NAME: /var/lib/mysql/test/db.opt
EVENT_NAME: wait/io/file/sql/dbopt
OBJECT_INSTANCE_BEGIN: 140578961971264
COUNT_STAR: 6
SUM_TIMER_WAIT: 39902495024
MIN_TIMER_WAIT: 177888
AVG_TIMER_WAIT: 6650415692
MAX_TIMER_WAIT: 21026400404
COUNT_READ: 1
SUM_TIMER_READ: 21026400404
MIN_TIMER_READ: 21026400404
AVG_TIMER_READ: 21026400404
MAX_TIMER_READ: 21026400404
SUM_NUMBER_OF_BYTES_READ: 65
COUNT_WRITE: 0
SUM_TIMER_WRITE: 0
MIN_TIMER_WRITE: 0
AVG_TIMER_WRITE: 0
MAX_TIMER_WRITE: 0
SUM_NUMBER_OF_BYTES_WRITE: 0
COUNT_MISC: 5
SUM_TIMER_MISC: 18876094620
MIN_TIMER_MISC: 177888
AVG_TIMER_MISC: 3775218924
MAX_TIMER_MISC: 18864558060
*************************** 205. row ***************************
FILE_NAME: /var/log/mysql/mariadb-bin.000157
EVENT_NAME: wait/io/file/sql/binlog
OBJECT_INSTANCE_BEGIN: 140578961971968
COUNT_STAR: 6
SUM_TIMER_WAIT: 73985877680
MIN_TIMER_WAIT: 251136
AVG_TIMER_WAIT: 12330979468
MAX_TIMER_WAIT: 73846656340
COUNT_READ: 0
SUM_TIMER_READ: 0
MIN_TIMER_READ: 0
AVG_TIMER_READ: 0
MAX_TIMER_READ: 0
SUM_NUMBER_OF_BYTES_READ: 0
COUNT_WRITE: 2
SUM_TIMER_WRITE: 62583004
MIN_TIMER_WRITE: 27630192
AVG_TIMER_WRITE: 31291284
MAX_TIMER_WRITE: 34952812
SUM_NUMBER_OF_BYTES_WRITE: 369
COUNT_MISC: 4
SUM_TIMER_MISC: 73923294676
MIN_TIMER_MISC: 251136
AVG_TIMER_MISC: 18480823560
MAX_TIMER_MISC: 73846656340

1.1.1.2.9.2.1.42 Performance Schema


global_status Table
MariaDB starting with 10.5.2
The global_status table was added in MariaDB 10.5.2.

The global_status table contains a list of status variables and their global values. The table only stores status
variable statistics for threads which are instrumented, and does not collect statistics for Com_xxx variables.
The table contains the following columns:

Column Description
VARIABLE_NAME The global status variable name.
VARIABLE_VALUE The global status variable value.

TRUNCATE TABLE resets global status variables, including thread, account, host, and user status, but not those that
are never reset by the server.

429/3812
1.1.1.2.9.2.1.43 Performance Schema hosts
Table
Description
The hosts table contains a row for each host used by clients to connect to the server, containing current and total
connections.
The size is determined by the performance_schema_hosts_size system variable, which, if set to zero, will disable
connection statistics in the hosts table.
It contains the following columns:

Column Description
Host name used by the client to connect, NULL for internal threads or user sessions that
HOST
failed to authenticate.
CURRENT_CONNECTIONS Current number of the host's connections.
TOTAL_CONNECTIONS Total number of the host's connections

Example
SELECT * FROM hosts;
+-----------+---------------------+-------------------+
| HOST | CURRENT_CONNECTIONS | TOTAL_CONNECTIONS |
+-----------+---------------------+-------------------+
| localhost | 1 | 45 |
| NULL | 20 | 23 |
+-----------+---------------------+-------------------+

1.1.1.2.9.2.1.44 Performance Schema


host_cache Table
The host_cache table contains host and IP information from the host_cache, used for avoiding DNS lookups for new
client connections.
The host_cache table contains the following columns:

Column Description
IP Client IP address.
HOST IP's resolved DNS host name, or NULL if unknown.
YES if the IP-to-host DNS lookup was successful, and the HOST
column can be used to avoid DNS calls, or NO if unsuccessful, in
HOST_VALIDATED
which case DNS lookup is performed for each connect until either
successful or a permanent error.
Number of connection errors. Counts only protocol handshake
SUM_CONNECT_ERRORS errors for hosts that passed validation. These errors count towards
max_connect_errors.
Number of blocked connections because SUM_CONNECT_ERRORS
COUNT_HOST_BLOCKED_ERRORS exceeded the max_connect_errors system variable.

COUNT_NAMEINFO_TRANSIENT_ERRORS Number of transient errors during IP-to-host DNS lookups.


COUNT_NAMEINFO_PERMANENT_ERRORS Number of permanent errors during IP-to-host DNS lookups.
Number of host name format errors, for example a numeric host
COUNT_FORMAT_ERRORS
column.
COUNT_ADDRINFO_TRANSIENT_ERRORS Number of transient errors during host-to-IP reverse DNS lookups.
Number of permanent errors during host-to-IP reverse DNS
COUNT_ADDRINFO_PERMANENT_ERRORS
lookups.

430/3812
Number of forward-confirmed reverse DNS errors, which occur
COUNT_FCRDNS_ERRORS when IP-to-host DNS lookup does not match the originating IP
address.
Number of errors occurring because no user from the host is
permitted to log in. These attempts return error code 1130
COUNT_HOST_ACL_ERRORS
ER_HOST_NOT_PRIVILEGED and do not proceed to username and
password authentication.
Number of errors due to requesting an authentication plugin that
COUNT_NO_AUTH_PLUGIN_ERRORS was not available. This can be due to the plugin never having been
loaded, or the load attempt failing.
Number of errors reported by an authentication plugin. Plugins can
increment COUNT_AUTHENTICATION_ERRORS or
COUNT_AUTH_PLUGIN_ERRORS
COUNT_HANDSHAKE_ERRORS instead, but, if specified or the error is
unknown, this column is incremented.
COUNT_HANDSHAKE_ERRORS Number of errors detected at the wire protocol level.
Number of errors detected when a proxy user is proxied to a user
COUNT_PROXY_USER_ERRORS
that does not exist.
Number of errors detected when a proxy user is proxied to a user
COUNT_PROXY_USER_ACL_ERRORS
that exists, but the proxy user doesn't have the PROXY privilege.
COUNT_AUTHENTICATION_ERRORS Number of errors where authentication failed.
COUNT_SSL_ERRORS Number of errors due to TLS problems.
COUNT_MAX_USER_CONNECTIONS_ERRORS Number of errors due to the per-user quota being exceeded.

COUNT_MAX_USER_CONNECTIONS_PER_HOUR_ERRORS Number of errors due to the per-hour quota being exceeded.

Number of errors due to the user not having permission to access


COUNT_DEFAULT_DATABASE_ERRORS
the specified default database, or it not existing.
Number of errors due to statements in the init_connect system
COUNT_INIT_CONNECT_ERRORS
variable.
Number of local server errors, such as out-of-memory errors,
COUNT_LOCAL_ERRORS
unrelated to network, authentication, or authorization.
Number of unknown errors that cannot be allocated to another
COUNT_UNKNOWN_ERRORS
column.
FIRST_SEEN Timestamp of the first connection attempt by the IP.
LAST_SEEN Timestamp of the most recent connection attempt by the IP.
FIRST_ERROR_SEEN Timestamp of the first error seen from the IP.
LAST_ERROR_SEEN Timestamp of the most recent error seen from the IP.

The host_cache table, along with the host_cache , is cleared with FLUSH HOSTS, TRUNCATE TABLE host_cache
or by setting the host_cache_size system variable at runtime.

1.1.1.2.9.2.1.45 Performance Schema


memory_summary_by_account_by_event_name
Table
MariaDB starting with 10.5.2
The memory_summary_by_account_by_event_name table was introduced in MariaDB 10.5.2.

There are five memory summary tables in the Performance Schema that share a number of fields in common. These
include:
memory_summary_by_account_by_event_name
memory_summary_by_host_by_event_name
memory_summary_by_thread_by_event_name
memory_summary_by_user_by_event_name
memory_global_by_event_name
The memory_summary_by_account_by_event_name table contains memory usage statistics aggregated by account and

431/3812
event.
The table contains the following columns:

Field Type Null Default Description


USER char(32) YES NULL User portion of the account.
HOST char(60) YES NULL Host portion of the account.
EVENT_NAME varchar(128) NO NULL Event name.
bigint(20)
COUNT_ALLOC NO NULL Total number of allocations to memory.
unsigned
bigint(20) Total number of attempts to free the
COUNT_FREE NO NULL
unsigned allocated memory.
bigint(20)
SUM_NUMBER_OF_BYTES_ALLOC NO NULL Total number of bytes allocated.
unsigned
bigint(20)
SUM_NUMBER_OF_BYTES_FREE NO NULL Total number of bytes freed
unsigned
Lowest number of allocated blocks
LOW_COUNT_USED bigint(20) NO NULL (lowest value of
CURRENT_COUNT_USED).
Currently allocated blocks that have not
CURRENT_COUNT_USED bigint(20) NO NULL been freed (COUNT_ALLOC minus
COUNT_FREE).
Highest number of allocated blocks
HIGH_COUNT_USED bigint(20) NO NULL (highest value of
CURRENT_COUNT_USED).
LOW_NUMBER_OF_BYTES_USED bigint(20) NO NULL Lowest number of bytes used.
Current number of bytes used (total
CURRENT_NUMBER_OF_BYTES_USED bigint(20) NO NULL
allocated minus total freed).
HIGH_NUMBER_OF_BYTES_USED bigint(20) NO NULL Highest number of bytes used.

1.1.1.2.9.2.1.46 Performance Schema


memory_summary_by_host_by_event_name
Table
MariaDB starting with 10.5.2
The memory_summary_by_host_by_event_name table was introduced in MariaDB 10.5.2.

There are five memory summary tables in the Performance Schema that share a number of fields in common. These
include:
memory_summary_by_account_by_event_name
memory_summary_by_host_by_event_name
memory_summary_by_thread_by_event_name
memory_summary_by_user_by_event_name
memory_global_by_event_name
The memory_summary_by_host_by_event_name table contains memory usage statistics aggregated by host and event.
The table contains the following columns:

Field Type Null Default Description


HOST char(60) YES NULL Host portion of the account.
EVENT_NAME varchar(128) NO NULL Event name.
bigint(20)
COUNT_ALLOC NO NULL Total number of allocations to memory.
unsigned
bigint(20) Total number of attempts to free the
COUNT_FREE NO NULL
unsigned allocated memory.

432/3812
bigint(20)
SUM_NUMBER_OF_BYTES_ALLOC unsigned NO NULL Total number of bytes allocated.

bigint(20)
SUM_NUMBER_OF_BYTES_FREE NO NULL Total number of bytes freed
unsigned
Lowest number of allocated blocks
LOW_COUNT_USED bigint(20) NO NULL (lowest value of
CURRENT_COUNT_USED).
Currently allocated blocks that have not
CURRENT_COUNT_USED bigint(20) NO NULL been freed (COUNT_ALLOC minus
COUNT_FREE).
Highest number of allocated blocks
HIGH_COUNT_USED bigint(20) NO NULL (highest value of
CURRENT_COUNT_USED).
LOW_NUMBER_OF_BYTES_USED bigint(20) NO NULL Lowest number of bytes used.
Current number of bytes used (total
CURRENT_NUMBER_OF_BYTES_USED bigint(20) NO NULL
allocated minus total freed).
HIGH_NUMBER_OF_BYTES_USED bigint(20) NO NULL Highest number of bytes used.

1.1.1.2.9.2.1.47 Performance Schema


memory_summary_by_thread_by_event_name
Table
MariaDB starting with 10.5.2
The memory_summary_by_thread_by_event_name table was introduced in MariaDB 10.5.2.

There are five memory summary tables in the Performance Schema that share a number of fields in common. These
include:
memory_summary_by_account_by_event_name
memory_summary_by_host_by_event_name
memory_summary_by_thread_by_event_name
memory_summary_by_user_by_event_name
memory_global_by_event_name
The memory_summary_by_thread_by_event_name table contains memory usage statistics aggregated by thread and
event.
The table contains the following columns:

Field Type Null Default Description


bigint(20)
THREAD_ID NO NULL Thread id.
unsigned
EVENT_NAME varchar(128) NO NULL Event name.
bigint(20)
COUNT_ALLOC NO NULL Total number of allocations to memory.
unsigned
bigint(20) Total number of attempts to free the
COUNT_FREE NO NULL
unsigned allocated memory.
bigint(20)
SUM_NUMBER_OF_BYTES_ALLOC NO NULL Total number of bytes allocated.
unsigned
bigint(20)
SUM_NUMBER_OF_BYTES_FREE NO NULL Total number of bytes freed
unsigned
Lowest number of allocated blocks (lowest
LOW_COUNT_USED bigint(20) NO NULL
value of CURRENT_COUNT_USED).
Currently allocated blocks that have not
CURRENT_COUNT_USED bigint(20) NO NULL been freed (COUNT_ALLOC minus
COUNT_FREE).

433/3812
Highest number of allocated blocks
HIGH_COUNT_USED bigint(20) NO NULL (highest value of
CURRENT_COUNT_USED).

LOW_NUMBER_OF_BYTES_USED bigint(20) NO NULL Lowest number of bytes used.


Current number of bytes used (total
CURRENT_NUMBER_OF_BYTES_USED bigint(20) NO NULL
allocated minus total freed).
HIGH_NUMBER_OF_BYTES_USED bigint(20) NO NULL Highest number of bytes used.

1.1.1.2.9.2.1.48 Performance Schema


memory_summary_by_user_by_event_name
Table
MariaDB starting with 10.5.2
The memory_summary_by_user_by_event_name table was introduced in MariaDB 10.5.2.

There are five memory summary tables in the Performance Schema that share a number of fields in common. These
include:
memory_summary_by_account_by_event_name
memory_summary_by_host_by_event_name
memory_summary_by_thread_by_event_name
memory_summary_by_user_by_event_name
memory_global_by_event_name
The memory_summary_by_user_by_event_name table contains memory usage statistics aggregated by user and event.
The table contains the following columns:

Field Type Null Default Description


USER char(32) YES NULL User portion of the account.
EVENT_NAME varchar(128) NO NULL Event name.
bigint(20)
COUNT_ALLOC NO NULL Total number of allocations to memory.
unsigned
bigint(20) Total number of attempts to free the
COUNT_FREE NO NULL
unsigned allocated memory.
bigint(20)
SUM_NUMBER_OF_BYTES_ALLOC NO NULL Total number of bytes allocated.
unsigned
bigint(20)
SUM_NUMBER_OF_BYTES_FREE NO NULL Total number of bytes freed
unsigned
Lowest number of allocated blocks
LOW_COUNT_USED bigint(20) NO NULL (lowest value of
CURRENT_COUNT_USED).
Currently allocated blocks that have not
CURRENT_COUNT_USED bigint(20) NO NULL been freed (COUNT_ALLOC minus
COUNT_FREE).
Highest number of allocated blocks
HIGH_COUNT_USED bigint(20) NO NULL (highest value of
CURRENT_COUNT_USED).
LOW_NUMBER_OF_BYTES_USED bigint(20) NO NULL Lowest number of bytes used.
Current number of bytes used (total
CURRENT_NUMBER_OF_BYTES_USED bigint(20) NO NULL
allocated minus total freed).
HIGH_NUMBER_OF_BYTES_USED bigint(20) NO NULL Highest number of bytes used.

1.1.1.2.9.2.1.49 Performance Schema


memory_summary_global_by_event_name
434/3812
Table
MariaDB starting with 10.5.2
The memory_summary_global_by_event_name table was introduced in MariaDB 10.5.2.

There are five memory summary tables in the Performance Schema that share a number of fields in common. These
include:
memory_summary_by_account_by_event_name
memory_summary_by_host_by_event_name
memory_summary_by_thread_by_event_name
memory_summary_by_user_by_event_name
memory_global_by_event_name
The memory_summary_global_by_event_name table contains memory usage statistics aggregated by event and event.
The table contains the following columns:

Field Type Null Default Description


EVENT_NAME varchar(128) NO NULL Event name.
bigint(20)
COUNT_ALLOC NO NULL Total number of allocations to memory.
unsigned
bigint(20) Total number of attempts to free the
COUNT_FREE NO NULL
unsigned allocated memory.
bigint(20)
SUM_NUMBER_OF_BYTES_ALLOC NO NULL Total number of bytes allocated.
unsigned
bigint(20)
SUM_NUMBER_OF_BYTES_FREE NO NULL Total number of bytes freed
unsigned
Lowest number of allocated blocks (lowest
LOW_COUNT_USED bigint(20) NO NULL
value of CURRENT_COUNT_USED).
Currently allocated blocks that have not
CURRENT_COUNT_USED bigint(20) NO NULL been freed (COUNT_ALLOC minus
COUNT_FREE).
Highest number of allocated blocks
HIGH_COUNT_USED bigint(20) NO NULL (highest value of
CURRENT_COUNT_USED).
LOW_NUMBER_OF_BYTES_USED bigint(20) NO NULL Lowest number of bytes used.
Current number of bytes used (total
CURRENT_NUMBER_OF_BYTES_USED bigint(20) NO NULL
allocated minus total freed).
HIGH_NUMBER_OF_BYTES_USED bigint(20) NO NULL Highest number of bytes used.

Example
Seeing what memory was most often allocated for:

SELECT * FROM memory_summary_global_by_event_name


ORDER BY count_alloc DESC LIMIT 1\G
*************************** 1. row ***************************
EVENT_NAME: memory/sql/QUICK_RANGE_SELECT::alloc
COUNT_ALLOC: 147976
COUNT_FREE: 147976
SUM_NUMBER_OF_BYTES_ALLOC: 600190656
SUM_NUMBER_OF_BYTES_FREE: 600190656
LOW_COUNT_USED: 0
CURRENT_COUNT_USED: 0
HIGH_COUNT_USED: 68
LOW_NUMBER_OF_BYTES_USED: 0
CURRENT_NUMBER_OF_BYTES_USED: 0
HIGH_NUMBER_OF_BYTES_USED: 275808

1.1.1.2.9.2.1.50 Performance Schema


metadata_locks Table
435/3812
MariaDB starting with 10.5.2
The metadata_locks table was introduced in MariaDB 10.5.2.

The metadata_locks table contains metadata lock information.


To enable metadata lock instrumention, at runtime:

UPDATE performance_schema.setup_instruments SET enabled='YES', timed='YES'


WHERE name LIKE 'wait/lock/metadata%';

or in the configuration file:

performance-schema-instrument='wait/lock/metadata/sql/mdl=ON'

The table is by default autosized, but the size can be configured with the performance_schema_max_metadata_locks
system variabe.
The table is read-only, and TRUNCATE TABLE cannot be used to empty the table.
The table contains the following columns:

Field Type Null Default Description


Object type. One of BACKUP , COMMIT , EVENT ,
FUNCTION , GLOBAL , LOCKING SERVICE , PROCEDURE ,
OBJECT_TYPE varchar(64) NO NULL
SCHEMA , TABLE , TABLESPACE , TRIGGER (unused) or
USER LEVEL LOCK .

OBJECT_SCHEMA varchar(64) YES NULL Object schema.


OBJECT_NAME varchar(64) YES NULL Object name.
bigint(20)
OBJECT_INSTANCE_BEGIN NO NULL Address in memory of the instrumented object.
unsigned
Lock type. One of BACKUP_FTWRL1 , BACKUP_START ,
BACKUP_TRANS_DML , EXCLUSIVE ,
LOCK_TYPE varchar(32) NO NULL INTENTION_EXCLUSIVE , SHARED , SHARED_HIGH_PRIO ,
SHARED_NO_READ_WRITE , SHARED_NO_WRITE ,
SHARED_READ , SHARED_UPGRADABLE or SHARED_WRITE .

Lock duration. One of EXPLICIT (locks released by


explicit action, for example a global lock acquired with
FLUSH TABLES WITH READ LOCK) , STATEMENT
LOCK_DURATION varchar(32) NO NULL
(locks implicitly released at statement end) or
TRANSACTION (locks implicitly released at transaction
end).
Lock status. One of GRANTED , KILLED , PENDING ,
LOCK_STATUS varchar(32) NO NULL POST_RELEASE_NOTIFY , PRE_ACQUIRE_NOTIFY , TIMEOUT
or VICTIM .
Source file containing the instrumented code that
produced the event, as well as the line number where
SOURCE varchar(64) YES NULL
the instrumentation occurred. This allows one to
examine the source code involved.
bigint(20)
OWNER_THREAD_ID YES NULL Thread that requested the lock.
unsigned
bigint(20)
OWNER_EVENT_ID YES NULL Event that requested the lock.
unsigned

1.1.1.2.9.2.1.51 Performance Schema


mutex_instances Table
Description
The mutex_instances table lists all mutexes that the Performance Schema seeing while the server is executing.
A mutex is a code mechanism for ensuring that threads can only access resources one at a time. A second thread
attempting to access a resource will find it protected by a mutex, and will wait for it to be unlocked.
436/3812
The performance_schema_max_mutex_instances system variable specifies the maximum number of instrumented mutex
instances.

Column Description
NAME Instrument name associated with the mutex.
OBJECT_INSTANCE_BEGIN Memory address of the instrumented mutex.
LOCKED_BY_THREAD_ID The THREAD_ID of the locking thread if a thread has a mutex locked, otherwise NULL .

1.1.1.2.9.2.1.52 Performance Schema


objects_summary_global_by_type Table
It aggregates object wait events, and contains the following columns:

Column Description
OBJECT_TYPE Groups records together with OBJECT_SCHEMA and OBJECT_NAME .
OBJECT_SCHEMA Groups records together with OBJECT_TYPE and OBJECT_NAME .
OBJECT_NAME Groups records together with OBJECT_SCHEMA and OBJECT_TYPE .
COUNT_STAR Number of summarized events
SUM_TIMER_WAIT Total wait time of the summarized events that are timed.
MIN_TIMER_WAIT Minimum wait time of the summarized events that are timed.
AVG_TIMER_WAIT Average wait time of the summarized events that are timed.
MAX_TIMER_WAIT Maximum wait time of the summarized events that are timed.

You can TRUNCATE the table, which will reset all counters to zero.

Example
SELECT * FROM objects_summary_global_by_type\G
...
*************************** 101. row ***************************
OBJECT_TYPE: TABLE
OBJECT_SCHEMA: test
OBJECT_NAME: v
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
*************************** 102. row ***************************
OBJECT_TYPE: TABLE
OBJECT_SCHEMA: test
OBJECT_NAME: xx2
COUNT_STAR: 2
SUM_TIMER_WAIT: 1621920
MIN_TIMER_WAIT: 481344
AVG_TIMER_WAIT: 810960
MAX_TIMER_WAIT: 1140576

1.1.1.2.9.2.1.53 Performance Schema


performance_timers Table
Description
The performance_timers table lists available event timers.
It contains the following columns:

Column Description
TIMER_NAME Time name, used in the setup_timers table.

437/3812
TIMER_FREQUENCY Number of timer units per second. Dependent on the processor speed.

TIMER_RESOLUTION Number of timer units by which timed values increase each time.
Minimum timer overhead, determined during initialization by calling the timer 20 times and
TIMER_OVERHEAD selecting the smallest value. Total overhead will be at least double this, as the timer is called at
the beginning and end of each timed event.

Any NULL values indicate that that particular timer is not available on your platform, Any timer names with a non-NULL
value can be used in the setup_timers table.

Example
SELECT * FROM performance_timers;
+-------------+-----------------+------------------+---------------------+
| TIMER_NAME | TIMER_FREQUENCY | TIMER_RESOLUTION | TIMER_OVERHEAD |
+-------------+-----------------+------------------+---------------------+
| CYCLE | 2293651741 | 1 | 28 |
| NANOSECOND | 1000000000 | 1 | 48 |
| MICROSECOND | 1000000 | 1 | 52 |
| MILLISECOND | 1000 | 1000 | 9223372036854775807 |
| TICK | 106 | 1 | 496 |
+-------------+-----------------+------------------+---------------------+

1.1.1.2.9.2.1.54 Performance Schema


prepared_statements_instances Table
MariaDB starting with 10.5.2
The prepared_statements_instances table was introduced in MariaDB 10.5.2.

The prepared_statements_instances table contains aggregated statistics of prepared statements.


The maximum number of rows in the table is determined by the
performance_schema_max_prepared_statement_instances system variable, which is by default autosized on startup.
The table contains the following columns:

438/3812
+-----------------------------+--------------------------------------------------------+------+-----+--
-------+-------+
| Field | Type | Null | Key |
Default | Extra |
+-----------------------------+--------------------------------------------------------+------+-----+--
-------+-------+
| OBJECT_INSTANCE_BEGIN | bigint(20) unsigned | NO | |
NULL | |
| STATEMENT_ID | bigint(20) unsigned | NO | |
NULL | |
| STATEMENT_NAME | varchar(64) | YES | |
NULL | |
| SQL_TEXT | longtext | NO | |
NULL | |
| OWNER_THREAD_ID | bigint(20) unsigned | NO | |
NULL | |
| OWNER_EVENT_ID | bigint(20) unsigned | NO | |
NULL | |
| OWNER_OBJECT_TYPE | enum('EVENT','FUNCTION','PROCEDURE','TABLE','TRIGGER') | YES | |
NULL | |
| OWNER_OBJECT_SCHEMA | varchar(64) | YES | |
NULL | |
| OWNER_OBJECT_NAME | varchar(64) | YES | |
NULL | |
| TIMER_PREPARE | bigint(20) unsigned | NO | |
NULL | |
| COUNT_REPREPARE | bigint(20) unsigned | NO | |
NULL | |
| COUNT_EXECUTE | bigint(20) unsigned | NO | |
NULL | |
| SUM_TIMER_EXECUTE | bigint(20) unsigned | NO | |
NULL | |
| MIN_TIMER_EXECUTE | bigint(20) unsigned | NO | |
NULL | |
| AVG_TIMER_EXECUTE | bigint(20) unsigned | NO | |
NULL | |
| MAX_TIMER_EXECUTE | bigint(20) unsigned | NO | |
NULL | |
| SUM_LOCK_TIME | bigint(20) unsigned | NO | |
NULL | |
| SUM_ERRORS | bigint(20) unsigned | NO | |
NULL | |
| SUM_WARNINGS | bigint(20) unsigned | NO | |
NULL | |
| SUM_ROWS_AFFECTED | bigint(20) unsigned | NO | |
NULL | |
| SUM_ROWS_SENT | bigint(20) unsigned | NO | |
NULL | |
| SUM_ROWS_EXAMINED | bigint(20) unsigned | NO | |
NULL | |
| SUM_CREATED_TMP_DISK_TABLES | bigint(20) unsigned | NO | |
NULL | |
| SUM_CREATED_TMP_TABLES | bigint(20) unsigned | NO | |
NULL | |
| SUM_SELECT_FULL_JOIN | bigint(20) unsigned | NO | |
NULL | |
| SUM_SELECT_FULL_RANGE_JOIN | bigint(20) unsigned | NO | |
NULL | |
| SUM_SELECT_RANGE | bigint(20) unsigned | NO | |
NULL | |
| SUM_SELECT_RANGE_CHECK | bigint(20) unsigned | NO | |
NULL | |
| SUM_SELECT_SCAN | bigint(20) unsigned | NO | |
NULL | |
| SUM_SORT_MERGE_PASSES | bigint(20) unsigned | NO | |
NULL | |
| SUM_SORT_RANGE | bigint(20) unsigned | NO | |
NULL | |
| SUM_SORT_ROWS | bigint(20) unsigned | NO | |
NULL | |
| SUM_SORT_SCAN | bigint(20) unsigned | NO | |
NULL | |
| SUM_NO_INDEX_USED | bigint(20) unsigned | NO | |
NULL | |
| SUM_NO_GOOD_INDEX_USED | bigint(20) unsigned | NO | |
NULL | |
+-----------------------------+--------------------------------------------------------+------+-----+--
-------+-------+

439/3812
1.1.1.2.9.2.1.55 Performance Schema
replication_applier_configuration Table
MariaDB starting with 10.5.2
The replication_applier_configuration table, along with many other new Performance Schema tables, was
added in MariaDB 10.5.2.

The Performance Schema replication_applier_configuration table contains configuration settings affecting replica
transactions.
It contains the following fields.

Field Type Null Description


CHANNEL_NAME char(64) NO Replication channel name.
DESIRED_DELAY int(11) NO Target number of seconds the replica should be delayed to the master.

1.1.1.2.9.2.1.56 Performance Schema


replication_applier_status Table
MariaDB starting with 10.5.2
The replication_applier_status table, along with many other new Performance Schema tables, was added in
MariaDB 10.5.2.

The Performance Schema replication_applier_status table contains information about the general transaction execution
status on the replica.
It contains the following fields.

Field Type Null Description


CHANNEL_NAME char(64) NO The replication channel name.
Shows ON when the replication channel's applier
SERVICE_STATE enum('ON','OFF') NO threads are active or idle, OFF means that the
applier threads are not active.
Seconds the replica needs to wait to reach the
REMAINING_DELAY int(10) unsigned YES
desired delay from master.
bigint(20) The number of retries that were made because the
COUNT_TRANSACTIONS_RETRIES NO
unsigned replication SQL thread failed to apply a transaction.

1.1.1.2.9.2.1.57 Performance Schema


replication_applier_status_by_coordinator
Table
MariaDB starting with 10.5.2
The replication_applier_status_by_coordinator table was added in MariaDB 10.5.2.

The Performance Schema replication_applier_status_by_coordinator table displays the status of the coordinator thread
used in multi-threaded replicas to manage multiple worker threads.
It contains the following fields.

Column Type Null Description


CHANNEL_NAME varchar(256) NO Replication channel name.
bigint(20)
THREAD_ID YES The SQL/coordinator thread ID.
unsigned
ON (thread exists and is active or idle) or OFF (thread no
SERVICE_STATE enum('ON','OFF') NO
longer exists).

440/3812
Last error number that caused the SQL/coordinator
LAST_ERROR_NUMBER int(11) NO
thread to stop.
Last error message that caused the SQL/coordinator
LAST_ERROR_MESSAGE varchar(1024) NO
thread to stop.
Timestamp that shows when the most recent
LAST_ERROR_TIMESTAMP timestamp NO
SQL/coordinator error occured.
LAST_SEEN_TRANSACTION char(57) NO The transaction the worker has last seen.
LAST_TRANS_RETRY_COUNT int(11) NO Total number of retries attempted by last transaction.

1.1.1.2.9.2.1.58 Performance Schema


replication_applier_status_by_worker Table
MariaDB starting with 10.6.0
The replication_applier_status_by_worker table was added in MariaDB 10.6.0.

The Performance Schema replication_applier_status_by_worker table displays replica worker thread specific
information.
It contains the following fields.

Column Description
CHANNEL_NAME Name of replication channel through which the transaction is received.
Thread_Id as displayed in the performance_schema.threads table for thread with
THREAD_ID name 'thread/sql/rpl_parallel_thread'. THREAD_ID will be NULL when worker
threads are stopped due to error/force stop.
SERVICE_STATE Whether or not the thread is running.
LAST_SEEN_TRANSACTION Last GTID executed by worker
LAST_ERROR_NUMBER Last Error that occurred on a particular worker.
LAST_ERROR_MESSAGE Last error specific message.
LAST_ERROR_TIMESTAMP Time stamp of last error.
Total idle time in seconds that the worker thread has spent waiting for work from
WORKER_IDLE_TIME
SQL thread.
LAST_TRANS_RETRY_COUNT Total number of retries attempted by last transaction.

1.1.1.2.9.2.1.59 Performance Schema


replication_connection_configuration Table
MariaDB starting with 10.5.2
The replication_connection_configuration table was added in MariaDB 10.6.0.

The Performance Schema replication_connection_configuration table displays replica's configuration settings used for
connecting to the primary.
It contains the following fields.

Column Type Null Description


CHANNEL_NAME varchar(256) NO The replication channel used.
The host name of the source that the replica is
HOST char(60) NO
connected to.
PORT int(11) NO The port used to connect to the source.
The user name of the replication user account
USER char(32) NO
used to connect to the source.

441/3812
enum('NO',
USING_GTID 'CURRENT_POS', NO Whether replication is using GTIDs or not.
'SLAVE_POS')
enum('YES', 'NO', Whether SSL is allowed for the replica
SSL_ALLOWED NO
'IGNORED') connection.
Path to the file that contains one or more
SSL_CA_FILE varchar(512) NO certificates for trusted Certificate Authorities (CA)
to use for TLS.
Path to a directory that contains one or more
SSL_CA_PATH varchar(512) NO PEM files that contain X509 certificates for a
trusted Certificate Authority (CA) to use for TLS.
Path to the certificate used to authenticate the
SSL_CERTIFICATE varchar(512) NO
master.
SSL_CIPHER varchar(512) NO Which cipher is used for encription.
SSL_KEY varchar(512) NO Path to the private key used for TLS.
Whether the server certificate is verified as part
SSL_VERIFY_SERVER_CERTIFICATE enum('YES','NO') NO
of the SSL connection.
Path to the PEM file containing one or more
SSL_CRL_FILE varchar(255) NO
revoked X.509 certificates.
PATH to a folder containing PEM files containing
SSL_CRL_PATH varchar(255) NO
one or more revoked X.509 certificates.
CONNECTION_RETRY_INTERVAL int(11) NO The number of seconds between connect retries.
The number of times the replica can attempt to
bigint(20)
CONNECTION_RETRY_COUNT NO reconnect to the source in the event of a lost
unsigned
connection.
double(10,3) Number of seconds after which a heartbeat will
HEARTBEAT_INTERVAL NO
unsigned be sent.
IGNORE_SERVER_IDS longtext NO Binary log events from servers (ids) to ignore.
REPL_DO_DOMAIN_IDS longtext NO Only apply binary logs from these domain ids.
REPL_IGNORE_DOMAIN_IDS longtext NO Binary log events from domains to ignore.

1.1.1.2.9.2.1.60 Performance Schema


rwlock_instances Table
The rwlock_instances table lists all read write lock (rwlock) instances that the Performance Schema sees while the
server is executing. A read write is a mechanism for ensuring threads can either share access to common resources, or
have exclusive access.
The performance_schema_max_rwlock_instances system variable specifies the maximum number of instrumented
rwlock objects.
The rwlock_instances table contains the following columns:

Column Description
NAME Instrument name associated with the read write lock
OBJECT_INSTANCE_BEGIN Address in memory of the instrumented lock
WRITE_LOCKED_BY_THREAD_ID THREAD_ID of the locking thread if locked in write (exclusive) mode, otherwise NULL .

READ_LOCKED_BY_COUNT Count of current read locks held

1.1.1.2.9.2.1.61 Performance Schema


session_account_connect_attrs Table
Description
The session_account_connect_attrs table shows connection attributes for the current session.
442/3812
Applications can pass key/value connection attributes to the server when a connection is made. The
session_connect_attrs and session_account_connect_attrs tables provide access to this information, for all sessions
and the current session respectively.
The C API functions mysql_options() and mysql_optionsv() are used for passing connection attributes to the server.
session_account_connect_attrs contains the following columns:

Column Description
PROCESSLIST_ID Session connection identifier.
ATTR_NAME Attribute name.
ATTR_VALUE Attribute value.
ORDINAL_POSITION Order in which attribute was added to the connection attributes.

Example
SELECT * FROM performance_schema.session_account_connect_attrs;
+----------------+-----------------+------------------+------------------+
| PROCESSLIST_ID | ATTR_NAME | ATTR_VALUE | ORDINAL_POSITION |
+----------------+-----------------+------------------+------------------+
| 45 | _os | debian-linux-gnu | 0 |
| 45 | _client_name | libmysql | 1 |
| 45 | _pid | 7711 | 2 |
| 45 | _client_version | 10.0.5 | 3 |
| 45 | _platform | x86_64 | 4 |
| 45 | program_name | mysql | 5 |
+----------------+-----------------+------------------+------------------+

1.1.1.2.9.2.1.62 Performance Schema


session_connect_attrs Table
Description
The session_connect_attrs table shows connection attributes for all sessions.
Applications can pass key/value connection attributes to the server when a connection is made. The
session_connect_attrs and session_account_connect_attrs tables provide access to this information, for all sessions
and the current session respectively.
The C API functions mysql_options() and mysql_optionsv() are used for passing connection attributes to the server.
session_connect_attrs contains the following columns:

Column Description
PROCESSLIST_ID Session connection identifier.
ATTR_NAME Attribute name.
ATTR_VALUE Attribute value.
ORDINAL_POSITION Order in which attribute was added to the connection attributes.

Example
Returning the current connection's attributes:

SELECT * FROM performance_schema.session_connect_attrs WHERE processlist_id=CONNECTION_ID();


+----------------+-----------------+------------------+------------------+
| PROCESSLIST_ID | ATTR_NAME | ATTR_VALUE | ORDINAL_POSITION |
+----------------+-----------------+------------------+------------------+
| 45 | _os | debian-linux-gnu | 0 |
| 45 | _client_name | libmysql | 1 |
| 45 | _pid | 7711 | 2 |
| 45 | _client_version | 10.0.5 | 3 |
| 45 | _platform | x86_64 | 4 |
| 45 | program_name | mysql | 5 |
+----------------+-----------------+------------------+------------------+

443/3812
1.1.1.2.9.2.1.63 Performance Schema
session_status Table
MariaDB starting with 10.5.2
The session_status table was added in MariaDB 10.5.2.

The session_status table contains a list of status variables for the current session. The table only stores status
variable statistics for threads which are instrumented, and does not collect statistics for Com_xxx variables.
The table contains the following columns:

Column Description
VARIABLE_NAME The session status variable name.
VARIABLE_VALUE The session status variable value.

It is not possible to empty this table with a TRUNCATE TABLE statement.

1.1.1.2.9.2.1.64 Performance Schema


setup_actors Table
The setup_actors table contains information for determining whether monitoring should be enabled for new client
connection threads.
The default size is 100 rows, which can be changed by modifying the performance_schema_setup_actors_size system
variable at server startup.
If a row in the table matches a new foreground thread's client and host, the matching INSTRUMENTED column in the
threads table is set to either YES or NO , which allows selective application of instrumenting by host, by user, or
combination thereof.

Column Description
HOST Host name, either a literal, or the % wildcard representing any host.
USER User name, either a literal or the % wildcard representing any name.
ROLE Unused

Initially, any user and host is matched:

SELECT * FROM performance_schema.setup_actors;


+------+------+------+
| HOST | USER | ROLE |
+------+------+------+
| % | % | % |
+------+------+------+

1.1.1.2.9.2.1.65 Performance Schema


setup_consumers Table
Lists the types of consumers for which event information is available.
The setup_consumers table contains the following columns:

Column Description
NAME Consumer name
YES or NO for whether or not the consumer is enabled. You can modify this column to ensure that event
ENABLED
information is added, or is not added.

The table can be modified directly, or the server started with the option enabled, for example:

performance-schema-consumer-events-waits-history=ON

Example
444/3812
SELECT * FROM performance_schema.setup_consumers;

+--------------------------------+---------+
| NAME | ENABLED |
+--------------------------------+---------+
| events_stages_current | NO |
| events_stages_history | NO |
| events_stages_history_long | NO |
| events_statements_current | YES |
| events_statements_history | NO |
| events_statements_history_long | NO |
| events_waits_current | NO |
| events_waits_history | NO |
| events_waits_history_long | NO |
| global_instrumentation | YES |
| thread_instrumentation | YES |
| statements_digest | YES |
+--------------------------------+---------+

See Also
Sys Schema ps_is_consumer_enabled function

1.1.1.2.9.2.1.66 Performance Schema


setup_instruments Table
The setup_instruments table contains a list of instrumented object classes for which it is possible to collect events.
There is one row for each instrument in the source code. When an instrument is enabled and executed, instances are
created which are then stored in the cond_instances, file_instances, mutex_instances, rwlock_instances or
socket_instance tables.
It contains the following columns:

Column Description
NAME Instrument name
ENABLED Whether or not the instrument is enabled. It can be disabled, and the instrument will produce no events.
Whether or not the instrument is timed. It can be set, but if disabled, events produced by the instrument will
TIMED
have NULL values for the corresponding TIMER_START , TIMER_END , and TIMER_WAIT values.

Example
From MariaDB 10.5.7, default settings with the Performance Schema enabled:

SELECT * FROM setup_instruments ORDER BY name;


+--------------------------------------------------------------------------------+---------+-------+
| NAME | ENABLED | TIMED |
+--------------------------------------------------------------------------------+---------+-------+
| idle | YES | YES |
| memory/csv/blobroot | NO | NO |
| memory/csv/row | NO | NO |
| memory/csv/tina_set | NO | NO |
| memory/csv/TINA_SHARE | NO | NO |
| memory/csv/Transparent_file | NO | NO |
| memory/innodb/adaptive hash index | NO | NO |
| memory/innodb/btr0btr | NO | NO |
| memory/innodb/btr0buf | NO | NO |
| memory/innodb/btr0bulk | NO | NO |
| memory/innodb/btr0cur | NO | NO |
| memory/innodb/btr0pcur | NO | NO |
| memory/innodb/btr0sea | NO | NO |
| memory/innodb/buf0buf | NO | NO |
| memory/innodb/buf0dblwr | NO | NO |
| memory/innodb/buf0dump | NO | NO |
| memory/innodb/buf_buf_pool | NO | NO |
| memory/innodb/dict0dict | NO | NO |
| memory/innodb/dict0mem | NO | NO |
| memory/innodb/dict0stats | NO | NO |
| memory/innodb/dict_stats_bg_recalc_pool_t | NO | NO |
| memory/innodb/dict_stats_index_map_t | NO | NO |
| memory/innodb/dict_stats_n_diff_on_level | NO | NO |
| memory/innodb/eval0eval | NO | NO |
| memory/innodb/fil0crypt | NO | NO |
445/3812
| memory/innodb/fil0crypt | NO | NO |
| memory/innodb/fil0fil | NO | NO |
| memory/innodb/fsp0file | NO | NO |
| memory/innodb/fts0ast | NO | NO |
| memory/innodb/fts0blex | NO | NO |
| memory/innodb/fts0config | NO | NO |
| memory/innodb/fts0file | NO | NO |
| memory/innodb/fts0fts | NO | NO |
| memory/innodb/fts0opt | NO | NO |
| memory/innodb/fts0pars | NO | NO |
| memory/innodb/fts0que | NO | NO |
| memory/innodb/fts0sql | NO | NO |
| memory/innodb/fts0tlex | NO | NO |
| memory/innodb/gis0sea | NO | NO |
| memory/innodb/handler0alter | NO | NO |
| memory/innodb/hash0hash | NO | NO |
| memory/innodb/ha_innodb | NO | NO |
| memory/innodb/i_s | NO | NO |
| memory/innodb/lexyy | NO | NO |
| memory/innodb/lock0lock | NO | NO |
| memory/innodb/mem0mem | NO | NO |
| memory/innodb/os0event | NO | NO |
| memory/innodb/os0file | NO | NO |
| memory/innodb/other | NO | NO |
| memory/innodb/pars0lex | NO | NO |
| memory/innodb/rem0rec | NO | NO |
| memory/innodb/row0ftsort | NO | NO |
| memory/innodb/row0import | NO | NO |
| memory/innodb/row0log | NO | NO |
| memory/innodb/row0merge | NO | NO |
| memory/innodb/row0mysql | NO | NO |
| memory/innodb/row0sel | NO | NO |
| memory/innodb/row_log_buf | NO | NO |
| memory/innodb/row_merge_sort | NO | NO |
| memory/innodb/srv0start | NO | NO |
| memory/innodb/std | NO | NO |
| memory/innodb/sync0arr | NO | NO |
| memory/innodb/sync0debug | NO | NO |
| memory/innodb/sync0rw | NO | NO |
| memory/innodb/sync0start | NO | NO |
| memory/innodb/sync0types | NO | NO |
| memory/innodb/trx0i_s | NO | NO |
| memory/innodb/trx0roll | NO | NO |
| memory/innodb/trx0rseg | NO | NO |
| memory/innodb/trx0seg | NO | NO |
| memory/innodb/trx0trx | NO | NO |
| memory/innodb/trx0undo | NO | NO |
| memory/innodb/ut0list | NO | NO |
| memory/innodb/ut0mem | NO | NO |
| memory/innodb/ut0new | NO | NO |
| memory/innodb/ut0pool | NO | NO |
| memory/innodb/ut0rbt | NO | NO |
| memory/innodb/ut0wqueue | NO | NO |
| memory/innodb/xtrabackup | NO | NO |
| memory/memory/HP_INFO | NO | NO |
| memory/memory/HP_KEYDEF | NO | NO |
| memory/memory/HP_PTRS | NO | NO |
| memory/memory/HP_SHARE | NO | NO |
| memory/myisam/filecopy | NO | NO |
| memory/myisam/FTB | NO | NO |
| memory/myisam/FTPARSER_PARAM | NO | NO |
| memory/myisam/FT_INFO | NO | NO |
| memory/myisam/ft_memroot | NO | NO |
| memory/myisam/ft_stopwords | NO | NO |
| memory/myisam/keycache_thread_var | NO | NO |
| memory/myisam/MI_DECODE_TREE | NO | NO |
| memory/myisam/MI_INFO | NO | NO |
| memory/myisam/MI_INFO::bulk_insert | NO | NO |
| memory/myisam/MI_INFO::ft1_to_ft2 | NO | NO |
| memory/myisam/MI_SORT_PARAM | NO | NO |
| memory/myisam/MI_SORT_PARAM::wordroot | NO | NO |
| memory/myisam/MYISAM_SHARE | NO | NO |
| memory/myisam/MYISAM_SHARE::decode_tables | NO | NO |
| memory/myisam/preload_buffer | NO | NO |
| memory/myisam/record_buffer | NO | NO |
| memory/myisam/SORT_FT_BUF | NO | NO |
| memory/myisam/SORT_INFO::buffer | NO | NO |
| memory/myisam/SORT_KEY_BLOCKS | NO | NO |
| memory/myisam/stPageList::pages | NO | NO |
| memory/myisammrg/children | NO | NO |
| memory/myisammrg/MYRG_INFO | NO | NO |
| memory/partition/ha_partition::file | NO | NO |
| memory/partition/ha_partition::part_ids | NO | NO | 446/3812
| memory/partition/ha_partition::part_ids | NO | NO |
| memory/partition/Partition_admin | NO | NO |
| memory/partition/Partition_share | NO | NO |
| memory/partition/partition_sort_buffer | NO | NO |
| memory/performance_schema/accounts | YES | NO |
| memory/performance_schema/cond_class | YES | NO |
| memory/performance_schema/cond_instances | YES | NO |
| memory/performance_schema/events_stages_history | YES | NO |
| memory/performance_schema/events_stages_history_long | YES | NO |
| memory/performance_schema/events_stages_summary_by_account_by_event_name | YES | NO |
| memory/performance_schema/events_stages_summary_by_host_by_event_name | YES | NO |
| memory/performance_schema/events_stages_summary_by_thread_by_event_name | YES | NO |
| memory/performance_schema/events_stages_summary_by_user_by_event_name | YES | NO |
| memory/performance_schema/events_stages_summary_global_by_event_name | YES | NO |
| memory/performance_schema/events_statements_current | YES | NO |
| memory/performance_schema/events_statements_current.sqltext | YES | NO |
| memory/performance_schema/events_statements_current.tokens | YES | NO |
| memory/performance_schema/events_statements_history | YES | NO |
| memory/performance_schema/events_statements_history.sqltext | YES | NO |
| memory/performance_schema/events_statements_history.tokens | YES | NO |
| memory/performance_schema/events_statements_history_long | YES | NO |
| memory/performance_schema/events_statements_history_long.sqltext | YES | NO |
| memory/performance_schema/events_statements_history_long.tokens | YES | NO |
| memory/performance_schema/events_statements_summary_by_account_by_event_name | YES | NO |
| memory/performance_schema/events_statements_summary_by_digest | YES | NO |
| memory/performance_schema/events_statements_summary_by_digest.tokens | YES | NO |
| memory/performance_schema/events_statements_summary_by_host_by_event_name | YES | NO |
| memory/performance_schema/events_statements_summary_by_program | YES | NO |
| memory/performance_schema/events_statements_summary_by_thread_by_event_name | YES | NO |
| memory/performance_schema/events_statements_summary_by_user_by_event_name | YES | NO |
| memory/performance_schema/events_statements_summary_global_by_event_name | YES | NO |
| memory/performance_schema/events_transactions_history | YES | NO |
| memory/performance_schema/events_transactions_history_long | YES | NO |
| memory/performance_schema/events_transactions_summary_by_account_by_event_name | YES | NO |
| memory/performance_schema/events_transactions_summary_by_host_by_event_name | YES | NO |
| memory/performance_schema/events_transactions_summary_by_thread_by_event_name | YES | NO |
| memory/performance_schema/events_transactions_summary_by_user_by_event_name | YES | NO |
| memory/performance_schema/events_waits_history | YES | NO |
| memory/performance_schema/events_waits_history_long | YES | NO |
| memory/performance_schema/events_waits_summary_by_account_by_event_name | YES | NO |
| memory/performance_schema/events_waits_summary_by_host_by_event_name | YES | NO |
| memory/performance_schema/events_waits_summary_by_thread_by_event_name | YES | NO |
| memory/performance_schema/events_waits_summary_by_user_by_event_name | YES | NO |
| memory/performance_schema/file_class | YES | NO |
| memory/performance_schema/file_handle | YES | NO |
| memory/performance_schema/file_instances | YES | NO |
| memory/performance_schema/hosts | YES | NO |
| memory/performance_schema/memory_class | YES | NO |
| memory/performance_schema/memory_summary_by_account_by_event_name | YES | NO |
| memory/performance_schema/memory_summary_by_host_by_event_name | YES | NO |
| memory/performance_schema/memory_summary_by_thread_by_event_name | YES | NO |
| memory/performance_schema/memory_summary_by_user_by_event_name | YES | NO |
| memory/performance_schema/memory_summary_global_by_event_name | YES | NO |
| memory/performance_schema/metadata_locks | YES | NO |
| memory/performance_schema/mutex_class | YES | NO |
| memory/performance_schema/mutex_instances | YES | NO |
| memory/performance_schema/prepared_statements_instances | YES | NO |
| memory/performance_schema/rwlock_class | YES | NO |
| memory/performance_schema/rwlock_instances | YES | NO |
| memory/performance_schema/scalable_buffer | YES | NO |
| memory/performance_schema/session_connect_attrs | YES | NO |
| memory/performance_schema/setup_actors | YES | NO |
| memory/performance_schema/setup_objects | YES | NO |
| memory/performance_schema/socket_class | YES | NO |
| memory/performance_schema/socket_instances | YES | NO |
| memory/performance_schema/stage_class | YES | NO |
| memory/performance_schema/statement_class | YES | NO |
| memory/performance_schema/table_handles | YES | NO |
| memory/performance_schema/table_io_waits_summary_by_index_usage | YES | NO |
| memory/performance_schema/table_lock_waits_summary_by_table | YES | NO |
| memory/performance_schema/table_shares | YES | NO |
| memory/performance_schema/threads | YES | NO |
| memory/performance_schema/thread_class | YES | NO |
| memory/performance_schema/users | YES | NO |
| memory/sql/acl_cache | NO | NO |
| memory/sql/binlog_cache_mngr | NO | NO |
| memory/sql/binlog_pos | NO | NO |
| memory/sql/binlog_statement_buffer | NO | NO |
| memory/sql/binlog_ver_1_event | NO | NO |
| memory/sql/bison_stack | NO | NO |
| memory/sql/Blob_mem_storage::storage | NO | NO |
| memory/sql/DATE_TIME_FORMAT | NO | NO |
447/3812
| memory/sql/dboptions_hash | NO | NO |
| memory/sql/DDL_LOG_MEMORY_ENTRY | NO | NO |
| memory/sql/display_table_locks | NO | NO |
| memory/sql/errmsgs | NO | NO |
| memory/sql/Event_basic::mem_root | NO | NO |
| memory/sql/Event_queue_element_for_exec::names | NO | NO |
| memory/sql/Event_scheduler::scheduler_param | NO | NO |
| memory/sql/Filesort_info::merge | NO | NO |
| memory/sql/Filesort_info::record_pointers | NO | NO |
| memory/sql/frm::string | NO | NO |
| memory/sql/gdl | NO | NO |
| memory/sql/Gis_read_stream::err_msg | NO | NO |
| memory/sql/global_system_variables | NO | NO |
| memory/sql/handler::errmsgs | NO | NO |
| memory/sql/handlerton | NO | NO |
| memory/sql/hash_index_key_buffer | NO | NO |
| memory/sql/host_cache::hostname | NO | NO |
| memory/sql/ignored_db | NO | NO |
| memory/sql/JOIN_CACHE | NO | NO |
| memory/sql/load_env_plugins | NO | NO |
| memory/sql/Locked_tables_list::m_locked_tables_root | NO | NO |
| memory/sql/MDL_context::acquire_locks | NO | NO |
| memory/sql/MPVIO_EXT::auth_info | NO | NO |
| memory/sql/MYSQL_BIN_LOG::basename | NO | NO |
| memory/sql/MYSQL_BIN_LOG::index | NO | NO |
| memory/sql/MYSQL_BIN_LOG::recover | NO | NO |
| memory/sql/MYSQL_LOCK | NO | NO |
| memory/sql/MYSQL_LOG::name | NO | NO |
| memory/sql/mysql_plugin | NO | NO |
| memory/sql/mysql_plugin_dl | NO | NO |
| memory/sql/MYSQL_RELAY_LOG::basename | NO | NO |
| memory/sql/MYSQL_RELAY_LOG::index | NO | NO |
| memory/sql/my_str_malloc | NO | NO |
| memory/sql/NAMED_ILINK::name | NO | NO |
| memory/sql/native_functions | NO | NO |
| memory/sql/plugin_bookmark | NO | NO |
| memory/sql/plugin_int_mem_root | NO | NO |
| memory/sql/plugin_mem_root | NO | NO |
| memory/sql/Prepared_statement::main_mem_root | NO | NO |
| memory/sql/Prepared_statement_map | NO | NO |
| memory/sql/PROFILE | NO | NO |
| memory/sql/Query_cache | NO | NO |
| memory/sql/Queue::queue_item | NO | NO |
| memory/sql/QUICK_RANGE_SELECT::alloc | NO | NO |
| memory/sql/QUICK_RANGE_SELECT::mrr_buf_desc | NO | NO |
| memory/sql/Relay_log_info::group_relay_log_name | NO | NO |
| memory/sql/root | NO | NO |
| memory/sql/Row_data_memory::memory | NO | NO |
| memory/sql/rpl_filter memory | NO | NO |
| memory/sql/Rpl_info_file::buffer | NO | NO |
| memory/sql/servers_cache | NO | NO |
| memory/sql/SLAVE_INFO | NO | NO |
| memory/sql/Sort_param::tmp_buffer | NO | NO |
| memory/sql/sp_head::call_mem_root | NO | NO |
| memory/sql/sp_head::execute_mem_root | NO | NO |
| memory/sql/sp_head::main_mem_root | NO | NO |
| memory/sql/sql_acl_mem | NO | NO |
| memory/sql/sql_acl_memex | NO | NO |
| memory/sql/String::value | NO | NO |
| memory/sql/ST_SCHEMA_TABLE | NO | NO |
| memory/sql/Sys_var_charptr::value | NO | NO |
| memory/sql/TABLE | NO | NO |
| memory/sql/table_mapping::m_mem_root | NO | NO |
| memory/sql/TABLE_RULE_ENT | NO | NO |
| memory/sql/TABLE_SHARE::mem_root | NO | NO |
| memory/sql/Table_triggers_list | NO | NO |
| memory/sql/Table_trigger_dispatcher::m_mem_root | NO | NO |
| memory/sql/TC_LOG_MMAP::pages | NO | NO |
| memory/sql/THD::db | NO | NO |
| memory/sql/THD::handler_tables_hash | NO | NO |
| memory/sql/thd::main_mem_root | NO | NO |
| memory/sql/THD::sp_cache | NO | NO |
| memory/sql/THD::transactions::mem_root | NO | NO |
| memory/sql/THD::variables | NO | NO |
| memory/sql/tz_storage | NO | NO |
| memory/sql/udf_mem | NO | NO |
| memory/sql/Unique::merge_buffer | NO | NO |
| memory/sql/Unique::sort_buffer | NO | NO |
| memory/sql/user_conn | NO | NO |
| memory/sql/User_level_lock | NO | NO |
| memory/sql/user_var_entry | NO | NO |
| memory/sql/user_var_entry::value | NO | NO |
448/3812
| memory/sql/user_var_entry::value | NO | NO |
| memory/sql/XID | NO | NO |
| stage/aria/Waiting for a resource | NO | NO |
| stage/innodb/alter table (end) | YES | YES |
| stage/innodb/alter table (insert) | YES | YES |
| stage/innodb/alter table (log apply index) | YES | YES |
| stage/innodb/alter table (log apply table) | YES | YES |
| stage/innodb/alter table (merge sort) | YES | YES |
| stage/innodb/alter table (read PK and internal sort) | YES | YES |
| stage/innodb/buffer pool load | YES | YES |
| stage/mysys/Waiting for table level lock | NO | NO |
| stage/sql/After apply log event | NO | NO |
| stage/sql/After create | NO | NO |
| stage/sql/After opening tables | NO | NO |
| stage/sql/After table lock | NO | NO |
| stage/sql/Allocating local table | NO | NO |
| stage/sql/altering table | NO | NO |
| stage/sql/Apply log event | NO | NO |
| stage/sql/Changing master | NO | NO |
| stage/sql/Checking master version | NO | NO |
| stage/sql/checking permissions | NO | NO |
| stage/sql/checking privileges on cached query | NO | NO |
| stage/sql/Checking query cache for query | NO | NO |
| stage/sql/closing tables | NO | NO |
| stage/sql/Commit | NO | NO |
| stage/sql/Commit implicit | NO | NO |
| stage/sql/Committing alter table to storage engine | NO | NO |
| stage/sql/Connecting to master | NO | NO |
| stage/sql/Converting HEAP to Aria | NO | NO |
| stage/sql/copy to tmp table | YES | YES |
| stage/sql/Copying to group table | NO | NO |
| stage/sql/Copying to tmp table | NO | NO |
| stage/sql/Creating delayed handler | NO | NO |
| stage/sql/Creating sort index | NO | NO |
| stage/sql/creating table | NO | NO |
| stage/sql/Creating tmp table | NO | NO |
| stage/sql/Deleting from main table | NO | NO |
| stage/sql/Deleting from reference tables | NO | NO |
| stage/sql/Discard_or_import_tablespace | NO | NO |
| stage/sql/Enabling keys | NO | NO |
| stage/sql/End of update loop | NO | NO |
| stage/sql/Executing | NO | NO |
| stage/sql/Execution of init_command | NO | NO |
| stage/sql/Explaining | NO | NO |
| stage/sql/Filling schema table | NO | NO |
| stage/sql/Finding key cache | NO | NO |
| stage/sql/Finished reading one binlog; switching to next binlog | NO | NO |
| stage/sql/Flushing relay log and master info repository. | NO | NO |
| stage/sql/Flushing relay-log info file. | NO | NO |
| stage/sql/Freeing items | NO | NO |
| stage/sql/Fulltext initialization | NO | NO |
| stage/sql/Got handler lock | NO | NO |
| stage/sql/Got old table | NO | NO |
| stage/sql/init | NO | NO |
| stage/sql/init for update | NO | NO |
| stage/sql/Insert | NO | NO |
| stage/sql/Invalidating query cache entries (table list) | NO | NO |
| stage/sql/Invalidating query cache entries (table) | NO | NO |
| stage/sql/Killing slave | NO | NO |
| stage/sql/Logging slow query | NO | NO |
| stage/sql/Making temporary file (append) before replaying LOAD DATA INFILE | NO | NO |
| stage/sql/Making temporary file (create) before replaying LOAD DATA INFILE | NO | NO |
| stage/sql/Manage keys | NO | NO |
| stage/sql/Master has sent all binlog to slave; waiting for more updates | NO | NO |
| stage/sql/Opening tables | NO | NO |
| stage/sql/Optimizing | NO | NO |
| stage/sql/Preparing | NO | NO |
| stage/sql/preparing for alter table | NO | NO |
| stage/sql/Processing binlog checkpoint notification | NO | NO |
| stage/sql/Processing requests | NO | NO |
| stage/sql/Purging old relay logs | NO | NO |
| stage/sql/Query end | NO | NO |
| stage/sql/Queueing master event to the relay log | NO | NO |
| stage/sql/Reading event from the relay log | NO | NO |
| stage/sql/Reading semi-sync ACK from slave | NO | NO |
| stage/sql/Recreating table | NO | NO |
| stage/sql/Registering slave on master | NO | NO |
| stage/sql/Removing duplicates | NO | NO |
| stage/sql/Removing tmp table | NO | NO |
| stage/sql/Rename | NO | NO |
| stage/sql/Rename result table | NO | NO |
| stage/sql/Requesting binlog dump | NO | NO |
| stage/sql/Reschedule | NO | NO | 449/3812
| stage/sql/Reschedule | NO | NO |
| stage/sql/Reset for next command | NO | NO |
| stage/sql/Rollback | NO | NO |
| stage/sql/Rollback_implicit | NO | NO |
| stage/sql/Searching rows for update | NO | NO |
| stage/sql/Sending binlog event to slave | NO | NO |
| stage/sql/Sending cached result to client | NO | NO |
| stage/sql/Sending data | NO | NO |
| stage/sql/setup | NO | NO |
| stage/sql/Show explain | NO | NO |
| stage/sql/Slave has read all relay log; waiting for more updates | NO | NO |
| stage/sql/Sorting | NO | NO |
| stage/sql/Sorting for group | NO | NO |
| stage/sql/Sorting for order | NO | NO |
| stage/sql/Sorting result | NO | NO |
| stage/sql/starting | NO | NO |
| stage/sql/Starting cleanup | NO | NO |
| stage/sql/Statistics | NO | NO |
| stage/sql/Stopping binlog background thread | NO | NO |
| stage/sql/Storing result in query cache | NO | NO |
| stage/sql/Storing row into queue | NO | NO |
| stage/sql/System lock | NO | NO |
| stage/sql/table lock | NO | NO |
| stage/sql/Unlocking tables | NO | NO |
| stage/sql/Update | NO | NO |
| stage/sql/Updating | NO | NO |
| stage/sql/Updating main table | NO | NO |
| stage/sql/Updating reference tables | NO | NO |
| stage/sql/Upgrading lock | NO | NO |
| stage/sql/User lock | NO | NO |
| stage/sql/User sleep | NO | NO |
| stage/sql/Verifying table | NO | NO |
| stage/sql/Waiting for background binlog tasks | NO | NO |
| stage/sql/Waiting for backup lock | NO | NO |
| stage/sql/Waiting for delay_list | NO | NO |
| stage/sql/Waiting for event metadata lock | NO | NO |
| stage/sql/Waiting for GTID to be written to binary log | NO | NO |
| stage/sql/Waiting for handler insert | NO | NO |
| stage/sql/Waiting for handler lock | NO | NO |
| stage/sql/Waiting for handler open | NO | NO |
| stage/sql/Waiting for INSERT | NO | NO |
| stage/sql/Waiting for master to send event | NO | NO |
| stage/sql/Waiting for master update | NO | NO |
| stage/sql/Waiting for next activation | NO | NO |
| stage/sql/Waiting for other master connection to process the same GTID | NO | NO |
| stage/sql/Waiting for parallel replication deadlock handling to complete | NO | NO |
| stage/sql/Waiting for prior transaction to commit | NO | NO |
| stage/sql/Waiting for prior transaction to start commit | NO | NO |
| stage/sql/Waiting for query cache lock | NO | NO |
| stage/sql/Waiting for requests | NO | NO |
| stage/sql/Waiting for room in worker thread event queue | NO | NO |
| stage/sql/Waiting for schema metadata lock | NO | NO |
| stage/sql/Waiting for semi-sync ACK from slave | NO | NO |
| stage/sql/Waiting for semi-sync slave connection | NO | NO |
| stage/sql/Waiting for slave mutex on exit | NO | NO |
| stage/sql/Waiting for slave thread to start | NO | NO |
| stage/sql/Waiting for stored function metadata lock | NO | NO |
| stage/sql/Waiting for stored package body metadata lock | NO | NO |
| stage/sql/Waiting for stored procedure metadata lock | NO | NO |
| stage/sql/Waiting for table flush | NO | NO |
| stage/sql/Waiting for table metadata lock | NO | NO |
| stage/sql/Waiting for the next event in relay log | NO | NO |
| stage/sql/Waiting for the scheduler to stop | NO | NO |
| stage/sql/Waiting for the slave SQL thread to advance position | NO | NO |
| stage/sql/Waiting for the slave SQL thread to free enough relay log space | NO | NO |
| stage/sql/Waiting for trigger metadata lock | NO | NO |
| stage/sql/Waiting for work from SQL thread | NO | NO |
| stage/sql/Waiting in MASTER_GTID_WAIT() | NO | NO |
| stage/sql/Waiting in MASTER_GTID_WAIT() (primary waiter) | NO | NO |
| stage/sql/Waiting on empty queue | NO | NO |
| stage/sql/Waiting to finalize termination | NO | NO |
| stage/sql/Waiting until MASTER_DELAY seconds after master executed event | NO | NO |
| stage/sql/Writing to binlog | NO | NO |
| statement/abstract/new_packet | YES | YES |
| statement/abstract/Query | YES | YES |
| statement/abstract/relay_log | YES | YES |
| statement/com/Binlog Dump | YES | YES |
| statement/com/Bulk_execute | YES | YES |
| statement/com/Change user | YES | YES |
| statement/com/Close stmt | YES | YES |
| statement/com/Com_multi | YES | YES |
| statement/com/Connect | YES | YES |
450/3812
| statement/com/Connect Out | YES | YES |
| statement/com/Create DB | YES | YES |
| statement/com/Daemon | YES | YES |
| statement/com/Debug | YES | YES |
| statement/com/Delayed insert | YES | YES |
| statement/com/Drop DB | YES | YES |
| statement/com/Error | YES | YES |
| statement/com/Execute | YES | YES |
| statement/com/Fetch | YES | YES |
| statement/com/Field List | YES | YES |
| statement/com/Init DB | YES | YES |
| statement/com/Kill | YES | YES |
| statement/com/Long Data | YES | YES |
| statement/com/Ping | YES | YES |
| statement/com/Prepare | YES | YES |
| statement/com/Processlist | YES | YES |
| statement/com/Quit | YES | YES |
| statement/com/Refresh | YES | YES |
| statement/com/Register Slave | YES | YES |
| statement/com/Reset connection | YES | YES |
| statement/com/Reset stmt | YES | YES |
| statement/com/Set option | YES | YES |
| statement/com/Shutdown | YES | YES |
| statement/com/Slave_IO | YES | YES |
| statement/com/Slave_SQL | YES | YES |
| statement/com/Slave_worker | YES | YES |
| statement/com/Sleep | YES | YES |
| statement/com/Statistics | YES | YES |
| statement/com/Table Dump | YES | YES |
| statement/com/Time | YES | YES |
| statement/com/Unimpl get tid | YES | YES |
| statement/scheduler/event | YES | YES |
| statement/sp/agg_cfetch | YES | YES |
| statement/sp/cclose | YES | YES |
| statement/sp/cfetch | YES | YES |
| statement/sp/copen | YES | YES |
| statement/sp/cpop | YES | YES |
| statement/sp/cpush | YES | YES |
| statement/sp/cursor_copy_struct | YES | YES |
| statement/sp/error | YES | YES |
| statement/sp/freturn | YES | YES |
| statement/sp/hpop | YES | YES |
| statement/sp/hpush_jump | YES | YES |
| statement/sp/hreturn | YES | YES |
| statement/sp/jump | YES | YES |
| statement/sp/jump_if_not | YES | YES |
| statement/sp/preturn | YES | YES |
| statement/sp/set | YES | YES |
| statement/sp/set_case_expr | YES | YES |
| statement/sp/set_trigger_field | YES | YES |
| statement/sp/stmt | YES | YES |
| statement/sql/ | YES | YES |
| statement/sql/alter_db | YES | YES |
| statement/sql/alter_db_upgrade | YES | YES |
| statement/sql/alter_event | YES | YES |
| statement/sql/alter_function | YES | YES |
| statement/sql/alter_procedure | YES | YES |
| statement/sql/alter_sequence | YES | YES |
| statement/sql/alter_server | YES | YES |
| statement/sql/alter_table | YES | YES |
| statement/sql/alter_tablespace | YES | YES |
| statement/sql/alter_user | YES | YES |
| statement/sql/analyze | YES | YES |
| statement/sql/assign_to_keycache | YES | YES |
| statement/sql/backup | YES | YES |
| statement/sql/backup_lock | YES | YES |
| statement/sql/begin | YES | YES |
| statement/sql/binlog | YES | YES |
| statement/sql/call_procedure | YES | YES |
| statement/sql/change_db | YES | YES |
| statement/sql/change_master | YES | YES |
| statement/sql/check | YES | YES |
| statement/sql/checksum | YES | YES |
| statement/sql/commit | YES | YES |
| statement/sql/compound_sql | YES | YES |
| statement/sql/create_db | YES | YES |
| statement/sql/create_event | YES | YES |
| statement/sql/create_function | YES | YES |
| statement/sql/create_index | YES | YES |
| statement/sql/create_package | YES | YES |
| statement/sql/create_package_body | YES | YES |
| statement/sql/create_procedure | YES | YES |
451/3812
| statement/sql/create_procedure | YES | YES |
| statement/sql/create_role | YES | YES |
| statement/sql/create_sequence | YES | YES |
| statement/sql/create_server | YES | YES |
| statement/sql/create_table | YES | YES |
| statement/sql/create_trigger | YES | YES |
| statement/sql/create_udf | YES | YES |
| statement/sql/create_user | YES | YES |
| statement/sql/create_view | YES | YES |
| statement/sql/dealloc_sql | YES | YES |
| statement/sql/delete | YES | YES |
| statement/sql/delete_multi | YES | YES |
| statement/sql/do | YES | YES |
| statement/sql/drop_db | YES | YES |
| statement/sql/drop_event | YES | YES |
| statement/sql/drop_function | YES | YES |
| statement/sql/drop_index | YES | YES |
| statement/sql/drop_package | YES | YES |
| statement/sql/drop_package_body | YES | YES |
| statement/sql/drop_procedure | YES | YES |
| statement/sql/drop_role | YES | YES |
| statement/sql/drop_sequence | YES | YES |
| statement/sql/drop_server | YES | YES |
| statement/sql/drop_table | YES | YES |
| statement/sql/drop_trigger | YES | YES |
| statement/sql/drop_user | YES | YES |
| statement/sql/drop_view | YES | YES |
| statement/sql/empty_query | YES | YES |
| statement/sql/error | YES | YES |
| statement/sql/execute_immediate | YES | YES |
| statement/sql/execute_sql | YES | YES |
| statement/sql/flush | YES | YES |
| statement/sql/get_diagnostics | YES | YES |
| statement/sql/grant | YES | YES |
| statement/sql/grant_role | YES | YES |
| statement/sql/ha_close | YES | YES |
| statement/sql/ha_open | YES | YES |
| statement/sql/ha_read | YES | YES |
| statement/sql/help | YES | YES |
| statement/sql/insert | YES | YES |
| statement/sql/insert_select | YES | YES |
| statement/sql/install_plugin | YES | YES |
| statement/sql/kill | YES | YES |
| statement/sql/load | YES | YES |
| statement/sql/lock_tables | YES | YES |
| statement/sql/optimize | YES | YES |
| statement/sql/preload_keys | YES | YES |
| statement/sql/prepare_sql | YES | YES |
| statement/sql/purge | YES | YES |
| statement/sql/purge_before_date | YES | YES |
| statement/sql/release_savepoint | YES | YES |
| statement/sql/rename_table | YES | YES |
| statement/sql/rename_user | YES | YES |
| statement/sql/repair | YES | YES |
| statement/sql/replace | YES | YES |
| statement/sql/replace_select | YES | YES |
| statement/sql/reset | YES | YES |
| statement/sql/resignal | YES | YES |
| statement/sql/revoke | YES | YES |
| statement/sql/revoke_all | YES | YES |
| statement/sql/revoke_role | YES | YES |
| statement/sql/rollback | YES | YES |
| statement/sql/rollback_to_savepoint | YES | YES |
| statement/sql/savepoint | YES | YES |
| statement/sql/select | YES | YES |
| statement/sql/set_option | YES | YES |
| statement/sql/show_authors | YES | YES |
| statement/sql/show_binlogs | YES | YES |
| statement/sql/show_binlog_events | YES | YES |
| statement/sql/show_binlog_status | YES | YES |
| statement/sql/show_charsets | YES | YES |
| statement/sql/show_collations | YES | YES |
| statement/sql/show_contributors | YES | YES |
| statement/sql/show_create_db | YES | YES |
| statement/sql/show_create_event | YES | YES |
| statement/sql/show_create_func | YES | YES |
| statement/sql/show_create_package | YES | YES |
| statement/sql/show_create_package_body | YES | YES |
| statement/sql/show_create_proc | YES | YES |
| statement/sql/show_create_table | YES | YES |
| statement/sql/show_create_trigger | YES | YES |
| statement/sql/show_create_user | YES | YES |
| statement/sql/show_databases | YES | YES | 452/3812
| statement/sql/show_databases | YES | YES |
| statement/sql/show_engine_logs | YES | YES |
| statement/sql/show_engine_mutex | YES | YES |
| statement/sql/show_engine_status | YES | YES |
| statement/sql/show_errors | YES | YES |
| statement/sql/show_events | YES | YES |
| statement/sql/show_explain | YES | YES |
| statement/sql/show_fields | YES | YES |
| statement/sql/show_function_status | YES | YES |
| statement/sql/show_generic | YES | YES |
| statement/sql/show_grants | YES | YES |
| statement/sql/show_keys | YES | YES |
| statement/sql/show_open_tables | YES | YES |
| statement/sql/show_package_body_status | YES | YES |
| statement/sql/show_package_status | YES | YES |
| statement/sql/show_plugins | YES | YES |
| statement/sql/show_privileges | YES | YES |
| statement/sql/show_procedure_status | YES | YES |
| statement/sql/show_processlist | YES | YES |
| statement/sql/show_profile | YES | YES |
| statement/sql/show_profiles | YES | YES |
| statement/sql/show_relaylog_events | YES | YES |
| statement/sql/show_slave_hosts | YES | YES |
| statement/sql/show_slave_status | YES | YES |
| statement/sql/show_status | YES | YES |
| statement/sql/show_storage_engines | YES | YES |
| statement/sql/show_tables | YES | YES |
| statement/sql/show_table_status | YES | YES |
| statement/sql/show_triggers | YES | YES |
| statement/sql/show_variables | YES | YES |
| statement/sql/show_warnings | YES | YES |
| statement/sql/shutdown | YES | YES |
| statement/sql/signal | YES | YES |
| statement/sql/start_all_slaves | YES | YES |
| statement/sql/start_slave | YES | YES |
| statement/sql/stop_all_slaves | YES | YES |
| statement/sql/stop_slave | YES | YES |
| statement/sql/truncate | YES | YES |
| statement/sql/uninstall_plugin | YES | YES |
| statement/sql/unlock_tables | YES | YES |
| statement/sql/update | YES | YES |
| statement/sql/update_multi | YES | YES |
| statement/sql/xa_commit | YES | YES |
| statement/sql/xa_end | YES | YES |
| statement/sql/xa_prepare | YES | YES |
| statement/sql/xa_recover | YES | YES |
| statement/sql/xa_rollback | YES | YES |
| statement/sql/xa_start | YES | YES |
| transaction | NO | NO |
| wait/io/file/aria/control | YES | YES |
| wait/io/file/aria/MAD | YES | YES |
| wait/io/file/aria/MAI | YES | YES |
| wait/io/file/aria/translog | YES | YES |
| wait/io/file/csv/data | YES | YES |
| wait/io/file/csv/metadata | YES | YES |
| wait/io/file/csv/update | YES | YES |
| wait/io/file/innodb/innodb_data_file | YES | YES |
| wait/io/file/innodb/innodb_log_file | YES | YES |
| wait/io/file/innodb/innodb_temp_file | YES | YES |
| wait/io/file/myisam/data_tmp | YES | YES |
| wait/io/file/myisam/dfile | YES | YES |
| wait/io/file/myisam/kfile | YES | YES |
| wait/io/file/myisam/log | YES | YES |
| wait/io/file/myisammrg/MRG | YES | YES |
| wait/io/file/mysys/charset | YES | YES |
| wait/io/file/mysys/cnf | YES | YES |
| wait/io/file/partition/ha_partition::parfile | YES | YES |
| wait/io/file/sql/binlog | YES | YES |
| wait/io/file/sql/binlog_cache | YES | YES |
| wait/io/file/sql/binlog_index | YES | YES |
| wait/io/file/sql/binlog_index_cache | YES | YES |
| wait/io/file/sql/binlog_state | YES | YES |
| wait/io/file/sql/casetest | YES | YES |
| wait/io/file/sql/dbopt | YES | YES |
| wait/io/file/sql/des_key_file | YES | YES |
| wait/io/file/sql/ERRMSG | YES | YES |
| wait/io/file/sql/file_parser | YES | YES |
| wait/io/file/sql/FRM | YES | YES |
| wait/io/file/sql/global_ddl_log | YES | YES |
| wait/io/file/sql/init | YES | YES |
| wait/io/file/sql/io_cache | YES | YES |
| wait/io/file/sql/load | YES | YES |
453/3812
| wait/io/file/sql/load | YES | YES |
| wait/io/file/sql/LOAD_FILE | YES | YES |
| wait/io/file/sql/log_event_data | YES | YES |
| wait/io/file/sql/log_event_info | YES | YES |
| wait/io/file/sql/map | YES | YES |
| wait/io/file/sql/master_info | YES | YES |
| wait/io/file/sql/misc | YES | YES |
| wait/io/file/sql/partition_ddl_log | YES | YES |
| wait/io/file/sql/pid | YES | YES |
| wait/io/file/sql/query_log | YES | YES |
| wait/io/file/sql/relaylog | YES | YES |
| wait/io/file/sql/relaylog_cache | YES | YES |
| wait/io/file/sql/relaylog_index | YES | YES |
| wait/io/file/sql/relaylog_index_cache | YES | YES |
| wait/io/file/sql/relay_log_info | YES | YES |
| wait/io/file/sql/select_to_file | YES | YES |
| wait/io/file/sql/send_file | YES | YES |
| wait/io/file/sql/slow_log | YES | YES |
| wait/io/file/sql/tclog | YES | YES |
| wait/io/file/sql/trigger | YES | YES |
| wait/io/file/sql/trigger_name | YES | YES |
| wait/io/file/sql/wsrep_gra_log | YES | YES |
| wait/io/socket/sql/client_connection | NO | NO |
| wait/io/socket/sql/server_tcpip_socket | NO | NO |
| wait/io/socket/sql/server_unix_socket | NO | NO |
| wait/io/table/sql/handler | YES | YES |
| wait/lock/metadata/sql/mdl | NO | NO |
| wait/lock/table/sql/handler | YES | YES |
| wait/synch/cond/aria/BITMAP::bitmap_cond | NO | NO |
| wait/synch/cond/aria/COND_soft_sync | NO | NO |
| wait/synch/cond/aria/SERVICE_THREAD_CONTROL::COND_control | NO | NO |
| wait/synch/cond/aria/SHARE::key_del_cond | NO | NO |
| wait/synch/cond/aria/SORT_INFO::cond | NO | NO |
| wait/synch/cond/aria/TRANSLOG_BUFFER::prev_sent_to_disk_cond | NO | NO |
| wait/synch/cond/aria/TRANSLOG_BUFFER::waiting_filling_buffer | NO | NO |
| wait/synch/cond/aria/TRANSLOG_DESCRIPTOR::log_flush_cond | NO | NO |
| wait/synch/cond/aria/TRANSLOG_DESCRIPTOR::new_goal_cond | NO | NO |
| wait/synch/cond/innodb/commit_cond | NO | NO |
| wait/synch/cond/myisam/MI_SORT_INFO::cond | NO | NO |
| wait/synch/cond/mysys/COND_alarm | NO | NO |
| wait/synch/cond/mysys/COND_timer | NO | NO |
| wait/synch/cond/mysys/IO_CACHE_SHARE::cond | NO | NO |
| wait/synch/cond/mysys/IO_CACHE_SHARE::cond_writer | NO | NO |
| wait/synch/cond/mysys/my_thread_var::suspend | NO | NO |
| wait/synch/cond/mysys/THR_COND_threads | NO | NO |
| wait/synch/cond/mysys/WT_RESOURCE::cond | NO | NO |
| wait/synch/cond/sql/Ack_receiver::cond | NO | NO |
| wait/synch/cond/sql/COND_binlog_send | NO | NO |
| wait/synch/cond/sql/COND_flush_thread_cache | NO | NO |
| wait/synch/cond/sql/COND_group_commit_orderer | NO | NO |
| wait/synch/cond/sql/COND_gtid_ignore_duplicates | NO | NO |
| wait/synch/cond/sql/COND_manager | NO | NO |
| wait/synch/cond/sql/COND_parallel_entry | NO | NO |
| wait/synch/cond/sql/COND_prepare_ordered | NO | NO |
| wait/synch/cond/sql/COND_queue_state | NO | NO |
| wait/synch/cond/sql/COND_rpl_thread | NO | NO |
| wait/synch/cond/sql/COND_rpl_thread_pool | NO | NO |
| wait/synch/cond/sql/COND_rpl_thread_queue | NO | NO |
| wait/synch/cond/sql/COND_rpl_thread_stop | NO | NO |
| wait/synch/cond/sql/COND_server_started | NO | NO |
| wait/synch/cond/sql/COND_slave_background | NO | NO |
| wait/synch/cond/sql/COND_start_thread | NO | NO |
| wait/synch/cond/sql/COND_thread_cache | NO | NO |
| wait/synch/cond/sql/COND_wait_gtid | NO | NO |
| wait/synch/cond/sql/COND_wsrep_donor_monitor | NO | NO |
| wait/synch/cond/sql/COND_wsrep_gtid_wait_upto | NO | NO |
| wait/synch/cond/sql/COND_wsrep_joiner_monitor | NO | NO |
| wait/synch/cond/sql/COND_wsrep_ready | NO | NO |
| wait/synch/cond/sql/COND_wsrep_replaying | NO | NO |
| wait/synch/cond/sql/COND_wsrep_sst | NO | NO |
| wait/synch/cond/sql/COND_wsrep_sst_init | NO | NO |
| wait/synch/cond/sql/COND_wsrep_wsrep_slave_threads | NO | NO |
| wait/synch/cond/sql/Delayed_insert::cond | NO | NO |
| wait/synch/cond/sql/Delayed_insert::cond_client | NO | NO |
| wait/synch/cond/sql/Event_scheduler::COND_state | NO | NO |
| wait/synch/cond/sql/Item_func_sleep::cond | NO | NO |
| wait/synch/cond/sql/Master_info::data_cond | NO | NO |
| wait/synch/cond/sql/Master_info::sleep_cond | NO | NO |
| wait/synch/cond/sql/Master_info::start_cond | NO | NO |
| wait/synch/cond/sql/Master_info::stop_cond | NO | NO |
| wait/synch/cond/sql/MDL_context::COND_wait_status | NO | NO |
| wait/synch/cond/sql/MYSQL_BIN_LOG::COND_binlog_background_thread | NO | NO |
| wait/synch/cond/sql/MYSQL_BIN_LOG::COND_binlog_background_thread_end | NO | NO |
454/3812
| wait/synch/cond/sql/MYSQL_BIN_LOG::COND_binlog_background_thread_end | NO | NO |
| wait/synch/cond/sql/MYSQL_BIN_LOG::COND_bin_log_updated | NO | NO |
| wait/synch/cond/sql/MYSQL_BIN_LOG::COND_queue_busy | NO | NO |
| wait/synch/cond/sql/MYSQL_BIN_LOG::COND_relay_log_updated | NO | NO |
| wait/synch/cond/sql/MYSQL_BIN_LOG::COND_xid_list | NO | NO |
| wait/synch/cond/sql/MYSQL_RELAY_LOG::COND_bin_log_updated | NO | NO |
| wait/synch/cond/sql/MYSQL_RELAY_LOG::COND_queue_busy | NO | NO |
| wait/synch/cond/sql/MYSQL_RELAY_LOG::COND_relay_log_updated | NO | NO |
| wait/synch/cond/sql/PAGE::cond | NO | NO |
| wait/synch/cond/sql/Query_cache::COND_cache_status_changed | NO | NO |
| wait/synch/cond/sql/Relay_log_info::data_cond | NO | NO |
| wait/synch/cond/sql/Relay_log_info::log_space_cond | NO | NO |
| wait/synch/cond/sql/Relay_log_info::start_cond | NO | NO |
| wait/synch/cond/sql/Relay_log_info::stop_cond | NO | NO |
| wait/synch/cond/sql/Rpl_group_info::sleep_cond | NO | NO |
| wait/synch/cond/sql/show_explain | NO | NO |
| wait/synch/cond/sql/TABLE_SHARE::cond | NO | NO |
| wait/synch/cond/sql/TABLE_SHARE::COND_rotation | NO | NO |
| wait/synch/cond/sql/TABLE_SHARE::tdc.COND_release | NO | NO |
| wait/synch/cond/sql/TC_LOG_MMAP::COND_active | NO | NO |
| wait/synch/cond/sql/TC_LOG_MMAP::COND_pool | NO | NO |
| wait/synch/cond/sql/TC_LOG_MMAP::COND_queue_busy | NO | NO |
| wait/synch/cond/sql/THD::COND_wakeup_ready | NO | NO |
| wait/synch/cond/sql/THD::COND_wsrep_thd | NO | NO |
| wait/synch/cond/sql/User_level_lock::cond | NO | NO |
| wait/synch/cond/sql/wait_for_commit::COND_wait_commit | NO | NO |
| wait/synch/cond/sql/wsrep_sst_thread | NO | NO |
| wait/synch/mutex/aria/LOCK_soft_sync | NO | NO |
| wait/synch/mutex/aria/LOCK_trn_list | NO | NO |
| wait/synch/mutex/aria/PAGECACHE::cache_lock | NO | NO |
| wait/synch/mutex/aria/SERVICE_THREAD_CONTROL::LOCK_control | NO | NO |
| wait/synch/mutex/aria/SHARE::bitmap::bitmap_lock | NO | NO |
| wait/synch/mutex/aria/SHARE::close_lock | NO | NO |
| wait/synch/mutex/aria/SHARE::intern_lock | NO | NO |
| wait/synch/mutex/aria/SHARE::key_del_lock | NO | NO |
| wait/synch/mutex/aria/SORT_INFO::mutex | NO | NO |
| wait/synch/mutex/aria/THR_LOCK_maria | NO | NO |
| wait/synch/mutex/aria/TRANSLOG_BUFFER::mutex | NO | NO |
| wait/synch/mutex/aria/TRANSLOG_DESCRIPTOR::dirty_buffer_mask_lock | NO | NO |
| wait/synch/mutex/aria/TRANSLOG_DESCRIPTOR::file_header_lock | NO | NO |
| wait/synch/mutex/aria/TRANSLOG_DESCRIPTOR::log_flush_lock | NO | NO |
| wait/synch/mutex/aria/TRANSLOG_DESCRIPTOR::purger_lock | NO | NO |
| wait/synch/mutex/aria/TRANSLOG_DESCRIPTOR::sent_to_disk_lock | NO | NO |
| wait/synch/mutex/aria/TRANSLOG_DESCRIPTOR::unfinished_files_lock | NO | NO |
| wait/synch/mutex/aria/TRN::state_lock | NO | NO |
| wait/synch/mutex/csv/tina | NO | NO |
| wait/synch/mutex/csv/TINA_SHARE::mutex | NO | NO |
| wait/synch/mutex/innodb/buf_dblwr_mutex | NO | NO |
| wait/synch/mutex/innodb/buf_pool_mutex | NO | NO |
| wait/synch/mutex/innodb/commit_cond_mutex | NO | NO |
| wait/synch/mutex/innodb/dict_foreign_err_mutex | NO | NO |
| wait/synch/mutex/innodb/dict_sys_mutex | NO | NO |
| wait/synch/mutex/innodb/fil_system_mutex | NO | NO |
| wait/synch/mutex/innodb/flush_list_mutex | NO | NO |
| wait/synch/mutex/innodb/fts_delete_mutex | NO | NO |
| wait/synch/mutex/innodb/fts_doc_id_mutex | NO | NO |
| wait/synch/mutex/innodb/ibuf_bitmap_mutex | NO | NO |
| wait/synch/mutex/innodb/ibuf_mutex | NO | NO |
| wait/synch/mutex/innodb/ibuf_pessimistic_insert_mutex | NO | NO |
| wait/synch/mutex/innodb/lock_mutex | NO | NO |
| wait/synch/mutex/innodb/lock_wait_mutex | NO | NO |
| wait/synch/mutex/innodb/log_flush_order_mutex | NO | NO |
| wait/synch/mutex/innodb/log_sys_mutex | NO | NO |
| wait/synch/mutex/innodb/noredo_rseg_mutex | NO | NO |
| wait/synch/mutex/innodb/page_zip_stat_per_index_mutex | NO | NO |
| wait/synch/mutex/innodb/pending_checkpoint_mutex | NO | NO |
| wait/synch/mutex/innodb/purge_sys_pq_mutex | NO | NO |
| wait/synch/mutex/innodb/recalc_pool_mutex | NO | NO |
| wait/synch/mutex/innodb/recv_sys_mutex | NO | NO |
| wait/synch/mutex/innodb/redo_rseg_mutex | NO | NO |
| wait/synch/mutex/innodb/rtr_active_mutex | NO | NO |
| wait/synch/mutex/innodb/rtr_match_mutex | NO | NO |
| wait/synch/mutex/innodb/rtr_path_mutex | NO | NO |
| wait/synch/mutex/innodb/rw_lock_list_mutex | NO | NO |
| wait/synch/mutex/innodb/srv_innodb_monitor_mutex | NO | NO |
| wait/synch/mutex/innodb/srv_misc_tmpfile_mutex | NO | NO |
| wait/synch/mutex/innodb/srv_monitor_file_mutex | NO | NO |
| wait/synch/mutex/innodb/srv_threads_mutex | NO | NO |
| wait/synch/mutex/innodb/trx_mutex | NO | NO |
| wait/synch/mutex/innodb/trx_pool_manager_mutex | NO | NO |
| wait/synch/mutex/innodb/trx_pool_mutex | NO | NO |
| wait/synch/mutex/innodb/trx_sys_mutex | NO | NO |
| wait/synch/mutex/myisam/MI_CHECK::print_msg | NO | NO | 455/3812
| wait/synch/mutex/myisam/MI_CHECK::print_msg | NO | NO |
| wait/synch/mutex/myisam/MI_SORT_INFO::mutex | NO | NO |
| wait/synch/mutex/myisam/MYISAM_SHARE::intern_lock | NO | NO |
| wait/synch/mutex/myisammrg/MYRG_INFO::mutex | NO | NO |
| wait/synch/mutex/mysys/BITMAP::mutex | NO | NO |
| wait/synch/mutex/mysys/IO_CACHE::append_buffer_lock | NO | NO |
| wait/synch/mutex/mysys/IO_CACHE::SHARE_mutex | NO | NO |
| wait/synch/mutex/mysys/KEY_CACHE::cache_lock | NO | NO |
| wait/synch/mutex/mysys/LOCK_alarm | NO | NO |
| wait/synch/mutex/mysys/LOCK_timer | NO | NO |
| wait/synch/mutex/mysys/LOCK_uuid_generator | NO | NO |
| wait/synch/mutex/mysys/my_thread_var::mutex | NO | NO |
| wait/synch/mutex/mysys/THR_LOCK::mutex | NO | NO |
| wait/synch/mutex/mysys/THR_LOCK_charset | NO | NO |
| wait/synch/mutex/mysys/THR_LOCK_heap | NO | NO |
| wait/synch/mutex/mysys/THR_LOCK_lock | NO | NO |
| wait/synch/mutex/mysys/THR_LOCK_malloc | NO | NO |
| wait/synch/mutex/mysys/THR_LOCK_myisam | NO | NO |
| wait/synch/mutex/mysys/THR_LOCK_myisam_mmap | NO | NO |
| wait/synch/mutex/mysys/THR_LOCK_net | NO | NO |
| wait/synch/mutex/mysys/THR_LOCK_open | NO | NO |
| wait/synch/mutex/mysys/THR_LOCK_threads | NO | NO |
| wait/synch/mutex/mysys/TMPDIR_mutex | NO | NO |
| wait/synch/mutex/partition/Partition_share::auto_inc_mutex | NO | NO |
| wait/synch/mutex/sql/Ack_receiver::mutex | NO | NO |
| wait/synch/mutex/sql/Cversion_lock | NO | NO |
| wait/synch/mutex/sql/Delayed_insert::mutex | NO | NO |
| wait/synch/mutex/sql/Event_scheduler::LOCK_scheduler_state | NO | NO |
| wait/synch/mutex/sql/gtid_waiting::LOCK_gtid_waiting | NO | NO |
| wait/synch/mutex/sql/hash_filo::lock | NO | NO |
| wait/synch/mutex/sql/HA_DATA_PARTITION::LOCK_auto_inc | NO | NO |
| wait/synch/mutex/sql/LOCK_active_mi | NO | NO |
| wait/synch/mutex/sql/LOCK_after_binlog_sync | NO | NO |
| wait/synch/mutex/sql/LOCK_audit_mask | NO | NO |
| wait/synch/mutex/sql/LOCK_binlog | NO | NO |
| wait/synch/mutex/sql/LOCK_binlog_state | NO | NO |
| wait/synch/mutex/sql/LOCK_commit_ordered | NO | NO |
| wait/synch/mutex/sql/LOCK_crypt | NO | NO |
| wait/synch/mutex/sql/LOCK_delayed_create | NO | NO |
| wait/synch/mutex/sql/LOCK_delayed_insert | NO | NO |
| wait/synch/mutex/sql/LOCK_delayed_status | NO | NO |
| wait/synch/mutex/sql/LOCK_des_key_file | NO | NO |
| wait/synch/mutex/sql/LOCK_error_log | NO | NO |
| wait/synch/mutex/sql/LOCK_error_messages | NO | NO |
| wait/synch/mutex/sql/LOCK_event_queue | NO | NO |
| wait/synch/mutex/sql/LOCK_gdl | NO | NO |
| wait/synch/mutex/sql/LOCK_global_index_stats | NO | NO |
| wait/synch/mutex/sql/LOCK_global_system_variables | NO | NO |
| wait/synch/mutex/sql/LOCK_global_table_stats | NO | NO |
| wait/synch/mutex/sql/LOCK_global_user_client_stats | NO | NO |
| wait/synch/mutex/sql/LOCK_item_func_sleep | NO | NO |
| wait/synch/mutex/sql/LOCK_load_client_plugin | NO | NO |
| wait/synch/mutex/sql/LOCK_manager | NO | NO |
| wait/synch/mutex/sql/LOCK_parallel_entry | NO | NO |
| wait/synch/mutex/sql/LOCK_plugin | NO | NO |
| wait/synch/mutex/sql/LOCK_prepared_stmt_count | NO | NO |
| wait/synch/mutex/sql/LOCK_prepare_ordered | NO | NO |
| wait/synch/mutex/sql/LOCK_rpl_semi_sync_master_enabled | NO | NO |
| wait/synch/mutex/sql/LOCK_rpl_status | NO | NO |
| wait/synch/mutex/sql/LOCK_rpl_thread | NO | NO |
| wait/synch/mutex/sql/LOCK_rpl_thread_pool | NO | NO |
| wait/synch/mutex/sql/LOCK_server_started | NO | NO |
| wait/synch/mutex/sql/LOCK_slave_background | NO | NO |
| wait/synch/mutex/sql/LOCK_slave_state | NO | NO |
| wait/synch/mutex/sql/LOCK_start_thread | NO | NO |
| wait/synch/mutex/sql/LOCK_stats | NO | NO |
| wait/synch/mutex/sql/LOCK_status | NO | NO |
| wait/synch/mutex/sql/LOCK_system_variables_hash | NO | NO |
| wait/synch/mutex/sql/LOCK_table_cache | NO | NO |
| wait/synch/mutex/sql/LOCK_thread_cache | NO | NO |
| wait/synch/mutex/sql/LOCK_thread_id | NO | NO |
| wait/synch/mutex/sql/LOCK_unused_shares | NO | NO |
| wait/synch/mutex/sql/LOCK_user_conn | NO | NO |
| wait/synch/mutex/sql/LOCK_uuid_short_generator | NO | NO |
| wait/synch/mutex/sql/LOCK_wsrep_cluster_config | NO | NO |
| wait/synch/mutex/sql/LOCK_wsrep_config_state | NO | NO |
| wait/synch/mutex/sql/LOCK_wsrep_desync | NO | NO |
| wait/synch/mutex/sql/LOCK_wsrep_donor_monitor | NO | NO |
| wait/synch/mutex/sql/LOCK_wsrep_group_commit | NO | NO |
| wait/synch/mutex/sql/LOCK_wsrep_gtid_wait_upto | NO | NO |
| wait/synch/mutex/sql/LOCK_wsrep_joiner_monitor | NO | NO |
| wait/synch/mutex/sql/LOCK_wsrep_ready | NO | NO |
456/3812
| wait/synch/mutex/sql/LOCK_wsrep_ready | NO | NO |
| wait/synch/mutex/sql/LOCK_wsrep_replaying | NO | NO |
| wait/synch/mutex/sql/LOCK_wsrep_slave_threads | NO | NO |
| wait/synch/mutex/sql/LOCK_wsrep_SR_pool | NO | NO |
| wait/synch/mutex/sql/LOCK_wsrep_SR_store | NO | NO |
| wait/synch/mutex/sql/LOCK_wsrep_sst | NO | NO |
| wait/synch/mutex/sql/LOCK_wsrep_sst_init | NO | NO |
| wait/synch/mutex/sql/LOG::LOCK_log | NO | NO |
| wait/synch/mutex/sql/Master_info::data_lock | NO | NO |
| wait/synch/mutex/sql/Master_info::run_lock | NO | NO |
| wait/synch/mutex/sql/Master_info::sleep_lock | NO | NO |
| wait/synch/mutex/sql/Master_info::start_stop_lock | NO | NO |
| wait/synch/mutex/sql/MDL_wait::LOCK_wait_status | NO | NO |
| wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_binlog_background_thread | NO | NO |
| wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_binlog_end_pos | NO | NO |
| wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_index | NO | NO |
| wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_xid_list | NO | NO |
| wait/synch/mutex/sql/MYSQL_RELAY_LOG::LOCK_binlog_end_pos | NO | NO |
| wait/synch/mutex/sql/MYSQL_RELAY_LOG::LOCK_index | NO | NO |
| wait/synch/mutex/sql/PAGE::lock | NO | NO |
| wait/synch/mutex/sql/Query_cache::structure_guard_mutex | NO | NO |
| wait/synch/mutex/sql/Relay_log_info::data_lock | NO | NO |
| wait/synch/mutex/sql/Relay_log_info::log_space_lock | NO | NO |
| wait/synch/mutex/sql/Relay_log_info::run_lock | NO | NO |
| wait/synch/mutex/sql/Rpl_group_info::sleep_lock | NO | NO |
| wait/synch/mutex/sql/Slave_reporting_capability::err_lock | NO | NO |
| wait/synch/mutex/sql/TABLE_SHARE::LOCK_ha_data | NO | NO |
| wait/synch/mutex/sql/TABLE_SHARE::LOCK_rotation | NO | NO |
| wait/synch/mutex/sql/TABLE_SHARE::LOCK_share | NO | NO |
| wait/synch/mutex/sql/TABLE_SHARE::tdc.LOCK_table_share | NO | NO |
| wait/synch/mutex/sql/TC_LOG_MMAP::LOCK_active | NO | NO |
| wait/synch/mutex/sql/TC_LOG_MMAP::LOCK_pending_checkpoint | NO | NO |
| wait/synch/mutex/sql/TC_LOG_MMAP::LOCK_pool | NO | NO |
| wait/synch/mutex/sql/TC_LOG_MMAP::LOCK_sync | NO | NO |
| wait/synch/mutex/sql/THD::LOCK_thd_data | NO | NO |
| wait/synch/mutex/sql/THD::LOCK_thd_kill | NO | NO |
| wait/synch/mutex/sql/THD::LOCK_wakeup_ready | NO | NO |
| wait/synch/mutex/sql/tz_LOCK | NO | NO |
| wait/synch/mutex/sql/wait_for_commit::LOCK_wait_commit | NO | NO |
| wait/synch/mutex/sql/wsrep_sst_thread | NO | NO |
| wait/synch/rwlock/aria/KEYINFO::root_lock | NO | NO |
| wait/synch/rwlock/aria/SHARE::mmap_lock | NO | NO |
| wait/synch/rwlock/aria/TRANSLOG_DESCRIPTOR::open_files_lock | NO | NO |
| wait/synch/rwlock/myisam/MYISAM_SHARE::key_root_lock | NO | NO |
| wait/synch/rwlock/myisam/MYISAM_SHARE::mmap_lock | NO | NO |
| wait/synch/rwlock/mysys/SAFE_HASH::mutex | NO | NO |
| wait/synch/rwlock/proxy_proto/rwlock | NO | NO |
| wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock | NO | NO |
| wait/synch/rwlock/sql/LOCK_all_status_vars | NO | NO |
| wait/synch/rwlock/sql/LOCK_dboptions | NO | NO |
| wait/synch/rwlock/sql/LOCK_grant | NO | NO |
| wait/synch/rwlock/sql/LOCK_SEQUENCE | NO | NO |
| wait/synch/rwlock/sql/LOCK_ssl_refresh | NO | NO |
| wait/synch/rwlock/sql/LOCK_system_variables_hash | NO | NO |
| wait/synch/rwlock/sql/LOCK_sys_init_connect | NO | NO |
| wait/synch/rwlock/sql/LOCK_sys_init_slave | NO | NO |
| wait/synch/rwlock/sql/LOGGER::LOCK_logger | NO | NO |
| wait/synch/rwlock/sql/MDL_context::LOCK_waiting_for | NO | NO |
| wait/synch/rwlock/sql/MDL_lock::rwlock | NO | NO |
| wait/synch/rwlock/sql/Query_cache_query::lock | NO | NO |
| wait/synch/rwlock/sql/TABLE_SHARE::LOCK_stat_serial | NO | NO |
| wait/synch/rwlock/sql/THD_list::lock | NO | NO |
| wait/synch/rwlock/sql/THR_LOCK_servers | NO | NO |
| wait/synch/rwlock/sql/THR_LOCK_udf | NO | NO |
| wait/synch/rwlock/sql/Vers_field_stats::lock | NO | NO |
| wait/synch/sxlock/innodb/btr_search_latch | NO | NO |
| wait/synch/sxlock/innodb/dict_operation_lock | NO | NO |
| wait/synch/sxlock/innodb/fil_space_latch | NO | NO |
| wait/synch/sxlock/innodb/fts_cache_init_rw_lock | NO | NO |
| wait/synch/sxlock/innodb/fts_cache_rw_lock | NO | NO |
| wait/synch/sxlock/innodb/index_online_log | NO | NO |
| wait/synch/sxlock/innodb/index_tree_rw_lock | NO | NO |
| wait/synch/sxlock/innodb/trx_i_s_cache_lock | NO | NO |
| wait/synch/sxlock/innodb/trx_purge_latch | NO | NO |
+--------------------------------------------------------------------------------+---------+-------+
996 rows in set (0.005 sec)

1.1.1.2.9.2.1.67 Performance Schema


457/3812
setup_objects Table
Description
The setup_objects table determines whether objects are monitored by the performance schema or not. By default
limited to 100 rows, this can be changed by setting the performance_schema_setup_objects_size system variable when
the server starts.
It contains the following columns:

Column Description
OBJECT_TYPE Type of object to instrument, currently only . Currently, only TABLE' , for base table.
OBJECT_SCHEMA Schema containing the object, either the literal or % for any schema.
OBJECT_NAME Name of the instrumented object, either the literal or % for any object.
Whether the object's events are instrumented or not. Can be disabled, in which case monitoring is
ENABLED
not enabled for those objects.
TIMED Whether the object's events are timed or not. Can be modified.

When the Performance Schema looks for matches in the setup_objects , there may be more than one row matching,
with different ENABLED and TIMED values. It looks for the most specific matches first, that is, it will first look for the
specific database and table name combination, then the specific database, only then falling back to a wildcard for both.
Rows can be added or removed from the table, while for existing rows, only the TIMED and ENABLED columns can be
updated. By default, all tables except those in the performance_schema , information_schema and mysql databases
are instrumented.

1.1.1.2.9.2.1.68 Performance Schema


setup_timers Table
Description
The setup_timers table shows the currently selected event timers.
It contains the following columns:

Column Description
NAME Type of instrument the timer is used for.
TIMER_NAME Timer applying to the instrument type. Can be modified.

The TIMER_NAME value can be changed to choose a different timer, and can be any non-NULL value in the
performance_timers.TIMER_NAME column.
If you modify the table, monitoring is immediately affected, and currently monitored events would use a combination of
old and new timers, which is probably undesirable. It is best to reset the Performance Schema statistics if you make
changes to this table.

Example
SELECT * FROM setup_timers;
+-----------+-------------+
| NAME | TIMER_NAME |
+-----------+-------------+
| idle | MICROSECOND |
| wait | CYCLE |
| stage | NANOSECOND |
| statement | NANOSECOND |
+-----------+-------------+

1.1.1.2.9.2.1.69 Performance Schema


socket_instances Table
The socket_instances table lists active server connections, with each record being a Unix socket file or TCP/IP
458/3812
connection.
The socket_instances table contains the following columns:

Column Description
NAME from the setup_instruments table, and the name of the wait/io/socket/*
EVENT_NAME
instrument that produced the event.
OBJECT_INSTANCE_BEGIN Memory address of the object.
THREAD_ID Thread identifier that the server assigns to each socket.
SOCKET_ID The socket's internal file handle.
Client IP address. Blank for Unix socket file, otherwise an IPv4 or IPv6 address. Together
IP
with the PORT identifies the connection.
PORT TCP/IP port number, from 0 to 65535. Together with the IP identifies the connection.
STATE Socket status, either IDLE if waiting to receive a request from a client, or ACTIVE

1.1.1.2.9.2.1.70 Performance Schema


socket_summary_by_event_name Table
It aggregates timer and byte count statistics for all socket I/O operations by socket instrument.

Column Description
EVENT_NAME Socket instrument.
COUNT_STAR Number of summarized events
SUM_TIMER_WAIT Total wait time of the summarized events that are timed.
MIN_TIMER_WAIT Minimum wait time of the summarized events that are timed.
AVG_TIMER_WAIT Average wait time of the summarized events that are timed.
MAX_TIMER_WAIT Maximum wait time of the summarized events that are timed.
COUNT_READ Number of all read operations, including RECV , RECVFROM , and RECVMSG .
SUM_TIMER_READ Total wait time of all read operations that are timed.
MIN_TIMER_READ Minimum wait time of all read operations that are timed.
AVG_TIMER_READ Average wait time of all read operations that are timed.
MAX_TIMER_READ Maximum wait time of all read operations that are timed.
SUM_NUMBER_OF_BYTES_READ Bytes read by read operations.
COUNT_WRITE Number of all write operations, including SEND , SENDTO , and SENDMSG .
SUM_TIMER_WRITE Total wait time of all write operations that are timed.
MIN_TIMER_WRITE Minimum wait time of all write operations that are timed.
AVG_TIMER_WRITE Average wait time of all write operations that are timed.
MAX_TIMER_WRITE Maximum wait time of all write operations that are timed.

SUM_NUMBER_OF_BYTES_WRITE Bytes written by write operations.


Number of all miscellaneous operations not counted above, including CONNECT ,
COUNT_MISC
LISTEN , ACCEPT , CLOSE , and SHUTDOWN .

SUM_TIMER_MISC Total wait time of all miscellaneous operations that are timed.
MIN_TIMER_MISC Minimum wait time of all miscellaneous operations that are timed.
AVG_TIMER_MISC Average wait time of all miscellaneous operations that are timed.
MAX_TIMER_MISC Maximum wait time of all miscellaneous operations that are timed.

You can TRUNCATE the table, which will reset all counters to zero.

Example

459/3812
SELECT * FROM socket_summary_by_event_name\G
*************************** 1. row ***************************
EVENT_NAME: wait/io/socket/sql/server_tcpip_socket
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
COUNT_READ: 0
SUM_TIMER_READ: 0
MIN_TIMER_READ: 0
AVG_TIMER_READ: 0
MAX_TIMER_READ: 0
SUM_NUMBER_OF_BYTES_READ: 0
COUNT_WRITE: 0
SUM_TIMER_WRITE: 0
MIN_TIMER_WRITE: 0
AVG_TIMER_WRITE: 0
MAX_TIMER_WRITE: 0
SUM_NUMBER_OF_BYTES_WRITE: 0
COUNT_MISC: 0
SUM_TIMER_MISC: 0
MIN_TIMER_MISC: 0
AVG_TIMER_MISC: 0
MAX_TIMER_MISC: 0
*************************** 2. row ***************************
EVENT_NAME: wait/io/socket/sql/server_unix_socket
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
COUNT_READ: 0
SUM_TIMER_READ: 0
MIN_TIMER_READ: 0
AVG_TIMER_READ: 0
MAX_TIMER_READ: 0
SUM_NUMBER_OF_BYTES_READ: 0
COUNT_WRITE: 0
SUM_TIMER_WRITE: 0
MIN_TIMER_WRITE: 0
AVG_TIMER_WRITE: 0
MAX_TIMER_WRITE: 0
SUM_NUMBER_OF_BYTES_WRITE: 0
COUNT_MISC: 0
SUM_TIMER_MISC: 0
MIN_TIMER_MISC: 0
AVG_TIMER_MISC: 0
MAX_TIMER_MISC: 0
...

1.1.1.2.9.2.1.71 Performance Schema


socket_summary_by_instance Table
It aggregates timer and byte count statistics for all socket I/O operations by socket instance.

Column Description
EVENT_NAME Socket instrument.
OBJECT_INSTANCE_BEGIN Address in memory.
COUNT_STAR Number of summarized events
SUM_TIMER_WAIT Total wait time of the summarized events that are timed.
MIN_TIMER_WAIT Minimum wait time of the summarized events that are timed.
AVG_TIMER_WAIT Average wait time of the summarized events that are timed.
MAX_TIMER_WAIT Maximum wait time of the summarized events that are timed.
COUNT_READ
Number of all read operations, including RECV , RECVFROM , and RECVMSG .

SUM_TIMER_READ Total wait time of all read operations that are timed.
MIN_TIMER_READ Minimum wait time of all read operations that are timed.

460/3812
AVG_TIMER_READ Average wait time of all read operations that are timed.
MAX_TIMER_READ Maximum wait time of all read operations that are timed.
SUM_NUMBER_OF_BYTES_READ Bytes read by read operations.
COUNT_WRITE Number of all write operations, including SEND , SENDTO , and SENDMSG .
SUM_TIMER_WRITE Total wait time of all write operations that are timed.
MIN_TIMER_WRITE Minimum wait time of all write operations that are timed.
AVG_TIMER_WRITE Average wait time of all write operations that are timed.
MAX_TIMER_WRITE Maximum wait time of all write operations that are timed.
SUM_NUMBER_OF_BYTES_WRITE Bytes written by write operations.
Number of all miscellaneous operations not counted above, including CONNECT ,
COUNT_MISC
LISTEN , ACCEPT , CLOSE , and SHUTDOWN .

SUM_TIMER_MISC Total wait time of all miscellaneous operations that are timed.
MIN_TIMER_MISC Minimum wait time of all miscellaneous operations that are timed.
AVG_TIMER_MISC Average wait time of all miscellaneous operations that are timed.
MAX_TIMER_MISC Maximum wait time of all miscellaneous operations that are timed.

The corresponding row in the table is deleted when a connection terminates.


You can TRUNCATE the table, which will reset all counters to zero.

1.1.1.2.9.2.1.72 Performance Schema


status_by_account Table
MariaDB starting with 10.5.2
The status_by_account table was added in MariaDB 10.5.2.

The status_by_account table contains status variable information by user/host account. The table does not collect
statistics for Com_xxx variables.
The table contains the following columns:

Column Description
USER User for which the status variable is reported.
HOST Host for which the status variable is reported.
VARIABLE_NAME Status variable name.
VARIABLE_VALUE Aggregated status variable value

If TRUNCATE TABLE is run, will aggregate the status from terminated sessions to user and host status, then reset the
account status.
If FLUSH STATUS is run, session status from all active sessions are added to the global status variables, the status of
all active sessions are reset, and values aggregated from disconnected sessions are reset.

1.1.1.2.9.2.1.73 Performance Schema


status_by_host Table
MariaDB starting with 10.5.2
The status_by_host table was added in MariaDB 10.5.2.

The status_by_host table contains status variable information by host. The table does not collect statistics for
Com_xxx variables.
The table contains the following columns:

Column Description
HOST Host for which the status variable is reported.
461/3812
VARIABLE_NAME Status variable name.
VARIABLE_VALUE Aggregated status variable value

If TRUNCATE TABLE is run, will reset the aggregated host status from terminated sessions.
If FLUSH STATUS is run, session status from all active sessions are added to the global status variables, the status of
all active sessions are reset, and values aggregated from disconnected sessions are reset.

1.1.1.2.9.2.1.74 Performance Schema


status_by_thread Table
MariaDB starting with 10.5.2
The session_status table was added in MariaDB 10.5.2.

The status_by_thread table contains status variable information about active foreground threads. The table does not
collect statistics for Com_xxx variables.
The table contains the following columns:

Column Description
THREAD_ID The thread identifier of the session in which the status variable is defined.
VARIABLE_NAME Status variable name.
VARIABLE_VALUE Aggregated status variable value.

If TRUNCATE TABLE is run, will aggregate the status for all threads to the global status and account status, then reset
the thread status. If account statistics are not collected but host and user status are, the session status is added to host
and user status.

1.1.1.2.9.2.1.75 Performance Schema


status_by_user Table
MariaDB starting with 10.5.2
The status_by_account table was added in MariaDB 10.5.2.

The status_by_account table contains status variable information by user. The table does not collect statistics for
Com_xxx variables.

The table contains the following columns:

Column Description

USER User for which the status variable is reported.


VARIABLE_NAME Status variable name.
VARIABLE_VALUE Aggregated status variable value

If TRUNCATE TABLE is run, will reset the aggregated user status from terminated sessions.
If FLUSH STATUS is run, session status from all active sessions are added to the global status variables, the status of
all active sessions are reset, and values aggregated from disconnected sessions are reset.

1.1.1.2.9.2.1.76 Performance Schema


table_handles Table
MariaDB starting with 10.5.2
The table_handles table was added in MariaDB 10.5.2.

The table_handles table contains table lock information. It uses the wait/lock/table/sql/handler instrument, which
is enabled by default.
Information includes which table handles are open, which sessions are holding the locks, and how they are locked.
462/3812
The table is read-only, and TRUNCATE TABLE cannot be performed on the table.
The maximum number of opened table objects is determined by the performance_schema_max_table_handles system
variable.
The table contains the following columns:

Column Description
OBJECT_TYPE The table opened by a table handle.
OBJECT_SCHEMA The schema that contains the object.
OBJECT_NAME The name of the instrumented object.
OBJECT_INSTANCE_BEGIN The table handle address in memory.
OWNER_THREAD_ID The thread owning the table handle.
OWNER_EVENT_ID The event which caused the table handle to be opened.
INTERNAL_LOCK The table lock used at the SQL level.
EXTERNAL_LOCK The table lock used at the storage engine level.

1.1.1.2.9.2.1.77 Performance Schema


table_io_waits_summary_by_index_usage
Table
The table_io_waits_summary_by_index_usage table records table I/O waits by index.

Column Description
OBJECT_TYPE TABLE in the case of all indexes.

OBJECT_SCHEMA Schema name.


OBJECT_NAME Table name.
Index name, or PRIMARY for the primary index, NULL for no index (inserts are counted in this
INDEX_NAME
case).
COUNT_STAR Number of summarized events and the sum of the x_READ and x_WRITE columns.
SUM_TIMER_WAIT Total wait time of the summarized events that are timed.
MIN_TIMER_WAIT Minimum wait time of the summarized events that are timed.
AVG_TIMER_WAIT Average wait time of the summarized events that are timed.
MAX_TIMER_WAIT Maximum wait time of the summarized events that are timed.
COUNT_READ Number of all read operations, and the sum of the equivalent x_FETCH columns.
SUM_TIMER_READ Total wait time of all read operations that are timed.
MIN_TIMER_READ Minimum wait time of all read operations that are timed.
AVG_TIMER_READ Average wait time of all read operations that are timed.
MAX_TIMER_READ Maximum wait time of all read operations that are timed.
Number of all write operations, and the sum of the equivalent x_INSERT , x_UPDATE and
COUNT_WRITE
x_DELETE columns.

SUM_TIMER_WRITE Total wait time of all write operations that are timed.
MIN_TIMER_WRITE Minimum wait time of all write operations that are timed.
AVG_TIMER_WRITE Average wait time of all write operations that are timed.
MAX_TIMER_WRITE Maximum wait time of all write operations that are timed.
COUNT_FETCH Number of all fetch operations.
SUM_TIMER_FETCH Total wait time of all fetch operations that are timed.
MIN_TIMER_FETCH Minimum wait time of all fetch operations that are timed.
AVG_TIMER_FETCH Average wait time of all fetch operations that are timed.
MAX_TIMER_FETCH Maximum wait time of all fetch operations that are timed.

463/3812
COUNT_INSERT Number of all insert operations.
SUM_TIMER_INSERT Total wait time of all insert operations that are timed.
MIN_TIMER_INSERT Minimum wait time of all insert operations that are timed.
AVG_TIMER_INSERT Average wait time of all insert operations that are timed.
MAX_TIMER_INSERT Maximum wait time of all insert operations that are timed.
COUNT_UPDATE Number of all update operations.
SUM_TIMER_UPDATE Total wait time of all update operations that are timed.
MIN_TIMER_UPDATE Minimum wait time of all update operations that are timed.
AVG_TIMER_UPDATE Average wait time of all update operations that are timed.
MAX_TIMER_UPDATE Maximum wait time of all update operations that are timed.
COUNT_DELETE Number of all delete operations.
SUM_TIMER_DELETE Total wait time of all delete operations that are timed.
MIN_TIMER_DELETE Minimum wait time of all delete operations that are timed.
AVG_TIMER_DELETE Average wait time of all delete operations that are timed.
MAX_TIMER_DELETE Maximum wait time of all delete operations that are timed.

You can TRUNCATE the table, which will reset all counters to zero. The table is also truncated if the
table_io_waits_summary_by_table table is truncated.
If a table's index structure is changed, index statistics recorded in this table may also be reset.

1.1.1.2.9.2.1.78 Performance Schema


table_io_waits_summary_by_table Table
The table_io_waits_summary_by_table table records table I/O waits by table.

Column Description
OBJECT_TYPE Since this table records waits by table, always set to TABLE .
OBJECT_SCHEMA Schema name.
OBJECT_NAME Table name.
COUNT_STAR Number of summarized events and the sum of the x_READ and x_WRITE columns.
SUM_TIMER_WAIT Total wait time of the summarized events that are timed.
MIN_TIMER_WAIT Minimum wait time of the summarized events that are timed.
AVG_TIMER_WAIT Average wait time of the summarized events that are timed.
MAX_TIMER_WAIT Maximum wait time of the summarized events that are timed.
COUNT_READ Number of all read operations, and the sum of the equivalent x_FETCH columns.
SUM_TIMER_READ Total wait time of all read operations that are timed.
MIN_TIMER_READ Minimum wait time of all read operations that are timed.
AVG_TIMER_READ Average wait time of all read operations that are timed.
MAX_TIMER_READ Maximum wait time of all read operations that are timed.
Number of all write operations, and the sum of the equivalent x_INSERT , x_UPDATE and
COUNT_WRITE
x_DELETE columns.

SUM_TIMER_WRITE Total wait time of all write operations that are timed.
MIN_TIMER_WRITE Minimum wait time of all write operations that are timed.
AVG_TIMER_WRITE Average wait time of all write operations that are timed.
MAX_TIMER_WRITE Maximum wait time of all write operations that are timed.
COUNT_FETCH Number of all fetch operations.
SUM_TIMER_FETCH Total wait time of all fetch operations that are timed.
MIN_TIMER_FETCH Minimum wait time of all fetch operations that are timed.
464/3812
AVG_TIMER_FETCH Average wait time of all fetch operations that are timed.
MAX_TIMER_FETCH Maximum wait time of all fetch operations that are timed.
COUNT_INSERT Number of all insert operations.
SUM_TIMER_INSERT Total wait time of all insert operations that are timed.
MIN_TIMER_INSERT Minimum wait time of all insert operations that are timed.
AVG_TIMER_INSERT Average wait time of all insert operations that are timed.
MAX_TIMER_INSERT Maximum wait time of all insert operations that are timed.
COUNT_UPDATE Number of all update operations.
SUM_TIMER_UPDATE Total wait time of all update operations that are timed.
MIN_TIMER_UPDATE Minimum wait time of all update operations that are timed.
AVG_TIMER_UPDATE Average wait time of all update operations that are timed.
MAX_TIMER_UPDATE Maximum wait time of all update operations that are timed.
COUNT_DELETE Number of all delete operations.
SUM_TIMER_DELETE Total wait time of all delete operations that are timed.
MIN_TIMER_DELETE Minimum wait time of all delete operations that are timed.
AVG_TIMER_DELETE Average wait time of all delete operations that are timed.
MAX_TIMER_DELETE Maximum wait time of all delete operations that are timed.

You can TRUNCATE the table, which will reset all counters to zero. Truncating this table will also truncate the
table_io_waits_summary_by_index_usage table.

1.1.1.2.9.2.1.79 Performance Schema


table_lock_waits_summary_by_table Table
The table_lock_waits_summary_by_table table records table lock waits by table.

Column Description
OBJECT_TYPE Since this table records waits by table, always set to TABLE .
OBJECT_SCHEMA Schema name.
OBJECT_NAME Table name.
Number of summarized events and the sum of the x_READ and x_WRITE
COUNT_STAR
columns.
SUM_TIMER_WAIT Total wait time of the summarized events that are timed.
MIN_TIMER_WAIT Minimum wait time of the summarized events that are timed.
AVG_TIMER_WAIT Average wait time of the summarized events that are timed.
MAX_TIMER_WAIT Maximum wait time of the summarized events that are timed.
Number of all read operations, and the sum of the equivalent
COUNT_READ x_READ_NORMAL , x_READ_WITH_SHARED_LOCKS , x_READ_HIGH_PRIORITY and
x_READ_NO_INSERT columns.

SUM_TIMER_READ Total wait time of all read operations that are timed.
MIN_TIMER_READ Minimum wait time of all read operations that are timed.
AVG_TIMER_READ Average wait time of all read operations that are timed.
MAX_TIMER_READ Maximum wait time of all read operations that are timed.
Number of all write operations, and the sum of the equivalent
COUNT_WRITE x_WRITE_ALLOW_WRITE , x_WRITE_CONCURRENT_INSERT , x_WRITE_DELAYED ,
x_WRITE_LOW_PRIORITY and x_WRITE_NORMAL columns.

SUM_TIMER_WRITE Total wait time of all write operations that are timed.
MIN_TIMER_WRITE Minimum wait time of all write operations that are timed.
AVG_TIMER_WRITE Average wait time of all write operations that are timed.

465/3812
MAX_TIMER_WRITE Maximum wait time of all write operations that are timed.
COUNT_READ_NORMAL Number of all internal read normal locks.
SUM_TIMER_READ_NORMAL Total wait time of all internal read normal locks that are timed.
MIN_TIMER_READ_NORMAL Minimum wait time of all internal read normal locks that are timed.
AVG_TIMER_READ_NORMAL Average wait time of all internal read normal locks that are timed.
MAX_TIMER_READ_NORMAL Maximum wait time of all internal read normal locks that are timed.
COUNT_READ_WITH_SHARED_LOCKS Number of all internal read with shared locks.
SUM_TIMER_READ_WITH_SHARED_LOCKS Total wait time of all internal read with shared locks that are timed.
MIN_TIMER_READ_WITH_SHARED_LOCKS Minimum wait time of all internal read with shared locks that are timed.
AVG_TIMER_READ_WITH_SHARED_LOCKS Average wait time of all internal read with shared locks that are timed.
MAX_TIMER_READ_WITH_SHARED_LOCKS Maximum wait time of all internal read with shared locks that are timed.
COUNT_READ_HIGH_PRIORITY Number of all internal read high priority locks.
SUM_TIMER_READ_HIGH_PRIORITY Total wait time of all internal read high priority locks that are timed.

MIN_TIMER_READ_HIGH_PRIORITY Minimum wait time of all internal read high priority locks that are timed.
AVG_TIMER_READ_HIGH_PRIORITY Average wait time of all internal read high priority locks that are timed.
MAX_TIMER_READ_HIGH_PRIORITY Maximum wait time of all internal read high priority locks that are timed.
COUNT_READ_NO_INSERT Number of all internal read no insert locks.
SUM_TIMER_READ_NO_INSERT Total wait time of all internal read no insert locks that are timed.
MIN_TIMER_READ_NO_INSERT Minimum wait time of all internal read no insert locks that are timed.
AVG_TIMER_READ_NO_INSERT Average wait time of all internal read no insert locks that are timed.
MAX_TIMER_READ_NO_INSERT Maximum wait time of all internal read no insert locks that are timed.
COUNT_READ_EXTERNAL Number of all external read locks.
SUM_TIMER_READ_EXTERNAL Total wait time of all external read locks that are timed.
MIN_TIMER_READ_EXTERNAL Minimum wait time of all external read locks that are timed.
AVG_TIMER_READ_EXTERNAL Average wait time of all external read locks that are timed.
MAX_TIMER_READ_EXTERNAL Maximum wait time of all external read locks that are timed.
COUNT_WRITE_ALLOW_WRITE Number of all internal read normal locks.
SUM_TIMER_WRITE_ALLOW_WRITE Total wait time of all internal write allow write locks that are timed.
MIN_TIMER_WRITE_ALLOW_WRITE Minimum wait time of all internal write allow write locks that are timed.
AVG_TIMER_WRITE_ALLOW_WRITE Average wait time of all internal write allow write locks that are timed.
MAX_TIMER_WRITE_ALLOW_WRITE Maximum wait time of all internal write allow write locks that are timed.
COUNT_WRITE_CONCURRENT_INSERT Number of all internal concurrent insert write locks.
SUM_TIMER_WRITE_CONCURRENT_INSERT Total wait time of all internal concurrent insert write locks that are timed.
MIN_TIMER_WRITE_CONCURRENT_INSERT
Minimum wait time of all internal concurrent insert write locks that are timed.

AVG_TIMER_WRITE_CONCURRENT_INSERT Average wait time of all internal concurrent insert write locks that are timed.
MAX_TIMER_WRITE_CONCURRENT_INSERT Maximum wait time of all internal concurrent insert write locks that are timed.
COUNT_WRITE_DELAYED Number of all internal write delayed locks.
SUM_TIMER_WRITE_DELAYED Total wait time of all internal write delayed locks that are timed.
MIN_TIMER_WRITE_DELAYED Minimum wait time of all internal write delayed locks that are timed.
AVG_TIMER_WRITE_DELAYED Average wait time of all internal write delayed locks that are timed.
MAX_TIMER_WRITE_DELAYED Maximum wait time of all internal write delayed locks that are timed.
COUNT_WRITE_LOW_PRIORITY Number of all internal write low priority locks.
SUM_TIMER_WRITE_LOW_PRIORITY Total wait time of all internal write low priority locks that are timed.
MIN_TIMER_WRITE_LOW_PRIORITY Minimum wait time of all internal write low priority locks that are timed.
466/3812
AVG_TIMER_WRITE_LOW_PRIORITY Average wait time of all internal write low priority locks that are timed.
MAX_TIMER_WRITE_LOW_PRIORITY Maximum wait time of all internal write low priority locks that are timed.
COUNT_WRITE_NORMAL Number of all internal write normal locks.
SUM_TIMER_WRITE_NORMAL Total wait time of all internal write normal locks that are timed.
MIN_TIMER_WRITE_NORMAL Minimum wait time of all internal write normal locks that are timed.
AVG_TIMER_WRITE_NORMAL Average wait time of all internal write normal locks that are timed.
MAX_TIMER_WRITE_NORMAL Maximum wait time of all internal write normal locks that are timed.
COUNT_WRITE_EXTERNAL Number of all external write locks.
SUM_TIMER_WRITE_EXTERNAL Total wait time of all external write locks that are timed.
MIN_TIMER_WRITE_EXTERNAL Minimum wait time of all external write locks that are timed.
AVG_TIMER_WRITE_EXTERNAL Average wait time of all external write locks that are timed.
MAX_TIMER_WRITE_EXTERNAL Maximum wait time of all external write locks that are timed.

You can TRUNCATE the table, which will reset all counters to zero.

1.1.1.2.9.2.1.80 Performance Schema threads


Table
Each server thread is represented as a row in the threads table.
The threads table contains the following columns:

Column Description
THREAD_ID A unique thread identifier.
Name associated with the server's thread instrumentation code, for example
NAME thread/sql/main for the server's main() function, and thread/sql/one_connection for a
user connection.
FOREGROUND or BACKGROUND , depending on the thread type. User connection threads are
TYPE
FOREGROUND , internal server threads are BACKGROUND .

The PROCESSLIST.ID value for threads displayed in the INFORMATION_SCHEMA.PROCESSLIST


PROCESSLIST_ID table, or 0 for background threads. Also corresponds with the CONNECTION_ID() return
value for the thread.
PROCESSLIST_USER Foreground thread user, or NULL for a background thread.
PROCESSLIST_HOST Foreground thread host, or NULL for a background thread.
PROCESSLIST_DB Thread's default database, or NULL if none exists.
Type of command executed by the thread. These correspond to the the COM_xxx
PROCESSLIST_COMMAND client/server protocol commands, and the Com_xxx status variables. See Thread Command
Values.
PROCESSLIST_TIME Time in seconds the thread has been in its current state.
PROCESSLIST_STATE Action, event or state indicating what the thread is doing.

Statement being executed by the thread, or NULL if a statement is not being executed. If a
PROCESSLIST_INFO statement results in calling other statements, such as for a stored procedure, the innermost
statement from the stored procedure is shown here.
THREAD_ID of the parent thread, if any. Subthreads can for example be spawned as a result
PARENT_THREAD_ID
of INSERT DELAYED statements.
ROLE Unused.
YES or NO for Whether the thread is instrumented or not. For foreground threads, the initial
value is determined by whether there's a user/host match in the setup_actors table.
INSTRUMENTED Subthreads are again matched, while for background threads, this will be set to YES by
default. To monitor events that the thread executes, INSTRUMENTED must be YES and the
thread_instrumentation consumer in the setup_consumers table must also be YES .

467/3812
YES or NO for Whether to log historical events for the thread. For foreground threads, the
initial value is determined by whether there's a user/host match in the setup_actors table.
Subthreads are again matched, while for background threads, this will be set to YES by
HISTORY
default. To monitor events that the thread executes, INSTRUMENTED must be YES and the
thread_instrumentation consumer in the setup_consumers table must also be YES . Added in
MariaDB 10.5.
The protocol used to establish the connection. One of TCP/IP , SSL/TLS , Socket , Named
CONNECTION_TYPE
Pipe , Shared Memory , or NULL for background threads. Added in MariaDB 10.5.

The thread or task identifier as defined by the underlying operating system, if there is one.
THREAD_OS_ID
Added in MariaDB 10.5

Example
SELECT * FROM performance_schema.threads\G;
*************************** 1. row ***************************
THREAD_ID: 1
NAME: thread/sql/main
TYPE: BACKGROUND
PROCESSLIST_ID: NULL
PROCESSLIST_USER: NULL
PROCESSLIST_HOST: NULL
PROCESSLIST_DB: NULL
PROCESSLIST_COMMAND: NULL
PROCESSLIST_TIME: 215859
PROCESSLIST_STATE: Table lock
PROCESSLIST_INFO: INTERNAL DDL LOG RECOVER IN PROGRESS
PARENT_THREAD_ID: NULL
ROLE: NULL
INSTRUMENTED: YES
...
*************************** 21. row ***************************
THREAD_ID: 64
NAME: thread/sql/one_connection
TYPE: FOREGROUND
PROCESSLIST_ID: 44
PROCESSLIST_USER: root
PROCESSLIST_HOST: localhost
PROCESSLIST_DB: NULL
PROCESSLIST_COMMAND: Query
PROCESSLIST_TIME: 0
PROCESSLIST_STATE: Sending data
PROCESSLIST_INFO: SELECT * FROM performance_schema.threads
PARENT_THREAD_ID: NULL
ROLE: NULL
INSTRUMENTED: YES

1.1.1.2.9.2.1.81 Performance Schema


user_variables_by_thread Table
MariaDB starting with 10.5.2
The user_variables_by_thread table was added in MariaDB 10.5.2.

The user_variables_by_thread table contains information about user-defined variables and the threads that defined
them.
TRUNCATE TABLE cannot be performed on the table.
The table contains the following columns:

Column Description
THREAD_ID The thread identifier of the session in which the variable is defined.
VARIABLE_NAME The variable name, without the leading @ character.
VARIABLE_VALUE The variable value

Example
468/3812
SET @var = 0;

SELECT * FROM user_variables_by_thread;


+-----------+---------------+----------------+
| THREAD_ID | VARIABLE_NAME | VARIABLE_VALUE |
+-----------+---------------+----------------+
| 11 | var | 0 |
+-----------+---------------+----------------+

See Also
User-defined variables
Information Schema USER_VARIABLES Table

1.1.1.2.9.2.1.82 Performance Schema users


Table
Description
Each user that connects to the server is stored as a row in the users table, along with current and total connections.
The table size is determined at startup by the value of the performance_schema_users_size system variable. If this is
set to 0 , user statistics will be disabled.

Column Description
USER The connection's client user name for the connection, or NULL if an internal thread.
CURRENT_CONNECTIONS Current connections for the user.
TOTAL_CONNECTIONS Total connections for the user.

Example
SELECT * FROM performance_schema.users;
+------------------+---------------------+-------------------+
| USER | CURRENT_CONNECTIONS | TOTAL_CONNECTIONS |
+------------------+---------------------+-------------------+
| debian-sys-maint | 0 | 35 |
| NULL | 20 | 23 |
| root | 1 | 2 |
+------------------+---------------------+-------------------+

1.1.1.2.9.2.2 Performance Schema Overview


Contents
1. Introduction
2. Activating the Performance Schema
3. Enabling the Performance Schema
4. Listing Performance Schema Variables
5. Column Comments
6. See Also

The Performance Schema is a feature for monitoring server performance.

Introduction
It is implemented as a storage engine, and so will appear in the list of storage engines available.

469/3812
SHOW ENGINES;
+--------------------+---------+----------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+--------------------+---------+----------------------------------+--------------+------+------------+
| ... | | | | | |
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
| ... | | | | | |
+--------------------+---------+----------------------------------+--------------+------+------------+

However, performance_schema is not a regular storage engine for storing data, it's a mechanism for implementing the
Performance Schema feature.
The storage engine contains a database called performance_schema , which in turn consists of a number of tables that
can be queried with regular SQL statements, returning specific performance information.

USE performance_schema

SHOW TABLES;
+----------------------------------------------------+
| Tables_in_performance_schema |
+----------------------------------------------------+
| accounts |
...
| users |
+----------------------------------------------------+
80 rows in set (0.00 sec)

See List of Performance Schema Tables for a full list and links to detailed descriptions of each table. From MariaDB
10.5, there are 80 Performance Schema tables, while until MariaDB 10.4, there are 52.

Activating the Performance Schema


The performance schema is disabled by default for performance reasons. You can check its current status by looking at
the value of the performance_schema system variable.

SHOW VARIABLES LIKE 'performance_schema';


+--------------------+-------+
| Variable_name | Value |
+--------------------+-------+
| performance_schema | ON |
+--------------------+-------+

The performance schema cannot be activated at runtime - it must be set when the server starts by adding the following
line in your my.cnf configuration file.

performance_schema=ON

Until MariaDB 10.4, all memory used by the Performance Schema is allocated at startup. From MariaDB 10.5, some
memory is allocated dynamically, depending on load, number of connections, number of tables open etc.

Enabling the Performance Schema


You need to set up all consumers (starting collection of data) and instrumentations (what to collect):

UPDATE performance_schema.setup_consumers SET ENABLED = 'YES';


UPDATE performance_schema.setup_instruments SET ENABLED = 'YES', TIMED = 'YES';

You can decide what to enable/disable with WHERE NAME like "%what_to_enable" ; You can disable instrumentations
by setting ENABLED to "NO" .
You can also do this in your my.cnf file. The following enables all instrumentation of all stages (computation units) in
MariaDB:

[mysqld]
performance_schema=ON
performance-schema-instrument='stage/%=ON'
performance-schema-consumer-events-stages-current=ON
performance-schema-consumer-events-stages-history=ON
performance-schema-consumer-events-stages-history-long=ON

470/3812
Listing Performance Schema Variables
SHOW VARIABLES LIKE "perf%";
+--------------------------------------------------------+-------+
| Variable_name | Value |
+--------------------------------------------------------+-------+
| performance_schema | ON |
...
| performance_schema_users_size | 100 |
+--------------------------------------------------------+-------+

See Performance Schema System Variables for a full list of available system variables.
Note that the "consumer" events are not shown on this list, as they are only available as options, not as system
variables, and they can only be enabled at startup.

Column Comments
MariaDB starting with 10.7.1
From MariaDB 10.7.1, comments have been added to table columns in the Performance Schema. These can be
viewed with, for example:
SELECT column_name, column_comment FROM information_schema.columns
WHERE table_schema='performance_schema' AND table_name='file_instances';
...
*************************** 2. row ***************************
column_name: EVENT_NAME
column_comment: Instrument name associated with the file.
*************************** 3. row ***************************
column_name: OPEN_COUNT
column_comment: Open handles on the file. A value of greater than zero means
that the file is currently open.
...

See Also
Performance schema options
SHOW ENGINE STATUS
SHOW PROFILE
ANALYZE STATEMENT
Performance schema in MySQL 5.6 . All things here should also work for MariaDB.

1.1.1.2.9.2.3 Performance Schema Status


Variables

471/3812
Contents
1. Performance_schema_accounts_lost
2. Performance_schema_cond_classes_lost
3. Performance_schema_cond_instances_lost
4. Performance_schema_digest_lost
5. Performance_schema_file_classes_lost
6. Performance_schema_file_handles_lost
7. Performance_schema_file_instances_lost
8. Performance_schema_hosts_lost
9. Performance_schema_index_stat_lost
10. Performance_schema_locker_lost
11. Performance_schema_memory_classes_lost
12. Performance_schema_metadata_lock_lost
13. Performance_schema_mutex_classes_lost
14. Performance_schema_mutex_instances_lost
15. Performance_schema_nested_statement_lost
16. Performance_schema_prepared_statements_lost
17. Performance_schema_program_lost
18. Performance_schema_rwlock_classes_lost
19. Performance_schema_rwlock_instances_lost
20. Performance_schema_session_connect_attrs_lost
21. Performance_schema_socket_classes_lost
22. Performance_schema_socket_instances_lost
23. Performance_schema_stage_classes_lost
24. Performance_schema_statement_classes_lost
25. Performance_schema_table_handles_lost
26. Performance_schema_table_instances_lost
27. Performance_schema_table_lock_stat_lost
28. Performance_schema_thread_classes_lost
29. Performance_schema_thread_instances_lost
30. Performance_schema_users_lost

This page documents status variables related to the Performance Schema. See Server Status Variables for a complete
list of status variables that can be viewed with SHOW STATUS.
See also the Full list of MariaDB options, system and status variables.

Performance_schema_accounts_lost
Description: Number of times a row could not be added to the performance schema accounts table due to it
being full. The global value can be flushed by FLUSH STATUS.
Scope: Global, Session
Data Type: numeric

Performance_schema_cond_classes_lost
Description: Number of condition instruments that could not be loaded.
Scope: Global, Session
Data Type: numeric

Performance_schema_cond_instances_lost
Description: Number of instances a condition object could not be created. The global value can be flushed by
FLUSH STATUS.
Scope: Global, Session
Data Type: numeric

Performance_schema_digest_lost
Description: The global value can be flushed by FLUSH STATUS.
Scope: Global, Session
Data Type: numeric

Performance_schema_file_classes_lost
Description: Number of file instruments that could not be loaded.
Scope: Global, Session
Data Type: numeric

Performance_schema_file_handles_lost
Description: Number of instances a file object could not be opened. The global value can be flushed by FLUSH
472/3812
STATUS.
Scope: Global, Session
Data Type: numeric

Performance_schema_file_instances_lost
Description: Number of instances a file object could not be created. The global value can be flushed by FLUSH
STATUS.
Scope: Global, Session
Data Type: numeric

Performance_schema_hosts_lost
Description: Number of times a row could not be added to the performance schema hosts table due to it being
full. The global value can be flushed by FLUSH STATUS.
Scope: Global, Session
Data Type: numeric

Performance_schema_index_stat_lost
Description:
Scope: Global, Session
Data Type: numeric
Introduced: MariaDB 10.5.2

Performance_schema_locker_lost
Description: Number of events not recorded, due to either being recursive, or having a deeper nested events
stack than the implementation limit. The global value can be flushed by FLUSH STATUS.
Scope: Global, Session
Data Type: numeric

Performance_schema_memory_classes_lost
Description:
Scope: Global, Session
Data Type: numeric
Introduced: MariaDB 10.5.2

Performance_schema_metadata_lock_lost
Description:
Scope: Global, Session
Data Type: numeric
Introduced: MariaDB 10.5.2

Performance_schema_mutex_classes_lost
Description: Number of mutual exclusion instruments that could not be loaded.
Scope: Global, Session
Data Type: numeric

Performance_schema_mutex_instances_lost
Description: Number of instances a mutual exclusion object could not be created. The global value can be
flushed by FLUSH STATUS.
Scope: Global, Session
Data Type: numeric

Performance_schema_nested_statement_lost

473/3812
Description:
Scope: Global, Session
Data Type: numeric
Introduced: MariaDB 10.5.2

Performance_schema_prepared_statements_lost
Description:
Scope: Global, Session
Data Type: numeric
Introduced: MariaDB 10.5.2

Performance_schema_program_lost
Description:
Scope: Global, Session
Data Type: numeric
Introduced: MariaDB 10.5.2

Performance_schema_rwlock_classes_lost
Description: Number of read/write lock instruments that could not be loaded.
Scope: Global, Session
Data Type: numeric

Performance_schema_rwlock_instances_lost
Description: Number of instances a read/write lock object could not be created. The global value can be flushed
by FLUSH STATUS.
Scope: Global, Session
Data Type: numeric

Performance_schema_session_connect_attrs_lost
Description: Number of connections for which connection attribute truncation has occurred. The global value
can be flushed by FLUSH STATUS.
Scope: Global, Session
Data Type: numeric

Performance_schema_socket_classes_lost
Description:
Scope: Global, Session
Data Type: numeric

Performance_schema_socket_instances_lost
Description: Number of instances a socket object could not be created. The global value can be flushed by
FLUSH STATUS.
Scope: Global, Session
Data Type: numeric

Performance_schema_stage_classes_lost
Description: Number of stage event instruments that could not be loaded. The global value can be flushed by
FLUSH STATUS.
Scope: Global, Session
Data Type: numeric

Performance_schema_statement_classes_lost

474/3812
Description: Number of statement instruments that could not be loaded. The global value can be flushed by
FLUSH STATUS.
Scope: Global, Session
Data Type: numeric

Performance_schema_table_handles_lost
Description: Number of instances a table object could not be opened. The global value can be flushed by
FLUSH STATUS.
Scope: Global, Session
Data Type: numeric

Performance_schema_table_instances_lost
Description: Number of instances a table object could not be created. The global value can be flushed by
FLUSH STATUS.
Scope: Global, Session
Data Type: numeric

Performance_schema_table_lock_stat_lost
Description:
Scope: Global, Session
Data Type: numeric
Introduced: MariaDB 10.5.2

Performance_schema_thread_classes_lost
Description: Number of thread instruments that could not be loaded.
Scope: Global, Session
Data Type: numeric

Performance_schema_thread_instances_lost
Description: Number of instances thread object could not be created. The global value can be flushed by
FLUSH STATUS.
Scope: Global, Session
Data Type: numeric

Performance_schema_users_lost
Description: Number of times a row could not be added to the performance schema users table due to it being
full. The global value can be flushed by FLUSH STATUS.
Scope: Global, Session
Data Type: numeric

1.1.1.2.9.2.4 Performance Schema System


Variables

475/3812
Contents
1. performance_schema
2. performance_schema_accounts_size
3. performance_schema_digests_size
4. performance_schema_events_stages_history_long_size
5. performance_schema_events_stages_history_size
6. performance_schema_events_statements_history_long_size
7. performance_schema_events_statements_history_size
8. performance_schema_events_transactions_history_long_size
9. performance_schema_events_transactions_history_size
10. performance_schema_events_waits_history_long_size
11. performance_schema_events_waits_history_size
12. performance_schema_hosts_size
13. performance_schema_max_cond_classes
14. performance_schema_max_cond_instances
15. performance_schema_max_digest_length
16. performance_schema_max_file_classes
17. performance_schema_max_file_handles
18. performance_schema_max_file_instances
19. performance_schema_max_index_stat
20. performance_schema_max_memory_classes
21. performance_schema_max_metadata_locks
22. performance_schema_max_mutex_classes
23. performance_schema_max_mutex_instances
24. performance_schema_max_prepared_statement_instances
25. performance_schema_max_program_instances
26. performance_schema_max_rwlock_classes
27. performance_schema_max_rwlock_instances
28. performance_schema_max_socket_classes
29. performance_schema_max_socket_instances
30. performance_schema_max_sql_text_length
31. performance_schema_max_stage_classes
32. performance_schema_max_statement_classes
33. performance_schema_max_statement_stack
34. performance_schema_max_table_handles
35. performance_schema_max_table_instances
36. performance_schema_max_table_lock_stat
37. performance_schema_max_thread_classes
38. performance_schema_max_thread_instances
39. performance_schema_session_connect_attrs_size
40. performance_schema_setup_actors_size
41. performance_schema_setup_objects_size
42. performance_schema_users_size

The following variables are used with MariaDB's Performance Schema. See Performance Schema Options for
Performance Schema options that are not system variables. See Server System Variables for a complete list of system
variables and instructions on setting them.
See also the Full list of MariaDB options, system and status variables.

performance_schema
Description: If set to 1 ( 0 is default), enables the Performance Schema
Commandline: --performance-schema=#
Scope: Global
Dynamic: No
Data Type: boolean
Default Value: OFF

performance_schema_accounts_size
Description: Maximum number of rows in the performance_schema.accounts table. If set to 0, the Performance
Schema will not store statistics in the accounts table. Use -1 (the default) for automated sizing.
Commandline: --performance-schema-accounts-size=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: -1
Range: -1 to 1048576

performance_schema_digests_size
Description: Maximum number of rows that can be stored in the events_statements_summary_by_digest table.
0 for disabling, -1 (the default) for automated sizing.
Commandline: --performance-schema-digests-size=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: -1
Range: -1 to 200

476/3812
performance_schema_events_stages_history_long_size
Description: Number of rows in the events_stages_history_long table. 0 for disabling, -1 (the default) for
automated sizing.
Commandline: --performance-schema-events-stages-history-long-size=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: -1
Range: -1 to 1048576

performance_schema_events_stages_history_size
Description: Number of rows per thread in the events_stages_history table. 0 for disabling, -1 (the default) for
automated sizing.
Commandline: --performance-schema-events-stages-history-size=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: -1
Range: -1 to 1024

performance_schema_events_statements_history_long_size
Description: Number of rows in the events_statements_history_long table. 0 for disabling, -1 (the default) for
automated sizing.
Commandline: --performance-schema-events-statements-history-long-size=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: -1
Range: -1 to 1048576

performance_schema_events_statements_history_size
Description: Number of rows per thread in the events_statements_history table. 0 for disabling, -1 (the
default) for automated sizing.
Commandline: --performance-schema-events-statements-history-size=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: -1
Range: -1 to 1024

performance_schema_events_transactions_history_long_size
Description: Number of rows in events_transactions_history_long table. Use 0 to disable, -1 for automated
sizing.
Commandline: --performance-schema-events-transactions-history-long-size=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: -1
Range: -1 to 1048576
Introduced: MariaDB 10.5.2

performance_schema_events_transactions_history_size
Description:Number of rows per thread in events_transactions_history. Use 0 to disable, -1 for automated sizing.
Commandline: --performance-schema-events-transactions-history-size=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: -1
Range: -1 to 1024
Introduced: MariaDB 10.5.2
477/3812
performance_schema_events_waits_history_long_size
Description: Number of rows contained in the events_waits_history_long table. 0 for disabling, -1 (the default)
for automated sizing.
Commandline: --performance-schema-events-waits-history-long-size=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: -1
Range: -1 to 1048576

performance_schema_events_waits_history_size
Description: Number of rows per thread contained in the events_waits_history table. 0 for disabling, -1 (the
default) for automated sizing.
Commandline: --performance-schema-events-waits-history-size=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: -1
Range: -1 to 1024

performance_schema_hosts_size
Description: Number of rows stored in the hosts table. If set to zero, no connection statistics are kept for the
hosts table. -1 (the default) for automated sizing.
Commandline: --performance-schema-hosts-size=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: -1
Range: -1 to 1048576

performance_schema_max_cond_classes
Description: Specifies the maximum number of condition instruments.
Commandline: --performance-schema-max-cond-classes=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: 90 (>= MariaDB 10.5.1), 80 (<= MariaDB 10.5.0)
Range: 0 to 256

performance_schema_max_cond_instances
Description: Specifies the maximum number of instrumented condition objects. 0 for disabling, -1 (the default)
for automated sizing.
Commandline: --performance-schema-max-cond-instances=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: -1
Range: -1 to 1048576

performance_schema_max_digest_length
Description: Maximum length considered for digest text, when stored in performance_schema tables.
Commandline: --performance-schema-max-digest-length=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: 1024
Range: 0 to 1048576

478/3812
performance_schema_max_file_classes
Description: Specifies the maximum number of file instruments.
Commandline: --performance-schema-max-file-classes=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: 80 (>= MariaDB 10.5.2), 50 (<= MariaDB 10.5.1)
Range: 0 to 256

performance_schema_max_file_handles
Description: Specifies the maximum number of opened file objects. Should always be higher than
open_files_limit.
Commandline: --performance-schema-max-file-handles=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: 32768
Range: -1 to 32768

performance_schema_max_file_instances
Description: Specifies the maximum number of instrumented file objects. 0 for disabling, -1 (the default) for
automated sizing.
Commandline: --performance-schema-max-file-instances=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: -1
Range: -1 to 1048576

performance_schema_max_index_stat
Description: Maximum number of index statistics for instrumented tables. Use 0 to disable, -1 for automated
scaling.
Commandline: --performance-schema-max-index-stat=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: -1
Range: -1 to 1048576
Introduced: MariaDB 10.5.2

performance_schema_max_memory_classes
Description: Maximum number of memory pool instruments.
Commandline: --performance-schema-max-memory-classes=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: 320
Range: 0 to 1024
Introduced: MariaDB 10.5.2

performance_schema_max_metadata_locks
Description: Maximum number of Performance Schema metadata locks. Use 0 to disable, -1 for automated
scaling.
Commandline: --performance-schema-max-metadata-locks=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: -1
Range: -1 to 104857600
Introduced: MariaDB 10.5.2
479/3812
performance_schema_max_mutex_classes
Description: Specifies the maximum number of mutex instruments.
Commandline: --performance-schema-max-mutex-classes=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: 210 (>= MariaDB 10.5.2), 200 (<= MariaDB 10.5.1)
Range: 0 to 256

performance_schema_max_mutex_instances
Description: Specifies the maximum number of instrumented mutex instances. 0 for disabling, -1 (the default)
for automated sizing.
Commandline: --performance-schema-max-mutex-instances=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: -1
Range: -1 to 104857600

performance_schema_max_prepared_statement_instances
Description: Maximum number of instrumented prepared statements. Use 0 to disable, -1 for automated scaling.
Commandline: --performance-schema-max-prepared-statement-instances=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: -1
Range: -1 to 1048576
Introduced: MariaDB 10.5.2

performance_schema_max_program_instances
Description: Maximum number of instrumented programs. Use 0 to disable, -1 for automated scaling.
Commandline: --performance-schema-max-program-instances=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: -1
Range: -1 to 1048576
Introduced: MariaDB 10.5.2

performance_schema_max_rwlock_classes
Description: Specifies the maximum number of rwlock instruments.
Commandline: --performance-schema-max-rwlock-classes=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: 50 (>= MariaDB 10.5.2), 40 (<= MariaDB 10.5.1)
Range: 0 to 256

performance_schema_max_rwlock_instances
Description: Specifies the maximum number of instrumented rwlock objects. 0 for disabling, -1 (the default) for
automated sizing.
Commandline: --performance-schema-max-rwlock-instances=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: -1
Range: -1 to 104857600

480/3812
performance_schema_max_socket_classes
Description: Specifies the maximum number of socket instruments.
Commandline: --performance-schema-max-socket-classes=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: 10
Range: 0 to 256

performance_schema_max_socket_instances
Description: Specifies the maximum number of instrumented socket objects. 0 for disabling, -1 (the default) for
automated sizing.
Commandline: --performance-schema-max-socket-instances=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: -1
Range: -1 to 1048576

performance_schema_max_sql_text_length
Description: Maximum length of displayed sql text.
Commandline: --performance-schema-max-sql-text-length=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: 1024
Range: 0 to 1048576
Introduced: MariaDB 10.5.2

performance_schema_max_stage_classes
Description: Specifies the maximum number of stage instruments.
Commandline: --performance-schema-max-stage-classes=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: 160 (>= MariaDB 10.3.3), 150 (<= MariaDB 10.3.2)
Range: 0 to 256

performance_schema_max_statement_classes
Description: Specifies the maximum number of statement instruments. Automatically calculated at server build
based on the number of available statements. Should be left as either autosized or disabled, as changing to any
positive value has no benefit and will most likely allocate unnecessary memory. Setting to zero disables all
statement instrumentation, and no memory will be allocated for this purpose.
Commandline: --performance-schema-max-statement-classes=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: Autosized (see description)
Range: 0 to 256

performance_schema_max_statement_stack
Description: Number of rows per thread in EVENTS_STATEMENTS_CURRENT.
Commandline: --performance-schema-max-statement-stack=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: 10
Range: 1 to 256
Introduced: MariaDB 10.5.2

481/3812
performance_schema_max_table_handles
Description: Specifies the maximum number of opened table objects. 0 for disabling, -1 (the default) for
automated sizing. See also the Performance Schema table_handles table.
Commandline: --performance-schema-max-table-handles=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: -1
Range: -1 to 1048576

performance_schema_max_table_instances
Description: Specifies the maximum number of instrumented table objects. 0 for disabling, -1 (the default) for
automated sizing.
Commandline: --performance-schema-max-table-instances=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: -1
Range: -1 to 1048576

performance_schema_max_table_lock_stat
Description: Maximum number of lock statistics for instrumented tables. Use 0 to disable, -1 for automated
scaling.
Commandline: --performance-schema-max-table-lock-stat=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: -1
Range: -1 to 1048576
Introduced: MariaDB 10.5.2

performance_schema_max_thread_classes
Description: Specifies the maximum number of thread instruments.
Commandline: --performance-schema-max-thread-classes=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: 50
Range: 0 to 256

performance_schema_max_thread_instances
Description: Specifies how many of the running server threads (see max_connections and
max_delayed_threads) can be instrumented. Should be greater than the sum of max_connections and
max_delayed_threads. 0 for disabling, -1 (the default) for automated sizing.
Commandline: --performance-schema-max-thread-instances=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: -1
Range: -1 to 1048576

performance_schema_session_connect_attrs_size
Description: Per thread preallocated memory for holding connection attribute strings. Incremented if the strings
are larger than the reserved space. 0 for disabling, -1 (the default) for automated sizing.
Commandline: --performance-schema-session-connect-attrs-size=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: -1
Range: -1 to 1048576
482/3812
performance_schema_setup_actors_size
Description: The maximum number of rows to store in the performance schema setup_actors table. -1 (from
MariaDB 10.5.2) denotes automated sizing.
Commandline: --performance-schema-setup-actors-size=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: -1 (>= MariaDB 10.5.2), 100 (<= MariaDB 10.5.1)
Range: -1 to 1024 (>= MariaDB 10.5.2), 0 to 1024 (<= MariaDB 10.5.1)

performance_schema_setup_objects_size
Description: The maximum number of rows that can be stored in the performance schema setup_objects table.
-1 (from MariaDB 10.5.2) denotes automated sizing.
Commandline: --performance-schema-setup-objects-size=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: -1 (>= MariaDB 10.5.2), 100 (<= MariaDB 10.5.1)
Range: -1 to 1048576 (>= MariaDB 10.5.2), 0 to 1048576 (<= MariaDB 10.5.1)

performance_schema_users_size
Description: Number of rows in the performance_schema.users table. If set to 0, the Performance Schema will
not store connection statistics in the users table. -1 (the default) for automated sizing.
Commandline: --performance-schema-users-size=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: -1
Range: -1 to 1048576

1.1.1.2.9.2.5 Performance Schema Digests


The Performance Schema digest is a normalized form of a statement, with the specific data values removed. It allows
statistics to be gathered for similar kinds of statements.
For example:

SELECT * FROM customer WHERE age < 20


SELECT * FROM customer WHERE age < 30

With the data values removed, both of these statements normalize to:

SELECT * FROM customer WHERE age < ?

which is the digest text. The digest text is then MD5 hashed, resulting in a digest. For example:

DIGEST_TEXT: SELECT * FROM `performance_schema` . `users`


DIGEST: 0f70cec4015f2a346df4ac0e9475d9f1

By contrast, the following two statements would not have the same digest as, while the data values are the same, they
call upon different tables.

SELECT * FROM customer1 WHERE age < 20


SELECT * FROM customer2 WHERE age < 20

The digest text is limited to 1024 bytes. Queries exceeding this limit are truncated with '...', meaning that long queries
that would otherwise have different digests may share the same digest.
Digest information is used in a number of performance scheme tables. These include
events_statements_current
events_statements_history
events_statements_history_long
483/3812
events_statements_summary_by_digest (a summary table by schema and digest)

1.1.1.2.9.2.6 PERFORMANCE_SCHEMA
Storage Engine
If you run SHOW ENGINES, you'll see the following storage engine listed.

SHOW ENGINES\G
...
Engine: PERFORMANCE_SCHEMA
Support: YES
Comment: Performance Schema
Transactions: NO
XA: NO
Savepoints: NO
...

The PERFORMANCE_SCHEMA is not a regular storage engine for storing data, it's a mechanism for implementing the
Performance Schema feature.
The SHOW ENGINE PERFORMANCE_SCHEMA STATUS statement is also available, which shows how much
memory is used by the tables and internal buffers.
See Performance Schema for more details.

1.1.1.2.9.3 The mysql Database Tables


MariaDB comes pre-installed with a system database called mysql containing many important tables storing, in
particular, grant and privilege information. Until MariaDB 10.4, system tables used the MyISAM storage engine. From
MariaDB 10.4, they use Aria.
mysql.column_stats Table
Column stats for engine-independent statistics.

mysql.columns_priv Table
Column-level privileges

mysql.db Table
Database-level access and privileges.

mysql.event Table
Information about MariaDB events.

mysql.func Table
User-defined function information

mysql.general_log Table
Contents of the general query log if written to table

mysql.global_priv Table
1 Global privileges.

mysql.gtid_slave_pos Table
2 For replicas to keep track of the GTID.

mysql.help_category Table
Help categories

mysql.help_keyword Table
Help keywords

mysql.help_relation Table
HELP command relations

mysql.help_topic Table
Help topics

mysql.index_stats Table
Index stats for engine-independent statistics.
484/3812
mysql.innodb_index_stats
1 Data related to particular persistent index statistics, multiple rows for each index.

mysql.innodb_table_stats
Data related to persistent indexes, one row per table.

mysql.password_reuse_check_history Table
Contains old passwords for purposes of preventing password reuse.

mysql.plugin Table
Plugins loaded with INSTALL SONAME, INSTALL PLUGIN or the mysql_plugin utility

mysql.proc Table
Information about stored routines.

mysql.procs_priv Table
Stored procedure and stored function privileges

mysql.proxies_priv Table
Proxy privileges.

mysql.roles_mapping Table
MariaDB roles information.

mysql.servers Table
MariaDB servers

mysql.slow_log Table
Contents of the slow query log if written to table.

mysql.tables_priv Table
1 Table-level privileges

mysql.table_stats Table
Table stats for engine-independent statistics.

mysql.time_zone Table
Time zone table in the mysql database.

mysql.time_zone_leap_second Table
Time zone leap second.

mysql.time_zone_name Table
Time zone name.

mysql.time_zone_transition Table
Time zone transition table.

mysql.time_zone_transition_type Table
Time zone transition type table.

mysql.transaction_registry Table
6 Used for transaction-precise versioning.

mysql.user Table
User access and global privileges.

Obsolete mysql Database Tables


Tables no longer present in the mysql system database.

Spider mysql Database Tables


System tables related to the Spider storage engine.

There are 2 related questions .

1.1.1.2.9.3.1 mysql.column_stats Table


485/3812
The mysql.column_stats table is one of three tables storing data used for Engine-independent table statistics. The
others are mysql.table_stats and mysql.index_stats.

Note that statistics for blob and text columns are not collected. If explicitly specified, a warning is returned.

MariaDB starting with 10.4


In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3


In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

The mysql.column_stats table contains the following fields:

Field Type Null Key Default Description


db_name varchar(64) NO PRI NULL Database the table is in.
table_name varchar(64) NO PRI NULL Table name.
column_name varchar(64) NO PRI NULL Name of the column.
min_value varchar(255) YES NULL Minimum value in the table (in text form).
max_value varchar(255) YES NULL Maximum value in the table (in text form).
Fraction of NULL values (0- no NULL s, 0.5 -
nulls_ratio decimal(12,4) YES NULL half values are NULL s, 1 - all values are
NULL s).

Average length of column value, in bytes.


Counted as if one ran SELECT
avg_length decimal(12,4) YES NULL AVG(LENGTH(col)) . This doesn't count
NULL bytes, assumes endspace removal for
CHAR(n) , etc.

Average number of records with the same


avg_frequency decimal(12,4) YES NULL
value
Histogram size in bytes, from 0-255, or, from
hist_size tinyint(3) unsigned YES NULL MariaDB 10.7, number of buckets if the
histogram type is JSON_HB .
enum('SINGLE_PREC_HB',
'DOUBLE_PREC_HB') (>=
MariaDB 10.7) Histogram type. See the histogram_type
hist_type YES NULL
enum('SINGLE_PREC_HB', system variable.
'DOUBLE_PREC_HB','JSON_HB')
(<= MariaDB 10.6)
blob (>= MariaDB 10.7)
histogram varbinary(255) (<=MariaDB YES NULL
10.6)

It is possible to manually update the table. See Manual updates to statistics tables for details.

1.1.1.2.9.3.2 mysql.columns_priv Table


The mysql.columns_priv table contains information about column-level privileges. The table can be queried and
although it is possible to directly update it, it is best to use GRANT for setting privileges.
Note that the MariaDB privileges occur at many levels. A user may be granted a privilege at the column level, but may
still not have permission on a table level, for example. See privileges for a more complete view of the MariaDB privilege
system.
The INFORMATION_SCHEMA.COLUMN_PRIVILEGES table derives its contents from mysql.columns_priv .

MariaDB starting with 10.4


In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3


486/3812
In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

The mysql.columns_priv table contains the following fields:

Field Type Null Key Default Description


Host (together with User , Db ,
Host char(60) NO PRI Table_name and Column_name makes
up the unique identifier for this record.
Database name (together with User ,
Host , Table_name and Column_name
Db char(64) NO PRI
makes up the unique identifier for this
record.
User (together with Host , Db ,
User char(80) NO PRI Table_name and Column_name makes
up the unique identifier for this record.
Table name (together with User , Db ,
Table_name char(64) NO PRI Host and Column_name makes up the
unique identifier for this record.
Column name (together with User , Db
Column_name char(64) NO PRI , Table_name and Host makes up the
unique identifier for this record.
Timestamp timestamp NO CURRENT_TIMESTAMP

set('Select',
The privilege type. See Column
Column_priv 'Insert', 'Update', NO
Privileges for details.
'References')

The Acl_column_grants status variable, added in MariaDB 10.1.4 , indicates how many rows the mysql.columns_priv
table contains.

1.1.1.2.9.3.3 mysql.db Table


The mysql.db table contains information about database-level privileges. The table can be queried and although it is
possible to directly update it, it is best to use GRANT for setting privileges.
Note that the MariaDB privileges occur at many levels. A user may not be granted a privilege at the database level, but
may still have permission on a table level, for example. See privileges for a more complete view of the MariaDB privilege
system.

MariaDB starting with 10.4


In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3


In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

The mysql.db table contains the following fields:

Field Type Null Key Default Description Introduced


Host (together with User and Db
makes up the unique identifier for this
record. Until MariaDB 5.5, if the host
field was blank, the corresponding
Host char(60) NO PRI
record in the mysql.host table
would be examined. From MariaDB
10.0, a blank host field is the same
as the % wildcard.
Database (together with User and
Db char(64) NO PRI Host makes up the unique identifier
for this record.
User (together with Host and Db
User char(80) NO PRI makes up the unique identifier for this
record.
Select_priv enum('N','Y') NO N Can perform SELECT statements.
487/3812
Insert_priv enum('N','Y') NO N Can perform INSERT statements.
Update_priv enum('N','Y') NO N Can perform UPDATE statements.
Delete_priv enum('N','Y') NO N Can perform DELETE statements.
Create_priv enum('N','Y') NO N Can CREATE TABLE's.
Can DROP DATABASE's or DROP
Drop_priv enum('N','Y') NO N
TABLE's.
User can grant privileges they
Grant_priv enum('N','Y') NO N
possess.
References_priv enum('N','Y') NO N Unused
Can create an index on a table using
the CREATE INDEX statement.
Without the INDEX privilege, user
can still create indexes when creating
a table using the CREATE TABLE
Index_priv enum('N','Y') NO N
statement if the user has have the
CREATE privilege, and user can
create indexes using the ALTER
TABLE statement if they have the
ALTER privilege.

Can perform ALTER TABLE


Alter_priv enum('N','Y') NO N
statements.
Can create temporary tables with the
Create_tmp_table_priv enum('N','Y') NO N CREATE TEMPORARY TABLE
statement.
Acquire explicit locks using the LOCK
TABLES statement; user also needs
Lock_tables_priv enum('N','Y') NO N
to have the SELECT privilege on a
table in order to lock it.
Can create a view using the
Create_view_priv enum('N','Y') NO N
CREATE_VIEW statement.
Can show the CREATE VIEW
Show_view_priv enum('N','Y') NO N statement to create a view using the
SHOW CREATE VIEW statement.
Can create stored programs using
Create_routine_priv enum('N','Y') NO N the CREATE PROCEDURE and
CREATE FUNCTION statements.
Can change the characteristics of a
Alter_routine_priv enum('N','Y') NO N stored function using the ALTER
FUNCTION statement.
Can execute stored procedure or
Execute_priv enum('N','Y') NO N
functions.
Event_priv enum('N','Y') NO N Create, drop and alter events.
Can execute triggers associated with
tables the user updates, execute the
Trigger_priv enum('N','Y') NO N CREATE TRIGGER and DROP
TRIGGER statements.

Can delete rows created through MariaDB


Delete_history_priv enum('N','Y') NO N
system versioning. 10.3.5

The Acl_database_grants status variable, added in MariaDB 10.1.4 , indicates how many rows the mysql.db table
contains.

1.1.1.2.9.3.4 mysql.event Table


The mysql.event table contains information about MariaDB events. Similar information can be obtained by viewing the
INFORMATION_SCHEMA.EVENTS table, or with the SHOW EVENTS and SHOW CREATE EVENT statements.
The table is upgraded live, and there is no need to restart the server if the table has changed.

488/3812
MariaDB starting with 10.4
In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3


In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

The mysql.event table contains the following fields:

Field Type Null Key Default Description


db char(64) NO PRI
name char(64) NO PRI
body longblob NO NULL

definer char(141) NO
execute_at datetime YES NULL

interval_value int(11) YES NULL

enum('YEAR', 'QUARTER', 'MONTH',


'DAY', 'HOUR', 'MINUTE', 'WEEK',
'SECOND', 'MICROSECOND',
'YEAR_MONTH', 'DAY_HOUR',
'DAY_MINUTE', 'DAY_SECOND',
interval_field YES NULL
'HOUR_MINUTE', 'HOUR_SECOND',
'MINUTE_SECOND', 'DAY_MICROSECOND',
'HOUR_MICROSECOND',
'MINUTE_MICROSECOND',
'SECOND_MICROSECOND')

created timestamp NO CURRENT_TIMESTAMP

0000-00-00
modified timestamp NO
00:00:00
last_executed datetime YES NULL

starts datetime YES NULL

ends datetime YES NULL

Current
status of the
event, one
enum('ENABLED', 'DISABLED', of enabled,
status NO ENABLED
'SLAVESIDE_DISABLED') disabled, or
disabled on
the
slaveside.
on_completion enum('DROP','PRESERVE') NO DROP

489/3812
set('REAL_AS_FLOAT',
'PIPES_AS_CONCAT', 'ANSI_QUOTES',
'IGNORE_SPACE',
'IGNORE_BAD_TABLE_OPTIONS',
'ONLY_FULL_GROUP_BY',
'NO_UNSIGNED_SUBTRACTION',
'NO_DIR_IN_CREATE', 'POSTGRESQL',
'ORACLE', 'MSSQL', 'DB2', 'MAXDB',
'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS',
The
'NO_FIELD_OPTIONS', 'MYSQL323',
SQL_MODE
'MYSQL40', 'ANSI',
at the time
sql_mode 'NO_AUTO_VALUE_ON_ZERO', NO
the event
'NO_BACKSLASH_ESCAPES',
was
'STRICT_TRANS_TABLES',
created.
'STRICT_ALL_TABLES',
'NO_ZERO_IN_DATE', 'NO_ZERO_DATE',
'INVALID_DATES',
'ERROR_FOR_DIVISION_BY_ZERO',
'TRADITIONAL', 'NO_AUTO_CREATE_USER',
'HIGH_NOT_PRECEDENCE',
'NO_ENGINE_SUBSTITUTION',
'PAD_CHAR_TO_FULL_LENGTH')

comment char(64) NO
originator int(10) unsigned NO NULL

time_zone char(64) NO SYSTEM

character_set_client char(32) YES NULL

collation_connection char(32) YES NULL

db_collation char(32) YES NULL

body_utf8 longblob YES NULL

1.1.1.2.9.3.5 mysql.func Table


The mysql.func table stores information about user-defined functions (UDFs) created with the CREATE FUNCTION
UDF statement.

MariaDB starting with 10.4


In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3


In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

The mysql.func table contains the following fields:

Field Type Null Key Default Description


name char(64) NO PRI UDF name
ret tinyint(1) NO 0
dl char(128) NO Shared library name
Type, either function or aggregate . Aggregate
type enum('function','aggregate') NO NULL functions are summary functions such as SUM() and
AVG().

Example

490/3812
SELECT * FROM mysql.func;
+------------------------------+-----+--------------+-----------+
| name | ret | dl | type |
+------------------------------+-----+--------------+-----------+
| spider_direct_sql | 2 | ha_spider.so | function |
| spider_bg_direct_sql | 2 | ha_spider.so | aggregate |
| spider_ping_table | 2 | ha_spider.so | function |
| spider_copy_tables | 2 | ha_spider.so | function |
| spider_flush_table_mon_cache | 2 | ha_spider.so | function |
+------------------------------+-----+--------------+-----------+

1.1.1.2.9.3.6 mysql.general_log Table


The mysql.general_log table stores the contents of the General Query Log if general logging is active and the output
is being written to table (see Writing logs into tables).
It contains the following fields:

Field Type Null Key Default Description


event_time timestamp(6) NO CURRENT_TIMESTAMP(6) Time the query was executed.
user_host mediumtext NO NULL User and host combination.
thread_id int(11) NO NULL Thread id.
server_id int(10) unsigned NO NULL Server id.
command_type varchar(64) NO NULL Type of command.
argument mediumtext NO NULL Full query.

Example
SELECT * FROM mysql.general_log\G
*************************** 1. row ***************************
event_time: 2014-11-11 08:40:04.117177
user_host: root[root] @ localhost []
thread_id: 74
server_id: 1
command_type: Query
argument: SELECT * FROM test.s
*************************** 2. row ***************************
event_time: 2014-11-11 08:40:10.501131
user_host: root[root] @ localhost []
thread_id: 74
server_id: 1
command_type: Query
argument: SELECT * FROM mysql.general_log
...

1.1.1.2.9.3.7 mysql.global_priv Table


MariaDB starting with 10.4.1
The mysql.global_priv table was introduced in MariaDB 10.4.1 to replace the mysql.user table.

The mysql.global_priv table contains information about users that have permission to access the MariaDB server,
and their global privileges.
Note that the MariaDB privileges occur at many levels. A user may not be granted create privilege at the user level,
but may still have create permission on certain tables or databases, for example. See privileges for a more complete
view of the MariaDB privilege system.
The mysql.global_priv table contains the following fields:

Field Type Null Key Default Description


Host char(60) NO PRI Host (together with User makes up the unique identifier for this account).
User char(80) NO PRI User (together with Host makes up the unique identifier for this account).
Priv longtext NO Global privileges, granted to the account and other account properties

491/3812
From MariaDB 10.5.2, in order to help the server understand which version a privilege record was written by, the priv
field contains a new JSON field, version_id (MDEV-21704 ).

Examples
select * from mysql.global_priv;
+-----------+-------------+----------------------------------------------------------------------------
-----------------------------------------------------------+
| Host | User | Priv
|
+-----------+-------------+----------------------------------------------------------------------------
-----------------------------------------------------------+
| localhost | root | {"access":
18446744073709551615,"plugin":"mysql_native_password","authentication_string":"*6C387FC3893DBA1E3BA155E
74754DA6682D04747"} |
| 127.% | msandbox |
{"access":1073740799,"plugin":"mysql_native_password","authentication_string":"*6C387FC3893DBA1E3BA155E
74754DA6682D04747"} |
| localhost | msandbox |
{"access":1073740799,"plugin":"mysql_native_password","authentication_string":"*6C387FC3893DBA1E3BA155E
74754DA6682D04747"} |
| localhost | msandbox_rw |
{"access":487487,"plugin":"mysql_native_password","authentication_string":"*6C387FC3893DBA1E3BA155E7475
4DA6682D04747"} |
| 127.% | msandbox_rw |
{"access":487487,"plugin":"mysql_native_password","authentication_string":"*6C387FC3893DBA1E3BA155E7475
4DA6682D04747"} |
| 127.% | msandbox_ro |
{"access":262145,"plugin":"mysql_native_password","authentication_string":"*6C387FC3893DBA1E3BA155E7475
4DA6682D04747"} |
| localhost | msandbox_ro |
{"access":262145,"plugin":"mysql_native_password","authentication_string":"*6C387FC3893DBA1E3BA155E7475
4DA6682D04747"} |
| 127.% | rsandbox |
{"access":524288,"plugin":"mysql_native_password","authentication_string":"*B07EB15A2E7BD9620DAE47B194D
5B9DBA14377AD"} |
+-----------+-------------+----------------------------------------------------------------------------
-----------------------------------------------------------+

Readable format:

SELECT CONCAT(user, '@', host, ' => ', JSON_DETAILED(priv)) FROM mysql.global_priv;

+--------------------------------------------------------------------------------------+
| CONCAT(user, '@', host, ' => ', JSON_DETAILED(priv)) |
+--------------------------------------------------------------------------------------+
| root@localhost => {
"access": 18446744073709551615,
"plugin": "mysql_native_password",
"authentication_string": "*6C387FC3893DBA1E3BA155E74754DA6682D04747"
} |
| msandbox@127.% => {
"access": 1073740799,
"plugin": "mysql_native_password",
"authentication_string": "*6C387FC3893DBA1E3BA155E74754DA6682D04747"
} |
+--------------------------------------------------------------------------------------+

A particular user:

SELECT CONCAT(user, '@', host, ' => ', JSON_DETAILED(priv)) FROM mysql.global_priv
WHERE user='marijn';
+--------------------------------------------------------------------------------------+
| CONCAT(user, '@', host, ' => ', JSON_DETAILED(priv)) |
+--------------------------------------------------------------------------------------+
| marijn@localhost => {
"access": 0,
"plugin": "mysql_native_password",
"authentication_string": "",
"account_locked": true,
"password_last_changed": 1558017158
} |
+--------------------------------------------------------------------------------------+

From MariaDB 10.5.2:

492/3812
GRANT FILE ON *.* TO user1@localhost;
SELECT Host, User, JSON_DETAILED(Priv) FROM mysql.global_priv WHERE user='user1'\G

*************************** 1. row ***************************


Host: localhost
User: user1
JSON_DETAILED(Priv): {
"access": 512,
"plugin": "mysql_native_password",
"authentication_string": "",
"password_last_changed": 1581070979,
"version_id": 100502
}

1.1.1.2.9.3.8 mysql.gtid_slave_pos Table


The mysql.gtid_slave_pos table is used in replication by replica servers to keep track of their current position (the
global transaction ID of the last transaction applied). Using the table allows the replica to maintain a consistent value for
the gtid_slave_pos system variable across server restarts. See Global Transaction ID.
You should never attempt to modify the table directly. If you do need to change the global gtid_slave_pos value, use
SET GLOBAL gtid_slave_pos = ... instead.

The table is updated with the new position as part of each transaction committed during replication. This makes it
preferable that the table is using the same storage engine as the tables otherwise being modified in the transaction,
since otherwise a multi-engine transaction is needed that can reduce performance.
Starting from MariaDB 10.3.1, multiple versions of this table are supported, each using a different storage engine. This
is selected with the gtid_pos_auto_engines option, by giving a comma-separated list of engine names. The server will
then on-demand create an extra version of the table using the appropriate storage engine, and select the table version
using the same engine as the rest of the transaction, avoiding multi-engine transactions.
For example, when gtid_pos_auto_engines=innodb,rocksdb , tables mysql.gtid_slave_pos_InnoDB and
mysql.gtid_slave_pos_RocksDB will be created and used, if needed. If there is no match to the storage engine, the
default mysql.gtid_slave_pos table will be used; this also happens if non-transactional updates (like MyISAM) are
replicated, since there is then no active transaction at the time of the mysql.gtid_slave_pos table update.
Prior to MariaDB 10.3.1, only the default mysql.gtid_slave_pos table is available. In these versions, the table should
preferably be using the storage engine that is used for most replicated transactions.
The default mysql.gtid_slave_pos table will be initially created using the default storage engine set for the server
(which itself defaults to InnoDB). If the application load is primarily non-transactional MyISAM or Aria tables, it can be
beneficial to change the storage engine to avoid including an InnoDB update with every operation:

ALTER TABLE mysql.gtid_slave_pos ENGINE=MyISAM;

The mysql.gtid_slave_pos table should not be changed manually in any other way. From MariaDB 10.3.1, it is
preferable to use the gtid_pos_auto_engines server variable to get the GTID position updates to use the TokuDB or
RocksDB storage engine.
Note that for scalability reasons, the automatic creation of a new mysql.gtid_slave_posXXX table happens
asynchronously when the first transaction with the new storage engine is committed. So the very first few transactions
will update the old version of the table, until the new version is created and available.
The table mysql.gtid_slave_pos contains the following fields

Field Type Null Key Default Description


int(10)
domain_id NO PRI NULL Domain id (see Global Transaction ID domain ID.
unsigned

This field enables multiple parallel transactions within same


bigint(20) domain_id to update this table without contention. At any instant,
sub_id NO PRI NULL the replication state corresponds to records with largest sub_id for
unsigned
each domain_id .

int(10)
server_id NO NULL Server id.
unsigned

bigint(20) Sequence number, an integer that is monotonically increasing for


seq_no NO NULL
unsigned each new event group logged into the binlog.

From MariaDB 10.3.1, some status variables are available to monitor the use of the different gtid_slave_pos table
versions:
Transactions_gtid_foreign_engine
493/3812
Number of replicated transactions where the update of the gtid_slave_pos table had to choose a storage engine that
did not otherwise participate in the transaction. This can indicate that setting gtid_pos_auto_engines might be useful.
Rpl_transactions_multi_engine
Number of replicated transactions that involved changes in multiple (transactional) storage engines, before considering
the update of gtid_slave_pos . These are transactions that were already cross-engine, independent of the GTID
position update introduced by replication
Transactions_multi_engine
Number of transactions that changed data in multiple (transactional) storage engines. If this is significantly larger than
Rpl_transactions_multi_engine, it indicates that setting gtid_pos_auto_engines could reduce the need for cross-
engine transactions.

1.1.1.2.9.3.9 mysql.help_category Table


mysql.help_category is one of the four tables used by the HELP command. It is populated when the server is installed
by the fill_help_table.sql script. The other help tables are help_relation, help_topic and help_keyword.

MariaDB starting with 10.4


In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3


In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

The mysql.help_category table contains the following fields:

Field Type Null Key Default Description


help_category_id smallint(5) unsigned NO PRI NULL

name char(64) NO UNI NULL

parent_category_id smallint(5) unsigned YES NULL

url char(128) NO NULL

Example

494/3812
SELECT * FROM help_category;
+------------------+-----------------------------------------------+--------------------+-----+
| help_category_id | name | parent_category_id | url |
+------------------+-----------------------------------------------+--------------------+-----+
| 1 | Geographic | 0 | |
| 2 | Polygon properties | 34 | |
| 3 | WKT | 34 | |
| 4 | Numeric Functions | 38 | |
| 5 | Plugins | 35 | |
| 6 | MBR | 34 | |
| 7 | Control flow functions | 38 | |
| 8 | Transactions | 35 | |
| 9 | Help Metadata | 35 | |
| 10 | Account Management | 35 | |
| 11 | Point properties | 34 | |
| 12 | Encryption Functions | 38 | |
| 13 | LineString properties | 34 | |
| 14 | Miscellaneous Functions | 38 | |
| 15 | Logical operators | 38 | |
| 16 | Functions and Modifiers for Use with GROUP BY | 35 | |
| 17 | Information Functions | 38 | |
| 18 | Comparison operators | 38 | |
| 19 | Bit Functions | 38 | |
| 20 | Table Maintenance | 35 | |
| 21 | User-Defined Functions | 35 | |
| 22 | Data Types | 35 | |
| 23 | Compound Statements | 35 | |
| 24 | Geometry constructors | 34 | |
| 25 | GeometryCollection properties | 1 | |
| 26 | Administration | 35 | |
| 27 | Data Manipulation | 35 | |
| 28 | Utility | 35 | |
| 29 | Language Structure | 35 | |
| 30 | Geometry relations | 34 | |
| 31 | Date and Time Functions | 38 | |
| 32 | WKB | 34 | |
| 33 | Procedures | 35 | |
| 34 | Geographic Features | 35 | |
| 35 | Contents | 0 | |
| 36 | Geometry properties | 34 | |
| 37 | String Functions | 38 | |
| 38 | Functions | 35 | |
| 39 | Data Definition | 35 | |
+------------------+-----------------------------------------------+--------------------+-----+

1.1.1.2.9.3.10 mysql.help_keyword Table


mysql.help_keyword is one of the four tables used by the HELP command. It is populated when the server is installed
by the fill_help_table.sql script. The other help tables are help_relation, help_category and help_topic.

MariaDB starting with 10.4


In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3


In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

The mysql.help_keyword table contains the following fields:

Field Type Null Key Default Description


help_keyword_id int(10) unsigned NO PRI NULL

name char(64) NO UNI NULL

Example

495/3812
SELECT * FROM help_keyword;
+-----------------+-------------------------------+
| help_keyword_id | name |
+-----------------+-------------------------------+
| 0 | JOIN |
| 1 | HOST |
| 2 | REPEAT |
| 3 | SERIALIZABLE |
| 4 | REPLACE |
| 5 | AT |
| 6 | SCHEDULE |
| 7 | RETURNS |
| 8 | STARTS |
| 9 | MASTER_SSL_CA |
| 10 | NCHAR |
| 11 | COLUMNS |
| 12 | COMPLETION |
...

1.1.1.2.9.3.11 mysql.help_relation Table


mysql.help_relation is one of the four tables used by the HELP command. It is populated when the server is installed
by the fill_help_table.sql script. The other help tables are help_topic, help_category and help_keyword.

MariaDB starting with 10.4


In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3


In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

The mysql.help_relation table contains the following fields:

Field Type Null Key Default Description


help_topic_id int(10) unsigned NO PRI NULL

help_keyword_id int(10) unsigned NO PRI NULL

Example
...
| 106 | 456 |
| 463 | 456 |
| 468 | 456 |
| 463 | 457 |
| 194 | 458 |
| 478 | 458 |
| 374 | 459 |
| 459 | 459 |
| 39 | 460 |
| 58 | 460 |
| 185 | 460 |
| 264 | 460 |
| 269 | 460 |
| 209 | 461 |
| 468 | 461 |
| 201 | 462 |
| 468 | 463 |
+---------------+-----------------+

1.1.1.2.9.3.12 mysql.help_topic Table


mysql.help_topic is one of the four tables used by the HELP command. It is populated when the server is installed by
the fill_help_table.sql script. The other help tables are help_relation, help_category and help_keyword.

MariaDB starting with 10.4


In MariaDB 10.4 and later, this table uses the Aria storage engine.

496/3812
MariaDB until 10.3
In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

The mysql.help_topic table contains the following fields:

Field Type Null Key Default Description


help_topic_id int(10) unsigned NO PRI NULL

name char(64) NO UNI NULL

help_category_id smallint(5) unsigned NO NULL

description text NO NULL

example text NO NULL

url char(128) NO NULL

Example
SELECT * FROM help_topic\G;
...
*************************** 704. row ***************************
help_topic_id: 692
name: JSON_DEPTH
help_category_id: 41
description: JSON functions were added in MariaDB 10.2.3.

Syntax
------
JSON_DEPTH(json_doc)

Description
-----------
Returns the maximum depth of the given JSON document, or
NULL if the argument is null. An error will occur if the
argument is an invalid JSON document.
Scalar values or empty arrays or objects have a depth of 1.
Arrays or objects that are not empty but contain only
elements or member values of depth 1 will have a depth of 2.
In other cases, the depth will be greater than 2.

Examples
--------
SELECT JSON_DEPTH('[]'), JSON_DEPTH('true'),
JSON_DEPTH('{}');
+------------------+--------------------+------------------+
| JSON_DEPTH('[]') | JSON_DEPTH('true') |
JSON_DEPTH('{}') |
+------------------+--------------------+------------------+
| 1 | 1 | 1 |
+------------------+--------------------+------------------+

SELECT JSON_DEPTH('[1, 2, 3]'), JSON_DEPTH('[[], {},


[]]');
+-------------------------+----------------------------+
| JSON_DEPTH('[1, 2, 3]') | JSON_DEPTH('[[], {}, []]') |
+-------------------------+----------------------------+
| 2 | 2 |
+-------------------------+----------------------------+

SELECT JSON_DEPTH('[1, 2, [3, 4, 5, 6], 7]');


+---------------------------------------+
| JSON_DEPTH('[1, 2, [3, 4, 5, 6], 7]') |
+---------------------------------------+
| 3 |
+---------------------------------------+

URL: https://mariadb.com/kb/en/json_depth/
example:
url: https://mariadb.com/kb/en/json_depth/

1.1.1.2.9.3.13 mysql.index_stats Table


497/3812
The mysql.index_stats table is one of three tables storing data used for Engine-independent table statistics. The
others are mysql.column_stats and mysql.table_stats.

MariaDB starting with 10.4


In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3


In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

The mysql.index_stats table contains the following fields:

Field Type Null Key Default Description


db_name varchar(64) NO PRI NULL Database the table is in.
table_name varchar(64) NO PRI NULL Table name
index_name varchar(64) NO PRI NULL Name of the index
int(11) Index prefix length. 1 for the first keypart, 2 for the first two,
prefix_arity NO PRI NULL
unsigned and so on. InnoDB's extended keys are supported.
Average number of records one will find for given values of
avg_frequency decimal(12,4) YES NULL (keypart1, keypart2, ..), provided the values will be found in
the table.

It is possible to manually update the table. See Manual updates to statistics tables for details.

1.1.1.2.9.3.14 mysql.innodb_index_stats
Contents
1. Example
2. See Also

The mysql.innodb_index_stats table stores data related to particular InnoDB Persistent Statistics, and contains
multiple rows for each index.
This table, along with the related mysql.innodb_table_stats table, can be manually updated in order to force or test
differing query optimization plans. After updating, FLUSH TABLE innodb_index_stats is required to load the changes.
mysql.innodb_index_stats is not replicated, although any ANALYZE TABLE statements on the table will be by
default..
It contains the following fields:

Field Type Null Key Default Description


database_name varchar(64) NO PRI NULL Database name.
table_name varchar(64) NO PRI NULL Table, partition or subpartition name.
index_name varchar(64) NO PRI NULL Index name.
last_update timestamp NO current_timestamp() Time that this row was last updated.
stat_name varchar(64) NO PRI NULL Statistic name.
bigint(20)
stat_value NO NULL Estimated statistic value.
unsigned

bigint(20) Number of pages sampled for the


sample_size YES NULL
unsigned estimated statistic value.
stat_description varchar(1024) NO NULL Statistic description.

Example

498/3812
SELECT * FROM mysql.innodb_index_stats\G
*************************** 1. row ***************************
database_name: mysql
table_name: gtid_slave_pos
index_name: PRIMARY
last_update: 2017-08-19 20:38:34
stat_name: n_diff_pfx01
stat_value: 0
sample_size: 1
stat_description: domain_id
*************************** 2. row ***************************
database_name: mysql
table_name: gtid_slave_pos
index_name: PRIMARY
last_update: 2017-08-19 20:38:34
stat_name: n_diff_pfx02
stat_value: 0
sample_size: 1
stat_description: domain_id,sub_id
*************************** 3. row ***************************
database_name: mysql
table_name: gtid_slave_pos
index_name: PRIMARY
last_update: 2017-08-19 20:38:34
stat_name: n_leaf_pages
stat_value: 1
sample_size: NULL
stat_description: Number of leaf pages in the index
*************************** 4. row ***************************
database_name: mysql
table_name: gtid_slave_pos
index_name: PRIMARY
last_update: 2017-08-19 20:38:34
stat_name: size
stat_value: 1
sample_size: NULL
stat_description: Number of pages in the index
*************************** 5. row ***************************
database_name: test
table_name: ft
index_name: FTS_DOC_ID_INDEX
last_update: 2017-09-15 12:58:39
stat_name: n_diff_pfx01
stat_value: 0
sample_size: 1
stat_description: FTS_DOC_ID
*************************** 6. row ***************************
database_name: test
table_name: ft
index_name: FTS_DOC_ID_INDEX
last_update: 2017-09-15 12:58:39
stat_name: n_leaf_pages
stat_value: 1
sample_size: NULL
stat_description: Number of leaf pages in the index
...

See Also
InnoDB Persistent Statistics
mysql.innodb_table_stats
ANALYZE TABLE

1.1.1.2.9.3.15 mysql.innodb_table_stats
Contents
1. Example
2. See Also

The mysql.innodb_table_stats table stores data related to InnoDB Persistent Statistics, and contains one row per
table.
This table, along with the related mysql.innodb_index_stats table, can be manually updated in order to force or test
differing query optimization plans. After updating, FLUSH TABLE innodb_table_stats is required to load the changes.
mysql.innodb_table_stats is not replicated, although any ANALYZE TABLE statements on the table will be by
499/3812
default..
It contains the following fields:

Field Type Null Key Default Description


database_name varchar(64) NO PRI NULL Database name.
Table, partition or
table_name varchar(64) NO PRI NULL
subpartition name.
Time that this row was last
last_update timestamp NO current_timestamp()
updated.
bigint(20)
n_rows NO NULL Number of rows in the table.
unsigned

bigint(20) Size, in pages, of the primary


clustered_index_size NO NULL
unsigned index.
bigint(20) Size, in pages, of non-
sum_of_other_index_sizes NO NULL
unsigned primary indexes.

Example
SELECT * FROM mysql.innodb_table_stats\G
*************************** 1. row ***************************
database_name: mysql
table_name: gtid_slave_pos
last_update: 2017-08-19 20:38:34
n_rows: 0
clustered_index_size: 1
sum_of_other_index_sizes: 0
*************************** 2. row ***************************
database_name: test
table_name: ft
last_update: 2017-09-15 12:58:39
n_rows: 0
clustered_index_size: 1
sum_of_other_index_sizes: 2
...

See Also
InnoDB Persistent Statistics
mysql.innodb_index_stats
ANALYZE TABLE

1.1.1.2.9.3.16
mysql.password_reuse_check_history Table
MariaDB starting with 10.7.0
The mysql.password_reuse_check_history Table is installed as part of the password_reuse_check plugin, available
from MariaDB 10.7.0.

The mysql.password_reuse_check_history table stores old passwords, so that when a user sets a new password, it
can be checked for purposes of preventing password reuse.
It contains the following fields:

Field Type Null Key Default Description


hash binary(64) NO PRI NULL
time timestamp NO MUL current_timestamp()

1.1.1.2.9.3.17 mysql.plugin Table


The mysql.plugin table can be queried to get information about installed plugins.
This table only contains information about plugins that have been installed via the following methods:
500/3812
The INSTALL SONAME statement.
The INSTALL PLUGIN statement.
The mysql_plugin utility.
This table does not contain information about:
Built-in plugins.
Plugins loaded with the --plugin-load-add option.
Plugins loaded with the --plugin-load option.
This table only contains enough information to reload the plugin when the server is restarted, which means it only
contains the plugin name and the plugin library.

MariaDB starting with 10.4


In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3


In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

The mysql.plugin table contains the following fields:

Field Type Null Key Default Description


name varchar(64) NO PRI Plugin name.
dl varchar(128) NO Name of the plugin library.

Example
SELECT * FROM mysql.plugin;
+---------------------------+------------------------+
| name | dl |
+---------------------------+------------------------+
| spider | ha_spider.so |
| spider_alloc_mem | ha_spider.so |
| METADATA_LOCK_INFO | metadata_lock_info.so |
| OQGRAPH | ha_oqgraph.so |
| cassandra | ha_cassandra.so |
| QUERY_RESPONSE_TIME | query_response_time.so |
| QUERY_RESPONSE_TIME_AUDIT | query_response_time.so |
| LOCALES | locales.so |
| sequence | ha_sequence.so |
+---------------------------+------------------------+

1.1.1.2.9.3.18 mysql.proc Table


The mysql.proc table contains information about stored procedures and stored functions. It contains similar
information to that stored in the INFORMATION SCHEMA.ROUTINES table.

MariaDB starting with 10.4


In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3


In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

The mysql.proc table contains the following fields:


Field Type Null Key Default Description
Database
db char(64) NO PRI
name.
name char(64) NO PRI Routine name.
Whether stored
procedure,
stored function
or, from
type enum('FUNCTION','PROCEDURE','PACKAGE', 'PACKAGE BODY') NO PRI NULL
MariaDB
10.3.5, a
package or
package body.
501/3812
specific_name char(64) NO
language enum('SQL') NO SQL Always SQL .
enum('CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA',
sql_data_access NO CONTAINS_SQL
'MODIFIES_SQL_DATA')

Whether the
routine is
deterministic
(can produce
is_deterministic enum('YES','NO') NO NO
only one result
for a given list
of parameters)
or not.
INVOKER or
DEFINER .
Indicates which
security_type enum('INVOKER','DEFINER') NO DEFINER
user's
privileges apply
to this routine.
List of
param_list blob NO NULL
parameters.
What the
returns longblob NO NULL
routine returns.
Definition of the
body longblob NO NULL
routine.
If the
security_type
is DEFINER ,
definer char(141) NO this value
indicates which
user defined
this routine.
Date and time
created timestamp NO CURRENT_TIMESTAMP the routine was
created.
Date and time
0000-00-00
modified timestamp NO the routine was
00:00:00
modified.
set('REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES',
'IGNORE_SPACE', 'IGNORE_BAD_TABLE_OPTIONS',
'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION',
'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2',
The
'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS',
SQL_MODE at
'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI',
sql_mode NO the time the
'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES',
routine was
'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE',
created.
'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO',
'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE',
'NO_ENGINE_SUBSTITUTION', 'PAD_CHAR_TO_FULL_LENGTH',
'EMPTY_STRING_IS_NULL', 'SIMULTANEOUS_ASSIGNMENT')

Comment
comment text NO NULL associated with
the routine.
The character
set used by the
character_set_client char(32) YES NULL client that
created the
routine.
The collation
(and character
set) used by
collation_connection char(32) YES NULL
the connection
that created the
routine.
The default
collation (and
character set)
for the
db_collation char(32) YES NULL
database, at
the time the
routine was
created.
Definition of the
body_utf8 longblob YES NULL
routine in utf8.
From MariaDB
aggregate enum('NONE', 'GROUP') NO NONE
10.3.3
Field Type Null Key Default Description

502/3812
See Also
Stored Procedure Internals
MySQL to MariaDB migration: handling privilege table differences when using mysqldump

1.1.1.2.9.3.19 mysql.procs_priv Table


The mysql.procs_priv table contains information about stored procedure and stored function privileges. See CREATE
PROCEDURE and CREATE FUNCTION on creating these.
The INFORMATION_SCHEMA.ROUTINES table derives its contents from mysql.procs_priv .

MariaDB starting with 10.4


In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3


In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

The mysql.procs_priv table contains the following fields:

Field Type Null Key Default Description


Host (together with Db , User ,
Routine_name and
Host char(60) NO PRI Routine_type makes up the
unique identifier for this
record).
Database (together with Host ,
User , Routine_name and
Db char(64) NO PRI Routine_type makes up the
unique identifier for this
record).
User (together with Host , Db ,
Routine_name and
User char(80) NO PRI Routine_type makes up the
unique identifier for this
record).
Routine_name (together with
Host , Db User and
Routine_name char(64) NO PRI Routine_type makes up the
unique identifier for this
record).
Whether the routine is a stored
enum('FUNCTION','PROCEDURE', procedure, stored function, or,
Routine_type NO PRI NULL
'PACKAGE', 'PACKAGE BODY') from MariaDB 10.3.5, a
package or package body.

Grantor char(141) NO MUL


The routine privilege. See
set('Execute','Alter Function Privileges and
Proc_priv NO
Routine','Grant') Procedure Privileges for
details.
Timestamp timestamp NO CURRENT_TIMESTAMP

The Acl_function_grants status variable, added in MariaDB 10.1.4 , indicates how many rows the
mysql.columns_priv table contains with the FUNCTION routine type.
The Acl_procedure_grants status variable, added in MariaDB 10.1.4 , indicates how many rows the
mysql.columns_priv table contains with the PROCEDURE routine type.

1.1.1.2.9.3.20 mysql.roles_mapping Table


The mysql.roles_mapping table contains information about mariaDB roles.

MariaDB starting with 10.4


503/3812
In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3


In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

The mysql.roles_mapping table contains the following fields:

Field Type Null Key Default Description


Host (together with User and Role makes up the unique
Host char(60) NO PRI
identifier for this record.
User (together with Host and Role makes up the unique
User char(80) NO PRI
identifier for this record.
Role (together with Host and User makes up the unique
Role char(80) NO PRI
identifier for this record.
Whether the role can be granted (see the CREATE ROLE
Admin_option enum('N','Y') NO N
WITH ADMIN clause).

The Acl_role_grants status variable, added in MariaDB 10.1.4 , indicates how many rows the mysql.roles_mapping
table contains.

1.1.1.2.9.3.21 mysql.servers Table


The mysql.servers table contains information about servers as used by the Spider, FEDERATED or FederatedX ,
Connect storage engines (see CREATE SERVER).

MariaDB starting with 10.4


In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3


In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

The mysql.servers table contains the following fields:

Field Type Null Key Default Description


Server_name char(64) NO PRI
Host char(64) NO
Db char(64) NO
Username char(80) NO
Password char(64) NO
Port int(4) NO 0
Socket char(64) NO
Wrapper char(64) NO mysql or mariadb

Owner char(64) NO

1.1.1.2.9.3.22 mysql.slow_log Table


The mysql.slow_log table stores the contents of the Slow Query Log if slow logging is active and the output is being
written to table (see Writing logs into tables).
It contains the following fields:

Field Type Null Key Default Description


start_time timestamp(6) NO CURRENT_TIMESTAMP(6) Time the query began.
user_host mediumtext NO NULL User and host combination.
query_time time(6) NO NULL Total time the query took to execute.
lock_time time(6) NO NULL Total time the query was locked.
504/3812
rows_sent int(11) NO NULL Number of rows sent.
rows_examined int(11) NO NULL Number of rows examined.
db varchar(512) NO NULL Default database.
last_insert_id int(11) NO NULL last_insert_id.
insert_id int(11) NO NULL Insert id.
int(10)
server_id NO NULL The server's id.
unsigned

sql_text mediumtext NO NULL Full query.


bigint(21)
thread_id NO NULL Thread id.
unsigned

Number of rows affected by an UPDATE or


rows_affected int(11) NO NULL
DELETE (from MariaDB 10.1.2 )

Example
SELECT * FROM mysql.slow_log\G
...
*************************** 2. row ***************************
start_time: 2014-11-11 07:56:28.721519
user_host: root[root] @ localhost []
query_time: 00:00:12.000215
lock_time: 00:00:00.000000
rows_sent: 1
rows_examined: 0
db: test
last_insert_id: 0
insert_id: 0
server_id: 1
sql_text: SELECT SLEEP(12)
thread_id: 74
...

1.1.1.2.9.3.23 mysql.tables_priv Table


The mysql.tables_priv table contains information about table-level privileges. The table can be queried and although
it is possible to directly update it, it is best to use GRANT for setting privileges.
Note that the MariaDB privileges occur at many levels. A user may be granted a privilege at the table level, but may still
not have permission on a database level, for example. See privileges for a more complete view of the MariaDB privilege
system.
The INFORMATION_SCHEMA.TABLE_PRIVILEGES table derives its contents from mysql.tables_priv .

MariaDB starting with 10.4


In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3


In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

The mysql.tables_priv table contains the following fields:

Field Type Null Key Default Description


Host (together with
User , Db and
Table_name makes
Host char(60) NO PRI
up the unique
identifier for this
record.

505/3812
Database
(together with
User , Host and
Db char(64) NO PRI Table_name makes
up the unique
identifier for this
record.
User (together with
Host , Db and
Table_name makes
User char(80) NO PRI
up the unique
identifier for this
record.
Table name
(together with
User , Db and
Table_name char(64) NO PRI Table makes up
the unique
identifier for this
record.
Grantor char(141) NO MUL
Timestamp timestamp NO CURRENT_TIMESTAMP

set('Select', 'Insert', 'Update',


The table privilege
'Delete', 'Create', 'Drop', 'Grant',
type. See Table
Table_priv 'References', 'Index', 'Alter', 'Create NO
Privileges for
View', 'Show view', 'Trigger', 'Delete
details.
versioning rows')

The column
set('Select', 'Insert', 'Update', privilege type. See
Column_priv NO
'References') Column Privileges
for details.

The Acl_table_grants status variable, added in MariaDB 10.1.4 , indicates how many rows the mysql.tables_priv
table contains.

1.1.1.2.9.3.24 mysql.table_stats Table


The mysql.table_stats table is one of three tables storing data used for Engine-independent table statistics. The
others are mysql.column_stats and mysql.index_stats.

MariaDB starting with 10.4


In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3


In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

The mysql.table_stats table contains the following fields:

Field Type Null Key Default Description


db_name varchar(64) NO PRI NULL Database the table is in .
table_name varchar(64) NO PRI NULL Table name.
cardinality bigint(21) unsigned YES NULL Number of records in the table.

It is possible to manually update the table. See Manual updates to statistics tables for details.

1.1.1.2.9.3.25 mysql.time_zone Table


The mysql.time_zone table is one of the mysql system tables that can contain time zone information. It is usually
preferable for the system to handle the time zone, in which case the table will be empty (the default), but you can
populate the mysql time zone tables using the mysql_tzinfo_to_sql utility. See Time Zones for details.

MariaDB starting with 10.4


506/3812
In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3


In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

The mysql.time_zone table contains the following fields:

Field Type Null Key Default Description


Time_zone_id int(10) unsigned NO PRI NULL ID field, auto_increments.
Use_leap_seconds enum('Y','N') NO N Whether or not leap seconds are used.

Example
SELECT * FROM mysql.time_zone;
+--------------+------------------+
| Time_zone_id | Use_leap_seconds |
+--------------+------------------+
| 1 | N |
| 2 | N |
| 3 | N |
| 4 | N |
| 5 | N |
| 6 | N |
| 7 | N |
| 8 | N |
| 9 | N |
| 10 | N |
...
+--------------+------------------+

See Also
mysql.time_zone_leap_second table
mysql.time_zone_name table
mysql.time_zone_transition table
mysql.time_zone_transition_type table

1.1.1.2.9.3.26 mysql.time_zone_leap_second
Table
The mysql.time_zone_leap_second table is one of the mysql system tables that can contain time zone information. It is
usually preferable for the system to handle the time zone, in which case the table will be empty (the default), but you
can populate the mysql time zone tables using the mysql_tzinfo_to_sql utility. See Time Zones for details.

MariaDB starting with 10.4


In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3


In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

The mysql.time_zone_leap_second table contains the following fields:

Field Type Null Key Default Description


Transition_time bigint(20) NO PRI NULL

Correction int(11) NO NULL

See Also
mysql.time_zone table
mysql.time_zone_name table
mysql.time_zone_transition table
mysql.time_zone_transition_type table
507/3812
1.1.1.2.9.3.27 mysql.time_zone_name Table
The mysql.time_zone_name table is one of the mysql system tables that can contain time zone information. It is usually
preferable for the system to handle the time zone, in which case the table will be empty (the default), but you can
populate the mysql time zone tables using the mysql_tzinfo_to_sql utility. See Time Zones for details.

MariaDB starting with 10.4


In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3


In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

The mysql.time_zone_name table contains the following fields:

Field Type Null Key Default Description


Name char(64) NO PRI NULL Name of the time zone.
Time_zone_id int(10) unsigned NO PRI NULL ID field, auto_increments.

Example
SELECT * FROM mysql.time_zone_name;
+--------------------+--------------+
| Name | Time_zone_id |
+--------------------+--------------+
| Africa/Abidjan | 1 |
| Africa/Accra | 2 |
| Africa/Addis_Ababa | 3 |
| Africa/Algiers | 4 |
| Africa/Asmara | 5 |
| Africa/Asmera | 6 |
| Africa/Bamako | 7 |
| Africa/Bangui | 8 |
| Africa/Banjul | 9 |
| Africa/Bissau | 10 |
...
+--------------------+--------------+

See Also
mysql.time_zone table
mysql.time_zone_leap_second table
mysql.time_zone_transition table
mysql.time_zone_transition_type table

1.1.1.2.9.3.28 mysql.time_zone_transition
Table
The mysql.time_zone_transition table is one of the mysql system tables that can contain time zone information. It is
usually preferable for the system to handle the time zone, in which case the table will be empty (the default), but you
can populate the mysql time zone tables using the mysql_tzinfo_to_sql utility. See Time Zones for details.

MariaDB starting with 10.4


In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3


In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

The mysql.time_zone_transition table contains the following fields:

Field Type Null Key Default Description


Time_zone_id int(10) unsigned NO PRI NULL

508/3812
Transition_time bigint(20) NO PRI NULL

Transition_type_id int(10) unsigned NO NULL

Example
SELECT * FROM mysql.time_zone_transition;
+--------------+-----------------+--------------------+
| Time_zone_id | Transition_time | Transition_type_id |
+--------------+-----------------+--------------------+
| 1 | -1830383032 | 1 |
| 2 | -1640995148 | 2 |
| 2 | -1556841600 | 1 |
| 2 | -1546388400 | 2 |
| 2 | -1525305600 | 1 |
| 2 | -1514852400 | 2 |
| 2 | -1493769600 | 1 |
| 2 | -1483316400 | 2 |
| 2 | -1462233600 | 1 |
| 2 | -1451780400 | 2 |
...
+--------------+-----------------+--------------------+

See Also
mysql.time_zone table
mysql.time_zone_leap_second table
mysql.time_zone_name table
mysql.time_zone_transition_type table

1.1.1.2.9.3.29 mysql.time_zone_transition_type
Table
The mysql.time_zone_transition_type table is one of the mysql system tables that can contain time zone
information. It is usually preferable for the system to handle the time zone, in which case the table will be empty (the
default), but you can populate the mysql time zone tables using the mysql_tzinfo_to_sql utility. See Time Zones for
details.

MariaDB starting with 10.4


In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3


In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

The mysql.time_zone_transition_type table contains the following fields:

Field Type Null Key Default Description


Time_zone_id int(10) unsigned NO PRI NULL

Transition_type_id int(10) unsigned NO PRI NULL

Offset int(11) NO 0
Is_DST tinyint(3) unsigned NO 0
Abbreviation char(8) NO

Example

509/3812
SELECT * FROM mysql.time_zone_transition_type;
+--------------+--------------------+--------+--------+--------------+
| Time_zone_id | Transition_type_id | Offset | Is_DST | Abbreviation |
+--------------+--------------------+--------+--------+--------------+
| 1 | 0 | -968 | 0 | LMT |
| 1 | 1 | 0 | 0 | GMT |
| 2 | 0 | -52 | 0 | LMT |
| 2 | 1 | 1200 | 1 | GHST |
| 2 | 2 | 0 | 0 | GMT |
| 3 | 0 | 8836 | 0 | LMT |
| 3 | 1 | 10800 | 0 | EAT |
| 3 | 2 | 9000 | 0 | BEAT |
| 3 | 3 | 9900 | 0 | BEAUT |
| 3 | 4 | 10800 | 0 | EAT |
...
+--------------+--------------------+--------+--------+--------------+

See Also
mysql.time_zone table
mysql.time_zone_leap_second table
mysql.time_zone_name table
mysql.time_zone_transition table

1.1.1.2.9.3.30 mysql.transaction_registry Table


MariaDB starting with 10.3.4
The mysql.transaction_registry table was introduced in MariaDB 10.3.4 as part of system-versioned tables.

The mysql.transaction_registry table is used for transaction-precise versioning, and contains the following fields:

Field Type Null Key Default Description


transaction_id bigint(20) unsigned NO Primary NULL
commit_id bigint(20) unsigned NO Unique NULL
Timestamp when the
transaction began
0000-00-00
begin_timestamp timestamp(6) NO Multiple (BEGIN statement),
00:00:00.000000
however see MDEV-
16024 .
Timestamp when the
0000-00-00
commit timestamp(6) NO Multiple transaction was
00:00:00.000000
committed.
enum('READ-UNCOMMITTED','READ-
Transaction isolation
isolation_level COMMITTED','REPEATABLE- NO NULL
level.
READ','SERIALIZABLE')

1.1.1.2.9.3.31 mysql.user Table


MariaDB starting with 10.4
In MariaDB 10.4 and later, the mysql.global_priv table has replaced the mysql.user table, and mysql.user should
be considered obsolete. It is now a view into mysql.global_priv created for compatibility with older applications and
monitoring scripts. New tools are supposed to use INFORMATION_SCHEMA tables. From MariaDB 10.4.13, the
dedicated mariadb.sys user is created as the definer of the view. Previously, root was the definer, which resulted
in privilege problems when this username was changed (MDEV-19650 ).

The mysql.user table contains information about users that have permission to access the MariaDB server, and their
global privileges. The table can be queried and although it is possible to directly update it, it is best to use GRANT and
CREATE USER for adding users and privileges.
Note that the MariaDB privileges occur at many levels. A user may not be granted create privilege at the user level,
but may still have create permission on certain tables or databases, for example. See privileges for a more complete
view of the MariaDB privilege system.

510/3812
MariaDB until 10.3
In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

The mysql.user table contains the following fields:

Field Type Null Key Default Description Introduced


Host (together with User makes
Host char(60) NO PRI up the unique identifier for this
account.
User (together with Host makes
User char(80) NO PRI up the unique identifier for this
account.
longtext (>=
MariaDB
10.4.1), Hashed password, generated by
Password NO
char(41) (<= the PASSWORD() function.
MariaDB
10.4.0)
Select_priv enum('N','Y') NO N Can perform SELECT statements.
Insert_priv enum('N','Y') NO N Can perform INSERT statements.
Update_priv enum('N','Y') NO N Can perform UPDATE statements.
Delete_priv enum('N','Y') NO N Can perform DELETE statements.
Can CREATE DATABASE's or
Create_priv enum('N','Y') NO N
CREATE TABLE's.
Can DROP DATABASE's or
Drop_priv enum('N','Y') NO N
DROP TABLE's.
Can execute FLUSH statements
Reload_priv enum('N','Y') NO N or equivalent mysqladmin
commands.
Can shut down the server with
Shutdown_priv enum('N','Y') NO N SHUTDOWN or mysqladmin
shutdown.
Can show information about active
processes, via SHOW
Process_priv enum('N','Y') NO N
PROCESSLIST or mysqladmin
processlist.
Read and write files on the server,
using statements like LOAD DATA
INFILE or functions like
File_priv enum('N','Y') NO N LOAD_FILE(). Also needed to
create CONNECT outward tables.
MariaDB server must have
permission to access those files.
User can grant privileges they
Grant_priv enum('N','Y') NO N
possess.
References_priv enum('N','Y') NO N Unused
Can create an index on a table
using the CREATE INDEX
statement. Without the INDEX
privilege, user can still create
indexes when creating a table
Index_priv enum('N','Y') NO N using the CREATE TABLE
statement if the user has have the
CREATE privilege, and user can
create indexes using the ALTER
TABLE statement if they have the
ALTER privilege.

Can perform ALTER TABLE


Alter_priv enum('N','Y') NO N
statements.

511/3812
Can list all databases using the
SHOW DATABASES statement.
Without the SHOW DATABASES
privilege, user can still issue the
Show_db_priv enum('N','Y') NO N
SHOW DATABASES statement, but it
will only list databases containing
tables on which they have
privileges.
Can execute superuser
statements: CHANGE MASTER
TO, KILL (users who do not have
this privilege can only KILL their
own threads), PURGE LOGS,
SET global system variables, or
the mysqladmin debug command.
Also, this permission allows the
user to write data even if the
read_only startup option is set,
Super_priv enum('N','Y') NO N enable or disable logging, enable
or disable replication on slaves,
specify a DEFINER for statements
that support that clause, connect
once after reaching the
MAX_CONNECTIONS . If a statement
has been specified for the init-
connect mysqld option, that
command will not be executed
when a user with SUPER privileges
connects to the server.
Can create temporary tables with
Create_tmp_table_priv enum('N','Y') NO N the CREATE TEMPORARY
TABLE statement.
Acquire explicit locks using the
LOCK TABLES statement; user
Lock_tables_priv enum('N','Y') NO N also needs to have the SELECT
privilege on a table in order to lock
it.
Can execute stored procedure or
Execute_priv enum('N','Y') NO N
functions.
Accounts used by slave servers
on the master need this privilege.
Repl_slave_priv enum('N','Y') NO N
This is needed to get the updates
made on the master.
Can execute SHOW MASTER
Repl_client_priv enum('N','Y') NO N STATUS and SHOW SLAVE
STATUS statements.
Can create a view using the
Create_view_priv enum('N','Y') NO N
CREATE_VIEW statement.
Can show the CREATE VIEW
statement to create a view using
Show_view_priv enum('N','Y') NO N
the SHOW CREATE VIEW
statement.
Can create stored programs using
Create_routine_priv enum('N','Y') NO N the CREATE PROCEDURE and
CREATE FUNCTION statements.
Can change the characteristics of
Alter_routine_priv enum('N','Y') NO N a stored function using the ALTER
FUNCTION statement.
Can create a user using the
CREATE USER statement, or
Create_user_priv enum('N','Y') NO N
implicitly create a user with the
GRANT statement.

Event_priv enum('N','Y') NO N Create, drop and alter events.

512/3812
Can execute triggers associated
with tables the user updates,
Trigger_priv enum('N','Y') NO N
execute the CREATE TRIGGER
and DROP TRIGGER statements.
Create_tablespace_priv enum('N','Y') NO N
Can delete rows created through MariaDB
Delete_history_priv enum('N','Y') NO N
system versioning. 10.3.5
enum('',
ssl_type 'ANY', 'X509', NO TLS type - see TLS options.
'SPECIFIED')

ssl_cipher blob NO NULL TLS cipher - see TLS options.


x509_issuer blob NO NULL X509 cipher - see TLS options.
x509_subject blob NO NULL SSL subject - see TLS options.
Number of queries the user can
int(11) perform per hour. Zero is
max_questions NO 0
unsigned unlimited. See per-account
resource limits.
Number of updates the user can
int(11) perform per hour. Zero is
max_updates NO 0
unsigned unlimited. See per-account
resource limits.
Number of connections the
int(11) account can start per hour. Zero is
max_connections NO 0
unsigned unlimited. See per-account
resource limits.
Number of simultaneous
connections the account can
max_user_connections int(11) NO 0
have. Zero is unlimited. See per-
account resource limits.
Authentication plugin used on
plugin char(64) NO connection. If empty, uses the
default.
Authentication string for the
authentication_string text NO NULL
authentication plugin.
MySQL-compatibility option, not
password_expired enum('N','Y') NO N
implemented in MariaDB.
is_role enum('N','Y') NO N Whether the user is a role.
Role which will be enabled on
default_role char(80) NO N
user login automatically.
If non-zero, how long queries can
max_statement_time decimal(12,6) NO 0.000000 run before being killed
automatically.
Field Type Null Key Default Description Introduced

The Acl_roles status variable indicates how many rows the mysql.user table contains where is_role='Y' .
The Acl_users status variable, indicates how many rows the mysql.user table contains where is_role='N' .

Authentication Plugin
When the plugin column is empty, MariaDB defaults to authenticating accounts with either the
mysql_native_password or the mysql_old_password plugins. It decides which based on the hash used in the value for
the Password column. When there's no password set or when the 4.1 password hash is used, (which is 41 characters
long), MariaDB uses the mysql_native_password plugin. The mysql_old_password plugin is used with pre-4.1
password hashes, (which are 16 characters long).
MariaDB also supports the use of alternative authentication plugins. When the plugin column is not empty for the
given account, MariaDB uses it to authenticate connection attempts. The specific plugin then uses the value of either
the Password column or the authentication_string column to authenticate the user.
A specific authentication plugin can be used for an account by providing the IDENTIFIED VIA authentication_plugin
clause with the CREATE USER, ALTER USER, or GRANT statements.
513/3812
For example, the following statement would create an account that authenticates with the PAM authentication plugin:

CREATE USER foo2@test IDENTIFIED VIA pam;

If the specific authentication plugin uses the authentication_string column, then this value for the account can be
specified after a USING or AS keyword. For example, the PAM authentication plugin accepts a service name that would
go into the authentication_string column for the account:

CREATE USER foo2@test IDENTIFIED VIA pam USING 'mariadb';

1.1.1.2.9.3.32 Spider mysql Database Tables


The Spider storage engine installs the following system tables in the mysql database.
mysql.spider_link_failed_log Table
The mysql.spider_link_failed_log table.

mysql.spider_link_mon_servers Table
The mysql.spider_link_mon_servers table.

mysql.spider_tables Table
The mysql.spider_tables table.

mysql.spider_table_crd Table
The mysql.spider_table_crd table.

mysql.spider_table_position_for_recovery Table
The mysql.spider_table_position_for_recovery table.

mysql.spider_table_sts Table
The mysql.spider_table_sts table.

mysql.spider_xa Table
The mysql.spider_xa table.

mysql.spider_xa_failed_log Table
The mysql.spider_xa_failed_log table.

mysql.spider_xa_member Table
The mysql.spider_xa_member table.

1.1.1.2.9.3.32.1 mysql.spider_link_failed_log
Table
The mysql.spider_link_failed_log table is installed by the Spider storage engine.

MariaDB starting with 10.4


In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3


In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

It contains the following fields:

Field Type Null Key Default Description


db_name char(64) NO
table_name char(199) NO
link_id char(64) NO
failed_time timestamp NO current_timestamp()

514/3812
1.1.1.2.9.3.32.2
mysql.spider_link_mon_servers Table
The mysql.spider_link_mon_servers table is installed by the Spider storage engine.

MariaDB starting with 10.4


In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3


In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

It contains the following fields:

Field Type Null Key Default Description


db_name char(64) NO PRI
table_name char(199) NO PRI
link_id char(64) NO PRI
sid int(10) unsigned NO PRI 0
server char(64) YES NULL
scheme char(64) YES NULL
host char(64) YES NULL
port char(5) YES NULL
socket text YES NULL
username char(64) YES NULL
password char(64) YES NULL
ssl_ca text YES NULL
ssl_capath text YES NULL
ssl_cert text YES NULL
ssl_cipher char(64) YES NULL
ssl_key text YES NULL
ssl_verify_server_cert tinyint(4) NO 0
default_file text YES NULL
default_group char(64) YES NULL
dsn char(64) YES NULL
filedsn text YES NULL
driver char(64) YES NULL

1.1.1.2.9.3.32.3 mysql.spider_tables Table


The mysql.spider_tables table is installed by the Spider storage engine.

MariaDB starting with 10.4


In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3


In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

It contains the following fields:

Field Type Null Key Default Description

515/3812
db_name char(64) NO PRI
table_name char(199) NO PRI

link_id int(11) NO PRI 0


priority bigint(20) NO MUL 0
server char(64) YES NULL
scheme char(64) YES NULL
host char(64) YES NULL
port char(5) YES NULL
socket text YES NULL
username char(64) YES NULL
password char(64) YES NULL
ssl_ca text YES NULL
ssl_capath text YES NULL
ssl_cert text YES NULL
ssl_cipher char(64) YES NULL
ssl_key text YES NULL
ssl_verify_server_cert tinyint(4) NO 0
monitoring_binlog_pos_at_failing tinyint(4) NO 0
default_file text YES NULL
default_group char(64) YES NULL
dsn char(64) YES NULL
filedsn text YES NULL
driver char(64) YES NULL
tgt_db_name char(64) YES NULL
tgt_table_name char(64) YES NULL
link_status tinyint(4) NO 1
block_status tinyint(4) NO 0
static_link_id char(64) YES NULL

1.1.1.2.9.3.32.4 mysql.spider_table_crd Table


The mysql.spider_table_crd table is installed by the Spider storage engine.

MariaDB starting with 10.4


In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3


In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

It contains the following fields:

Field Type Null Key Default Description


db_name char(64) NO PRI
table_name char(199) NO PRI
key_seq int(10) unsigned NO PRI 0
cardinality bigint(20) NO 0

516/3812
1.1.1.2.9.3.32.5
mysql.spider_table_position_for_recovery Table
The mysql.spider_table_position_for_recovery table is installed by the Spider storage engine.

MariaDB starting with 10.4


In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3


In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

It contains the following fields:

Field Type Null Key Default Description


db_name char(64) NO PRI
table_name char(199) NO PRI
failed_link_id int(11) NO PRI 0
source_link_id int(11) NO PRI 0
file text YES NULL
position text YES NULL
gtid text YES NULL

1.1.1.2.9.3.32.6 mysql.spider_table_sts Table


The mysql.spider_table_sts table is installed by the Spider storage engine.

MariaDB starting with 10.4


In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3


In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

It contains the following fields:

Field Type Null Key Default Description


db_name char(64) NO PRI
table_name char(199) NO PRI
data_file_length bigint(20) unsigned NO 0
max_data_file_length bigint(20) unsigned NO 0
index_file_length bigint(20) unsigned NO 0
records bigint(20) unsigned NO 0
mean_rec_length bigint(20) unsigned NO 0
check_time datetime NO 0000-00-00 00:00:00
create_time datetime NO 0000-00-00 00:00:00

update_time datetime NO 0000-00-00 00:00:00

checksum bigint(20) unsigned YES NULL

1.1.1.2.9.3.32.7 mysql.spider_xa Table


The mysql.spider_xa table is installed by the Spider storage engine.

MariaDB starting with 10.4


517/3812
In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3


In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

It contains the following fields:

Field Type Null Key Default Description


format_id int(11) NO PRI 0
gtrid_length int(11) NO PRI 0
bqual_length int(11) NO 0
data binary(128) NO PRI
status char(8) NO MUL

1.1.1.2.9.3.32.8 mysql.spider_xa_failed_log
Table
The mysql.spider_xa_failed_log table is installed by the Spider storage engine.

MariaDB starting with 10.4


In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3


In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

It contains the following fields:

Field Type Null Key Default Description


format_id int(11) NO 0
gtrid_length int(11) NO 0
bqual_length int(11) NO 0
data binary(128) NO MUL
scheme char(64) NO
host char(64) NO
port char(5) NO

socket text NO NULL


username char(64) NO
password char(64) NO
ssl_ca text YES NULL
ssl_capath text YES NULL
ssl_cert text YES NULL
ssl_cipher char(64) YES NULL
ssl_key text YES NULL
ssl_verify_server_cert tinyint(4) NO 0
default_file text YES NULL
default_group char(64) YES NULL
dsn char(64) YES NULL
filedsn text YES NULL
driver char(64) YES NULL

518/3812
thread_id int(11) YES NULL
status char(8) NO
failed_time timestamp NO current_timestamp()

1.1.1.2.9.3.32.9 mysql.spider_xa_member
Table
The mysql.spider_xa_member table is installed by the Spider storage engine.

MariaDB starting with 10.4


In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3


In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

It contains the following fields:

Field Type Null Key Default Description


format_id int(11) NO 0
gtrid_length int(11) NO 0
bqual_length int(11) NO 0
data binary(128) NO MUL
scheme char(64) NO
host char(64) NO
port char(5) NO
socket text NO NULL
username char(64) NO
password char(64) NO
ssl_ca text YES NULL
ssl_capath text YES NULL
ssl_cert text YES NULL
ssl_cipher char(64) YES NULL
ssl_key text YES NULL
ssl_verify_server_cert tinyint(4) NO 0
default_file text YES NULL
default_group char(64) YES NULL
dsn char(64) YES NULL
filedsn text YES NULL
driver char(64) YES NULL

1.1.1.2.9.4 Sys Schema


MariaDB starting with 10.6.0
The sys_schema is a collection of views, functions and procedures to help administrators get insight into database
usage.

This article is currently incomplete.

519/3812
Sys Schema sys_config Table
1 Configuration options for the Sys Schema.

Sys Schema Stored Functions


Stored functions available in the Sys Schema.

Sys Schema Stored Procedures


Stored procedures available in the Sys Schema.

1.1.1.2.9.4.1 Sys Schema sys_config Table


MariaDB starting with 10.6.0
The Sys Schema sys_config table was added in MariaDB 10.6.0.

The sys_config table holds configuration options for the Sys Schema.
This is a persistent table (using the InnoDB storage engine), with the configuration persisting across upgrades (new
options are added with INSERT IGNORE).
The table also has two related triggers, which maintain the user that INSERTs or UPDATEs the configuration -
sys_config_insert_set_user and sys_config_update_set_user respectively.
Its structure is as follows:

+----------+--------------+------+-----+-------------------+-----------------------------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+-------------------+-----------------------------+
| variable | varchar(128) | NO | PRI | NULL | |
| value | varchar(128) | YES | | NULL | |
| set_time | timestamp | NO | | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
| set_by | varchar(128) | YES | | NULL | |
+----------+--------------+------+-----+-------------------+-----------------------------+

Note, when functions check for configuration options, they first check whether a similar named user variable exists with
a value, and if this is not set then pull the configuration option from this table in to that named user variable. This is
done for performance reasons (to not continually SELECT from the table), however this comes with the side effect that
once inited, the values last with the session, somewhat like how session variables are inited from global variables. If the
values within this table are changed, they will not take effect until the user logs in again.

Options Included
Default
Variable Description
Value
Sets the size to truncate statements to, for the format_statement
statement_truncate_len 64
function.
The maximum number of rows to include for the views that does not
statement_performance_analyzer.limit 100 have a built-in limit (e.g. the 95th percentile view). If not set the limit
is 100.
Used together with the 'custom' view. If the value contains a space,
it is considered a query, otherwise it must be an existing view
statement_performance_analyzer.view NULL querying the
performance_schema.events_statements_summary_by_digest
table.
Specifies whether it is allowed to do table scan queries on
diagnostics.allow_i_s_tables OFF
information_schema.TABLES for the diagnostics procedure.
Set to 'ON' to include the raw data (e.g. the original output of
diagnostics.include_raw OFF
"SELECT * FROM sys.metrics") for the diagnostics procedure.
Sets the maximum output length for JSON object output by the
ps_thread_trx_info.max_length 65535
ps_thread_trx_info() function.

1.1.1.2.9.4.2 Sys Schema Stored Functions


The following stored functions are available in the Sys Schema.

520/3812
extract_schema_from_file_name
Returns the schema (database) name.

extract_table_from_file_name
Returns the table name from the provided path.

format_bytes
Returns a string consisting of a value and the units in a human-readable format.

format_path
Returns a modified path, replacing subpaths matching the values of various system variables.

format_statement
Returns a reduced length string.

format_time
Given a time in picoseconds, returns a human-readable time and unit.

list_add
Takes a list to be be modified and a value to be added to the list, returning the resulting value.

list_drop
Takes a list to be be modified and a value to be dropped, returning the resulting value.

ps_is_account_enabled
Whether or not Performance Schema instrumentation for a given account is enabled.

ps_is_consumer_enabled
Whether or not Performance Schema instrumentation for a given consumer is enabled.

ps_is_instrument_default_enabled
Whether or not a Performance Schema instrument is enabled by default.

ps_is_instrument_default_timed
Whether or not a Performance Schema instrument is timed by default.

ps_is_thread_instrumented
Whether or not instrumentation for a given connection_id is enabled.

ps_thread_account
Returns the account associated with the given thread_id.

ps_thread_id
Returns the thread_id associated with the given connection_id.

ps_thread_stack
Returns statements, stages, events within the Performance Schema for a given thread_id.

ps_thread_trx_info
Returns a JSON object with information about the thread specified by the given thread_id.

quote_identifier
Returns quoted, properly escaped identifier.

sys_get_config
Returns a configuration option value from the sys_config table.

version_major
Returns the MariaDB Server major release version.

version_minor
Returns the MariaDB Server minor release version.

version_patch
MariaDB Server patch release version.

1.1.1.2.9.4.2.1
521/3812
extract_schema_from_file_name
Syntax
sys.extract_schema_from_file_name(path)

Description
extract_schema_from_file_name is a stored function available with the Sys Schema.
Given a file path, it returns the schema (database) name. The file name is assumed to be within the schema directory,
and therefore the function will not return the expected result with partitions, or when tables are defined using the
DATA_DIRECTORY table option.
The function does not examine anything on disk. The return value, a VARCHAR(64), is determined solely from the
provided path.

Examples
SELECT sys.extract_schema_from_file_name('/usr/local/mysql/data/db/t1.ibd');
+----------------------------------------------------------------------+
| sys.extract_schema_from_file_name('/usr/local/mysql/data/db/t1.ibd') |
+----------------------------------------------------------------------+
| db |
+----------------------------------------------------------------------+

See also
extract_table_from_file_name()

1.1.1.2.9.4.2.2 extract_table_from_file_name
Syntax
sys.extract_table_from_file_name(path)

Description
extract_table_from_file_name is a stored function available with the Sys Schema.
Given a file path, it returns the table name.
The function does not examine anything on disk. The return value, a VARCHAR(64), is determined solely from the
provided path.

Examples
SELECT sys.extract_table_from_file_name('/usr/local/mysql/data/db/t1.ibd');
+---------------------------------------------------------------------+
| sys.extract_table_from_file_name('/usr/local/mysql/data/db/t1.ibd') |
+---------------------------------------------------------------------+
| t1 |
+---------------------------------------------------------------------+

See also
extract_schema_from_file_name()

1.1.1.2.9.4.2.3 format_bytes
Syntax
522/3812
sys.format_bytes(double)

Description
format_bytes is a stored function available with the Sys Schema.

Given a byte count, returns a string consisting of a value and the units in a human-readable format. The units will be in
bytes, KiB (kibibytes), MiB (mebibytes), GiB (gibibytes), TiB (tebibytes), or PiB (pebibytes).
The binary prefixes (kibi, mebi, gibi, tebi and pebi) were created in December 1998 by the International Electrotechnical
Commission to avoid possible ambiguity, as the widely-used prefixes kilo, mega, giga, tera and peta can be used to
refer to both the power-of-10 decimal system multipliers and the power-of-two binary system multipliers.

Examples
SELECT sys.format_bytes(1000),sys.format_bytes(1024);
+------------------------+------------------------+
| sys.format_bytes(1000) | sys.format_bytes(1024) |
+------------------------+------------------------+
| 1000 bytes | 1.00 KiB |
+------------------------+------------------------+

SELECT sys.format_bytes(1000000),sys.format_bytes(1048576);
+---------------------------+---------------------------+
| sys.format_bytes(1000000) | sys.format_bytes(1048576) |
+---------------------------+---------------------------+
| 976.56 KiB | 1.00 MiB |
+---------------------------+---------------------------+

SELECT sys.format_bytes(1000000000),sys.format_bytes(1073741874);
+------------------------------+------------------------------+
| sys.format_bytes(1000000000) | sys.format_bytes(1073741874) |
+------------------------------+------------------------------+
| 953.67 MiB | 1.00 GiB |
+------------------------------+------------------------------+

SELECT sys.format_bytes(1000000000000),sys.format_bytes(1099511627776);
+---------------------------------+---------------------------------+
| sys.format_bytes(1000000000000) | sys.format_bytes(1099511627776) |
+---------------------------------+---------------------------------+
| 931.32 GiB | 1.00 TiB |
+---------------------------------+---------------------------------+

SELECT sys.format_bytes(1000000000000000),sys.format_bytes(1125899906842624);
+------------------------------------+------------------------------------+
| sys.format_bytes(1000000000000000) | sys.format_bytes(1125899906842624) |
+------------------------------------+------------------------------------+
| 909.49 TiB | 1.00 PiB |
+------------------------------------+------------------------------------+

1.1.1.2.9.4.2.4 format_path
Syntax
sys.format_path(path)

Description
format_path is a stored function available with the Sys Schema that, given a path, returns a modified path after
replacing subpaths matching the values of various system variables with the variable name.
The system variables that are matched are, in order:
datadir
tmpdir
slave_load_tmpdir
innodb_data_home_dir
innodb_log_group_home_dir
innodb_undo_directory
basedir
523/3812
Examples
SELECT @@tmpdir;
+------------------------------------+
| @@tmpdir |
+------------------------------------+
| /home/ian/sandboxes/msb_10_8_2/tmp |
+------------------------------------+

SELECT sys.format_path('/home/ian/sandboxes/msb_10_8_2/tmp/testdb.ibd');
+------------------------------------------------------------------+
| sys.format_path('/home/ian/sandboxes/msb_10_8_2/tmp/testdb.ibd') |
+------------------------------------------------------------------+
| @@tmpdir/testdb.ibd |
+------------------------------------------------------------------+

1.1.1.2.9.4.2.5 format_statement
Syntax
sys.format_statement(statement)

Description
Returns a reduced length string. The length is specified by the statement_truncate_len configuration option (default 64),
and the removed part of the string (if any) is replaced with an ellipsis (three dots).
The function is intended for use in formatting lengthy SQL statements to a fixed length.

Examples
Default truncation length 64:

SELECT sys.format_statement(
'SELECT field1, field2, field3, field4, field5, field6 FROM table1'
) AS formatted_statement;
+-------------------------------------------------------------------+
| formatted_statement |
+-------------------------------------------------------------------+
| SELECT field1, field2, field3, ... d4, field5, field6 FROM table1 |
+-------------------------------------------------------------------+

Reducing the truncation length to 48:

SET @sys.statement_truncate_len = 48;

SELECT sys.format_statement(
'SELECT field1, field2, field3, field4, field5, field6 FROM table1'
) AS formatted_statement;
+---------------------------------------------------+
| formatted_statement |
+---------------------------------------------------+
| SELECT field1, field2, ... d5, field6 FROM table1 |
+---------------------------------------------------+

1.1.1.2.9.4.2.6 format_time
Syntax
sys.format_time(picoseconds)

Description
format_time is a stored function available with the Sys Schema. Given a time in picoseconds, returns a human-
524/3812
readable time value and unit indicator. Unit can be:
ps - picoseconds
ns - nanoseconds
us - microseconds
ms - milliseconds
s - seconds
m - minutes
h - hours
d - days
w - weeks

Examples
SELECT sys.format_time(4321) AS ns,
sys.format_time(43211234) AS us,
sys.format_time(432112344321) AS ms,
sys.format_time(43211234432123) AS s,
sys.format_time(432112344321234) AS m,
sys.format_time(4321123443212345) AS h,
sys.format_time(432112344321234545) AS d,
sys.format_time(43211234432123444543) AS w;
+---------+----------+-----------+---------+--------+--------+--------+---------+
| ns | us | ms | s | m | h | d | w |
+---------+----------+-----------+---------+--------+--------+--------+---------+
| 4.32 ns | 43.21 us | 432.11 ms | 43.21 s | 7.20 m | 1.20 h | 5.00 d | 71.45 w |
+---------+----------+-----------+---------+--------+--------+--------+---------+

1.1.1.2.9.4.2.7 list_add
Syntax
sys.list_add(list,value)

Description
list_add is a stored function available with the Sys Schema.

It takes a list to be be modified and a value to be added to the list, returning the resulting value. This can be used, for
example, to add a value to a system variable taking a comma-delimited list of options, such as sql_mode.
The related function list_drop can be used to drop a value from a list.

Examples
SELECT @@sql_mode;
+-----------------------------------------------------------------------+
| @@sql_mode |
+-----------------------------------------------------------------------+
| STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,
NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+-----------------------------------------------------------------------+

SET @@sql_mode = sys.list_add(@@sql_mode, 'NO_ZERO_DATE');

SELECT @@sql_mode;
+-----------------------------------------------------------------------+
| @@sql_mode |
+-----------------------------------------------------------------------+
| STRICT_TRANS_TABLES,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,
NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+-----------------------------------------------------------------------+

See Also
list_drop

525/3812
1.1.1.2.9.4.2.8 list_drop
Syntax
sys.list_drop(list,value)

Description
list_drop is a stored function available with the Sys Schema.

It takes a list to be be modified and a value to be dropped from the list, returning the resulting value. This can be used,
for example, to remove a value from a system variable taking a comma-delimited list of options, such as sql_mode.
The related function list_add can be used to add a value to a list.

Examples
SELECT @@sql_mode;
+-----------------------------------------------------------------------+
| @@sql_mode |
+-----------------------------------------------------------------------+
| STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,
NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+-----------------------------------------------------------------------+

SET @@sql_mode = sys.list_drop(@@sql_mode, 'NO_ENGINE_SUBSTITUTION');

SELECT @@sql_mode;
+-----------------------------------------------------------------------+
| @@sql_mode |
+-----------------------------------------------------------------------+
| STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,
NO_AUTO_CREATE_USER |
+-----------------------------------------------------------------------+

See Also
list_add

1.1.1.2.9.4.2.9 ps_is_account_enabled
Syntax
sys.ps_is_account_enabled(host,user)

Description
ps_is_account_enabled is a stored function available with the Sys Schema.
It takes host and user arguments, and returns an ENUM('YES','NO') depending on whether Performance Schema
instrumentation for the given account is enabled.

Examples
SELECT sys.ps_is_account_enabled('localhost', 'root');
+------------------------------------------------+
| sys.ps_is_account_enabled('localhost', 'root') |
+------------------------------------------------+
| YES |
+------------------------------------------------+

1.1.1.2.9.4.2.10 ps_is_consumer_enabled
526/3812
Syntax
sys.ps_is_consumer_enabled(consumer)

Description
ps_is_consumer_enabled is a stored function available with the Sys Schema.
It returns an ENUM('YES','NO') depending on whether Performance Schema instrumentation for the given consumer is
enabled, and NULL if not given a valid consumer name.

Examples
SELECT sys.ps_is_consumer_enabled('global_instrumentation');
+------------------------------------------------------+
| sys.ps_is_consumer_enabled('global_instrumentation') |
+------------------------------------------------------+
| YES |
+------------------------------------------------------+

SELECT sys.ps_is_consumer_enabled('events_stages_current');
+-----------------------------------------------------+
| sys.ps_is_consumer_enabled('events_stages_current') |
+-----------------------------------------------------+
| NO |
+-----------------------------------------------------+

SELECT sys.ps_is_consumer_enabled('nonexistent_consumer');
+----------------------------------------------------+
| sys.ps_is_consumer_enabled('nonexistent_consumer') |
+----------------------------------------------------+
| NULL |
+----------------------------------------------------+

See Also
Performance Schema setup_consumers Table

1.1.1.2.9.4.2.11
ps_is_instrument_default_enabled
Syntax
sys.ps_is_instrument_default_enabled(instrument)

Description
ps_is_instrument_default_enabled is a stored function available with the Sys Schema.
It returns YES if the given Performance Schema instrument is enabled by default, and NO if it is not, does not exist, or
is a NULL value.

Examples

527/3812
SELECT sys.ps_is_instrument_default_enabled('statement/sql/select');
+--------------------------------------------------------------+
| sys.ps_is_instrument_default_enabled('statement/sql/select') |
+--------------------------------------------------------------+
| YES |
+--------------------------------------------------------------+

SELECT sys.ps_is_instrument_default_enabled('memory/sql/udf_mem');
+------------------------------------------------------------+
| sys.ps_is_instrument_default_enabled('memory/sql/udf_mem') |
+------------------------------------------------------------+
| NO |
+------------------------------------------------------------+

SELECT sys.ps_is_instrument_default_enabled('memory/sql/nonexistent');
+----------------------------------------------------------------+
| sys.ps_is_instrument_default_enabled('memory/sql/nonexistent') |
+----------------------------------------------------------------+
| NO |
+----------------------------------------------------------------+

SELECT sys.ps_is_instrument_default_enabled(NULL);
+--------------------------------------------+
| sys.ps_is_instrument_default_enabled(NULL) |
+--------------------------------------------+
| NO |
+--------------------------------------------+

1.1.1.2.9.4.2.12
ps_is_instrument_default_timed
Syntax
sys.ps_is_instrument_default_timed(instrument)

Description
ps_is_instrument_default_timed is a stored function available with the Sys Schema.

It returns YES if the given Performance Schema instrument is timed by default, and NO if it is not, does not exist, or is a
NULL value.

Examples

528/3812
SELECT sys.ps_is_instrument_default_timed('statement/sql/select');
+------------------------------------------------------------+
| sys.ps_is_instrument_default_timed('statement/sql/select') |
+------------------------------------------------------------+
| YES |
+------------------------------------------------------------+

SELECT sys.ps_is_instrument_default_timed('memory/sql/udf_mem');
+----------------------------------------------------------+
| sys.ps_is_instrument_default_timed('memory/sql/udf_mem') |
+----------------------------------------------------------+
| NO |
+----------------------------------------------------------+

SELECT sys.ps_is_instrument_default_timed('memory/sql/nonexistent');
+-------------------------------------------------------------+
| sys.ps_is_instrument_default_timed('memory/sql/udf_memsds') |
+-------------------------------------------------------------+
| NO |
+-------------------------------------------------------------+

SELECT sys.ps_is_instrument_default_timed(NULL);
+------------------------------------------+
| sys.ps_is_instrument_default_timed(NULL) |
+------------------------------------------+
| NO |
+------------------------------------------+

1.1.1.2.9.4.2.13 ps_is_thread_instrumented
Syntax
sys.ps_is_thread_instrumented(connection_id)

Description
ps_is_thread_instrumented is a stored function available with the Sys Schema that returns whether or not
Performance Schema instrumentation for the given connection_id is enabled.
YES - instrumentation is enabled
NO - instrumentation is not enabled
UNKNOWN - the connection ID is unknown
NULL - NULL value

Examples
SELECT sys.ps_is_thread_instrumented(CONNECTION_ID());
+------------------------------------------------+
| sys.ps_is_thread_instrumented(CONNECTION_ID()) |
+------------------------------------------------+
| YES |
+------------------------------------------------+

SELECT sys.ps_is_thread_instrumented(2042);
+-------------------------------------+
| sys.ps_is_thread_instrumented(2042) |
+-------------------------------------+
| UNKNOWN |
+-------------------------------------+

SELECT sys.ps_is_thread_instrumented(NULL);
+-------------------------------------+
| sys.ps_is_thread_instrumented(NULL) |
+-------------------------------------+
| NULL |
+-------------------------------------+

1.1.1.2.9.4.2.14 ps_thread_account
529/3812
Syntax
sys.ps_thread_account(thread_id)

Description
ps_thread_account is a stored function available with the Sys Schema that returns the account
(username@hostname) associated with the given thread_id.
Returns NULL if the thread_id is not found.

Examples
SELECT sys.ps_thread_account(sys.ps_thread_id(CONNECTION_ID()));
+----------------------------------------------------------+
| sys.ps_thread_account(sys.ps_thread_id(CONNECTION_ID())) |
+----------------------------------------------------------+
| msandbox@localhost |
+----------------------------------------------------------+

SELECT sys.ps_thread_account(sys.ps_thread_id(2042));
+-----------------------------------------------+
| sys.ps_thread_account(sys.ps_thread_id(2042)) |
+-----------------------------------------------+
| NULL |
+-----------------------------------------------+

SELECT sys.ps_thread_account(sys.ps_thread_id(NULL));
+-----------------------------------------------+
| sys.ps_thread_account(sys.ps_thread_id(NULL)) |
+-----------------------------------------------+
| msandbox@localhost |
+-----------------------------------------------+

1.1.1.2.9.4.2.15 ps_thread_id
Syntax
sys.ps_thread_id(connection_id)

Description
ps_thread_id is a stored function available with the Sys Schema that returns the thread_id associated with the given
connection_id. If the connection_id is NULL, returns the thread_id for the current connection.

Examples

530/3812
SELECT * FROM performance_schema.threads\G
*************************** 13. row ***************************
THREAD_ID: 13
NAME: thread/sql/one_connection
TYPE: FOREGROUND
PROCESSLIST_ID: 3
PROCESSLIST_USER: msandbox
PROCESSLIST_HOST: localhost
PROCESSLIST_DB: test
PROCESSLIST_COMMAND: Query
PROCESSLIST_TIME: 0
PROCESSLIST_STATE: Sending data
PROCESSLIST_INFO: SELECT * FROM performance_schema.threads
PARENT_THREAD_ID: 1
ROLE: NULL
INSTRUMENTED: YES
HISTORY: YES
CONNECTION_TYPE: Socket
THREAD_OS_ID: 24379

SELECT sys.ps_thread_id(3);
+---------------------+
| sys.ps_thread_id(3) |
+---------------------+
| 13 |
+---------------------+

SELECT sys.ps_thread_id(NULL);
+------------------------+
| sys.ps_thread_id(NULL) |
+------------------------+
| 13 |
+------------------------+

1.1.1.2.9.4.2.16 ps_thread_stack
Syntax
sys.ps_thread_stack(thread_id, verbose)

Description
ps_thread_stack is a stored function available with the Sys Schema that, for a given thread_id, returns all statements,
stages, and events within the Performance Schema, as a JSON formatted stack.
The boolean verbose argument specifies whether or not to include file:lineno information in the events.

Examples
SELECT sys.ps_thread_stack(13, FALSE) AS thread_stack\G
*************************** 1. row ***************************
thread_stack: {"rankdir": "LR","nodesep": "0.10",
"stack_created": "2022-03-28 16:01:06",
"mysql_version": "10.8.2-MariaDB",
"mysql_user": "msandbox@localhost",
"events": []}

1.1.1.2.9.4.2.17 ps_thread_trx_info
Syntax
sys.ps_thread_trx_info(thread_id)

531/3812
Contents
1. Syntax
2. Description
3. Examples
4. See Also

Description
ps_thread_trx_info is a stored function available with the Sys Schema.

It returns a JSON object with information about the thread specified by the given thread_id. This information includes:
the current transaction
executed statements (derived from the Performance Schema events_transactions_current Table and the
Performance Schema events_statements_history Table (full data will only returned if the consumers for those
tables are enabled).
The maximum length of the returned JSON object is determined by the value of the ps_thread_trx_info.max_length
sys_config option (by default 65535). If the returned value exceeds this length, a JSON object error is returned.

Examples

See Also
Sys Schema sys_config Table

1.1.1.2.9.4.2.18 quote_identifier
Syntax
sys.quote_identifier(str)

Description
quote_identifier is a stored function available with the Sys Schema.
It quotes a string to produce a result that can be used as an identifier in an SQL statement. The string is returned
enclosed by backticks (" ` ") and with each instance of backtick (" ` ") doubled. If the argument is NULL , the return value
is the word " NULL " without enclosing backticks.

Examples
SELECT sys.quote_identifier("Identifier with spaces");
+------------------------------------------------+
| sys.quote_identifier("Identifier with spaces") |
+------------------------------------------------+
| `Identifier with spaces` |
+------------------------------------------------+

SELECT sys.quote_identifier("Identifier` containing `backticks");


+-----------------------------------------------------------+
| sys.quote_identifier("Identifier` containing `backticks") |
+-----------------------------------------------------------+
| `Identifier`` containing ``backticks` |
+-----------------------------------------------------------+

1.1.1.2.9.4.2.19 sys_get_config
Syntax
sys.sys_get_config(name,default)

532/3812
Contents
1. Syntax
2. Description
3. Examples
4. See Also

Description
sys_get_config is a stored function available with the Sys Schema.
The function returns a configuration option value from the sys_config table. It takes two arguments; name, a
configuration option name, and default, which is returned if the given option does not exist in the table.
Both arguments are VARCHAR(128) and can be NULL. Returns NULL if name is NULL, or if the given option is not
found and default is NULL.

Examples
SELECT sys.sys_get_config('ps_thread_trx_info.max_length',NULL);
+----------------------------------------------------------+
| sys.sys_get_config('ps_thread_trx_info.max_length',NULL) |
+----------------------------------------------------------+
| 65535 |
+----------------------------------------------------------+

See Also
Sys Schema sys_config Table

1.1.1.2.9.4.2.20 version_major
Syntax
sys.version_major()

Description
version_major is a stored function available with the Sys Schema.

It returns the MariaDB Server major release version.

Examples
SELECT VERSION(),
sys.version_major() AS major,
sys.version_minor() AS minor,
sys.version_patch() AS patch;
+----------------+-------+-------+-------+
| VERSION() | major | minor | patch |
+----------------+-------+-------+-------+
| 10.8.2-MariaDB | 10 | 8 | 2 |
+----------------+-------+-------+-------+

See Also
version_minor
version_patch

1.1.1.2.9.4.2.21 version_minor
Syntax
533/3812
sys.version_minor()

Description
version_minor is a stored function available with the Sys Schema.
It returns the MariaDB Server minor release version.

Examples
SELECT VERSION(),
sys.version_major() AS major,
sys.version_minor() AS minor,
sys.version_patch() AS patch;
+----------------+-------+-------+-------+
| VERSION() | major | minor | patch |
+----------------+-------+-------+-------+
| 10.8.2-MariaDB | 10 | 8 | 2 |
+----------------+-------+-------+-------+

See Also
version_major
version_patch

1.1.1.2.9.4.2.22 version_patch
Syntax
sys.version_patch()

Description
version_patch is a stored function available with the Sys Schema.

It returns the MariaDB Server patch release version.

Examples
SELECT VERSION(),
sys.version_major() AS major,
sys.version_minor() AS minor,
sys.version_patch() AS patch;
+----------------+-------+-------+-------+
| VERSION() | major | minor | patch |
+----------------+-------+-------+-------+
| 10.8.2-MariaDB | 10 | 8 | 2 |
+----------------+-------+-------+-------+

See Also
version_major
version_minor

1.1.1.2.9.4.3 Sys Schema Stored Procedures


This article is currently incomplete.

The following stored procedures are available in the Sys Schema.


create_synonym_db
Takes a source db and create a synonym db with views that point to all of t...
534/3812
statement_performance_analyzer
Returns a report on running statements.

table_exists
Given a database and table name, returns the table type.

1.1.1.2.9.4.3.1 create_synonym_db
Syntax
create_synonym_db(db_name,synonym)

# db_name (VARCHAR(64))
# synonym (VARCHAR(64))

Description
create_synonym_db is a stored procedure available with the Sys Schema.

Takes a source database name db_name and synonym name and creates a synonym database with views that point to
all of the tables within the source database. Useful for example for creating a synonym for the performance_schema or
information_schema databases.
Returns an error if the source database doesn't exist, or the synonym already exists.

Example
SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| test |
+--------------------+

CALL sys.create_synonym_db('performance_schema', 'perf');


+-----------------------------------------+
| summary |
+-----------------------------------------+
| Created 81 views in the `perf` database |
+-----------------------------------------+

SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| perf |
| performance_schema |
| sys |
| test |
+--------------------+

SHOW FULL TABLES FROM perf;


+------------------------------------------------------+------------+
| Tables_in_perf | Table_type |
+------------------------------------------------------+------------+
| accounts | VIEW |
| cond_instances | VIEW |
| events_stages_current | VIEW |
| events_stages_history | VIEW |
| events_stages_history_long | VIEW |
...

535/3812
1.1.1.2.9.4.3.2
statement_performance_analyzer
Syntax
statement_performance_analyzer(in_action,in_table, in_views)

# in_action ENUM('snapshot', 'overall', 'delta', 'create_tmp',


'create_table', 'save', 'cleanup')
# in_table VARCHAR(129)
# in_views SET ('with_runtimes_in_95th_percentile', 'analysis',
'with_errors_or_warnings', 'with_full_table_scans',
'with_sorting', 'with_temp_tables', 'custom')

Description
statement_performance_analyzer is a stored procedure available with the Sys Schema which returns a report on
running statements.
The following options from the sys_config table impact the output:
statement_performance_analyzer.limit - maximum number of rows (default 100) returned for views that have no
built-in limit.
statement_performance_analyzer.view - custom query/view to be used (default NULL). If the
statement_performance_analyzer.limit configuration option is greater than 0, there can't be a LIMIT clause in the
query/view definition
If the debug option is set (default OFF), the procedure will also produce debugging output.

1.1.1.2.9.4.3.3 table_exists
Syntax
table_exists(in_db_name,in_table_name, out_table_type)

# in_db_name VARCHAR(64)
# in_table_name VARCHAR(64)
# out_table_type ENUM('', 'BASE TABLE', 'VIEW', 'TEMPORARY')

Description
table_exists is a stored procedure available with the Sys Schema.
Given a database in_db_name and table name in_table_name, returns the table type in the OUT parameter
out_table_type. The return value is an ENUM field containing one of:
'' - the table does not exist
'BASE TABLE' - a regular table
'VIEW' - a view
'TEMPORARY' - a temporary table

Examples
CALL sys.table_exists('mysql', 'time_zone', @table_type); SELECT @table_type;
+-------------+
| @table_type |
+-------------+
| BASE TABLE |
+-------------+

CALL sys.table_exists('mysql', 'user', @table_type); SELECT @table_type;


+-------------+
| @table_type |
+-------------+
| VIEW |
+-------------+

536/3812
1.1.1.2.9.5 mariadb_schema
Contents
1. History

mariadb_schema is a data type qualifier that allows one to create MariaDB native date types in an SQL_MODE that has
conflicting data type translations.
mariadb_schema was introduced in MariaDB 10.3.24, MariaDB 10.4.14 and MariaDB 10.5.5.
For example, in SQL_MODE=ORACLE, if one creates a table with the DATE type, it will actually create a DATETIME
column to match what an Oracle user is expecting. To be able to create a MariaDB DATE in Oracle mode one would
have to use mariadb_schema :

CREATE TABLE t1 (d mariadb_schema.DATE);

mariadb_schema is also shown if one creates a table with DATE in MariaDB native mode and then does a SHOW
CREATE TABLE in ORACLE mode:

SET sql_mode=DEFAULT;
CREATE OR REPLACE TABLE t1 (
d DATE
);
SET SQL_mode=ORACLE;
SHOW CREATE TABLE t1;
+-------+--------------------------------------------------------------+
| Table | Create Table |
+-------+--------------------------------------------------------------+
| t1 | CREATE TABLE "t1" (
"d" mariadb_schema.date DEFAULT NULL
) |
+-------+--------------------------------------------------------------+

When the server sees the mariadb_schema qualifier, it disables sql_mode-specific data type translation and interprets
the data type literally, so for example mariadb_schema.DATE is interpreted as the traditional MariaDB DATE data type,
no matter what the current sql_mode is.
The mariadb_schema prefix is displayed only when the data type name would be ambiguous otherwise. The prefix is
displayed together with MariaDB DATE when SHOW CREATE TABLE is executed in SQL_MODE=ORACLE. The prefix
is not displayed when SHOW CREATE TABLE is executed in SQL_MODE=DEFAULT, or when a non-ambiguous data
type is displayed.
Note, the mariadb_schema prefix can be used with any data type, including non-ambiguous ones:

CREATE OR REPLACE TABLE t1 (a mariadb_schema.INT);


SHOW CREATE TABLE t1;
+-------+--------------------------------------------------+
| Table | Create Table |
+-------+--------------------------------------------------+
| t1 | CREATE TABLE "t1" (
"a" int(11) DEFAULT NULL
) |
+-------+--------------------------------------------------+

Currently the mariadb_schema prefix is only used in the following case:


For a MariaDB native DATE type when running SHOW CREATE TABLE in Oracle mode.

History
When running with SQL_MODE=ORACLE, MariaDB server translates the data type DATE to DATETIME , for better
Oracle compatibility:

537/3812
SET SQL_mode=ORACLE;
CREATE OR REPLACE TABLE t1 (
d DATE
);
SHOW CREATE TABLE t1;
+-------+---------------------------------------------------+
| Table | Create Table |
+-------+---------------------------------------------------+
| t1 | CREATE TABLE "t1" (
"d" datetime DEFAULT NULL
) |
+-------+---------------------------------------------------+

Notice, DATE was translated to DATETIME .


This translation may cause some ambiguity. Suppose a user creates a table with a column of the traditional MariaDB
DATE data type using the default sql_mode, but then switches to SQL_MODE=ORACLE and runs a SHOW CREATE
TABLE statement:

SET sql_mode=DEFAULT;
CREATE OR REPLACE TABLE t1 (
d DATE
);
SET SQL_mode=ORACLE;
SHOW CREATE TABLE t1;

Before mariadb_schema was introduced, the above script displayed:

CREATE TABLE "t1" (


"d" date DEFAULT NULL
);

which had two problems:


It was confusing for the reader: its not clear if it is the traditional MariaDB DATE , or is it Oracle-alike date (which is
actually DATETIME );
It broke replication and caused data type mismatch on the master and on the slave (see MDEV-19632 ).
To address this problem, starting from the mentioned versions, MariaDB uses the idea of qualified data types:

SET sql_mode=DEFAULT;
CREATE OR REPLACE TABLE t1 (
d DATE
);
SET SQL_mode=ORACLE;
SHOW CREATE TABLE t1;
+-------+--------------------------------------------------------------+
| Table | Create Table |
+-------+--------------------------------------------------------------+
| t1 | CREATE TABLE "t1" (
"d" mariadb_schema.date DEFAULT NULL
) |
+-------+--------------------------------------------------------------+

1.1.1.2.9.6 Writing Logs Into Tables


By default, all logs are disabled or written into files. The general query log and the slow query log can also be written to
special tables in the mysql database. During the startup, entries will always be written into files.
Note that EXPLAIN output will only be recorded if the slow query log is written to a file and not to a table.
To write logs into tables, the log_output server system variable is used. Allowed values are FILE , TABLE and NONE . It
is possible to specify multiple values, separated with commas, to write the logs into both tables and files. NONE disables
logging and has precedence over the other values.
So, to write logs into tables, one of the following settings can be used:

SET GLOBAL log_output = 'TABLE';


SET GLOBAL log_output = 'FILE,TABLE';

The general log will be written into the general_log table, and the slow query log will be written into the slow_log table.
Only a limited set of operations are supported for those special tables. For example, direct DML statements (like
INSERT ) on those tables will fail with an error similar to the following:

538/3812
ERROR 1556 (HY000): You can't use locks with log tables.

To flush data to the tables, use FLUSH TABLES instead of FLUSH LOGS.
To empty the contents of the log tables, TRUNCATE TABLE can be used.
The log tables use the CSV storage engine by default. This allows an external program to read the files if needed:
normal CSV files are stored in the mysql subdirectory, in the data dir. However that engine is slow because it does not
support indexes, so you can convert the tables to MyISAM (but not other storage engines). To do so, first temporarily
disable logging:

SET GLOBAL general_log = 'OFF';


ALTER TABLE mysql.general_log ENGINE = MyISAM;
ALTER TABLE mysql.slow_log ENGINE = MyISAM;
SET GLOBAL general_log = @old_log_state;

CHECK TABLE and CHECKSUM TABLE are supported.


CREATE TABLE is supported. ALTER TABLE, RENAME TABLE and DROP TABLE are supported when logging is
disabled, but log tables cannot be partitioned.
The contents of the log tables is not logged in the binary log thus cannot be replicated.

1.1.1.2.10 BINLOG
Syntax
BINLOG 'str'

Description
BINLOG is an internal-use statement. It is generated by the mariadb-binlog/mysqlbinlog program as the printable
representation of certain events in binary log files. The 'str' value is a base 64-encoded string the that server
decodes to determine the data change indicated by the corresponding event. This statement requires the SUPER
privilege (<= MariaDB 10.5.1) or theBINLOG REPLAY privilege (>= MariaDB 10.5.2).

See also
MariaDB replication

1.1.1.2.11 PURGE BINARY LOGS


Syntax
PURGE { BINARY | MASTER } LOGS
{ TO 'log_name' | BEFORE datetime_expr }

Description
The PURGE BINARY LOGS statement deletes all the binary log files listed in the log index file prior to the specified log file
name or date. BINARY and MASTER are synonyms. Deleted log files also are removed from the list recorded in the index
file, so that the given log file becomes the first in the list.
The datetime expression is in the format 'YYYY-MM-DD hh:mm:ss'.

If a replica is active but has yet to read from a binary log file you attempt to delete, the statement will fail with an
error. However, if the replica is not connected and has yet to read from a log file you delete, the file will be deleted,
but the replica will be unable to continue replicating once it connects again.

This statement has no effect if the server was not started with the --log-bin option to enable binary logging.
To list the binary log files on the server, use SHOW BINARY LOGS. To see which files they are reading, use SHOW
SLAVE STATUS (or SHOW REPLICA STATUS from MariaDB 10.5.1). You can only delete the files that are older than
the oldest file that is used by the slaves.

539/3812
To delete all binary log files, use RESET MASTER. To move to a new log file (for example if you want to remove the
current log file), use FLUSH LOGS before you execute PURGE LOGS .
If the expire_logs_days server system variable is not set to 0, the server automatically deletes binary log files after the
given number of days. From MariaDB 10.6, the binlog_expire_logs_seconds variable allows more precise control over
binlog deletion, and takes precedence if both are non-zero.
Requires the SUPER privilege or, from MariaDB 10.5.2, the BINLOG ADMIN privilege, to run.

Examples
PURGE BINARY LOGS TO 'mariadb-bin.000063';

PURGE BINARY LOGS BEFORE '2013-04-21';

PURGE BINARY LOGS BEFORE '2013-04-22 09:55:22';

See Also
Using and Maintaining the Binary Log
FLUSH LOGS.

1.1.1.2.12 CACHE INDEX


Syntax
CACHE INDEX
tbl_index_list [, tbl_index_list] ...
IN key_cache_name

tbl_index_list:
tbl_name [[INDEX|KEY] (index_name[, index_name] ...)]

Description
The CACHE INDEX statement assigns table indexes to a specific key cache. It is used only for MyISAM tables.
A default key cache exists and cannot be destroyed. To create more key caches, the key_buffer_size server system
variable.
The associations between tables indexes and key caches are lost on server restart. To recreate them automatically, it is
necessary to configure caches in a configuration file and include some CACHE INDEX (and optionally LOAD INDEX )
statements in the init file.

Examples
The following statement assigns indexes from the tables t1, t2, and t3 to the key cache named hot_cache:

CACHE INDEX t1, t2, t3 IN hot_cache;


+---------+--------------------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+---------+--------------------+----------+----------+
| test.t1 | assign_to_keycache | status | OK |
| test.t2 | assign_to_keycache | status | OK |
| test.t3 | assign_to_keycache | status | OK |
+---------+--------------------+----------+----------+

Implementation (for MyISAM)


Normally CACHE INDEX should not take a long time to execute. Internally it's implemented the following way:
Find the right key cache (under LOCK_global_system_variables)
Open the table with a TL_READ_NO_INSERT lock.
Flush the original key cache for the given file (under key cache lock)
Flush the new key cache for the given file (safety)
Move the file to the new key cache (under file share lock)
540/3812
The only possible long operations are getting the locks for the table and flushing the original key cache, if there were
many key blocks for the file in it.
We plan to also add CACHE INDEX for Aria tables if there is a need for this.

1.1.1.2.13 DESCRIBE
Syntax
{DESCRIBE | DESC} tbl_name [col_name | wild]

Contents
1. Syntax
2. Description
3. See Also

Description
DESCRIBE provides information about the columns in a table. It is a shortcut for SHOW COLUMNS FROM . These statements
also display information for views.
col_name can be a column name, or a string containing the SQL " % " and " _ " wildcard characters to obtain output only
for the columns with names matching the string. There is no need to enclose the string within quotes unless it contains
spaces or other special characters.

DESCRIBE city;
+------------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+----------+------+-----+---------+----------------+
| Id | int(11) | NO | PRI | NULL | auto_increment |
| Name | char(35) | YES | | NULL | |
| Country | char(3) | NO | UNI | | |
| District | char(20) | YES | MUL | | |
| Population | int(11) | YES | | NULL | |
+------------+----------+------+-----+---------+----------------+

The description for SHOW COLUMNS provides more information about the output columns