All pages
Powered by GitBook
1 of 21

Sys Schema Views

Explore sys_schema views in MariaDB Server. These views offer simplified, aggregated insights into server performance, I/O, and memory usage, making diagnostics and monitoring easier.

host_summary and x$host_summary Sys Schema Views

Sys Schema views are available from MariaDB 10.6.

Description

The host_summary and x$host_summary views contain host activity information, grouped by host. The host_summary view is intended to be easier for human reading, while the x$host_summary view provides the data in raw form, intended for tools that process the data.

They contain the following columns:

Column
Description

host

Host that the client connected from, or background for background threads (where the HOST column in the underlying Performance Schema table is NULL).

statements

Total number of statements for the host.

statement_latency

Total wait time of timed statements for the host.

statement_avg_latency

Average wait time per timed statement for the host.

table_scans

Total table scans for the host.

file_ios

Total file I/O events for the host.

file_io_latency

Total wait time of timed file I/O events for the host.

current_connections

Current connections for the host.

total_connections

Total connections for the host.

unique_users

Number of distinct users for the host.

current_memory

Current allocated memory for the host.

total_memory_allocated

Total allocated memory for the host.

Example

SELECT * FROM sys.host_summary\G
*************************** 1. row ***************************
                  host: localhost
            statements: 59
     statement_latency: 148.11 ms
 statement_avg_latency: 2.51 ms
           table_scans: 11
              file_ios: 2065
       file_io_latency: 79.57 ms
   current_connections: 1
     total_connections: 3
          unique_users: 1
        current_memory: -2672 bytes
total_memory_allocated: 0 bytes

SELECT * FROM sys.x$host_summary\G
*************************** 1. row ***************************
                  host: localhost
            statements: 98
     statement_latency: 160926285000
 statement_avg_latency: 1642104948.9796
           table_scans: 12
              file_ios: 2071
       file_io_latency: 79742533755
   current_connections: 1
     total_connections: 3
          unique_users: 1
        current_memory: -2672
total_memory_allocated: 0

This page is licensed: CC BY-SA / Gnu FDL

host_summary_by_file_io and x$host_summary_by_file_io Sys Schema Views

Sys Schema views are available from MariaDB 10.6.

Description

The host_summary_by_file_io and x$host_summary_by_file_io views summarize file I/O, grouped by host. Rows are sorted by descending total file I/O latency by default.

The host_summary_by_file_io view is intended to be easier for human reading, while the andx$host_summary_by_file_ioview provides the data in raw form, intended for tools that process the data.

They contain the following columns:

Column
Description

host

Host that the client connected from, or background for background threads (where the HOST column in the underlying Performance Schema table is NULL).

ios

Total file I/O events for the host.

ios_latency

Total wait time of timed file I/O events for the host.

Example

SELECT * FROM sys.host_summary_by_file_io\G
*************************** 1. row ***************************
      host: localhost
       ios: 6526
io_latency: 490.28 ms
*************************** 2. row ***************************
      host: background
       ios: 457
io_latency: 151.39 ms

SELECT * FROM sys.x$host_summary_by_file_io\G
*************************** 1. row ***************************
      host: localhost
       ios: 6532
io_latency: 490447878974
*************************** 2. row ***************************
      host: background
       ios: 457
io_latency: 151388125856

This page is licensed: CC BY-SA / Gnu FDL

host_summary_by_file_io_type and x$host_summary_by_file_io_type Sys Schema Views

Sys Schema views are available from MariaDB 10.6.

Description

The host_summary_by_file_io_type and x$host_summary_by_file_io_type views summarize file I/O, grouped by host and event type. Rows are sorted by host and descending total I/O latency by default. The host_summary_by_file_io_type view is intended to be easier for human reading, while the x$host_summary_by_file_io_type view provides the data in raw form, intended for tools that process the data.

They contain the following columns:

Column
Description

host

Host that the client connected from, or background for background threads (where the HOST column in the underlying Performance Schema table is NULL).

event_name

File I/O event name.

total

Total number of occurrences of the file I/O event for the host.

total_latency

Total wait time of timed occurrences of the file I/O event for the host.

max_latency

Maximum single wait time of timed occurrences of the file I/O event for the host.

Example

SELECT * FROM sys.host_summary_by_file_io_type;
+------------+----------------------------------------------+-------+---------------+-------------+
| host       | event_name                                   | total | total_latency | max_latency |
+------------+----------------------------------------------+-------+---------------+-------------+
| background | wait/io/file/innodb/innodb_log_file          |    45 | 109.80 ms     | 26.48 ms    |
| background | wait/io/file/innodb/innodb_data_file         |   195 | 29.47 ms      | 1.23 ms     |
| background | wait/io/file/sql/global_ddl_log              |     4 | 4.45 ms       | 4.33 ms     |
...
| localhost  | wait/io/file/csv/data                        |     4 | 25.98 us      | 9.60 us     |
| localhost  | wait/io/file/partition/ha_partition::parfile |     1 | 14.19 us      | 14.19 us    |
| localhost  | wait/io/file/myisam/kfile                    |     1 | 11.95 us      | 11.95 us    |
+------------+----------------------------------------------+-------+---------------+-------------+

SELECT * FROM sys.x$host_summary_by_file_io_type;
+------------+----------------------------------------------+-------+---------------+-------------+
| host       | event_name                                   | total | total_latency | max_latency |
+------------+----------------------------------------------+-------+---------------+-------------+
| background | wait/io/file/innodb/innodb_log_file          |    45 |  109804643160 | 26478157582 |
| background | wait/io/file/innodb/innodb_data_file         |   195 |   29469738630 |  1226986584 |
| background | wait/io/file/sql/global_ddl_log              |     4 |    4447263252 |  4327780456 |
| localhost  | wait/io/file/csv/data                        |     4 |      25978718 |     9603922 |
| localhost  | wait/io/file/partition/ha_partition::parfile |     1 |      14191190 |    14191190 |
| localhost  | wait/io/file/myisam/kfile                    |     1 |      11954300 |    11954300 |
+------------+----------------------------------------------+-------+---------------+-------------+

This page is licensed: CC BY-SA / Gnu FDL

host_summary_by_stages and x$host_summary_by_stages Sys Schema Views

Sys Schema views are available from MariaDB 10.6.

Description

The host_summary_by_stages and x$host_summary_by_stages views summarize statement stages, grouped by host. Rows are sorted by host and descending total latency by default. The host_summary_by_stages view is intended to be easier for human reading, while the x$host_summary_by_stages view provides the data in raw form, intended for tools that process the data.

They contain the following columns:

Column
Description

host

Host that the client connected from, or background for background threads (where the HOST column in the underlying Performance Schema table is NULL).

event_name

Stage event name.

total

Total number of occurrences of the file stage event for the host.

total_latency

Total wait time of timed occurrences of the stage event for the host.

avg_latency

Average wait time per timed occurrence of the stage event for the host.

Example

SELECT * FROM sys.host_summary_by_stages\G
*************************** 1. row ***************************
         host: background
   event_name: stage/innodb/buffer pool load
        total: 1
total_latency: 3.75 ms
  avg_latency: 3.75 ms

SELECT * FROM sys.x$host_summary_by_stages\G
*************************** 1. row ***************************
         host: background
   event_name: stage/innodb/buffer pool load
        total: 1
total_latency: 3747098000
  avg_latency: 3747098000

This page is licensed: CC BY-SA / Gnu FDL

host_summary_by_statement_type and x$host_summary_by_statement_type Sys Schema Views

Sys Schema views are available from MariaDB 10.6.

Description

The host_summary_by_statement_type and x$host_summary_by_statement_type views summarize information about executed statements, grouped by host and statement type. Rows are sorted by host and descending total latency by default.

The host_summary_by_statement_type view is intended to be easier for human reading, while the x$host_summary_by_statement_type view provides the data in raw form, intended for tools that process the data.

They contain the following columns:

Column
Description

host

Host that the client connected from, or background for background threads (where the HOST column in the underlying Performance Schema table is NULL).

statement

Final component of the statement event name, for example create_table or select.

total

Total number of statement occurrences for the host.

total_latency

Total wait time of timed statements of the statement event for the host.

max_latency

Maximum single wait time of timed occurrences of the statement event for the host.

lock_latency

Total time spent by timed occurrences of the statement event for the host waiting for locks.

rows_sent

Total number of rows returned by occurrences of the statement event for the host.

rows_examined

Total number of rows read from storage engines by occurrences of the statement event for the host.

rows_affected

Total number of rows affected by occurrences of the statement event for the host.

full_scans

Total number of full table scans by occurrences of the statement event for the host.

Example

SELECT * FROM sys.host_summary_by_statement_type\G
*************************** 1. row ***************************
         host: localhost
    statement: create_table
        total: 18
total_latency: 366.93 ms
  max_latency: 48.02 ms
 lock_latency: 3.16 ms
    rows_sent: 0
rows_examined: 0
rows_affected: 0
   full_scans: 0
*************************** 2. row ***************************
         host: localhost
    statement: select
        total: 27
total_latency: 339.16 ms
  max_latency: 64.51 ms
 lock_latency: 205.61 ms
    rows_sent: 750599937895926
rows_examined: 13925
rows_affected: 0
   full_scans: 21

...

SELECT * FROM sys.x$host_summary_by_statement_type\G
*************************** 1. row ***************************
         host: localhost
    statement: create_table
        total: 18
total_latency: 366927804000
  max_latency: 48023563000
 lock_latency: 3156000000
    rows_sent: 0
rows_examined: 0
rows_affected: 0
   full_scans: 0
*************************** 2. row ***************************
         host: localhost
    statement: select
        total: 28
total_latency: 343873182000
  max_latency: 64507216000
 lock_latency: 205984000000
    rows_sent: 750678474440767
rows_examined: 14370
rows_affected: 0
   full_scans: 22

This page is licensed: CC BY-SA / Gnu FDL

innodb_buffer_stats_by_schema and x$innodb_buffer_stats_by_schema Sys Schema Views

Sys Schema views are available from MariaDB 10.6.

Querying these views can have a noticeable performance impact on a production server.

Description

The innodb_buffer_stats_by_schema and x$innodb_buffer_stats_by_schema views summarize information from the Information Schema INNODB_BUFFER_PAGE table, grouped by schema. Rows are sorted by descending buffer size by default.

The innodb_buffer_stats_by_schema view is intended to be easier for human reading, while the x$innodb_buffer_stats_by_schema view provides the data in raw form, intended for tools that process the data.

They contain the following columns:

Column
Description

object_schema

Object schema name, or InnoDB System if the table belongs to the InnoDB storage engine.

allocated

Total number of bytes allocated for the schema.

data

Total number of data bytes allocated for the schema.

pages

Total number of pages allocated for the schema.

pages_hashed

Total number of hashed pages allocated for the schema.

pages_old

Total number of old pages allocated for the schema.

rows_cached

Total number of cached rows for the schema.

Example

SELECT * FROM sys.innodb_buffer_stats_by_schema\G
*************************** 1. row ***************************
object_schema: InnoDB System
    allocated: 160.00 KiB
         data: 6.21 KiB
        pages: 10
 pages_hashed: 10
    pages_old: 10
  rows_cached: 21
*************************** 2. row ***************************
object_schema: mysql
    allocated: 112.00 KiB
         data: 1.73 KiB
        pages: 7
 pages_hashed: 7
    pages_old: 7
  rows_cached: 5
*************************** 3. row ***************************
object_schema: test
    allocated: 64.00 KiB
         data: 0 bytes
        pages: 4
 pages_hashed: 4
    pages_old: 4
  rows_cached: 0

SELECT * FROM sys.x$innodb_buffer_stats_by_schema\G
*************************** 1. row ***************************
object_schema: InnoDB System
    allocated: 163840
         data: 6362
        pages: 10
 pages_hashed: 0
    pages_old: 0
  rows_cached: 21
*************************** 2. row ***************************
object_schema: mysql
    allocated: 114688
         data: 1775
        pages: 7
 pages_hashed: 0
    pages_old: 0
  rows_cached: 5
*************************** 3. row ***************************
object_schema: test
    allocated: 65536
         data: 0
        pages: 4
 pages_hashed: 0
    pages_old: 0
  rows_cached: 0

This page is licensed: CC BY-SA / Gnu FDL

innodb_buffer_stats_by_table and x$innodb_buffer_stats_by_table Sys Schema Views

Sys Schema views are available from MariaDB 10.6.

Querying these views can have a noticeable performance impact on a production server.

Description

The innodb_buffer_stats_by_table and x$innodb_buffer_stats_by_table views summarize information from the Information Schema INNODB_BUFFER_PAGE table, grouped by schema and table. Rows are sorted by descending buffer size by default.

The innodb_buffer_stats_by_table view is intended to be easier for human reading, while the x$innodb_buffer_stats_by_table view provides the data in raw form, intended for tools that process the data.

They contain the following columns:

Column
Description

object_schema

Object schema name, or InnoDB System if the table belongs to the InnoDB storage engine.

object_name

Table name.

allocated

Total number of bytes allocated for the table.

data

Number of data bytes allocated for the table.

pages

Total number of pages allocated for the table.

pages_hashed

Total number of hashed pages allocated for the table.

pages_old

Total number of old pages allocated for the table.

rows_cached

Total number of cached rows for the table.

Example

SELECT * FROM sys.innodb_buffer_stats_by_table\G
*************************** 1. row ***************************
object_schema: mysql
  object_name: transaction_registry
    allocated: 64.00 KiB
         data: 0 bytes
        pages: 4
 pages_hashed: 4
    pages_old: 4
  rows_cached: 0
*************************** 2. row ***************************
object_schema: InnoDB System
  object_name: SYS_FOREIGN
    allocated: 48.00 KiB
         data: 0 bytes
        pages: 3
 pages_hashed: 3
    pages_old: 3
  rows_cached: 0
*************************** 3. row ***************************
object_schema: InnoDB System
  object_name: SYS_TABLES
    allocated: 32.00 KiB
         data: 1.07 KiB
        pages: 2
 pages_hashed: 2
    pages_old: 2
  rows_cached: 10

...

 SELECT * FROM sys.x$innodb_buffer_stats_by_table\G
*************************** 1. row ***************************
object_schema: mysql
  object_name: transaction_registry
    allocated: 65536
         data: 0
        pages: 4
 pages_hashed: 0
    pages_old: 0
  rows_cached: 0
*************************** 2. row ***************************
object_schema: InnoDB System
  object_name: SYS_FOREIGN
    allocated: 49152
         data: 0
        pages: 3
 pages_hashed: 0
    pages_old: 0
  rows_cached: 0
*************************** 3. row ***************************
object_schema: InnoDB System
  object_name: SYS_TABLES
    allocated: 32768
         data: 1100
        pages: 2
 pages_hashed: 0
    pages_old: 0
  rows_cached: 10
....

This page is licensed: CC BY-SA / Gnu FDL

innodb_lock_waits and x$innodb_lock_waits Sys Schema Views

Sys Schema views are available from MariaDB 10.6.

Description

The innodb_lock_waits and x$innodb_lock_waits views summarize InnoDB locks that transactions are waiting upon, by default sorted in descending buffer size.

The innodb_lock_waits view is intended to be easier for human reading, while the x$innodb_lock_waits view provides the data in raw form, intended for tools that process the data.

They contain the following columns:

Column
Description

wait_started

Time that lock wait began.

wait_age

TIME value for the length of the lock wait.

wait_age_secs

Seconds value for the length of the lock wait.

locked_table_schema

Schema containing the locked table.

locked_table_name

Name of the locked table.

locked_table_partition

Name of the locked partition, or NULL if none.

locked_table_subpartition

Name of the locked subpartition, or NULL if none.

locked_index

Name of the locked index.

locked_type

Type of the waiting lock.

waiting_trx_id

ID of the waiting transaction.

waiting_trx_started

Time that the waiting transaction started.

waiting_trx_age

TIME value for the length of time that the transaction has been waiting.

waiting_trx_rows_locked

Number of rows locked by the waiting transaction.

waiting_trx_rows_modified

Number of rows modified by the waiting transaction.

waiting_pid

Processlist ID of the waiting transaction.

waiting_query

Statement waiting for the lock.

waiting_lock_id

ID of the waiting lock.

waiting_lock_mode

Mode of the waiting lock.

blocking_trx_id

ID of the transaction blocking the waiting lock.

blocking_pid

Processlist ID of the blocking transaction.

blocking_query

Statement the blocking transaction is executing, or NULL if the session that issued the blocking query has become idle.

blocking_lock_id

ID of the lock blocking the waiting lock.

blocking_lock_mode

Mode of the lock blocking the waiting lock.

blocking_trx_started

Time the blocking transaction started.

blocking_trx_age

TIME value for how long the blocking transaction has been executing.

blocking_trx_rows_locked

Number of rows locked by the blocking transaction.

blocking_trx_rows_modified

Number of rows modified by the blocking transaction.

sql_kill_blocking_query

KILL statement that could be used to kill the blocking statement.

sql_kill_blocking_connection

KILL statement that could be used to kill the blocking statement session.

This page is licensed: CC BY-SA / Gnu FDL

io_by_thread_by_latency and x$io_by_thread_by_latency Sys Schema Views

Sys Schema views are available from MariaDB 10.6.

Description

The io_by_thread_by_latency and x$io_by_thread_by_latency view summarize I/O consumers to display time waiting for I/O, grouped by thread. Rows are sorted by descending total I/O latency by default.

The io_by_thread_by_latency view is intended to be easier for human reading, while the x$io_by_thread_by_latency view provides the data in raw form, intended for tools that process the data.

They contain the following columns:

Column
Description

user

The account associated with a foreground thread, or the background thread name

total

Total number of I/O events allocated for the thread.

total_latency

Total wait time of timed I/O events for the thread.

min_latency

Minimum single wait time of timed I/O events for the thread.

avg_latency

Average wait time per timed I/O event for the thread.

min_latency

Maximum single wait time of timed I/O events for the thread.

thread_id

Thread id.

processlist_id

Processlist id for foreground threads, or NULL for background threads.

Example

SELECT * FROM sys.io_by_thread_by_latency\G
*************************** 1. row ***************************
          user: main
         total: 378
 total_latency: 40.11 ms
   min_latency: 570.21 ns
   avg_latency: 206.02 us
   max_latency: 4.33 ms
     thread_id: 1
processlist_id: NULL
*************************** 2. row ***************************
          user: msandbox@localhost
         total: 521
 total_latency: 10.28 ms
   min_latency: 775.04 ns
   avg_latency: 21.79 us
   max_latency: 977.79 us
     thread_id: 89
processlist_id: 7

...

SELECT * FROM sys.x$io_by_thread_by_latency\G
*************************** 1. row ***************************
          user: main
         total: 378
 total_latency: 40106340880
   min_latency: 570208
   avg_latency: 206016046.6000
   max_latency: 4327780456
     thread_id: 1
processlist_id: NULL
*************************** 2. row ***************************
          user: msandbox@localhost
         total: 498
 total_latency: 9637694714
   min_latency: 775040
   avg_latency: 21364289.0000
   max_latency: 977787350
     thread_id: 89
processlist_id: 7

...

This page is licensed: CC BY-SA / Gnu FDL

io_global_by_file_by_bytes and x$io_global_by_file_by_bytes Sys Schema Views

Sys Schema views are available from MariaDB 10.6.

Description

The io_global_by_file_by_bytes and x$io_global_by_file_by_bytes views summarize global I/O consumers showing I/O in bytes, grouped by file. Rows are sorted by descending total I/O (bytes read and written) by default.

The io_global_by_file_by_bytes view is intended to be easier for human reading, while the x$io_global_by_file_by_bytes view provides the data in raw form, intended for tools that process the data.

They contain the following columns:

Column
Description

file

File path name.

count_read

Total number of read events for the file.

total_read

Total number of bytes read from the file.

avg_read

Average number of bytes per read from the file.

count_write

Total number of write events for the file.

total_written

Total number of bytes written to the file.

avg_write

Average number of bytes per write to the file.

total

Total number of bytes read and written for the file.

write_pct

Percentage of total I/O bytes that were writes.

Example

SELECT * FROM sys.io_global_by_file_by_bytes\G
...
*************************** 3. row ***************************
         file: @@datadir/ddl_recovery.log
   count_read: 0
   total_read: 0 bytes
     avg_read: 0 bytes
  count_write: 114
total_written: 220.17 KiB
    avg_write: 1.93 KiB
        total: 220.17 KiB
    write_pct: 100.00
*************************** 4. row ***************************
         file: @@datadir/ib_logfile0
   count_read: 6
   total_read: 66.50 KiB
     avg_read: 11.08 KiB
  count_write: 43
total_written: 81.00 KiB
    avg_write: 1.88 KiB
        total: 147.50 KiB
    write_pct: 54.92
...

SELECT * FROM sys.x$io_global_by_file_by_bytes\G
...
*************************** 3. row ***************************
         file: /home/ian/sandboxes/msb_10_6_19/data/ddl_recovery.log
   count_read: 0
   total_read: 0
     avg_read: 0.0000
  count_write: 114
total_written: 225459
    avg_write: 1977.7105
        total: 225459
    write_pct: 100.00
*************************** 4. row ***************************
         file: /home/ian/sandboxes/msb_10_6_19/data/ib_logfile0
   count_read: 6
   total_read: 68096
     avg_read: 11349.3333
  count_write: 43
total_written: 82944
    avg_write: 1928.9302
        total: 151040
    write_pct: 54.92
...

This page is licensed: CC BY-SA / Gnu FDL

io_global_by_file_by_latency and x$io_global_by_file_by_latency Sys Schema Views

Sys Schema views are available from MariaDB 10.6.

Description

The io_global_by_file_by_latency and x$io_global_by_file_by_latency views summarize global I/O consumers to display time waiting for I/O, grouped by file. Rows are sorted by descending total latency by default.

The io_global_by_file_by_latency view is intended to be easier for human reading, while the x$io_global_by_file_by_latency view provides the data in raw form, intended for tools that process the data.

They contain the following columns:

Column
Description

file

File path name.

total

Total number of I/O events for the file.

total_latency

Total wait time of timed I/O events for the file.

count_read

Total number of read I/O events for the file.

read_latency

Total wait time of timed read I/O events for the file.

count_write

Total number of write I/O events for the file.

write_latency

Total wait time of timed write I/O events for the file.

count_misc

Total number of other I/O events for the file.

misc_latency

Total wait time of timed other I/O events for the file.

Example

SELECT * FROM sys.io_global_by_file_by_latency\G
*************************** 1. row ***************************
         file: @@datadir/ddl_recovery.log
        total: 222
total_latency: 288.64 ms
   count_read: 0
 read_latency: 0 ps
  count_write: 114
write_latency: 2.59 ms
   count_misc: 108
 misc_latency: 286.05 ms
*************************** 2. row ***************************
         file: @@datadir/ib_logfile0
        total: 95
total_latency: 165.29 ms
   count_read: 6
 read_latency: 61.04 us
  count_write: 43
write_latency: 1.31 ms
   count_misc: 46
 misc_latency: 163.92 ms
...

SELECT * FROM sys.x$io_global_by_file_by_latency\G
*************************** 1. row ***************************
         file: /home/ian/sandboxes/msb_10_6_19/data/ddl_recovery.log
        total: 222
total_latency: 288641408158
   count_read: 0
 read_latency: 0
  count_write: 114
write_latency: 2594925264
   count_misc: 108
 misc_latency: 286046482894
*************************** 2. row ***************************
         file: /home/ian/sandboxes/msb_10_6_19/data/ib_logfile0
        total: 95
total_latency: 165291020006
   count_read: 6
 read_latency: 61040974
  count_write: 43
write_latency: 1310187820
   count_misc: 46
 misc_latency: 163919791212
...

This page is licensed: CC BY-SA / Gnu FDL

io_global_by_wait_by_bytes and x$io_global_by_wait_by_bytes Sys Schema Views

Sys Schema views are available from MariaDB 10.6.

Description

The io_global_by_wait_by_bytes and x$io_global_by_wait_by_bytes views summarize global I/O consumers, displaying amount of I/O and time waiting for I/O, grouped by event. Rows are sorted by descending total I/O (bytes read and written) by default.

The io_global_by_wait_by_bytes view is intended to be easier for human reading, while the x$io_global_by_wait_by_bytes view provides the data in raw form, intended for tools that process the data.

They contain the following columns:

Column
Description

event_name

I/O event name. The wait/io/file prefix is stripped.

total

Total number of occurrences of the I/O event.

total_latency

Total wait time of timed occurrences of the I/O event

min_latency

Minimum single wait time of timed occurrences of the I/O event.

avg_latency

Average wait time per timed occurrence of the I/O event.

max_latency

Maximum single wait time of timed occurrences of the I/O event.

count_read

Total number of read I/O events for the file.

total_read

Total number of bytes read for the I/O event.

avg_read

Average number of bytes per read for the I/O event.

count_write

Total number of write requests for the I/O event.

total_written

Number of bytes written for the I/O event.

avg_written

Average number of bytes per write for the I/O event.

total_requested

Total number of bytes (read and write) for the I/O event.

Example

SELECT * FROM sys.io_global_by_wait_by_bytes\G
*************************** 1. row ***************************
     event_name: innodb/innodb_data_file
          total: 220
  total_latency: 38.96 ms
    min_latency: 0 ps
    avg_latency: 177.09 us
    max_latency: 4.07 ms
     count_read: 174
     total_read: 4.73 MiB
       avg_read: 27.86 KiB
    count_write: 0
  total_written: 0 bytes
    avg_written: 0 bytes
total_requested: 4.73 MiB
*************************** 2. row ***************************
     event_name: aria/MAD
          total: 1107
  total_latency: 18.27 ms
    min_latency: 0 ps
    avg_latency: 16.50 us
    max_latency: 204.97 us
     count_read: 105
     total_read: 840.00 KiB
       avg_read: 8.00 KiB
    count_write: 0
  total_written: 0 bytes
    avg_written: 0 bytes
total_requested: 840.00 KiB

...

SELECT * FROM sys.x$io_global_by_wait_by_bytes\G
*************************** 1. row ***************************
     event_name: innodb/innodb_data_file
          total: 220
  total_latency: 38959722138
    min_latency: 0
    avg_latency: 177089374
    max_latency: 4065566778
     count_read: 174
     total_read: 4964352
       avg_read: 28530.7586
    count_write: 0
  total_written: 0
    avg_written: 0.0000
total_requested: 4964352
*************************** 2. row ***************************
     event_name: aria/MAD
          total: 1107
  total_latency: 18270683624
    min_latency: 0
    avg_latency: 16504546
    max_latency: 204973168
     count_read: 105
     total_read: 860160
       avg_read: 8192.0000
    count_write: 0
  total_written: 0
    avg_written: 0.0000
total_requested: 860160

...

This page is licensed: CC BY-SA / Gnu FDL

io_global_by_wait_by_latency and x$io_global_by_wait_by_latency Sys Schema Views

Sys Schema views are available from MariaDB 10.6.

Description

The io_global_by_wait_by_latency and x$io_global_by_wait_by_latency views summarize global I/O consumers, displaying I/O and time waiting for I/O, grouped by event. Rows are sorted by descending total latency by default.

The io_global_by_wait_by_latency view is intended to be easier for human reading, while the x$io_global_by_wait_by_latency view provides the data in raw form, intended for tools that process the data.

They contain the following columns:

Column
Description

event_name

I/O event name. The wait/io/file prefix is stripped.

total

Total number of occurrences of the I/O event.

total_latency

Total wait time of timed occurrences of the I/O event.

min_latency

Minimum single wait time of timed occurrences of the I/O event.

avg_latency

Average wait time per timed occurrence of the I/O event.

max_latency

Maximum single wait time of timed occurrences of the I/O event.

count_read

Total number of read request for the I/O event.

total_read

Total number of bytes read for the I/O event.

avg_read

Average number of bytes per read for the I/O event.

count_write

Total number of write requests for the I/O event.

total_written

Number of bytes written for the I/O event.

avg_written

Average number of bytes per write for the I/O event.

total_requested

Total number of bytes (read and write) for the I/O event.

Example

SELECT * FROM sys.io_global_by_wait_by_latency\G
*************************** 1. row ***************************
   event_name: sql/global_ddl_log
        total: 223
total_latency: 288.66 ms
  avg_latency: 1.29 ms
  max_latency: 26.07 ms
 read_latency: 0 ps
write_latency: 2.59 ms
 misc_latency: 286.07 ms
   count_read: 0
   total_read: 0 bytes
     avg_read: 0 bytes
  count_write: 114
total_written: 220.17 KiB
  avg_written: 1.93 KiB
*************************** 2. row ***************************
   event_name: innodb/innodb_log_file
        total: 95
total_latency: 165.29 ms
  avg_latency: 1.74 ms
  max_latency: 26.48 ms
 read_latency: 61.04 us
write_latency: 1.31 ms
 misc_latency: 163.92 ms
   count_read: 6
   total_read: 66.50 KiB
     avg_read: 11.08 KiB
  count_write: 43
total_written: 81.00 KiB
  avg_written: 1.88 KiB
...

SELECT * FROM sys.x$io_global_by_wait_by_latency\G
*************************** 1. row ***************************
   event_name: sql/global_ddl_log
        total: 223
total_latency: 288663966666
  avg_latency: 1294456930
  max_latency: 26072142152
 read_latency: 0
write_latency: 2594925264
 misc_latency: 286069041402
   count_read: 0
   total_read: 0
     avg_read: 0.0000
  count_write: 114
total_written: 225459
  avg_written: 1977.7105
*************************** 2. row ***************************
   event_name: innodb/innodb_log_file
        total: 95
total_latency: 165291020006
  avg_latency: 1739905288
  max_latency: 26478157582
 read_latency: 61040974
write_latency: 1310187820
 misc_latency: 163919791212
   count_read: 6
   total_read: 68096
     avg_read: 11349.3333
  count_write: 43
total_written: 82944
  avg_written: 1928.9302
...

This page is licensed: CC BY-SA / Gnu FDL

latest_file_io and x$latest_file_io Sys Schema Views

Sys Schema views are available from MariaDB 10.6.

Description

The latest_file_io and x$latest_file_io views summarize file I/O activity, grouped by file and thread. Rows are sorted by most recent I/O by default.

The latest_file_io view is intended to be easier for human reading, while the x$latest_file_io view provides the data in raw form, intended for tools that process the data.

They contain the following columns:

Column
Description

thread

Account associated with the thread for foreground threads (port number for TCP/IP connections), or thread name and thread ID for background threads.

total

Total number of occurrences of the I/O event.

file

File path name.

latency

Wait time of the file I/O event.

operation

Type of operation

requested

Number of bytes requested for the file I/O event.

This page is licensed: CC BY-SA / Gnu FDL

memory_by_host_by_current_bytes and x$memory_by_host_by_current_bytes Views

Sys Schema views are available from MariaDB 10.6.

Description

The memory_by_host_by_current_bytes and x$memory_by_host_by_current_bytes summarize memory use grouped by host. Rows by default are sorted by descending amount of memory used.

The memory_by_host_by_current_bytes view is intended to be easier for human reading, while the x$memory_by_host_by_current_bytes view provides the data in raw form, intended for tools that process the data.

They contain the following columns:

Column
Description

host

Host from which the client connected. If the HOST column in the underlying Performance Schema table is NULL, rows are assumed to be for background threads, and the background host name is used.

current_count_used

Current number of allocated memory blocks that have not yet been freed for the host.

current_allocated

Current number of allocated bytes that have not yet been freed for the host.

current_avg_alloc

Current number of allocated bytes per memory block for the host.

current_max_alloc

Largest single current memory allocation in bytes for the host.

total_allocated

Total memory allocation in bytes for the host.

This page is licensed: CC BY-SA / Gnu FDL

metrics Sys Schema View

Sys Schema views are available from MariaDB 10.6.

Description

The metrics view contains global status variables (as found in the Performance Schema global_status Table), InnoDB metrics (as found in the Information Schema INNODB_METRICS Table, current and total memory allocation, based on the Performance Schema memory instrumentation, as well the current time in human readable and Unix timestamp formats.

It contains the following columns:

Column
Description

Variable_name

The name of the metric. One of the VARIABLE_NAME column if a global_status table, the NAME column if an InnoDB metric, or a description for other metrics.

Variable_value

The metric value. One of the VARIABLE_VALUE column if a global status variable, the COUNT column for InnoDB metrics, the related column from the Performance Schema memory_summary_global_by_event_name table, the value of NOW(3) or UNIX_TIMESTAMP(NOW(3)).

Type

Metric type. One of Global Status, InnoDB Metrics - % (with % being the value of the SUBSYSTEM column in the INNODB_METRICS table, Performance Schema or System Time

Enabled

Whether the metric is enabled. Always YES for global status variables and the current time. For InnoDB metrics, YES only if the STATUS column of the INNODB_METRICS table, otherwise NO. For memory metrics: YES, NO or PARTIAL (for metrics where not all memory/% instruments are enabled). Performance Schema memory instruments are always enabled)

Example

SELECT * FROM sys.metrics\G
*************************** 1. row ***************************
 Variable_name: aborted_clients
Variable_value: 0
          Type: Global Status
       Enabled: YES
*************************** 2. row ***************************
 Variable_name: aborted_connects
Variable_value: 0
          Type: Global Status
       Enabled: YES

...

*************************** 578. row ***************************
 Variable_name: trx_undo_slots_used
Variable_value: 0
          Type: InnoDB Metrics - transaction
       Enabled: YES
*************************** 579. row ***************************
 Variable_name: NOW()
Variable_value: 2024-09-09 16:16:08.745
          Type: System Time
       Enabled: YES
*************************** 580. row ***************************
 Variable_name: UNIX_TIMESTAMP()
Variable_value: 1725891368.745
          Type: System Time
       Enabled: YES

This page is licensed: CC BY-SA / Gnu FDL

privileges_by_table_by_level Sys Schema View

Sys Schema views are available from MariaDB 10.6.

This view is available from MariaDB 11.4.

Description

Shows granted privileges broken down by table on which they allow access and level on which they were granted.

For example, if a user x has SELECT privilege granted ON db.*, this view will list all tables in the db schema with the user x having SELECT privilege on them. This is different from INFORMATION_SCHEMA.TABLE_PRIVILEGES, which only lists privileges granted on the table level.

Column
Description

TABLE_SCHEMA

Database name.

TABLE_NAME

Table name.

GRANTEE

Account name that was granted the privilege.

PRIVILEGE

Privilege, such as SELECT or DROP.

LEVEL

Privilege level, such as GLOBAL or SCHEMA.

Example

SELECT * FROM sys.privileges_by_table_by_level;
+--------------+------------+---------------------------+----------------+--------+
| TABLE_SCHEMA | TABLE_NAME | GRANTEE                   | PRIVILEGE      | LEVEL  |
+--------------+------------+---------------------------+----------------+--------+
...
| test         | t2         | 'root'@'localhost'        | SELECT         | GLOBAL |
| test         | t1         | 'root'@'localhost'        | SELECT         | GLOBAL |
| test         | t3         | 'root'@'localhost'        | SELECT         | GLOBAL |
| test         | t2         | 'root'@'localhost'        | INSERT         | GLOBAL |
| test         | t1         | 'root'@'localhost'        | INSERT         | GLOBAL |
| test         | t3         | 'root'@'localhost'        | INSERT         | GLOBAL |
| test         | t2         | 'root'@'localhost'        | UPDATE         | GLOBAL |
| test         | t1         | 'root'@'localhost'        | UPDATE         | GLOBAL |
| test         | t3         | 'root'@'localhost'        | UPDATE         | GLOBAL |
| test         | t2         | 'root'@'localhost'        | DELETE         | GLOBAL |
| test         | t1         | 'root'@'localhost'        | DELETE         | GLOBAL |
| test         | t3         | 'root'@'localhost'        | DELETE         | GLOBAL |
| test         | t2         | 'root'@'localhost'        | CREATE         | GLOBAL |
| test         | t1         | 'root'@'localhost'        | CREATE         | GLOBAL |
| test         | t3         | 'root'@'localhost'        | CREATE         | GLOBAL |
| test         | t2         | 'root'@'localhost'        | DROP           | GLOBAL |
| test         | t1         | 'root'@'localhost'        | DROP           | GLOBAL |
| test         | t3         | 'root'@'localhost'        | DROP           | GLOBAL |
| test         | t2         | 'root'@'localhost'        | REFERENCES     | GLOBAL |
| test         | t1         | 'root'@'localhost'        | REFERENCES     | GLOBAL |
| test         | t3         | 'root'@'localhost'        | REFERENCES     | GLOBAL |
| test         | t2         | 'root'@'localhost'        | INDEX          | GLOBAL |
| test         | t1         | 'root'@'localhost'        | INDEX          | GLOBAL |
| test         | t3         | 'root'@'localhost'        | INDEX          | GLOBAL |
| test         | t2         | 'root'@'localhost'        | ALTER          | GLOBAL |
| test         | t1         | 'root'@'localhost'        | ALTER          | GLOBAL |
| test         | t3         | 'root'@'localhost'        | ALTER          | GLOBAL |
| test         | t2         | 'root'@'localhost'        | SHOW VIEW      | GLOBAL |
| test         | t1         | 'root'@'localhost'        | SHOW VIEW      | GLOBAL |
| test         | t3         | 'root'@'localhost'        | SHOW VIEW      | GLOBAL |
| test         | t2         | 'root'@'localhost'        | TRIGGER        | GLOBAL |
| test         | t1         | 'root'@'localhost'        | TRIGGER        | GLOBAL |
| test         | t3         | 'root'@'localhost'        | TRIGGER        | GLOBAL |
| test         | t2         | 'root'@'localhost'        | DELETE HISTORY | GLOBAL |
| test         | t1         | 'root'@'localhost'        | DELETE HISTORY | GLOBAL |
| test         | t3         | 'root'@'localhost'        | DELETE HISTORY | GLOBAL |
| test         | t2         | 'PUBLIC'@''               | SELECT         | SCHEMA |
| test         | t1         | 'PUBLIC'@''               | SELECT         | SCHEMA |
| test         | t3         | 'PUBLIC'@''               | SELECT         | SCHEMA |
| test         | t2         | 'PUBLIC'@''               | INSERT         | SCHEMA |
| test         | t1         | 'PUBLIC'@''               | INSERT         | SCHEMA |
| test         | t3         | 'PUBLIC'@''               | INSERT         | SCHEMA |
| test         | t2         | 'PUBLIC'@''               | UPDATE         | SCHEMA |
| test         | t1         | 'PUBLIC'@''               | UPDATE         | SCHEMA |
| test         | t3         | 'PUBLIC'@''               | UPDATE         | SCHEMA |
| test         | t2         | 'PUBLIC'@''               | DELETE         | SCHEMA |
| test         | t1         | 'PUBLIC'@''               | DELETE         | SCHEMA |
| test         | t3         | 'PUBLIC'@''               | DELETE         | SCHEMA |
| test         | t2         | 'PUBLIC'@''               | CREATE         | SCHEMA |
| test         | t1         | 'PUBLIC'@''               | CREATE         | SCHEMA |
| test         | t3         | 'PUBLIC'@''               | CREATE         | SCHEMA |
| test         | t2         | 'PUBLIC'@''               | DROP           | SCHEMA |
| test         | t1         | 'PUBLIC'@''               | DROP           | SCHEMA |
| test         | t3         | 'PUBLIC'@''               | DROP           | SCHEMA |
| test         | t2         | 'PUBLIC'@''               | REFERENCES     | SCHEMA |
| test         | t1         | 'PUBLIC'@''               | REFERENCES     | SCHEMA |
| test         | t3         | 'PUBLIC'@''               | REFERENCES     | SCHEMA |
| test         | t2         | 'PUBLIC'@''               | INDEX          | SCHEMA |
| test         | t1         | 'PUBLIC'@''               | INDEX          | SCHEMA |
| test         | t3         | 'PUBLIC'@''               | INDEX          | SCHEMA |
| test         | t2         | 'PUBLIC'@''               | ALTER          | SCHEMA |
| test         | t1         | 'PUBLIC'@''               | ALTER          | SCHEMA |
| test         | t3         | 'PUBLIC'@''               | ALTER          | SCHEMA |
| test         | t2         | 'PUBLIC'@''               | SHOW VIEW      | SCHEMA |
| test         | t1         | 'PUBLIC'@''               | SHOW VIEW      | SCHEMA |
| test         | t3         | 'PUBLIC'@''               | SHOW VIEW      | SCHEMA |
| test         | t2         | 'PUBLIC'@''               | TRIGGER        | SCHEMA |
| test         | t1         | 'PUBLIC'@''               | TRIGGER        | SCHEMA |
| test         | t3         | 'PUBLIC'@''               | TRIGGER        | SCHEMA |
| test         | t2         | 'PUBLIC'@''               | DELETE HISTORY | SCHEMA |
| test         | t1         | 'PUBLIC'@''               | DELETE HISTORY | SCHEMA |
| test         | t3         | 'PUBLIC'@''               | DELETE HISTORY | SCHEMA |
+--------------+------------+---------------------------+----------------+--------+

See Also

  • GRANT (description of the privileges and how to grant them)

  • INFORMATION_SCHEMA.TABLE_PRIVILEGES

  • MDEV-24486

This page is licensed: CC BY-SA / Gnu FDL

schema_auto_increment_columns Sys Schema View

Sys Schema views are available from MariaDB 10.6.

Description

Information about AUTO_INCREMENT columns, sorted by descending usage ratio and maximum column value. Does not include columns in the mysql, sys, information_schema and performance_schema schemas.

Contains the following columns:

Column
Description

table_schema

Schema name containing the table with the auto_increment attribute.

table_name

Table containing the auto_increment attribute.

column_name

Name of the column containing the auto_increment attribute.

data_type

Data type of the auto_increment column, for example tinyint.

column_type

Data type of the auto_increment column, plus additional information for example tinyint(3) unsigned.

is_signed

1 if the column is signed,0 if not.

is_unsigned

1 if the column is unsigned,0 if it is.

max_value

Maximum possible value for the column, for example 255 for an unsigned tinyint.

auto_increment

Current auto_increment value for the column.

auto_increment_ratio

Ratio of used to maximum value for the auto_increment column.

Example

CREATE OR REPLACE TABLE animals (
    id TINYINT NOT NULL AUTO_INCREMENT,
    name CHAR(30) NOT NULL,
    PRIMARY KEY (id)
);

 INSERT INTO animals (name) VALUES
    ('dog'),('cat'),('penguin'),
    ('fox'),('whale'),('ostrich');

SELECT * FROM sys.schema_auto_increment_columns\G
*************************** 1. row ***************************
        table_schema: test
          table_name: animals
         column_name: id
           data_type: tinyint
         column_type: tinyint(4)
           is_signed: 1
         is_unsigned: 0
           max_value: 127
      auto_increment: 7
auto_increment_ratio: 0.0551

This page is licensed: CC BY-SA / Gnu FDL

schema_object_overview Sys Schema View

Sys Schema views are available from MariaDB 10.6.

Description

A count of the number of objects within each schema, sorted by schema and object.

Contains the following columns:

Column
Description

db

Schema name

object_type

Object name

count

Count of the number of objects

Example

SELECT * FROM sys.schema_object_overview;
+--------------------+---------------+-------+
| db                 | object_type   | count |
+--------------------+---------------+-------+
| information_schema | SYSTEM VIEW   |    79 |
| mysql              | BASE TABLE    |    30 |
| mysql              | INDEX (BTREE) |    76 |
| mysql              | PROCEDURE     |     2 |
| mysql              | VIEW          |     1 |
| performance_schema | BASE TABLE    |    81 |
| sys                | BASE TABLE    |     1 |
| sys                | FUNCTION      |    22 |
| sys                | INDEX (BTREE) |     1 |
| sys                | PROCEDURE     |    26 |
| sys                | VIEW          |   100 |
+--------------------+---------------+-------+

This page is licensed: CC BY-SA / Gnu FDL

host_summary_by_statement_latency and x$host_summary_by_statement_latency Sys Schema Views

Sys Schema views are available from MariaDB 10.6.

Description

The host_summary_by_statement_latency and x$host_summary_by_statement_latency views summarize statement statistics, grouped by host. Rows are sorted by descending total latency by default. The host_summary_by_statement_latency view is intended to be easier for human reading, while the x$host_summary_by_statement_latency view provides the data in raw form, intended for tools that process the data.

They contain the following columns:

Column
Description

host

Host that the client connected from, or background for background threads (where the HOST column in the underlying Performance Schema table is NULL).

total

Total number of statements for the host.

max_latency

Maximum single wait time of timed statements for the host.

lock_latency

Total time spent by timed statements for the host waiting for locks.

total_latency

Total wait time of timed statements for the host.

rows_sent

Total number of rows returned by statements for the host.

rows_examined

Total number of rows read from storage engines by statements for the host.

rows_affected

Total number of rows affected by statements for the host.

full_scans

Total number of full table scans by statements for the host.

Example

SELECT * FROM sys.host_summary_by_statement_latency\G
*************************** 1. row ***************************
         host: localhost
        total: 1042
total_latency: 816.89 ms
  max_latency: 64.51 ms
 lock_latency: 215.64 ms
    rows_sent: 750599937895985
rows_examined: 13548
rows_affected: 6
   full_scans: 33
*************************** 2. row ***************************
         host: background
        total: 0
total_latency: 0 ps
  max_latency: 0 ps
 lock_latency: 0 ps
    rows_sent: 0
rows_examined: 0
rows_affected: 0
   full_scans: 0

SELECT * FROM sys.x$host_summary_by_statement_latency\G
*************************** 1. row ***************************
         host: localhost
        total: 1041
total_latency: 812132706000
  max_latency: 64507216000
 lock_latency: 215301000000
    rows_sent: 750599937895983
rows_examined: 13110
rows_affected: 6
   full_scans: 32
*************************** 2. row ***************************
         host: background
        total: 0
total_latency: 0
  max_latency: 0
 lock_latency: 0
    rows_sent: 0
rows_examined: 0
rows_affected: 0
   full_scans: 0

This page is licensed: CC BY-SA / Gnu FDL