Commit 5ce22bac authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-9077 - sysschema test suite.

parent f6bb1c11
......@@ -7,4 +7,5 @@ plugins,^
mariabackup,^
roles,^
auth_gssapi,^
rocksdb
rocksdb,^
sysschema
......@@ -211,6 +211,7 @@ my @DEFAULT_SUITES= qw(
vcol-
versioning-
period-
sysschema-
);
my $opt_suites;
......
# Reset the performance_schema.setup_actors table
TRUNCATE TABLE performance_schema.setup_actors;
INSERT INTO performance_schema.setup_actors VALUES ('%', '%', '%', 'YES', 'YES');
# Reset the performance_schema.setup_consumers table
UPDATE performance_schema.setup_consumers SET enabled = 'YES';
# Reset the performance_schema.setup_instruments table
UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES';
# Reset all Performance Schema configuration
--source ./ps_setup_instruments_cleanup.inc
--source ./ps_setup_actors_cleanup.inc
--source ./ps_setup_consumers_cleanup.inc
--source ./ps_threads_cleanup.inc
# Reset the performance_schema.setup_consumers table
UPDATE performance_schema.threads SET instrumented = 'YES';
# Reset all underlying Performance Schema data
--disable_result_log
--disable_query_log ONCE
CALL sys.ps_truncate_all_tables(FALSE);
--enable_result_log
# Reset the sys.sys_config table
# Note, we have to disable the triggers to reset the set_by column back to NULL
# as the sys.sys_config_update_set_user trigger will overwrite it to the current user
SET @sys.ignore_sys_config_triggers := true;
DELETE FROM sys.sys_config;
INSERT IGNORE INTO sys.sys_config (variable, value) VALUES
('statement_truncate_len', 64),
('statement_performance_analyzer.limit', 100),
('statement_performance_analyzer.view', NULL),
('diagnostics.allow_i_s_tables', 'OFF'),
('diagnostics.include_raw', 'OFF'),
('ps_thread_trx_info.max_length', 65535);
SET @sys.ignore_sys_config_triggers := NULL;
USE sys;
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'sys' ORDER BY TABLE_NAME;
TABLE_NAME
host_summary
host_summary_by_file_io
host_summary_by_file_io_type
host_summary_by_stages
host_summary_by_statement_latency
host_summary_by_statement_type
innodb_buffer_stats_by_schema
innodb_buffer_stats_by_table
innodb_lock_waits
io_by_thread_by_latency
io_global_by_file_by_bytes
io_global_by_file_by_latency
io_global_by_wait_by_bytes
io_global_by_wait_by_latency
latest_file_io
memory_by_host_by_current_bytes
memory_by_thread_by_current_bytes
memory_by_user_by_current_bytes
memory_global_by_current_bytes
memory_global_total
metrics
processlist
ps_check_lost_instrumentation
schema_auto_increment_columns
schema_index_statistics
schema_object_overview
schema_redundant_indexes
schema_tables_with_full_table_scans
schema_table_lock_waits
schema_table_statistics
schema_table_statistics_with_buffer
schema_unused_indexes
session
session_ssl_status
statements_with_errors_or_warnings
statements_with_full_table_scans
statements_with_runtimes_in_95th_percentile
statements_with_sorting
statements_with_temp_tables
statement_analysis
sys_config
user_summary
user_summary_by_file_io
user_summary_by_file_io_type
user_summary_by_stages
user_summary_by_statement_latency
user_summary_by_statement_type
version
waits_by_host_by_latency
waits_by_user_by_latency
waits_global_by_latency
wait_classes_global_by_avg_latency
wait_classes_global_by_latency
x$host_summary
x$host_summary_by_file_io
x$host_summary_by_file_io_type
x$host_summary_by_stages
x$host_summary_by_statement_latency
x$host_summary_by_statement_type
x$innodb_buffer_stats_by_schema
x$innodb_buffer_stats_by_table
x$innodb_lock_waits
x$io_by_thread_by_latency
x$io_global_by_file_by_bytes
x$io_global_by_file_by_latency
x$io_global_by_wait_by_bytes
x$io_global_by_wait_by_latency
x$latest_file_io
x$memory_by_host_by_current_bytes
x$memory_by_thread_by_current_bytes
x$memory_by_user_by_current_bytes
x$memory_global_by_current_bytes
x$memory_global_total
x$processlist
x$ps_digest_95th_percentile_by_avg_us
x$ps_digest_avg_latency_distribution
x$ps_schema_table_statistics_io
x$schema_flattened_keys
x$schema_index_statistics
x$schema_tables_with_full_table_scans
x$schema_table_lock_waits
x$schema_table_statistics
x$schema_table_statistics_with_buffer
x$session
x$statements_with_errors_or_warnings
x$statements_with_full_table_scans
x$statements_with_runtimes_in_95th_percentile
x$statements_with_sorting
x$statements_with_temp_tables
x$statement_analysis
x$user_summary
x$user_summary_by_file_io
x$user_summary_by_file_io_type
x$user_summary_by_stages
x$user_summary_by_statement_latency
x$user_summary_by_statement_type
x$waits_by_host_by_latency
x$waits_by_user_by_latency
x$waits_global_by_latency
x$wait_classes_global_by_avg_latency
x$wait_classes_global_by_latency
SELECT ROUTINE_NAME, ROUTINE_TYPE FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA = 'sys' ORDER BY ROUTINE_TYPE, ROUTINE_NAME;
ROUTINE_NAME ROUTINE_TYPE
extract_schema_from_file_name FUNCTION
extract_table_from_file_name FUNCTION
format_bytes FUNCTION
format_path FUNCTION
format_statement FUNCTION
format_time FUNCTION
list_add FUNCTION
list_drop FUNCTION
ps_is_account_enabled FUNCTION
ps_is_consumer_enabled FUNCTION
ps_is_instrument_default_enabled FUNCTION
ps_is_instrument_default_timed FUNCTION
ps_is_thread_instrumented FUNCTION
ps_thread_account FUNCTION
ps_thread_id FUNCTION
ps_thread_stack FUNCTION
ps_thread_trx_info FUNCTION
quote_identifier FUNCTION
sys_get_config FUNCTION
version_major FUNCTION
version_minor FUNCTION
version_patch FUNCTION
create_synonym_db PROCEDURE
diagnostics PROCEDURE
execute_prepared_stmt PROCEDURE
ps_setup_disable_background_threads PROCEDURE
ps_setup_disable_consumer PROCEDURE
ps_setup_disable_instrument PROCEDURE
ps_setup_disable_thread PROCEDURE
ps_setup_enable_background_threads PROCEDURE
ps_setup_enable_consumer PROCEDURE
ps_setup_enable_instrument PROCEDURE
ps_setup_enable_thread PROCEDURE
ps_setup_reload_saved PROCEDURE
ps_setup_reset_to_default PROCEDURE
ps_setup_save PROCEDURE
ps_setup_show_disabled PROCEDURE
ps_setup_show_disabled_consumers PROCEDURE
ps_setup_show_disabled_instruments PROCEDURE
ps_setup_show_enabled PROCEDURE
ps_setup_show_enabled_consumers PROCEDURE
ps_setup_show_enabled_instruments PROCEDURE
ps_statement_avg_latency_histogram PROCEDURE
ps_trace_statement_digest PROCEDURE
ps_trace_thread PROCEDURE
ps_truncate_all_tables PROCEDURE
statement_performance_analyzer PROCEDURE
table_exists PROCEDURE
SELECT TRIGGER_NAME FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_SCHEMA = 'sys' ORDER BY TRIGGER_NAME;
TRIGGER_NAME
sys_config_insert_set_user
sys_config_update_set_user
SELECT sys_version FROM sys.version;
sys_version
1.5.1
SELECT sys.extract_schema_from_file_name(NULL);
sys.extract_schema_from_file_name(NULL)
NULL
SELECT sys.extract_schema_from_file_name('/var/lib/mysql/employees/employee.ibd');
sys.extract_schema_from_file_name('/var/lib/mysql/employees/employee.ibd')
employees
SELECT sys.extract_table_from_file_name(NULL);
sys.extract_table_from_file_name(NULL)
NULL
SELECT sys.extract_table_from_file_name('/var/lib/mysql/employees/employee.ibd');
sys.extract_table_from_file_name('/var/lib/mysql/employees/employee.ibd')
employee
SELECT sys.format_bytes(NULL);
sys.format_bytes(NULL)
NULL
SELECT sys.format_bytes(1);
sys.format_bytes(1)
1 bytes
SELECT sys.format_bytes(1023);
sys.format_bytes(1023)
1023 bytes
SELECT sys.format_bytes(1024);
sys.format_bytes(1024)
1.00 KiB
SELECT sys.format_bytes(1048575);
sys.format_bytes(1048575)
1024.00 KiB
SELECT sys.format_bytes(1048576);
sys.format_bytes(1048576)
1.00 MiB
SELECT sys.format_bytes(1073741823);
sys.format_bytes(1073741823)
1024.00 MiB
SELECT sys.format_bytes(1073741824);
sys.format_bytes(1073741824)
1.00 GiB
SELECT sys.format_bytes(1099511627775);
sys.format_bytes(1099511627775)
1024.00 GiB
SELECT sys.format_bytes(1099511627776);
sys.format_bytes(1099511627776)
1.00 TiB
SELECT sys.format_bytes(1125899906842623);
sys.format_bytes(1125899906842623)
1024.00 TiB
SELECT sys.format_bytes(1125899906842624);
sys.format_bytes(1125899906842624)
1.00 PiB
SELECT sys.format_bytes(1125899906842624238947293);
sys.format_bytes(1125899906842624238947293)
1000000000.00 PiB
SELECT sys.format_path(NULL);
sys.format_path(NULL)
NULL
SET @mypath := CONCAT(@@global.datadir, 'foo/bar.foo');
SELECT sys.format_path(@mypath);
sys.format_path(@mypath)
@@datadir/foo/bar.foo
SET @mypath := CONCAT(@@global.tmpdir, '/foo/bar.foo');
SELECT sys.format_path(@mypath);
sys.format_path(@mypath)
@@tmpdir/foo/bar.foo
SELECT sys.format_path('/foo/bar/baz.foo');
sys.format_path('/foo/bar/baz.foo')
/foo/bar/baz.foo
SELECT sys.format_statement(NULL);
sys.format_statement(NULL)
NULL
SELECT sys.format_statement('SELECT foo, bar, baz, foobar, foobaz FROM foo JOIN bar USING (foobar) JOIN baz USING (foobar) WHERE foo = \'foo\' AND bar = \'bar\'') AS statement;
statement
SELECT foo, bar, baz, foobar, ... RE foo = 'foo' AND bar = 'bar'
SET @sys.statement_truncate_len = 80;
SELECT sys.format_statement('SELECT foo, bar, baz, foobar, foobaz FROM foo JOIN bar USING (foobar) JOIN baz USING (foobar) WHERE foo = \'foo\' AND bar = \'bar\'') AS statement;
statement
SELECT foo, bar, baz, foobar, foobaz F ... bar) WHERE foo = 'foo' AND bar = 'bar'
SELECT sys.format_time(NULL);
sys.format_time(NULL)
NULL
SELECT sys.format_time(1);
sys.format_time(1)
1 ps
SELECT sys.format_time(999);
sys.format_time(999)
999 ps
SELECT sys.format_time(1000);
sys.format_time(1000)
1.00 ns
SELECT sys.format_time(999999);
sys.format_time(999999)
1000.00 ns
SELECT sys.format_time(1000000);
sys.format_time(1000000)
1.00 us
SELECT sys.format_time(999999999);
sys.format_time(999999999)
1000.00 us
SELECT sys.format_time(1000000000);
sys.format_time(1000000000)
1.00 ms
SELECT sys.format_time(999999999999);
sys.format_time(999999999999)
1000.00 ms
SELECT sys.format_time(1000000000000);
sys.format_time(1000000000000)
1.00 s
SELECT sys.format_time(59999999999999);
sys.format_time(59999999999999)
60.00 s
SELECT sys.format_time(60000000000000);
sys.format_time(60000000000000)
1.00 m
SELECT sys.format_time(3599999999999999);
sys.format_time(3599999999999999)
60.00 m
SELECT sys.format_time(3600000000000000);
sys.format_time(3600000000000000)
1.00 h
SELECT sys.format_time(86399999999999988);
sys.format_time(86399999999999988)
24.00 h
SELECT sys.format_time(86400000000000000);
sys.format_time(86400000000000000)
1.00 d
SELECT sys.format_time(604799999999999888);
sys.format_time(604799999999999888)
7.00 d
SELECT sys.format_time(604800000000000000);
sys.format_time(604800000000000000)
1.00 w
SELECT sys.format_time(2389472398472389748237429837423984728374);
sys.format_time(2389472398472389748237429837423984728374)
3950847219696411300000.00 w
SELECT sys.list_add(NULL, 'foo');
sys.list_add(NULL, 'foo')
foo
SELECT sys.list_add('', 'foo');
sys.list_add('', 'foo')
foo
SELECT sys.list_add('bar', 'foo');
sys.list_add('bar', 'foo')
bar,foo
SELECT sys.list_add('bar, ', 'foo');
sys.list_add('bar, ', 'foo')
bar,foo
SELECT sys.list_add('foo', NULL);
ERROR 02200: Function sys.list_add: in_add_value input variable should not be NULL
SET @sqlmode := @@sql_mode;
SELECT @@sql_mode;
@@sql_mode
STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
SET SESSION sql_mode = sys.list_add(@@sql_mode, 'ANSI_QUOTES');
SELECT @@sql_mode;
@@sql_mode
ANSI_QUOTES,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
SET SESSION sql_mode = @sqlmode;
SET @sqlmode := NULL;
SET @input := REPEAT('a', 4194304);
SELECT sys.list_add(@input, 'foo');
ERROR 22001: Data too long for column 'in_list' at row 1
SET @input := NULL;
SELECT sys.list_drop('1,2,3,4,5', '1');
sys.list_drop('1,2,3,4,5', '1')
2,3,4,5
SELECT sys.list_drop('1,2,3,4,5', '3');
sys.list_drop('1,2,3,4,5', '3')
1,2,4,5
SELECT sys.list_drop('1,2,3,4,5', '5');
sys.list_drop('1,2,3,4,5', '5')
1,2,3,4
SELECT sys.list_drop('1, 2, 3, 4, 5', '1');
sys.list_drop('1, 2, 3, 4, 5', '1')
2, 3, 4, 5
SELECT sys.list_drop('1, 2, 3, 4, 5', '3');
sys.list_drop('1, 2, 3, 4, 5', '3')
1, 2, 4, 5
SELECT sys.list_drop('1, 2, 3, 4, 5', '5');
sys.list_drop('1, 2, 3, 4, 5', '5')
1, 2, 3, 4
SELECT sys.list_drop('1,2,3,4,5', NULL);
ERROR 02200: Function sys.list_drop: in_drop_value input variable should not be NULL
SET @sqlmode := @@sql_mode;
SELECT @@sql_mode;
@@sql_mode
STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
SET SESSION sql_mode = sys.list_drop(@@sql_mode, 'STRICT_TRANS_TABLES');
SELECT @@sql_mode;
@@sql_mode
ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
SET SESSION sql_mode = @sqlmode;
SET @sqlmode := NULL;
SELECT sys.ps_is_account_enabled('foo', 'bar');
sys.ps_is_account_enabled('foo', 'bar')
YES
DELETE FROM performance_schema.setup_actors;
INSERT INTO performance_schema.setup_actors VALUES
('test', 'test', '%', 'YES', 'NO');
SELECT sys.ps_is_account_enabled('foo', 'bar');
sys.ps_is_account_enabled('foo', 'bar')
NO
SELECT sys.ps_is_account_enabled('test', 'test');
sys.ps_is_account_enabled('test', 'test')
YES
TRUNCATE TABLE performance_schema.setup_actors;
INSERT INTO performance_schema.setup_actors VALUES ('%', '%', '%', 'YES', 'YES');
UPDATE performance_schema.setup_consumers SET enabled = 'NO' WHERE name = 'events_stages_history';
SELECT sys.ps_is_consumer_enabled('events_stages_history');
sys.ps_is_consumer_enabled('events_stages_history')
NO
SELECT sys.ps_is_consumer_enabled('global_instrumentation');
sys.ps_is_consumer_enabled('global_instrumentation')
YES
UPDATE performance_schema.setup_consumers SET enabled = 'NO' WHERE name = 'events_stages_current';
UPDATE performance_schema.setup_consumers SET enabled = 'YES' WHERE name = 'events_stages_history';
SELECT sys.ps_is_consumer_enabled('events_stages_history');
sys.ps_is_consumer_enabled('events_stages_history')
NO
UPDATE performance_schema.setup_consumers SET enabled = 'YES' WHERE name = 'events_stages_current';
SELECT sys.ps_is_consumer_enabled('events_stages_history');
sys.ps_is_consumer_enabled('events_stages_history')
YES
UPDATE performance_schema.setup_consumers SET enabled = 'NO' WHERE name = 'global_instrumentation';
SELECT sys.ps_is_consumer_enabled('thread_instrumentation');
sys.ps_is_consumer_enabled('thread_instrumentation')
NO
SELECT sys.ps_is_consumer_enabled('statements_digest');
sys.ps_is_consumer_enabled('statements_digest')
NO
SELECT sys.ps_is_consumer_enabled('events_stages_current');
sys.ps_is_consumer_enabled('events_stages_current')
NO
SELECT sys.ps_is_consumer_enabled('events_stages_history');
sys.ps_is_consumer_enabled('events_stages_history')
NO
SELECT sys.ps_is_consumer_enabled('events_stages_history_long');
sys.ps_is_consumer_enabled('events_stages_history_long')
NO
SELECT sys.ps_is_consumer_enabled('events_statements_current');
sys.ps_is_consumer_enabled('events_statements_current')
NO
SELECT sys.ps_is_consumer_enabled('events_statements_history');
sys.ps_is_consumer_enabled('events_statements_history')
NO
SELECT sys.ps_is_consumer_enabled('events_statements_history_long');
sys.ps_is_consumer_enabled('events_statements_history_long')
NO
UPDATE performance_schema.setup_consumers SET enabled = 'YES';
SELECT sys.ps_is_instrument_default_enabled('memory/performance_schema/internal_buffers');
sys.ps_is_instrument_default_enabled('memory/performance_schema/internal_buffers')
YES
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('statement/sp/error');
sys.ps_is_instrument_default_enabled('statement/sp/error')
YES
SELECT sys.ps_is_instrument_default_enabled('statement/com/Prepare');
sys.ps_is_instrument_default_enabled('statement/com/Prepare')
YES
SELECT sys.ps_is_instrument_default_enabled('wait/io/file/sql/binlog');
sys.ps_is_instrument_default_enabled('wait/io/file/sql/binlog')
YES
SELECT sys.ps_is_instrument_default_enabled('wait/io/table/sql/handler');
sys.ps_is_instrument_default_enabled('wait/io/table/sql/handler')
YES
SELECT sys.ps_is_instrument_default_enabled('wait/lock/table/sql/handler');
sys.ps_is_instrument_default_enabled('wait/lock/table/sql/handler')
YES
SELECT sys.ps_is_instrument_default_enabled('idle');
sys.ps_is_instrument_default_enabled('idle')
YES
SELECT sys.ps_is_instrument_default_enabled('wait/synch/mutex/sql/LOCK_plugin');
sys.ps_is_instrument_default_enabled('wait/synch/mutex/sql/LOCK_plugin')
NO
SELECT sys.ps_is_instrument_default_enabled('wait/synch/rwlock/sql/LOCK_grant');
sys.ps_is_instrument_default_enabled('wait/synch/rwlock/sql/LOCK_grant')
NO
SELECT sys.ps_is_instrument_default_enabled('wait/synch/sxlock/innodb/btr_search_latch');
sys.ps_is_instrument_default_enabled('wait/synch/sxlock/innodb/btr_search_latch')
NO
SELECT sys.ps_is_instrument_default_enabled('wait/synch/cond/sql/MYSQL_BIN_LOG::update_cond');
sys.ps_is_instrument_default_enabled('wait/synch/cond/sql/MYSQL_BIN_LOG::update_cond')
NO
SELECT sys.ps_is_instrument_default_enabled('stage/sql/end');
sys.ps_is_instrument_default_enabled('stage/sql/end')
NO
SELECT sys.ps_is_instrument_default_enabled('transaction');
sys.ps_is_instrument_default_enabled('transaction')
NO
SELECT sys.ps_is_instrument_default_enabled('wait/io/socket/sql/server_tcpip_socket');
sys.ps_is_instrument_default_enabled('wait/io/socket/sql/server_tcpip_socket')
NO
SELECT sys.ps_is_instrument_default_enabled('wait/lock/metadata/sql/mdl');
sys.ps_is_instrument_default_enabled('wait/lock/metadata/sql/mdl')
NO
SELECT sys.ps_is_instrument_default_timed('wait/io/file/sql/binlog');
sys.ps_is_instrument_default_timed('wait/io/file/sql/binlog')
YES
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('statement/sp/error');
sys.ps_is_instrument_default_timed('statement/sp/error')
YES
SELECT sys.ps_is_instrument_default_timed('statement/com/Prepare');
sys.ps_is_instrument_default_timed('statement/com/Prepare')
YES
SELECT sys.ps_is_instrument_default_timed('wait/io/table/sql/handler');
sys.ps_is_instrument_default_timed('wait/io/table/sql/handler')
YES
SELECT sys.ps_is_instrument_default_timed('wait/lock/table/sql/handler');
sys.ps_is_instrument_default_timed('wait/lock/table/sql/handler')
YES
SELECT sys.ps_is_instrument_default_timed('idle');
sys.ps_is_instrument_default_timed('idle')
YES
SELECT sys.ps_is_instrument_default_timed('wait/synch/mutex/sql/LOCK_plugin');
sys.ps_is_instrument_default_timed('wait/synch/mutex/sql/LOCK_plugin')
NO
SELECT sys.ps_is_instrument_default_timed('wait/synch/rwlock/sql/LOCK_grant');
sys.ps_is_instrument_default_timed('wait/synch/rwlock/sql/LOCK_grant')
NO
SELECT sys.ps_is_instrument_default_timed('wait/synch/sxlock/innodb/btr_search_latch');
sys.ps_is_instrument_default_timed('wait/synch/sxlock/innodb/btr_search_latch')
NO
SELECT sys.ps_is_instrument_default_timed('wait/synch/cond/sql/MYSQL_BIN_LOG::update_cond');
sys.ps_is_instrument_default_timed('wait/synch/cond/sql/MYSQL_BIN_LOG::update_cond')
NO
SELECT sys.ps_is_instrument_default_timed('stage/sql/end');
sys.ps_is_instrument_default_timed('stage/sql/end')
NO
SELECT sys.ps_is_instrument_default_timed('transaction');
sys.ps_is_instrument_default_timed('transaction')
NO
SELECT sys.ps_is_instrument_default_timed('wait/io/socket/sql/server_tcpip_socket');
sys.ps_is_instrument_default_timed('wait/io/socket/sql/server_tcpip_socket')
NO
SELECT sys.ps_is_instrument_default_timed('memory/performance_schema/internal_buffers');
sys.ps_is_instrument_default_timed('memory/performance_schema/internal_buffers')
NO
SELECT sys.ps_is_instrument_default_timed('wait/lock/metadata/sql/mdl');
sys.ps_is_instrument_default_timed('wait/lock/metadata/sql/mdl')
NO
SELECT sys.ps_is_thread_instrumented(NULL);
sys.ps_is_thread_instrumented(NULL)
NULL
SELECT sys.ps_is_thread_instrumented(CONNECTION_ID());
sys.ps_is_thread_instrumented(CONNECTION_ID())
YES
UPDATE performance_schema.threads SET instrumented = 'NO' WHERE processlist_id = CONNECTION_ID();
SELECT sys.ps_is_thread_instrumented(CONNECTION_ID());
sys.ps_is_thread_instrumented(CONNECTION_ID())
NO
SELECT sys.ps_is_thread_instrumented(234623462376);
sys.ps_is_thread_instrumented(234623462376)
UNKNOWN
UPDATE performance_schema.threads SET instrumented = 'YES';
SELECT sys.ps_thread_account(NULL);
sys.ps_thread_account(NULL)
NULL
SELECT sys.ps_thread_account(234623462376);
sys.ps_thread_account(234623462376)
NULL
SELECT sys.ps_thread_account(sys.ps_thread_id(NULL));
sys.ps_thread_account(sys.ps_thread_id(NULL))
root@localhost
SELECT sys.ps_thread_id(234623462376);
sys.ps_thread_id(234623462376)
NULL
SELECT sys.ps_thread_id(CONNECTION_ID()) = @ps_thread_id;
sys.ps_thread_id(CONNECTION_ID()) = @ps_thread_id
1
SELECT sys.ps_thread_id(NULL) = @ps_thread_id;
sys.ps_thread_id(NULL) = @ps_thread_id
1
SELECT sys.ps_thread_trx_info(234623462376);
sys.ps_thread_trx_info(234623462376)
NULL
SELECT JSON_VALID(sys.ps_thread_trx_info(sys.ps_thread_id(NULL)));
JSON_VALID(sys.ps_thread_trx_info(sys.ps_thread_id(NULL)))
1
CREATE DATABASE trx;
CREATE TABLE trx.info (id INT PRIMARY KEY, info VARCHAR(20));
connect con1,localhost,root,,;
connection con1;
USE trx;
START TRANSACTION;
INSERT INTO info VALUES (1, 'foo');
COMMIT;
START TRANSACTION;
INSERT INTO info VALUES (2, 'bar');
COMMIT;
connection default;
SET @json_doc := sys.ps_thread_trx_info(@ps_thread_id);
SELECT JSON_VALID(@json_doc);
JSON_VALID(@json_doc)
1
SELECT JSON_LENGTH(@json_doc);
JSON_LENGTH(@json_doc)
2
SELECT JSON_KEYS(JSON_EXTRACT(@json_doc, '$[0]'));
JSON_KEYS(JSON_EXTRACT(@json_doc, '$[0]'))
["time", "state", "mode", "autocommitted", "gtid", "isolation", "statements_executed"]
SELECT JSON_CONTAINS_PATH(@json_doc, 'one', '$[0].time');
JSON_CONTAINS_PATH(@json_doc, 'one', '$[0].time')
1
SELECT JSON_CONTAINS(@json_doc, '"COMMITTED"', '$[0].state');
JSON_CONTAINS(@json_doc, '"COMMITTED"', '$[0].state')
1
SELECT JSON_CONTAINS(@json_doc, '"READ WRITE"', '$[0].mode');
JSON_CONTAINS(@json_doc, '"READ WRITE"', '$[0].mode')
1
SELECT JSON_CONTAINS(@json_doc, '"NO"', '$[0].autocommitted');
JSON_CONTAINS(@json_doc, '"NO"', '$[0].autocommitted')
1
SELECT JSON_CONTAINS(@json_doc, '"AUTOMATIC"', '$[0].gtid');
JSON_CONTAINS(@json_doc, '"AUTOMATIC"', '$[0].gtid')
0
SELECT JSON_CONTAINS(@json_doc, '"REPEATABLE READ"', '$[0].isolation');
JSON_CONTAINS(@json_doc, '"REPEATABLE READ"', '$[0].isolation')
1
SELECT JSON_KEYS(JSON_EXTRACT(@json_doc, '$[0].statements_executed[0]'));
JSON_KEYS(JSON_EXTRACT(@json_doc, '$[0].statements_executed[0]'))
["sql_text", "time", "schema", "rows_examined", "rows_affected", "rows_sent", "tmp_tables", "tmp_disk_tables", "sort_rows", "sort_merge_passes"]
SELECT JSON_CONTAINS_PATH(@json_doc, 'one', '$[0].statements_executed[0].time');
JSON_CONTAINS_PATH(@json_doc, 'one', '$[0].statements_executed[0].time')
1
SELECT JSON_CONTAINS(@json_doc, '"INSERT INTO info VALUES (1, \'foo\')"', '$[0].statements_executed[0].sql_text');
JSON_CONTAINS(@json_doc, '"INSERT INTO info VALUES (1, \'foo\')"', '$[0].statements_executed[0].sql_text')
1
SELECT JSON_CONTAINS(@json_doc, '"trx"', '$[0].statements_executed[0].schema');
JSON_CONTAINS(@json_doc, '"trx"', '$[0].statements_executed[0].schema')
1
SELECT JSON_CONTAINS(@json_doc, '0', '$[0].statements_executed[0].rows_examined');
JSON_CONTAINS(@json_doc, '0', '$[0].statements_executed[0].rows_examined')
1
SELECT JSON_CONTAINS(@json_doc, '1', '$[0].statements_executed[0].rows_affected');
JSON_CONTAINS(@json_doc, '1', '$[0].statements_executed[0].rows_affected')
1
SELECT JSON_CONTAINS(@json_doc, '0', '$[0].statements_executed[0].rows_sent');
JSON_CONTAINS(@json_doc, '0', '$[0].statements_executed[0].rows_sent')
1
SELECT JSON_CONTAINS(@json_doc, '0', '$[0].statements_executed[0].tmp_tables');
JSON_CONTAINS(@json_doc, '0', '$[0].statements_executed[0].tmp_tables')
1
SELECT JSON_CONTAINS(@json_doc, '0', '$[0].statements_executed[0].tmp_disk_tables');
JSON_CONTAINS(@json_doc, '0', '$[0].statements_executed[0].tmp_disk_tables')
1
SELECT JSON_CONTAINS(@json_doc, '0', '$[0].statements_executed[0].sort_rows');
JSON_CONTAINS(@json_doc, '0', '$[0].statements_executed[0].sort_rows')
1
SELECT JSON_CONTAINS(@json_doc, '0', '$[0].statements_executed[0].sort_merge_passes');
JSON_CONTAINS(@json_doc, '0', '$[0].statements_executed[0].sort_merge_passes')
1
SELECT JSON_CONTAINS(@json_doc, '"COMMIT"', '$[0].statements_executed[1].sql_text');
JSON_CONTAINS(@json_doc, '"COMMIT"', '$[0].statements_executed[1].sql_text')
1
SET @sys.ps_thread_trx_info.max_length = 100;
SELECT sys.ps_thread_trx_info(@ps_thread_id);
sys.ps_thread_trx_info(@ps_thread_id)
{ "error": "Trx info truncated: Row 1X was cut by GROUP_CONCAT()" }
SET @sys.ps_thread_trx_info.max_length = NULL;
SELECT JSON_VALID(sys.ps_thread_trx_info(@ps_thread_id));
JSON_VALID(sys.ps_thread_trx_info(@ps_thread_id))
1
disconnect con1;
DROP DATABASE trx;
SELECT sys.quote_identifier(NULL);
sys.quote_identifier(NULL)
NULL
SELECT sys.quote_identifier('abc');
sys.quote_identifier('abc')
`abc`
SELECT sys.quote_identifier('ab`c');
sys.quote_identifier('ab`c')
`ab``c`
SELECT sys.quote_identifier('ab``c');
sys.quote_identifier('ab``c')
`ab````c`
SELECT sys.quote_identifier('ab```c');
sys.quote_identifier('ab```c')
`ab``````c`
SELECT sys.quote_identifier('a`b`c');
sys.quote_identifier('a`b`c')
`a``b``c`
SELECT sys.quote_identifier('a`b``c');
sys.quote_identifier('a`b``c')
`a``b````c`
SET @sys.statement_truncate_len := IFNULL(@sys.statement_truncate_len, sys.sys_get_config('statement_truncate_len', 128));
SELECT @sys.statement_truncate_len;
@sys.statement_truncate_len
64
SET @sys.foo := IFNULL(@sys.foo, sys.sys_get_config('foo', 'foobar'));
SELECT @sys.foo;
@sys.foo
foobar
CREATE TEMPORARY TABLE tmp_global_priv AS SELECT * FROM mysql.global_priv;
CREATE TEMPORARY TABLE tmp_tables_priv AS SELECT * FROM mysql.tables_priv;
DROP DATABASE sys;
SHOW DATABASES;
Database
information_schema
mtr
mysql
performance_schema
test
SHOW DATABASES;
Database
information_schema
mtr
mysql
performance_schema
sys
test
TRUNCATE TABLE mysql.global_priv;
INSERT INTO mysql.global_priv (SELECT * FROM tmp_global_priv);
DROP TEMPORARY TABLE tmp_global_priv;
TRUNCATE TABLE mysql.tables_priv;
INSERT INTO mysql.tables_priv (SELECT * FROM tmp_tables_priv);
DROP TEMPORARY TABLE tmp_tables_priv;
FLUSH PRIVILEGES;
CREATE TABLE t1 (t1_id int PRIMARY KEY, t1_val varchar(10));
CREATE TABLE t2 (t2_id int PRIMARY KEY, t1_id int, t2_val int, INDEX (t1_id));
CREATE TABLE `is` (t1_id int PRIMARY KEY, t1_val varchar(10));
CREATE TABLE `ab``c` (t1_id int PRIMARY KEY, t1_val varchar(10));
CREATE SQL SECURITY INVOKER VIEW myview AS SELECT * FROM t1 NATURAL JOIN t2;
CALL sys.create_synonym_db('test', 'test1');
summary
Created 5 views in the `test1` database
SELECT TABLE_NAME, SECURITY_TYPE FROM information_schema.VIEWS WHERE TABLE_SCHEMA = 'test1' ORDER BY TABLE_NAME;
TABLE_NAME SECURITY_TYPE
ab`c INVOKER
is INVOKER
myview INVOKER
t1 INVOKER
t2 INVOKER
CALL sys.create_synonym_db('test', 'test1');
ERROR HY000: Can't create database test1; database exists
CREATE SCHEMA test2;
CALL sys.create_synonym_db('test', 'test2');
ERROR HY000: Can't create database test2; database exists
SELECT COUNT(*) FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'test2';
COUNT(*)
0
CALL sys.create_synonym_db('test', 'is');
summary
Created 5 views in the `is` database
SELECT TABLE_NAME, SECURITY_TYPE FROM information_schema.VIEWS WHERE TABLE_SCHEMA = 'is' ORDER BY TABLE_NAME;
TABLE_NAME SECURITY_TYPE
ab`c INVOKER
is INVOKER
myview INVOKER
t1 INVOKER
t2 INVOKER
CALL sys.create_synonym_db('is', 'i`s');
summary
Created 5 views in the `i``s` database
SELECT TABLE_NAME, SECURITY_TYPE FROM information_schema.VIEWS WHERE TABLE_SCHEMA = 'i`s' ORDER BY TABLE_NAME;
TABLE_NAME SECURITY_TYPE
ab`c INVOKER
is INVOKER
myview INVOKER
t1 INVOKER
t2 INVOKER
DROP SCHEMA test1;
DROP SCHEMA test2;
DROP SCHEMA `is`;
DROP SCHEMA `i``s`;
DROP VIEW test.myview;
DROP TABLE test.t1;
DROP TABLE test.t2;
DROP TABLE `is`;
DROP TABLE `ab``c`;
SET @sys.debug = 'ON',
@sys.diagnostics.allow_i_s_tables = 'ON',
@sys.diagnostics.include_raw = 'ON';
CALL sys.diagnostics(4, 2, 'full');
SET @sys.debug = 'OFF',
@sys.diagnostics.allow_i_s_tables = 'OFF',
@sys.diagnostics.include_raw = 'OFF';
CALL sys.diagnostics(0, 0, 'full');
summary
Disabled 1 thread
ERROR 45000: in_max_runtime must be greater than 0
CALL sys.diagnostics(2, 0, 'full');
ERROR 45000: in_interval must be greater than 0
CALL sys.diagnostics(1, 2, 'full');
ERROR 45000: in_max_runtime must be greater than or equal to in_interval
SET @sql := "CREATE TABLE test.t1 (i INT) Engine=MEMORY";
CALL sys.execute_prepared_stmt(@sql);
SHOW CREATE TABLE test.t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1
SET @sql := CONCAT('INSERT INTO test.t1 VALUES (', 1, ')');
CALL sys.execute_prepared_stmt(@sql);
SELECT * FROM test.t1;
i
1
SET @sql := "DROP TABLE test.t1";
CALL sys.execute_prepared_stmt(@sql);
SHOW TABLES;
Tables_in_test
SET @sql = NULL;
CALL sys.execute_prepared_stmt(NULL);
ERROR 45000: The @sys.execute_prepared_stmt.sql must contain a query
CALL sys.execute_prepared_stmt('foo');
ERROR 45000: The @sys.execute_prepared_stmt.sql must contain a query
CALL sys.ps_setup_reset_to_default(TRUE);
status
Resetting: setup_actors
DELETE
FROM performance_schema.setup_actors
WHERE NOT (HOST = '%' AND USER = '%' AND ROLE = '%')
status
Resetting: setup_actors
INSERT IGNORE INTO performance_schema.setup_actors
VALUES ('%', '%', '%', 'YES', 'YES')
status
Resetting: setup_instruments
UPDATE performance_schema.setup_instruments
SET ENABLED = sys.ps_is_instrument_default_enabled(NAME),
TIMED = sys.ps_is_instrument_default_timed(NAME)
status
Resetting: setup_consumers
UPDATE performance_schema.setup_consumers
SET ENABLED = IF(NAME IN ('events_statements_current', 'events_transactions_current', 'global_instrumentation', 'thread_instrumentation', 'statements_digest'), 'YES', 'NO')
status
Resetting: setup_objects
DELETE
FROM performance_schema.setup_objects
WHERE NOT (OBJECT_TYPE IN ('EVENT', 'FUNCTION', 'PROCEDURE', 'TABLE', 'TRIGGER') AND OBJECT_NAME = '%'
AND (OBJECT_SCHEMA = 'mysql'AND ENABLED = 'NO'AND TIMED = 'NO' )
OR (OBJECT_SCHEMA = 'performance_schema' AND ENABLED = 'NO'AND TIMED = 'NO' )
OR (OBJECT_SCHEMA = 'information_schema' AND ENABLED = 'NO'AND TIMED = 'NO' )
OR (OBJECT_SCHEMA = '%'AND ENABLED = 'YES' AND TIMED = 'YES'))
status
Resetting: setup_objects
INSERT IGNORE INTO performance_schema.setup_objects
VALUES ('EVENT', 'mysql' , '%', 'NO' , 'NO' ),
('EVENT', 'performance_schema', '%', 'NO' , 'NO' ),
('EVENT', 'information_schema', '%', 'NO' , 'NO' ),
('EVENT', '%' , '%', 'YES', 'YES'),
('FUNCTION' , 'mysql' , '%', 'NO' , 'NO' ),
('FUNCTION' , 'performance_schema', '%', 'NO' , 'NO' ),
('FUNCTION' , 'information_schema', '%', 'NO' , 'NO' ),
('FUNCTION' , '%' , '%', 'YES', 'YES'),
('PROCEDURE', 'mysql' , '%', 'NO' , 'NO' ),
('PROCEDURE', 'performance_schema', '%', 'NO' , 'NO' ),
('PROCEDURE', 'information_schema', '%', 'NO' , 'NO' ),
('PROCEDURE', '%' , '%', 'YES', 'YES'),
('TABLE', 'mysql' , '%', 'NO' , 'NO' ),
('TABLE', 'performance_schema', '%', 'NO' , 'NO' ),
('TABLE', 'information_schema', '%', 'NO' , 'NO' ),
('TABLE', '%' , '%', 'YES', 'YES'),
('TRIGGER', 'mysql' , '%', 'NO' , 'NO' ),
('TRIGGER', 'performance_schema', '%', 'NO' , 'NO' ),
('TRIGGER', 'information_schema', '%', 'NO' , 'NO' ),
('TRIGGER', '%' , '%', 'YES', 'YES')
status
Resetting: threads
UPDATE performance_schema.threads
SET INSTRUMENTED = 'YES'
UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES';
TRUNCATE TABLE performance_schema.setup_actors;
INSERT INTO performance_schema.setup_actors VALUES ('%', '%', '%', 'YES', 'YES');
UPDATE performance_schema.setup_consumers SET enabled = 'YES';
UPDATE performance_schema.threads SET instrumented = 'YES';
INSERT INTO performance_schema.setup_actors
VALUES ('localhost', 'foo', '%', 'YES', 'YES'),
('localhost', 'bar', '%', 'NO', 'NO');
UPDATE performance_schema.setup_instruments
SET ENABLED = 'NO'
WHERE NAME LIKE 'stage/innodb/%'
OR NAME LIKE 'statement/com/%'
OR NAME = 'idle';
UPDATE performance_schema.setup_consumers
SET ENABLED = 'NO'
WHERE NAME LIKE '%\_history\_long';
UPDATE performance_schema.threads SET INSTRUMENTED = 'NO' WHERE NAME LIKE 'thread/innodb/srv\_%';
CALL sys.ps_setup_show_disabled(FALSE, FALSE);
performance_schema_enabled
1
object_type objects enabled timed
EVENT information_schema.% NO NO
EVENT mysql.% NO NO
EVENT performance_schema.% NO NO
FUNCTION information_schema.% NO NO
FUNCTION mysql.% NO NO
FUNCTION performance_schema.% NO NO
PROCEDURE information_schema.% NO NO
PROCEDURE mysql.% NO NO
PROCEDURE performance_schema.% NO NO
TABLE information_schema.% NO NO
TABLE mysql.% NO NO
TABLE performance_schema.% NO NO
TRIGGER information_schema.% NO NO
TRIGGER mysql.% NO NO
TRIGGER performance_schema.% NO NO
disabled_consumers
events_stages_history_long
events_statements_history_long
events_transactions_history_long
events_waits_history_long
CALL sys.ps_setup_show_disabled(TRUE, FALSE);
performance_schema_enabled
1
object_type objects enabled timed
EVENT information_schema.% NO NO
EVENT mysql.% NO NO
EVENT performance_schema.% NO NO
FUNCTION information_schema.% NO NO
FUNCTION mysql.% NO NO
FUNCTION performance_schema.% NO NO
PROCEDURE information_schema.% NO NO
PROCEDURE mysql.% NO NO
PROCEDURE performance_schema.% NO NO
TABLE information_schema.% NO NO
TABLE mysql.% NO NO
TABLE performance_schema.% NO NO
TRIGGER information_schema.% NO NO
TRIGGER mysql.% NO NO
TRIGGER performance_schema.% NO NO
disabled_consumers
events_stages_history_long
events_statements_history_long
events_transactions_history_long
events_waits_history_long
disabled_instruments timed
idle YES
stage/innodb/alter table (end) YES
stage/innodb/alter table (insert) YES
stage/innodb/alter table (log apply index) YES
stage/innodb/alter table (log apply table) YES
stage/innodb/alter table (merge sort) YES
stage/innodb/alter table (read PK and internal sort) YES
stage/innodb/buffer pool load YES
statement/com/Binlog Dump YES
statement/com/Bulk_execute YES
statement/com/Change user YES
statement/com/Close stmt YES
statement/com/Connect YES
statement/com/Connect Out YES
statement/com/Create DB YES
statement/com/Daemon YES
statement/com/Debug YES
statement/com/Delayed insert YES
statement/com/Drop DB YES
statement/com/Error YES
statement/com/Execute YES
statement/com/Fetch YES
statement/com/Field List YES
statement/com/Init DB YES
statement/com/Kill YES
statement/com/Long Data YES
statement/com/Ping YES
statement/com/Prepare YES
statement/com/Processlist YES
statement/com/Quit YES
statement/com/Refresh YES
statement/com/Register Slave YES
statement/com/Reset connection YES
statement/com/Reset stmt YES
statement/com/Set option YES
statement/com/Shutdown YES
statement/com/Slave_IO YES
statement/com/Slave_SQL YES
statement/com/Slave_worker YES
statement/com/Sleep YES
statement/com/Statistics YES
statement/com/Table Dump YES
statement/com/Time YES
statement/com/Unimpl get tid YES
CALL sys.ps_setup_show_disabled(FALSE, TRUE);
performance_schema_enabled
1
object_type objects enabled timed
EVENT information_schema.% NO NO
EVENT mysql.% NO NO
EVENT performance_schema.% NO NO
FUNCTION information_schema.% NO NO
FUNCTION mysql.% NO NO
FUNCTION performance_schema.% NO NO
PROCEDURE information_schema.% NO NO
PROCEDURE mysql.% NO NO
PROCEDURE performance_schema.% NO NO
TABLE information_schema.% NO NO
TABLE mysql.% NO NO
TABLE performance_schema.% NO NO
TRIGGER information_schema.% NO NO
TRIGGER mysql.% NO NO
TRIGGER performance_schema.% NO NO
disabled_consumers
events_stages_history_long
events_statements_history_long
events_transactions_history_long
events_waits_history_long
disabled_threads thread_type
CALL sys.ps_setup_show_disabled(TRUE, TRUE);
performance_schema_enabled
1
object_type objects enabled timed
EVENT information_schema.% NO NO
EVENT mysql.% NO NO
EVENT performance_schema.% NO NO
FUNCTION information_schema.% NO NO
FUNCTION mysql.% NO NO
FUNCTION performance_schema.% NO NO
PROCEDURE information_schema.% NO NO
PROCEDURE mysql.% NO NO
PROCEDURE performance_schema.% NO NO
TABLE information_schema.% NO NO
TABLE mysql.% NO NO
TABLE performance_schema.% NO NO
TRIGGER information_schema.% NO NO
TRIGGER mysql.% NO NO
TRIGGER performance_schema.% NO NO
disabled_consumers
events_stages_history_long
events_statements_history_long
events_transactions_history_long
events_waits_history_long
disabled_threads thread_type
disabled_instruments timed
idle YES
stage/innodb/alter table (end) YES
stage/innodb/alter table (insert) YES
stage/innodb/alter table (log apply index) YES
stage/innodb/alter table (log apply table) YES
stage/innodb/alter table (merge sort) YES
stage/innodb/alter table (read PK and internal sort) YES
stage/innodb/buffer pool load YES
statement/com/Binlog Dump YES
statement/com/Bulk_execute YES
statement/com/Change user YES
statement/com/Close stmt YES
statement/com/Connect YES
statement/com/Connect Out YES
statement/com/Create DB YES
statement/com/Daemon YES
statement/com/Debug YES
statement/com/Delayed insert YES
statement/com/Drop DB YES
statement/com/Error YES
statement/com/Execute YES
statement/com/Fetch YES
statement/com/Field List YES
statement/com/Init DB YES
statement/com/Kill YES
statement/com/Long Data YES
statement/com/Ping YES
statement/com/Prepare YES
statement/com/Processlist YES
statement/com/Quit YES
statement/com/Refresh YES
statement/com/Register Slave YES
statement/com/Reset connection YES
statement/com/Reset stmt YES
statement/com/Set option YES
statement/com/Shutdown YES
statement/com/Slave_IO YES
statement/com/Slave_SQL YES
statement/com/Slave_worker YES
statement/com/Sleep YES
statement/com/Statistics YES
statement/com/Table Dump YES
statement/com/Time YES
statement/com/Unimpl get tid YES
UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES';
TRUNCATE TABLE performance_schema.setup_actors;
INSERT INTO performance_schema.setup_actors VALUES ('%', '%', '%', 'YES', 'YES');
UPDATE performance_schema.setup_consumers SET enabled = 'YES';
UPDATE performance_schema.threads SET instrumented = 'YES';
UPDATE performance_schema.setup_consumers
SET ENABLED = 'NO'
WHERE NAME LIKE '%\_history\_long';
CALL sys.ps_setup_show_disabled_consumers();
disabled_consumers
events_stages_history_long
events_statements_history_long
events_transactions_history_long
events_waits_history_long
UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES';
TRUNCATE TABLE performance_schema.setup_actors;
INSERT INTO performance_schema.setup_actors VALUES ('%', '%', '%', 'YES', 'YES');
UPDATE performance_schema.setup_consumers SET enabled = 'YES';
UPDATE performance_schema.threads SET instrumented = 'YES';
UPDATE performance_schema.setup_instruments
SET ENABLED = 'NO'
WHERE NAME LIKE 'stage/innodb/%'
OR NAME LIKE 'statement/com/%'
OR NAME = 'idle';
CALL sys.ps_setup_show_disabled_instruments();
disabled_instruments timed
idle YES
stage/innodb/alter table (end) YES
stage/innodb/alter table (insert) YES
stage/innodb/alter table (log apply index) YES
stage/innodb/alter table (log apply table) YES
stage/innodb/alter table (merge sort) YES
stage/innodb/alter table (read PK and internal sort) YES
stage/innodb/buffer pool load YES
statement/com/Binlog Dump YES
statement/com/Bulk_execute YES
statement/com/Change user YES
statement/com/Close stmt YES
statement/com/Connect YES
statement/com/Connect Out YES
statement/com/Create DB YES
statement/com/Daemon YES
statement/com/Debug YES
statement/com/Delayed insert YES
statement/com/Drop DB YES
statement/com/Error YES
statement/com/Execute YES
statement/com/Fetch YES
statement/com/Field List YES
statement/com/Init DB YES
statement/com/Kill YES
statement/com/Long Data YES
statement/com/Ping YES
statement/com/Prepare YES
statement/com/Processlist YES
statement/com/Quit YES
statement/com/Refresh YES
statement/com/Register Slave YES
statement/com/Reset connection YES
statement/com/Reset stmt YES
statement/com/Set option YES
statement/com/Shutdown YES
statement/com/Slave_IO YES
statement/com/Slave_SQL YES
statement/com/Slave_worker YES
statement/com/Sleep YES
statement/com/Statistics YES
statement/com/Table Dump YES
statement/com/Time YES
statement/com/Unimpl get tid YES
UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES';
TRUNCATE TABLE performance_schema.setup_actors;
INSERT INTO performance_schema.setup_actors VALUES ('%', '%', '%', 'YES', 'YES');
UPDATE performance_schema.setup_consumers SET enabled = 'YES';
UPDATE performance_schema.threads SET instrumented = 'YES';
This diff is collapsed.
UPDATE performance_schema.setup_consumers
SET ENABLED = 'NO'
WHERE NAME LIKE '%\_history\_long';
CALL sys.ps_setup_show_enabled_consumers();
enabled_consumers
events_stages_current
events_stages_history
events_statements_current
events_statements_history
events_transactions_current
events_transactions_history
events_waits_current
events_waits_history
global_instrumentation
statements_digest
thread_instrumentation
UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES';
TRUNCATE TABLE performance_schema.setup_actors;
INSERT INTO performance_schema.setup_actors VALUES ('%', '%', '%', 'YES', 'YES');
UPDATE performance_schema.setup_consumers SET enabled = 'YES';
UPDATE performance_schema.threads SET instrumented = 'YES';
UPDATE performance_schema.setup_instruments
SET ENABLED = 'NO'
WHERE NAME NOT LIKE 'memory/performance_schema/%'
AND NAME NOT LIKE 'stage/innodb/%'
AND NAME NOT LIKE 'statement/com/%'
AND NAME <> 'idle';
CALL sys.ps_setup_show_enabled_instruments();
enabled_instruments timed
idle YES
memory/performance_schema/accounts NO
memory/performance_schema/cond_class NO
memory/performance_schema/cond_instances NO
memory/performance_schema/events_stages_history NO
memory/performance_schema/events_stages_history_long NO
memory/performance_schema/events_stages_summary_by_account_by_event_name NO
memory/performance_schema/events_stages_summary_by_host_by_event_name NO
memory/performance_schema/events_stages_summary_by_thread_by_event_name NO
memory/performance_schema/events_stages_summary_by_user_by_event_name NO
memory/performance_schema/events_stages_summary_global_by_event_name NO
memory/performance_schema/events_statements_current NO
memory/performance_schema/events_statements_current.sqltext NO
memory/performance_schema/events_statements_current.tokens NO
memory/performance_schema/events_statements_history NO
memory/performance_schema/events_statements_history.sqltext NO
memory/performance_schema/events_statements_history.tokens NO
memory/performance_schema/events_statements_history_long NO
memory/performance_schema/events_statements_history_long.sqltext NO
memory/performance_schema/events_statements_history_long.tokens NO
memory/performance_schema/events_statements_summary_by_account_by_event_name NO
memory/performance_schema/events_statements_summary_by_digest NO
memory/performance_schema/events_statements_summary_by_digest.tokens NO
memory/performance_schema/events_statements_summary_by_host_by_event_name NO
memory/performance_schema/events_statements_summary_by_program NO
memory/performance_schema/events_statements_summary_by_thread_by_event_name NO
memory/performance_schema/events_statements_summary_by_user_by_event_name NO
memory/performance_schema/events_statements_summary_global_by_event_name NO
memory/performance_schema/events_transactions_history NO
memory/performance_schema/events_transactions_history_long NO
memory/performance_schema/events_transactions_summary_by_account_by_event_name NO
memory/performance_schema/events_transactions_summary_by_host_by_event_name NO
memory/performance_schema/events_transactions_summary_by_thread_by_event_name NO
memory/performance_schema/events_transactions_summary_by_user_by_event_name NO
memory/performance_schema/events_waits_history NO
memory/performance_schema/events_waits_history_long NO
memory/performance_schema/events_waits_summary_by_account_by_event_name NO
memory/performance_schema/events_waits_summary_by_host_by_event_name NO
memory/performance_schema/events_waits_summary_by_thread_by_event_name NO
memory/performance_schema/events_waits_summary_by_user_by_event_name NO
memory/performance_schema/file_class NO
memory/performance_schema/file_handle NO
memory/performance_schema/file_instances NO
memory/performance_schema/hosts NO
memory/performance_schema/memory_class NO
memory/performance_schema/memory_summary_by_account_by_event_name NO
memory/performance_schema/memory_summary_by_host_by_event_name NO
memory/performance_schema/memory_summary_by_thread_by_event_name NO
memory/performance_schema/memory_summary_by_user_by_event_name NO
memory/performance_schema/memory_summary_global_by_event_name NO
memory/performance_schema/metadata_locks NO
memory/performance_schema/mutex_class NO
memory/performance_schema/mutex_instances NO
memory/performance_schema/prepared_statements_instances NO
memory/performance_schema/rwlock_class NO
memory/performance_schema/rwlock_instances NO
memory/performance_schema/scalable_buffer NO
memory/performance_schema/session_connect_attrs NO
memory/performance_schema/setup_actors NO
memory/performance_schema/setup_objects NO
memory/performance_schema/socket_class NO
memory/performance_schema/socket_instances NO
memory/performance_schema/stage_class NO
memory/performance_schema/statement_class NO
memory/performance_schema/table_handles NO
memory/performance_schema/table_io_waits_summary_by_index_usage NO
memory/performance_schema/table_lock_waits_summary_by_table NO
memory/performance_schema/table_shares NO
memory/performance_schema/threads NO
memory/performance_schema/thread_class NO
memory/performance_schema/users NO
stage/innodb/alter table (end) YES
stage/innodb/alter table (insert) YES
stage/innodb/alter table (log apply index) YES
stage/innodb/alter table (log apply table) YES
stage/innodb/alter table (merge sort) YES
stage/innodb/alter table (read PK and internal sort) YES
stage/innodb/buffer pool load YES
statement/com/Binlog Dump YES
statement/com/Bulk_execute YES
statement/com/Change user YES
statement/com/Close stmt YES
statement/com/Connect YES
statement/com/Connect Out YES
statement/com/Create DB YES
statement/com/Daemon YES
statement/com/Debug YES
statement/com/Delayed insert YES
statement/com/Drop DB YES
statement/com/Error YES
statement/com/Execute YES
statement/com/Fetch YES
statement/com/Field List YES
statement/com/Init DB YES
statement/com/Kill YES
statement/com/Long Data YES
statement/com/Ping YES
statement/com/Prepare YES
statement/com/Processlist YES
statement/com/Quit YES
statement/com/Refresh YES
statement/com/Register Slave YES
statement/com/Reset connection YES
statement/com/Reset stmt YES
statement/com/Set option YES
statement/com/Shutdown YES
statement/com/Slave_IO YES
statement/com/Slave_SQL YES
statement/com/Slave_worker YES
statement/com/Sleep YES
statement/com/Statistics YES
statement/com/Table Dump YES
statement/com/Time YES
statement/com/Unimpl get tid YES
UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES';
TRUNCATE TABLE performance_schema.setup_actors;
INSERT INTO performance_schema.setup_actors VALUES ('%', '%', '%', 'YES', 'YES');
UPDATE performance_schema.setup_consumers SET enabled = 'YES';
UPDATE performance_schema.threads SET instrumented = 'YES';
use test;
SET @threadid = sys.ps_thread_id(NULL);
CREATE TABLE t1 (id INT PRIMARY KEY, val int) ENGINE=MEMORY;
INSERT INTO test.t1 VALUES (1, 9);
SET @digest.insert = (SELECT DIGEST FROM performance_schema.events_statements_history WHERE THREAD_ID = @threadid AND SQL_TEXT LIKE 'INSERT INTO test.t1 VALUES (1, 9)');
SELECT * FROM t1;
id val
1 9
SET @digest.select = (SELECT DIGEST FROM performance_schema.events_statements_history WHERE THREAD_ID = @threadid AND SQL_TEXT LIKE 'SELECT * FROM t1');
SHOW CREATE TABLE test.t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL,
`val` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1
SET @digest.show = (SELECT DIGEST FROM performance_schema.events_statements_history WHERE THREAD_ID = @threadid AND SQL_TEXT LIKE 'SHOW CREATE TABLE test.t1');
CREATE SCHEMA test_sys;
use test_sys;
CALL sys.ps_trace_statement_digest(@digest.insert, 0.5, 0.1, FALSE, FALSE);
CALL sys.ps_trace_statement_digest(@digest.select, 0.5, 0.1, FALSE, FALSE);
CALL sys.ps_trace_statement_digest(@digest.show , 0.5, 0.1, FALSE, FALSE);
CALL sys.ps_trace_statement_digest(@digest.insert, 0.5, 0.1, TRUE , FALSE);
use test;
DROP SCHEMA test_sys;
DROP TABLE t1;
SET @threadid = NULL,
@digest.insert = NULL,
@digest.select = NULL,
@digest.show = NULL;
DROP TABLE IF EXISTS t1, t2;
DROP VIEW IF EXISTS v_t1;
CREATE TABLE t1 (id INT PRIMARY KEY);
CREATE view v_t1 AS SELECT * FROM t1;
CALL sys.table_exists('test', 't1', @exists);
SELECT @exists;
@exists
BASE TABLE
CALL sys.table_exists('test', 'v_t1', @exists);
SELECT @exists;
@exists
VIEW
CREATE TEMPORARY TABLE t1 (id INT PRIMARY KEY);
CALL sys.table_exists('test', 't1', @exists);
SELECT @exists;
@exists
TEMPORARY
CALL sys.table_exists('test', 't2', @exists);
SELECT @exists;
@exists
SET @identifier := REPEAT('a', 65);
CALL sys.table_exists(@identifier, 't1', @exists);
ERROR 22001: Data too long for column 'in_db' at row 1
CALL sys.table_exists('test', @identifier, @exists);
ERROR 22001: Data too long for column 'in_table' at row 1
DROP TEMPORARY TABLE t1;
DROP TABLE t1;
DROP VIEW v_t1;
SET @identifier := NULL;
DESC sys.sys_config;
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
SELECT variable, value, set_by FROM sys.sys_config ORDER BY 1;
variable value set_by
diagnostics.allow_i_s_tables OFF NULL
diagnostics.include_raw OFF NULL
ps_thread_trx_info.max_length 65535 NULL
statement_performance_analyzer.limit 100 NULL
statement_performance_analyzer.view NULL NULL
statement_truncate_len 64 NULL
UPDATE sys.sys_config SET value = 128 WHERE variable = 'statement_truncate_len';
SELECT variable, value, set_by FROM sys.sys_config ORDER BY 1;
variable value set_by
diagnostics.allow_i_s_tables OFF NULL
diagnostics.include_raw OFF NULL
ps_thread_trx_info.max_length 65535 NULL
statement_performance_analyzer.limit 100 NULL
statement_performance_analyzer.view NULL NULL
statement_truncate_len 128 NULL
INSERT INTO sys.sys_config (variable, value) VALUES ('foo', 'bar');
SELECT variable, value, set_by FROM sys.sys_config ORDER BY 1;
variable value set_by
diagnostics.allow_i_s_tables OFF NULL
diagnostics.include_raw OFF NULL
foo bar NULL
ps_thread_trx_info.max_length 65535 NULL
statement_performance_analyzer.limit 100 NULL
statement_performance_analyzer.view NULL NULL
statement_truncate_len 128 NULL
SET @sys.ignore_sys_config_triggers := true;
DELETE FROM sys.sys_config;
INSERT IGNORE INTO sys.sys_config (variable, value) VALUES
('statement_truncate_len', 64),
('statement_performance_analyzer.limit', 100),
('statement_performance_analyzer.view', NULL),
('diagnostics.allow_i_s_tables', 'OFF'),
('diagnostics.include_raw', 'OFF'),
('ps_thread_trx_info.max_length', 65535);
SET @sys.ignore_sys_config_triggers := NULL;
DESC sys.host_summary;
Field Type Null Key Default Extra
host varchar(60) YES NULL
statements decimal(64,0) YES NULL
statement_latency text YES NULL
statement_avg_latency text YES NULL
table_scans decimal(65,0) YES NULL
file_ios decimal(64,0) YES NULL
file_io_latency text YES NULL
current_connections decimal(41,0) YES NULL
total_connections decimal(41,0) YES NULL
unique_users bigint(21) NO 0
current_memory text YES NULL
total_memory_allocated text YES NULL
SELECT * FROM sys.host_summary;
DESC sys.x$host_summary;
Field Type Null Key Default Extra
host varchar(60) YES NULL
statements decimal(64,0) YES NULL
statement_latency decimal(64,0) YES NULL
statement_avg_latency decimal(65,4) YES NULL
table_scans decimal(65,0) YES NULL
file_ios decimal(64,0) YES NULL
file_io_latency decimal(64,0) YES NULL
current_connections decimal(41,0) YES NULL
total_connections decimal(41,0) YES NULL
unique_users bigint(21) NO 0
current_memory decimal(63,0) YES NULL
total_memory_allocated decimal(64,0) YES NULL
SELECT * FROM sys.x$host_summary;
DESC sys.host_summary_by_file_io;
Field Type Null Key Default Extra
host varchar(60) YES NULL
ios decimal(42,0) YES NULL
io_latency text YES NULL
SELECT * FROM sys.host_summary_by_file_io;
DESC sys.x$host_summary_by_file_io;
Field Type Null Key Default Extra
host varchar(60) YES NULL
ios decimal(42,0) YES NULL
io_latency decimal(42,0) YES NULL
SELECT * FROM sys.x$host_summary_by_file_io;
DESC sys.host_summary_by_file_io_type;
Field Type Null Key Default Extra
host varchar(60) YES NULL
event_name varchar(128) NO NULL
total bigint(20) unsigned NO NULL
total_latency text YES NULL
max_latency text YES NULL
SELECT * FROM sys.host_summary_by_file_io_type;
DESC sys.x$host_summary_by_file_io_type;
Field Type Null Key Default Extra
host varchar(60) YES NULL
event_name varchar(128) NO NULL
total bigint(20) unsigned NO NULL
total_latency bigint(20) unsigned NO NULL
max_latency bigint(20) unsigned NO NULL
SELECT * FROM sys.x$host_summary_by_file_io_type;
DESC sys.host_summary_by_stages;
Field Type Null Key Default Extra
host varchar(60) YES NULL
event_name varchar(128) NO NULL
total bigint(20) unsigned NO NULL
total_latency text YES NULL
avg_latency text YES NULL
SELECT * FROM sys.host_summary_by_stages;
DESC sys.x$host_summary_by_stages;
Field Type Null Key Default Extra
host varchar(60) YES NULL
event_name varchar(128) NO NULL
total bigint(20) unsigned NO NULL
total_latency bigint(20) unsigned NO NULL
avg_latency bigint(20) unsigned NO NULL
SELECT * FROM sys.x$host_summary_by_stages;
DESC sys.host_summary_by_statement_latency;
Field Type Null Key Default Extra
host varchar(60) YES NULL
total decimal(42,0) YES NULL
total_latency text YES NULL
max_latency text YES NULL
lock_latency text YES NULL
rows_sent decimal(42,0) YES NULL
rows_examined decimal(42,0) YES NULL
rows_affected decimal(42,0) YES NULL
full_scans decimal(43,0) YES NULL
SELECT * FROM sys.host_summary_by_statement_latency;
DESC sys.x$host_summary_by_statement_latency;
Field Type Null Key Default Extra
host varchar(60) YES NULL
total decimal(42,0) YES NULL
total_latency decimal(42,0) YES NULL
max_latency bigint(20) unsigned YES NULL
lock_latency decimal(42,0) YES NULL
rows_sent decimal(42,0) YES NULL
rows_examined decimal(42,0) YES NULL
rows_affected decimal(42,0) YES NULL
full_scans decimal(43,0) YES NULL
SELECT * FROM sys.x$host_summary_by_statement_latency;
DESC sys.host_summary_by_statement_type;
Field Type Null Key Default Extra
host varchar(60) YES NULL
statement varchar(128) YES NULL
total bigint(20) unsigned NO NULL
total_latency text YES NULL
max_latency text YES NULL
lock_latency text YES NULL
rows_sent bigint(20) unsigned NO NULL
rows_examined bigint(20) unsigned NO NULL
rows_affected bigint(20) unsigned NO NULL
full_scans bigint(21) unsigned NO 0
SELECT * FROM sys.host_summary_by_statement_type;
DESC sys.x$host_summary_by_statement_type;
Field Type Null Key Default Extra
host varchar(60) YES NULL
statement varchar(128) YES NULL
total bigint(20) unsigned NO NULL
total_latency bigint(20) unsigned NO NULL
max_latency bigint(20) unsigned NO NULL
lock_latency bigint(20) unsigned NO NULL
rows_sent bigint(20) unsigned NO NULL
rows_examined bigint(20) unsigned NO NULL
rows_affected bigint(20) unsigned NO NULL
full_scans bigint(21) unsigned NO 0
SELECT * FROM sys.x$host_summary_by_statement_type;
DESC sys.innodb_buffer_stats_by_schema;
Field Type Null Key Default Extra
object_schema text YES NULL
allocated text YES NULL
data text YES NULL
pages bigint(21) NO 0
pages_hashed bigint(21) NO 0
pages_old bigint(21) NO 0
rows_cached decimal(44,0) YES NULL
SELECT * FROM sys.innodb_buffer_stats_by_schema;
DESC sys.x$innodb_buffer_stats_by_schema;
Field Type Null Key Default Extra
object_schema text YES NULL
allocated decimal(43,0) YES NULL
data decimal(43,0) YES NULL
pages bigint(21) NO 0
pages_hashed bigint(21) NO 0
pages_old bigint(21) NO 0
rows_cached decimal(44,0) NO 0
SELECT * FROM sys.x$innodb_buffer_stats_by_schema;
DESC sys.innodb_buffer_stats_by_table;
Field Type Null Key Default Extra
object_schema text YES NULL
object_name text YES NULL
allocated text YES NULL
data text YES NULL
pages bigint(21) NO 0
pages_hashed bigint(21) NO 0
pages_old bigint(21) NO 0
rows_cached decimal(44,0) YES NULL
SELECT * FROM sys.innodb_buffer_stats_by_table;
DESC sys.x$innodb_buffer_stats_by_table;
Field Type Null Key Default Extra
object_schema text YES NULL
object_name text YES NULL
allocated decimal(43,0) YES NULL
data decimal(43,0) YES NULL
pages bigint(21) NO 0
pages_hashed bigint(21) NO 0
pages_old bigint(21) NO 0
rows_cached decimal(44,0) NO 0
SELECT * FROM sys.x$innodb_buffer_stats_by_table;
DESC sys.innodb_lock_waits;
Field Type Null Key Default Extra
wait_started datetime YES NULL
wait_age time /* mariadb-5.3 */ YES NULL
wait_age_secs bigint(21) YES NULL
locked_table varchar(1024) NO
locked_index varchar(1024) YES NULL
locked_type enum('RECORD','TABLE') NO NULL
waiting_trx_id bigint(21) unsigned NO 0
waiting_trx_started datetime NO 0000-00-00 00:00:00
waiting_trx_age time /* mariadb-5.3 */ YES NULL
waiting_trx_rows_locked bigint(21) unsigned NO 0
waiting_trx_rows_modified bigint(21) unsigned NO 0
waiting_pid bigint(21) unsigned NO 0
waiting_query longtext YES NULL
waiting_lock_id varchar(81) NO
waiting_lock_mode enum('S','S,GAP','X','X,GAP','IS','IS,GAP','IX','IX,GAP','AUTO_INC') NO NULL
blocking_trx_id bigint(21) unsigned NO 0
blocking_pid bigint(21) unsigned NO 0
blocking_query longtext YES NULL
blocking_lock_id varchar(81) NO
blocking_lock_mode enum('S','S,GAP','X','X,GAP','IS','IS,GAP','IX','IX,GAP','AUTO_INC') NO NULL
blocking_trx_started datetime NO 0000-00-00 00:00:00
blocking_trx_age time /* mariadb-5.3 */ YES NULL
blocking_trx_rows_locked bigint(21) unsigned NO 0
blocking_trx_rows_modified bigint(21) unsigned NO 0
sql_kill_blocking_query varchar(32) YES NULL
sql_kill_blocking_connection varchar(26) YES NULL
SELECT * FROM sys.innodb_lock_waits;
DESC sys.x$innodb_lock_waits;
Field Type Null Key Default Extra
wait_started datetime YES NULL
wait_age time /* mariadb-5.3 */ YES NULL
wait_age_secs bigint(21) YES NULL
locked_table varchar(1024) NO
locked_index varchar(1024) YES NULL
locked_type enum('RECORD','TABLE') NO NULL
waiting_trx_id bigint(21) unsigned NO 0
waiting_trx_started datetime NO 0000-00-00 00:00:00
waiting_trx_age time /* mariadb-5.3 */ YES NULL
waiting_trx_rows_locked bigint(21) unsigned NO 0
waiting_trx_rows_modified bigint(21) unsigned NO 0
waiting_pid bigint(21) unsigned NO 0
waiting_query varchar(1024) YES NULL
waiting_lock_id varchar(81) NO
waiting_lock_mode enum('S','S,GAP','X','X,GAP','IS','IS,GAP','IX','IX,GAP','AUTO_INC') NO NULL
blocking_trx_id bigint(21) unsigned NO 0
blocking_pid bigint(21) unsigned NO 0
blocking_query varchar(1024) YES NULL
blocking_lock_id varchar(81) NO
blocking_lock_mode enum('S','S,GAP','X','X,GAP','IS','IS,GAP','IX','IX,GAP','AUTO_INC') NO NULL
blocking_trx_started datetime NO 0000-00-00 00:00:00
blocking_trx_age time /* mariadb-5.3 */ YES NULL
blocking_trx_rows_locked bigint(21) unsigned NO 0
blocking_trx_rows_modified bigint(21) unsigned NO 0
sql_kill_blocking_query varchar(32) YES NULL
sql_kill_blocking_connection varchar(26) YES NULL
SELECT * FROM sys.x$innodb_lock_waits;
DESC sys.io_by_thread_by_latency;
Field Type Null Key Default Extra
user varchar(189) YES NULL
total decimal(42,0) YES NULL
total_latency text YES NULL
min_latency text YES NULL
avg_latency text YES NULL
max_latency text YES NULL
thread_id bigint(20) unsigned NO NULL
processlist_id bigint(20) unsigned YES NULL
SELECT * FROM sys.io_by_thread_by_latency;
DESC sys.x$io_by_thread_by_latency;
Field Type Null Key Default Extra
user varchar(189) YES NULL
total decimal(42,0) YES NULL
total_latency decimal(42,0) YES NULL
min_latency bigint(20) unsigned YES NULL
avg_latency decimal(24,4) YES NULL
max_latency bigint(20) unsigned YES NULL
thread_id bigint(20) unsigned NO NULL
processlist_id bigint(20) unsigned YES NULL
SELECT * FROM sys.x$io_by_thread_by_latency;
DESC sys.io_global_by_file_by_bytes;
Field Type Null Key Default Extra
file varchar(512) YES NULL
count_read bigint(20) unsigned NO NULL
total_read text YES NULL
avg_read text YES NULL
count_write bigint(20) unsigned NO NULL
total_written text YES NULL
avg_write text YES NULL
total text YES NULL
write_pct decimal(26,2) NO 0.00
SELECT * FROM sys.io_global_by_file_by_bytes;
DESC sys.x$io_global_by_file_by_bytes;
Field Type Null Key Default Extra
file varchar(512) NO NULL
count_read bigint(20) unsigned NO NULL
total_read bigint(20) NO NULL
avg_read decimal(23,4) NO 0.0000
count_write bigint(20) unsigned NO NULL
total_written bigint(20) NO NULL
avg_write decimal(23,4) NO 0.0000
total bigint(21) NO 0
write_pct decimal(26,2) NO 0.00
SELECT * FROM sys.x$io_global_by_file_by_bytes;
DESC sys.io_global_by_file_by_latency;
Field Type Null Key Default Extra
file varchar(512) YES NULL
total bigint(20) unsigned NO NULL
total_latency text YES NULL
count_read bigint(20) unsigned NO NULL
read_latency text YES NULL
count_write bigint(20) unsigned NO NULL
write_latency text YES NULL
count_misc bigint(20) unsigned NO NULL
misc_latency text YES NULL
SELECT * FROM sys.io_global_by_file_by_latency;
DESC sys.x$io_global_by_file_by_latency;
Field Type Null Key Default Extra
file varchar(512) NO NULL
total bigint(20) unsigned NO NULL
total_latency bigint(20) unsigned NO NULL
count_read bigint(20) unsigned NO NULL
read_latency bigint(20) unsigned NO NULL
count_write bigint(20) unsigned NO NULL
write_latency bigint(20) unsigned NO NULL
count_misc bigint(20) unsigned NO NULL
misc_latency bigint(20) unsigned NO NULL
SELECT * FROM sys.x$io_global_by_file_by_latency;
DESC sys.io_global_by_wait_by_bytes;
Field Type Null Key Default Extra
event_name varchar(128) YES NULL
total bigint(20) unsigned NO NULL
total_latency text YES NULL
min_latency text YES NULL
avg_latency text YES NULL
max_latency text YES NULL
count_read bigint(20) unsigned NO NULL
total_read text YES NULL
avg_read text YES NULL
count_write bigint(20) unsigned NO NULL
total_written text YES NULL
avg_written text YES NULL
total_requested text YES NULL
SELECT * FROM sys.io_global_by_wait_by_bytes;
DESC sys.x$io_global_by_wait_by_bytes;
Field Type Null Key Default Extra
event_name varchar(128) YES NULL
total bigint(20) unsigned NO NULL
total_latency bigint(20) unsigned NO NULL
min_latency bigint(20) unsigned NO NULL
avg_latency bigint(20) unsigned NO NULL
max_latency bigint(20) unsigned NO NULL
count_read bigint(20) unsigned NO NULL
total_read bigint(20) NO NULL
avg_read decimal(23,4) NO 0.0000
count_write bigint(20) unsigned NO NULL
total_written bigint(20) NO NULL
avg_written decimal(23,4) NO 0.0000
total_requested bigint(21) NO 0
SELECT * FROM sys.x$io_global_by_wait_by_bytes;
DESC sys.io_global_by_wait_by_latency;
Field Type Null Key Default Extra
event_name varchar(128) YES NULL
total bigint(20) unsigned NO NULL
total_latency text YES NULL
avg_latency text YES NULL
max_latency text YES NULL
read_latency text YES NULL
write_latency text YES NULL
misc_latency text YES NULL
count_read bigint(20) unsigned NO NULL
total_read text YES NULL
avg_read text YES NULL
count_write bigint(20) unsigned NO NULL
total_written text YES NULL
avg_written text YES NULL
SELECT * FROM sys.io_global_by_wait_by_latency;
DESC sys.x$io_global_by_wait_by_latency;
Field Type Null Key Default Extra
event_name varchar(128) YES NULL
total bigint(20) unsigned NO NULL
total_latency bigint(20) unsigned NO NULL
avg_latency bigint(20) unsigned NO NULL
max_latency bigint(20) unsigned NO NULL
read_latency bigint(20) unsigned NO NULL
write_latency bigint(20) unsigned NO NULL
misc_latency bigint(20) unsigned NO NULL
count_read bigint(20) unsigned NO NULL
total_read bigint(20) NO NULL
avg_read decimal(23,4) NO 0.0000
count_write bigint(20) unsigned NO NULL
total_written bigint(20) NO NULL
avg_written decimal(23,4) NO 0.0000
SELECT * FROM sys.x$io_global_by_wait_by_latency;
DESC sys.latest_file_io;
Field Type Null Key Default Extra
thread varchar(214) YES NULL
file varchar(512) YES NULL
latency text YES NULL
operation varchar(32) NO NULL
requested text YES NULL
SELECT * FROM sys.latest_file_io;
DESC sys.x$latest_file_io;
Field Type Null Key Default Extra
thread varchar(214) YES NULL
file varchar(512) YES NULL
latency bigint(20) unsigned YES NULL
operation varchar(32) NO NULL
requested bigint(20) YES NULL
SELECT * FROM sys.x$latest_file_io;
DESC sys.memory_by_host_by_current_bytes;
Field Type Null Key Default Extra
host varchar(60) YES NULL
current_count_used decimal(41,0) YES NULL
current_allocated text YES NULL
current_avg_alloc text YES NULL
current_max_alloc text YES NULL
total_allocated text YES NULL
SELECT * FROM sys.memory_by_host_by_current_bytes;
DESC sys.x$memory_by_host_by_current_bytes;
Field Type Null Key Default Extra
host varchar(60) YES NULL
current_count_used decimal(41,0) YES NULL
current_allocated decimal(41,0) YES NULL
current_avg_alloc decimal(45,4) NO 0.0000
current_max_alloc bigint(20) YES NULL
total_allocated decimal(42,0) YES NULL
SELECT * FROM sys.x$memory_by_host_by_current_bytes;
DESC sys.memory_by_thread_by_current_bytes;
Field Type Null Key Default Extra
thread_id bigint(20) unsigned NO NULL
user varchar(189) YES NULL
current_count_used decimal(41,0) YES NULL
current_allocated text YES NULL
current_avg_alloc text YES NULL
current_max_alloc text YES NULL
total_allocated text YES NULL
SELECT * FROM sys.memory_by_thread_by_current_bytes;
DESC sys.x$memory_by_thread_by_current_bytes;
Field Type Null Key Default Extra
thread_id bigint(20) unsigned NO NULL
user varchar(189) YES NULL
current_count_used decimal(41,0) YES NULL
current_allocated decimal(41,0) YES NULL
current_avg_alloc decimal(45,4) NO 0.0000
current_max_alloc bigint(20) YES NULL
total_allocated decimal(42,0) YES NULL
SELECT * FROM sys.x$memory_by_thread_by_current_bytes;
DESC sys.memory_by_user_by_current_bytes;
Field Type Null Key Default Extra
user varchar(32) YES NULL
current_count_used decimal(41,0) YES NULL
current_allocated text YES NULL
current_avg_alloc text YES NULL
current_max_alloc text YES NULL
total_allocated text YES NULL
SELECT * FROM sys.memory_by_user_by_current_bytes;
DESC sys.x$memory_by_user_by_current_bytes;
Field Type Null Key Default Extra
user varchar(32) YES NULL
current_count_used decimal(41,0) YES NULL
current_allocated decimal(41,0) YES NULL
current_avg_alloc decimal(45,4) NO 0.0000
current_max_alloc bigint(20) YES NULL
total_allocated decimal(42,0) YES NULL
SELECT * FROM sys.x$memory_by_user_by_current_bytes;
DESC sys.memory_global_by_current_bytes;
Field Type Null Key Default Extra
event_name varchar(128) NO NULL
current_count bigint(20) NO NULL
current_alloc text YES NULL
current_avg_alloc text YES NULL
high_count bigint(20) NO NULL
high_alloc text YES NULL
high_avg_alloc text YES NULL
SELECT * FROM sys.memory_global_by_current_bytes;
DESC sys.x$memory_global_by_current_bytes;
Field Type Null Key Default Extra
event_name varchar(128) NO NULL
current_count bigint(20) NO NULL
current_alloc bigint(20) NO NULL
current_avg_alloc decimal(23,4) NO 0.0000
high_count bigint(20) NO NULL
high_alloc bigint(20) NO NULL
high_avg_alloc decimal(23,4) NO 0.0000
SELECT * FROM sys.x$memory_global_by_current_bytes;
DESC sys.memory_global_total;
Field Type Null Key Default Extra
total_allocated text YES NULL
SELECT * FROM sys.memory_global_total;
DESC sys.x$memory_global_total;
Field Type Null Key Default Extra
total_allocated decimal(41,0) YES NULL
SELECT * FROM sys.x$memory_global_total;
DESC sys.metrics;
Field Type Null Key Default Extra
Variable_name varchar(193) YES NULL
Variable_value varchar(1024) YES NULL
Type varchar(210) YES NULL
Enabled varchar(3) NO
SELECT * FROM sys.metrics;
DESC sys.processlist;
Field Type Null Key Default Extra
thd_id bigint(20) unsigned NO NULL
conn_id bigint(20) unsigned YES NULL
user varchar(189) YES NULL
db varchar(64) YES NULL
command varchar(16) YES NULL
state varchar(64) YES NULL
time bigint(20) YES NULL
current_statement longtext YES NULL
statement_latency mediumtext YES NULL
progress decimal(26,2) YES NULL
lock_latency text YES NULL
rows_examined bigint(20) unsigned YES NULL
rows_sent bigint(20) unsigned YES NULL
rows_affected bigint(20) unsigned YES NULL
tmp_tables bigint(20) unsigned YES NULL
tmp_disk_tables bigint(20) unsigned YES NULL
full_scan varchar(3) YES NULL
last_statement longtext YES NULL
last_statement_latency mediumtext YES NULL
current_memory text YES NULL
last_wait varchar(128) YES NULL
last_wait_latency mediumtext YES NULL
source varchar(64) YES NULL
trx_latency text YES NULL
trx_state enum('ACTIVE','COMMITTED','ROLLED BACK') YES NULL
trx_autocommit enum('YES','NO') YES NULL
pid varchar(1024) YES NULL
program_name varchar(1024) YES NULL
SELECT * FROM sys.processlist;
DESC sys.x$processlist;
Field Type Null Key Default Extra
thd_id bigint(20) unsigned NO NULL
conn_id bigint(20) unsigned YES NULL
user varchar(189) YES NULL
db varchar(64) YES NULL
command varchar(16) YES NULL
state varchar(64) YES NULL
time bigint(20) YES NULL
current_statement longtext YES NULL
statement_latency bigint(20) unsigned YES NULL
progress decimal(26,2) YES NULL
lock_latency bigint(20) unsigned YES NULL
rows_examined bigint(20) unsigned YES NULL
rows_sent bigint(20) unsigned YES NULL
rows_affected bigint(20) unsigned YES NULL
tmp_tables bigint(20) unsigned YES NULL
tmp_disk_tables bigint(20) unsigned YES NULL
full_scan varchar(3) YES NULL
last_statement longtext YES NULL
last_statement_latency bigint(20) unsigned YES NULL
current_memory decimal(41,0) YES NULL
last_wait varchar(128) YES NULL
last_wait_latency varchar(20) YES NULL
source varchar(64) YES NULL
trx_latency bigint(20) unsigned YES NULL
trx_state enum('ACTIVE','COMMITTED','ROLLED BACK') YES NULL
trx_autocommit enum('YES','NO') YES NULL
pid varchar(1024) YES NULL
program_name varchar(1024) YES NULL
SELECT * FROM sys.x$processlist;
DESC sys.ps_check_lost_instrumentation;
Field Type Null Key Default Extra
variable_name varchar(64) NO NULL
variable_value varchar(1024) YES NULL
SELECT * FROM sys.ps_check_lost_instrumentation;
DESC sys.x$ps_digest_95th_percentile_by_avg_us;
Field Type Null Key Default Extra
avg_us decimal(21,0) YES NULL
percentile decimal(46,4) NO 0.0000
DESC sys.x$ps_digest_95th_percentile_by_avg_us;
Field Type Null Key Default Extra
avg_us decimal(21,0) YES NULL
percentile decimal(46,4) NO 0.0000
DESC sys.x$ps_digest_95th_percentile_by_avg_us;
Field Type Null Key Default Extra
avg_us decimal(21,0) YES NULL
percentile decimal(46,4) NO 0.0000
SELECT * FROM sys.x$ps_digest_95th_percentile_by_avg_us;
DESC sys.x$ps_digest_95th_percentile_by_avg_us;
Field Type Null Key Default Extra
avg_us decimal(21,0) YES NULL
percentile decimal(46,4) NO 0.0000
SELECT * FROM sys.x$ps_digest_95th_percentile_by_avg_us;
DESC sys.x$ps_digest_avg_latency_distribution;
Field Type Null Key Default Extra
cnt bigint(21) NO 0
avg_us decimal(21,0) YES NULL
DESC sys.x$ps_digest_avg_latency_distribution;
Field Type Null Key Default Extra
cnt bigint(21) NO 0
avg_us decimal(21,0) YES NULL
DESC sys.x$ps_digest_avg_latency_distribution;
Field Type Null Key Default Extra
cnt bigint(21) NO 0
avg_us decimal(21,0) YES NULL
SELECT * FROM sys.x$ps_digest_avg_latency_distribution;
DESC sys.x$ps_digest_avg_latency_distribution;
Field Type Null Key Default Extra
cnt bigint(21) NO 0
avg_us decimal(21,0) YES NULL
SELECT * FROM sys.x$ps_digest_avg_latency_distribution;
DESC sys.x$ps_schema_table_statistics_io;
Field Type Null Key Default Extra
table_schema varchar(64) YES NULL
table_name varchar(64) YES NULL
count_read decimal(42,0) YES NULL
sum_number_of_bytes_read decimal(41,0) YES NULL
sum_timer_read decimal(42,0) YES NULL
count_write decimal(42,0) YES NULL
sum_number_of_bytes_write decimal(41,0) YES NULL
sum_timer_write decimal(42,0) YES NULL
count_misc decimal(42,0) YES NULL
sum_timer_misc decimal(42,0) YES NULL
DESC sys.x$ps_schema_table_statistics_io;
Field Type Null Key Default Extra
table_schema varchar(64) YES NULL
table_name varchar(64) YES NULL
count_read decimal(42,0) YES NULL
sum_number_of_bytes_read decimal(41,0) YES NULL
sum_timer_read decimal(42,0) YES NULL
count_write decimal(42,0) YES NULL
sum_number_of_bytes_write decimal(41,0) YES NULL
sum_timer_write decimal(42,0) YES NULL
count_misc decimal(42,0) YES NULL
sum_timer_misc decimal(42,0) YES NULL
DESC sys.x$ps_schema_table_statistics_io;
Field Type Null Key Default Extra
table_schema varchar(64) YES NULL
table_name varchar(64) YES NULL
count_read decimal(42,0) YES NULL
sum_number_of_bytes_read decimal(41,0) YES NULL
sum_timer_read decimal(42,0) YES NULL
count_write decimal(42,0) YES NULL
sum_number_of_bytes_write decimal(41,0) YES NULL
sum_timer_write decimal(42,0) YES NULL
count_misc decimal(42,0) YES NULL
sum_timer_misc decimal(42,0) YES NULL
SELECT * FROM sys.x$ps_schema_table_statistics_io;
DESC sys.x$ps_schema_table_statistics_io;
Field Type Null Key Default Extra
table_schema varchar(64) YES NULL
table_name varchar(64) YES NULL
count_read decimal(42,0) YES NULL
sum_number_of_bytes_read decimal(41,0) YES NULL
sum_timer_read decimal(42,0) YES NULL
count_write decimal(42,0) YES NULL
sum_number_of_bytes_write decimal(41,0) YES NULL
sum_timer_write decimal(42,0) YES NULL
count_misc decimal(42,0) YES NULL
sum_timer_misc decimal(42,0) YES NULL
SELECT * FROM sys.x$ps_schema_table_statistics_io;
DESC sys.schema_auto_increment_columns;
Field Type Null Key Default Extra
table_schema varchar(64) NO
table_name varchar(64) NO
column_name varchar(64) NO
data_type varchar(64) NO
column_type longtext NO NULL
is_signed int(1) NO 0
is_unsigned int(1) NO 0
max_value bigint(21) unsigned YES NULL
auto_increment bigint(21) unsigned YES NULL
auto_increment_ratio decimal(25,4) unsigned YES NULL
SELECT * FROM sys.schema_auto_increment_columns;
CREATE DATABASE auto_incs;
CREATE TABLE auto_incs.tinyintcol (
id TINYINT AUTO_INCREMENT PRIMARY KEY,
foo INT
);
INSERT INTO auto_incs.tinyintcol (foo) VALUES (100);
INSERT INTO auto_incs.tinyintcol (foo) (SELECT foo FROM auto_incs.tinyintcol);
INSERT INTO auto_incs.tinyintcol (foo) (SELECT foo FROM auto_incs.tinyintcol);
INSERT INTO auto_incs.tinyintcol (foo) (SELECT foo FROM auto_incs.tinyintcol);
INSERT INTO auto_incs.tinyintcol (foo) (SELECT foo FROM auto_incs.tinyintcol);
CREATE TABLE auto_incs.tinyintcolunsigned (
id TINYINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
foo INT
);
INSERT INTO auto_incs.tinyintcolunsigned (foo) (SELECT foo FROM auto_incs.tinyintcol);
CREATE TABLE auto_incs.smallintcol (
id SMALLINT AUTO_INCREMENT PRIMARY KEY,
foo INT
);
INSERT INTO auto_incs.smallintcol (foo) VALUES (200);
INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol);
INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol);
INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol);
INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol);
INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol);
INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol);
INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol);
INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol);
INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol);
INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol);
INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol);
CREATE TABLE auto_incs.smallintcolunsigned (
id SMALLINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
foo INT
);
INSERT INTO auto_incs.smallintcolunsigned (foo) (SELECT foo FROM auto_incs.smallintcol);
CREATE TABLE auto_incs.mediumintcol (
id MEDIUMINT AUTO_INCREMENT PRIMARY KEY,
foo INT
);
INSERT INTO auto_incs.mediumintcol (foo) VALUES (300);
INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol);
INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol);
INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol);
INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol);
INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol);
INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol);
INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol);
INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol);
INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol);
INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol);
INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol);
INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol);
INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol);
INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol);
INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol);
INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol);
INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol);
CREATE TABLE auto_incs.mediumintcolunsigned (
id MEDIUMINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
foo INT
);
INSERT INTO auto_incs.mediumintcolunsigned (foo) (SELECT foo FROM auto_incs.mediumintcol);
CREATE TABLE auto_incs.intcol (
id INT AUTO_INCREMENT PRIMARY KEY,
foo INT
);
INSERT INTO auto_incs.intcol (foo) VALUES (400);
INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol);
INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol);
INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol);
INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol);
INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol);
INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol);
INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol);
INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol);
INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol);
INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol);
INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol);
INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol);
INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol);
INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol);
INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol);
INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol);
INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol);
CREATE TABLE auto_incs.intcolunsigned (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
foo INT
);
INSERT INTO auto_incs.intcolunsigned (foo) (SELECT foo FROM auto_incs.intcol);
CREATE TABLE auto_incs.bigintcol (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
foo INT
);
INSERT INTO auto_incs.bigintcol (foo) VALUES (500);
INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol);
INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol);
INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol);
INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol);
INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol);
INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol);
INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol);
INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol);
INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol);
INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol);
INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol);
INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol);
INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol);
INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol);
INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol);
INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol);
INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol);
CREATE TABLE auto_incs.bigintcolunsigned (
id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
foo INT
);
INSERT INTO auto_incs.bigintcolunsigned (foo) (SELECT foo FROM auto_incs.bigintcol);
SELECT * FROM sys.schema_auto_increment_columns;
table_schema table_name column_name data_type column_type is_signed is_unsigned max_value auto_increment auto_increment_ratio
auto_incs tinyintcol id tinyint tinyint(4) 1 0 127 28 0.2205
auto_incs tinyintcolunsigned id tinyint tinyint(3) unsigned 0 1 255 32 0.1255
auto_incs smallintcol id smallint smallint(6) 1 0 32767 4085 0.1247
auto_incs smallintcolunsigned id smallint smallint(5) unsigned 0 1 65535 4096 0.0625
auto_incs mediumintcol id mediumint mediumint(9) 1 0 8388607 262126 0.0312
auto_incs mediumintcolunsigned id mediumint mediumint(8) unsigned 0 1 16777215 196606 0.0117
auto_incs intcol id int int(11) 1 0 2147483647 262126 0.0001
auto_incs intcolunsigned id int int(10) unsigned 0 1 4294967295 196606 0.0000
auto_incs bigintcol id bigint bigint(20) 1 0 9223372036854775807 262126 0.0000
auto_incs bigintcolunsigned id bigint bigint(20) unsigned 0 1 18446744073709551615 196606 0.0000
DROP DATABASE auto_incs;
DESC sys.schema_index_statistics;
Field Type Null Key Default Extra
table_schema varchar(64) YES NULL
table_name varchar(64) YES NULL
index_name varchar(64) YES NULL
rows_selected bigint(20) unsigned NO NULL
select_latency text YES NULL
rows_inserted bigint(20) unsigned NO NULL
insert_latency text YES NULL
rows_updated bigint(20) unsigned NO NULL
update_latency text YES NULL
rows_deleted bigint(20) unsigned NO NULL
delete_latency text YES NULL
SELECT * FROM sys.schema_index_statistics;
DESC sys.x$schema_index_statistics;
Field Type Null Key Default Extra
table_schema varchar(64) YES NULL
table_name varchar(64) YES NULL
index_name varchar(64) YES NULL
rows_selected bigint(20) unsigned NO NULL
select_latency bigint(20) unsigned NO NULL
rows_inserted bigint(20) unsigned NO NULL
insert_latency bigint(20) unsigned NO NULL
rows_updated bigint(20) unsigned NO NULL
update_latency bigint(20) unsigned NO NULL
rows_deleted bigint(20) unsigned NO NULL
delete_latency bigint(20) unsigned NO NULL
SELECT * FROM sys.x$schema_index_statistics;
DESC sys.schema_object_overview;
Field Type Null Key Default Extra
db varchar(64) NO
object_type varchar(64) YES NULL
count bigint(21) NO 0
SELECT * FROM sys.schema_object_overview;
DESC sys.schema_redundant_indexes;
Field Type Null Key Default Extra
table_schema varchar(64) NO
table_name varchar(64) NO
redundant_index_name varchar(64) NO
redundant_index_columns mediumtext YES NULL
redundant_index_non_unique bigint(1) YES NULL
dominant_index_name varchar(64) NO
dominant_index_columns mediumtext YES NULL
dominant_index_non_unique bigint(1) YES NULL
subpart_exists int(1) YES NULL
sql_drop_index varchar(223) YES NULL
SELECT * FROM sys.schema_redundant_indexes;
DESC sys.x$schema_flattened_keys;
Field Type Null Key Default Extra
table_schema varchar(64) NO
table_name varchar(64) NO
index_name varchar(64) NO
non_unique bigint(1) YES NULL
subpart_exists bigint(1) YES NULL
index_columns mediumtext YES NULL
SELECT * FROM sys.x$schema_flattened_keys;
CREATE DATABASE rkey;
CREATE TABLE rkey.rkey (
i INT,
j INT,
k INT,
PRIMARY KEY (i),
KEY (j),
KEY (j, k),
KEY (i, j, k)
);
SELECT * FROM sys.schema_redundant_indexes;
table_schema table_name redundant_index_name redundant_index_columns redundant_index_non_unique dominant_index_name dominant_index_columns dominant_index_non_unique subpart_exists sql_drop_index
rkey rkey j j 1 j_2 j,k 1 0 ALTER TABLE `rkey`.`rkey` DROP INDEX `j`
rkey rkey i i,j,k 1 PRIMARY i 0 0 ALTER TABLE `rkey`.`rkey` DROP INDEX `i`
DROP DATABASE rkey;
DESC sys.schema_table_lock_waits;
Field Type Null Key Default Extra
object_schema varchar(64) YES NULL
object_name varchar(64) YES NULL
waiting_thread_id bigint(20) unsigned NO NULL
waiting_pid bigint(20) unsigned YES NULL
waiting_account text YES NULL
waiting_lock_type varchar(32) NO NULL
waiting_lock_duration varchar(32) NO NULL
waiting_query longtext YES NULL
waiting_query_secs bigint(20) YES NULL
waiting_query_rows_affected bigint(20) unsigned YES NULL
waiting_query_rows_examined bigint(20) unsigned YES NULL
blocking_thread_id bigint(20) unsigned NO NULL
blocking_pid bigint(20) unsigned YES NULL
blocking_account text YES NULL
blocking_lock_type varchar(32) NO NULL
blocking_lock_duration varchar(32) NO NULL
sql_kill_blocking_query varchar(31) YES NULL
sql_kill_blocking_connection varchar(25) YES NULL
SELECT * FROM sys.schema_table_lock_waits;
DESC sys.x$schema_table_lock_waits;
Field Type Null Key Default Extra
object_schema varchar(64) YES NULL
object_name varchar(64) YES NULL
waiting_thread_id bigint(20) unsigned NO NULL
waiting_pid bigint(20) unsigned YES NULL
waiting_account text YES NULL
waiting_lock_type varchar(32) NO NULL
waiting_lock_duration varchar(32) NO NULL
waiting_query longtext YES NULL
waiting_query_secs bigint(20) YES NULL
waiting_query_rows_affected bigint(20) unsigned YES NULL
waiting_query_rows_examined bigint(20) unsigned YES NULL
blocking_thread_id bigint(20) unsigned NO NULL
blocking_pid bigint(20) unsigned YES NULL
blocking_account text YES NULL
blocking_lock_type varchar(32) NO NULL
blocking_lock_duration varchar(32) NO NULL
sql_kill_blocking_query varchar(31) YES NULL
sql_kill_blocking_connection varchar(25) YES NULL
SELECT * FROM sys.x$schema_table_lock_waits;
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
CREATE TABLE test.lock_waits (i INT PRIMARY KEY, j INT) ENGINE = InnoDB;
LOCK TABLE lock_waits WRITE;
connection con2;
ALTER TABLE test.lock_waits ADD k VARCHAR(20);
connection default;
SELECT object_schema, object_name,
waiting_account, waiting_lock_type, waiting_query,
blocking_account, blocking_lock_type, blocking_lock_duration
FROM sys.schema_table_lock_waits;
object_schema object_name waiting_account waiting_lock_type waiting_query blocking_account blocking_lock_type blocking_lock_duration
test lock_waits root@localhost SHARED_UPGRADABLE ALTER TABLE test.lock_waits ADD k VARCHAR(20) root@localhost SHARED_NO_READ_WRITE TRANSACTION
disconnect con1;
connection default;
disconnect con2;
connection default;
DROP TABLE test.lock_waits;
DESC sys.schema_table_statistics;
Field Type Null Key Default Extra
table_schema varchar(64) YES NULL
table_name varchar(64) YES NULL
total_latency text YES NULL
rows_fetched bigint(20) unsigned NO NULL
fetch_latency text YES NULL
rows_inserted bigint(20) unsigned NO NULL
insert_latency text YES NULL
rows_updated bigint(20) unsigned NO NULL
update_latency text YES NULL
rows_deleted bigint(20) unsigned NO NULL
delete_latency text YES NULL
io_read_requests decimal(42,0) YES NULL
io_read text YES NULL
io_read_latency text YES NULL
io_write_requests decimal(42,0) YES NULL
io_write text YES NULL
io_write_latency text YES NULL
io_misc_requests decimal(42,0) YES NULL
io_misc_latency text YES NULL
SELECT * FROM sys.schema_table_statistics;
DESC sys.x$schema_table_statistics;
Field Type Null Key Default Extra
table_schema varchar(64) YES NULL
table_name varchar(64) YES NULL
total_latency bigint(20) unsigned NO NULL
rows_fetched bigint(20) unsigned NO NULL
fetch_latency bigint(20) unsigned NO NULL
rows_inserted bigint(20) unsigned NO NULL
insert_latency bigint(20) unsigned NO NULL
rows_updated bigint(20) unsigned NO NULL
update_latency bigint(20) unsigned NO NULL
rows_deleted bigint(20) unsigned NO NULL
delete_latency bigint(20) unsigned NO NULL
io_read_requests decimal(42,0) YES NULL
io_read decimal(41,0) YES NULL
io_read_latency decimal(42,0) YES NULL
io_write_requests decimal(42,0) YES NULL
io_write decimal(41,0) YES NULL
io_write_latency decimal(42,0) YES NULL
io_misc_requests decimal(42,0) YES NULL
io_misc_latency decimal(42,0) YES NULL
SELECT * FROM sys.x$schema_table_statistics;
DESC sys.schema_table_statistics_with_buffer;
Field Type Null Key Default Extra
table_schema varchar(64) YES NULL
table_name varchar(64) YES NULL
rows_fetched bigint(20) unsigned NO NULL
fetch_latency text YES NULL
rows_inserted bigint(20) unsigned NO NULL
insert_latency text YES NULL
rows_updated bigint(20) unsigned NO NULL
update_latency text YES NULL
rows_deleted bigint(20) unsigned NO NULL
delete_latency text YES NULL
io_read_requests decimal(42,0) YES NULL
io_read text YES NULL
io_read_latency text YES NULL
io_write_requests decimal(42,0) YES NULL
io_write text YES NULL
io_write_latency text YES NULL
io_misc_requests decimal(42,0) YES NULL
io_misc_latency text YES NULL
innodb_buffer_allocated text YES NULL
innodb_buffer_data text YES NULL
innodb_buffer_free text YES NULL
innodb_buffer_pages bigint(21) YES 0
innodb_buffer_pages_hashed bigint(21) YES 0
innodb_buffer_pages_old bigint(21) YES 0
innodb_buffer_rows_cached decimal(44,0) YES 0
SELECT * FROM sys.schema_table_statistics_with_buffer;
DESC sys.x$schema_table_statistics_with_buffer;
Field Type Null Key Default Extra
table_schema varchar(64) YES NULL
table_name varchar(64) YES NULL
rows_fetched bigint(20) unsigned NO NULL
fetch_latency bigint(20) unsigned NO NULL
rows_inserted bigint(20) unsigned NO NULL
insert_latency bigint(20) unsigned NO NULL
rows_updated bigint(20) unsigned NO NULL
update_latency bigint(20) unsigned NO NULL
rows_deleted bigint(20) unsigned NO NULL
delete_latency bigint(20) unsigned NO NULL
io_read_requests decimal(42,0) YES NULL
io_read decimal(41,0) YES NULL
io_read_latency decimal(42,0) YES NULL
io_write_requests decimal(42,0) YES NULL
io_write decimal(41,0) YES NULL
io_write_latency decimal(42,0) YES NULL
io_misc_requests decimal(42,0) YES NULL
io_misc_latency decimal(42,0) YES NULL
innodb_buffer_allocated decimal(43,0) YES NULL
innodb_buffer_data decimal(43,0) YES NULL
innodb_buffer_free decimal(44,0) YES NULL
innodb_buffer_pages bigint(21) YES 0
innodb_buffer_pages_hashed bigint(21) YES 0
innodb_buffer_pages_old bigint(21) YES 0
innodb_buffer_rows_cached decimal(44,0) YES 0
SELECT * FROM sys.x$schema_table_statistics_with_buffer;
DESC sys.schema_tables_with_full_table_scans;
Field Type Null Key Default Extra
object_schema varchar(64) YES NULL
object_name varchar(64) YES NULL
rows_full_scanned bigint(20) unsigned NO NULL
latency text YES NULL
SELECT * FROM sys.schema_tables_with_full_table_scans;
DESC sys.x$schema_tables_with_full_table_scans;
Field Type Null Key Default Extra
object_schema varchar(64) YES NULL
object_name varchar(64) YES NULL
rows_full_scanned bigint(20) unsigned NO NULL
latency bigint(20) unsigned NO NULL
SELECT * FROM sys.x$schema_tables_with_full_table_scans;
CREATE TABLE test.t (i BIGINT AUTO_INCREMENT PRIMARY KEY, j BIGINT) ENGINE = innodb;
INSERT INTO test.t (j) VALUES (1), (2), (3);
INSERT INTO test.t (j) (SELECT j*2 FROM test.t);
INSERT INTO test.t (j) (SELECT j*2 FROM test.t);
INSERT INTO test.t (j) (SELECT j*2 FROM test.t);
INSERT INTO test.t (j) (SELECT j*2 FROM test.t);
INSERT INTO test.t (j) (SELECT j*2 FROM test.t);
INSERT INTO test.t (j) (SELECT j*2 FROM test.t);
INSERT INTO test.t (j) (SELECT j*2 FROM test.t);
INSERT INTO test.t (j) (SELECT j*2 FROM test.t);
CALL sys.ps_truncate_all_tables(false);
summary
Truncated 44 tables
SELECT i, j, RAND() FROM test.t WHERE j = 12;
SELECT object_schema, object_name, rows_full_scanned FROM sys.schema_tables_with_full_table_scans;
object_schema object_name rows_full_scanned
test t 768
SELECT object_schema, object_name, rows_full_scanned FROM sys.x$schema_tables_with_full_table_scans;
object_schema object_name rows_full_scanned
test t 768
SELECT i, j, RAND() FROM test.t WHERE j = 12;
SELECT object_schema, object_name, rows_full_scanned FROM sys.schema_tables_with_full_table_scans;
object_schema object_name rows_full_scanned
test t 1536
SELECT object_schema, object_name, rows_full_scanned FROM sys.x$schema_tables_with_full_table_scans;
object_schema object_name rows_full_scanned
test t 1536
SELECT * FROM test.t WHERE i = 10;
i j
10 4
SELECT object_schema, object_name, rows_full_scanned FROM sys.schema_tables_with_full_table_scans;
object_schema object_name rows_full_scanned
test t 1536
SELECT object_schema, object_name, rows_full_scanned FROM sys.x$schema_tables_with_full_table_scans;
object_schema object_name rows_full_scanned
test t 1536
DROP TABLE test.t;
DESC sys.schema_unused_indexes;
Field Type Null Key Default Extra
object_schema varchar(64) YES NULL
object_name varchar(64) YES NULL
index_name varchar(64) YES NULL
SELECT * FROM sys.schema_unused_indexes;
DESC sys.session;
Field Type Null Key Default Extra
thd_id bigint(20) unsigned NO NULL
conn_id bigint(20) unsigned YES NULL
user varchar(189) YES NULL
db varchar(64) YES NULL
command varchar(16) YES NULL
state varchar(64) YES NULL
time bigint(20) YES NULL
current_statement longtext YES NULL
statement_latency mediumtext YES NULL
progress decimal(26,2) YES NULL
lock_latency text YES NULL
rows_examined bigint(20) unsigned YES NULL
rows_sent bigint(20) unsigned YES NULL
rows_affected bigint(20) unsigned YES NULL
tmp_tables bigint(20) unsigned YES NULL
tmp_disk_tables bigint(20) unsigned YES NULL
full_scan varchar(3) YES NULL
last_statement longtext YES NULL
last_statement_latency mediumtext YES NULL
current_memory text YES NULL
last_wait varchar(128) YES NULL
last_wait_latency mediumtext YES NULL
source varchar(64) YES NULL
trx_latency text YES NULL
trx_state enum('ACTIVE','COMMITTED','ROLLED BACK') YES NULL
trx_autocommit enum('YES','NO') YES NULL
pid varchar(1024) YES NULL
program_name varchar(1024) YES NULL
SELECT * FROM sys.session;
DESC sys.x$session;
Field Type Null Key Default Extra
thd_id bigint(20) unsigned NO NULL
conn_id bigint(20) unsigned YES NULL
user varchar(189) YES NULL
db varchar(64) YES NULL
command varchar(16) YES NULL
state varchar(64) YES NULL
time bigint(20) YES NULL
current_statement longtext YES NULL
statement_latency bigint(20) unsigned YES NULL
progress decimal(26,2) YES NULL
lock_latency bigint(20) unsigned YES NULL
rows_examined bigint(20) unsigned YES NULL
rows_sent bigint(20) unsigned YES NULL
rows_affected bigint(20) unsigned YES NULL
tmp_tables bigint(20) unsigned YES NULL
tmp_disk_tables bigint(20) unsigned YES NULL
full_scan varchar(3) YES NULL
last_statement longtext YES NULL
last_statement_latency bigint(20) unsigned YES NULL
current_memory decimal(41,0) YES NULL
last_wait varchar(128) YES NULL
last_wait_latency varchar(20) YES NULL
source varchar(64) YES NULL
trx_latency bigint(20) unsigned YES NULL
trx_state enum('ACTIVE','COMMITTED','ROLLED BACK') YES NULL
trx_autocommit enum('YES','NO') YES NULL
pid varchar(1024) YES NULL
program_name varchar(1024) YES NULL
SELECT * FROM sys.x$session;
DESC sys.session_ssl_status;
Field Type Null Key Default Extra
thread_id bigint(20) unsigned NO NULL
ssl_version varchar(1024) YES NULL
ssl_cipher varchar(1024) YES NULL
ssl_sessions_reused varchar(1024) YES NULL
SELECT * FROM sys.session_ssl_status;
DESC sys.statement_analysis;
Field Type Null Key Default Extra
query longtext YES NULL
db varchar(64) YES NULL
full_scan varchar(1) NO
exec_count bigint(20) unsigned NO NULL
err_count bigint(20) unsigned NO NULL
warn_count bigint(20) unsigned NO NULL
total_latency text YES NULL
max_latency text YES NULL
avg_latency text YES NULL
lock_latency text YES NULL
rows_sent bigint(20) unsigned NO NULL
rows_sent_avg decimal(21,0) NO 0
rows_examined bigint(20) unsigned NO NULL
rows_examined_avg decimal(21,0) NO 0
rows_affected bigint(20) unsigned NO NULL
rows_affected_avg decimal(21,0) NO 0
tmp_tables bigint(20) unsigned NO NULL
tmp_disk_tables bigint(20) unsigned NO NULL
rows_sorted bigint(20) unsigned NO NULL
sort_merge_passes bigint(20) unsigned NO NULL
digest varchar(32) YES NULL
first_seen timestamp NO 0000-00-00 00:00:00
last_seen timestamp NO 0000-00-00 00:00:00
SELECT * FROM sys.statement_analysis;
DESC sys.x$statement_analysis;
Field Type Null Key Default Extra
query longtext YES NULL
db varchar(64) YES NULL
full_scan varchar(1) NO
exec_count bigint(20) unsigned NO NULL
err_count bigint(20) unsigned NO NULL
warn_count bigint(20) unsigned NO NULL
total_latency bigint(20) unsigned NO NULL
max_latency bigint(20) unsigned NO NULL
avg_latency bigint(20) unsigned NO NULL
lock_latency bigint(20) unsigned NO NULL
rows_sent bigint(20) unsigned NO NULL
rows_sent_avg decimal(21,0) NO 0
rows_examined bigint(20) unsigned NO NULL
rows_examined_avg decimal(21,0) NO 0
rows_affected bigint(20) unsigned NO NULL
rows_affected_avg decimal(21,0) NO 0
tmp_tables bigint(20) unsigned NO NULL
tmp_disk_tables bigint(20) unsigned NO NULL
rows_sorted bigint(20) unsigned NO NULL
sort_merge_passes bigint(20) unsigned NO NULL
digest varchar(32) YES NULL
first_seen timestamp NO 0000-00-00 00:00:00
last_seen timestamp NO 0000-00-00 00:00:00
SELECT * FROM sys.x$statement_analysis;
DESC sys.statements_with_errors_or_warnings;
Field Type Null Key Default Extra
query longtext YES NULL
db varchar(64) YES NULL
exec_count bigint(20) unsigned NO NULL
errors bigint(20) unsigned NO NULL
error_pct decimal(27,4) NO 0.0000
warnings bigint(20) unsigned NO NULL
warning_pct decimal(27,4) NO 0.0000
first_seen timestamp NO 0000-00-00 00:00:00
last_seen timestamp NO 0000-00-00 00:00:00
digest varchar(32) YES NULL
SELECT * FROM sys.statements_with_errors_or_warnings;
DESC sys.x$statements_with_errors_or_warnings;
Field Type Null Key Default Extra
query longtext YES NULL
db varchar(64) YES NULL
exec_count bigint(20) unsigned NO NULL
errors bigint(20) unsigned NO NULL
error_pct decimal(27,4) NO 0.0000
warnings bigint(20) unsigned NO NULL
warning_pct decimal(27,4) NO 0.0000
first_seen timestamp NO 0000-00-00 00:00:00
last_seen timestamp NO 0000-00-00 00:00:00
digest varchar(32) YES NULL
SELECT * FROM sys.x$statements_with_errors_or_warnings;
DESC sys.statements_with_full_table_scans;
Field Type Null Key Default Extra
query longtext YES NULL
db varchar(64) YES NULL
exec_count bigint(20) unsigned NO NULL
total_latency text YES NULL
no_index_used_count bigint(20) unsigned NO NULL
no_good_index_used_count bigint(20) unsigned NO NULL
no_index_used_pct decimal(24,0) NO 0
rows_sent bigint(20) unsigned NO NULL
rows_examined bigint(20) unsigned NO NULL
rows_sent_avg decimal(21,0) unsigned YES NULL
rows_examined_avg decimal(21,0) unsigned YES NULL
first_seen timestamp NO 0000-00-00 00:00:00
last_seen timestamp NO 0000-00-00 00:00:00
digest varchar(32) YES NULL
SELECT * FROM sys.statements_with_full_table_scans;
DESC sys.x$statements_with_full_table_scans;
Field Type Null Key Default Extra
query longtext YES NULL
db varchar(64) YES NULL
exec_count bigint(20) unsigned NO NULL
total_latency bigint(20) unsigned NO NULL
no_index_used_count bigint(20) unsigned NO NULL
no_good_index_used_count bigint(20) unsigned NO NULL
no_index_used_pct decimal(24,0) NO 0
rows_sent bigint(20) unsigned NO NULL
rows_examined bigint(20) unsigned NO NULL
rows_sent_avg decimal(21,0) unsigned YES NULL
rows_examined_avg decimal(21,0) unsigned YES NULL
first_seen timestamp NO 0000-00-00 00:00:00
last_seen timestamp NO 0000-00-00 00:00:00
digest varchar(32) YES NULL
SELECT * FROM sys.x$statements_with_full_table_scans;
CREATE DATABASE v_statements_with_full_table_scans;
CREATE TABLE v_statements_with_full_table_scans.t (i BIGINT AUTO_INCREMENT PRIMARY KEY, j BIGINT) ENGINE = innodb;
INSERT INTO v_statements_with_full_table_scans.t (j) VALUES (1), (2), (3);
INSERT INTO v_statements_with_full_table_scans.t (j) (SELECT j*2 FROM v_statements_with_full_table_scans.t);
INSERT INTO v_statements_with_full_table_scans.t (j) (SELECT j*2 FROM v_statements_with_full_table_scans.t);
INSERT INTO v_statements_with_full_table_scans.t (j) (SELECT j*2 FROM v_statements_with_full_table_scans.t);
INSERT INTO v_statements_with_full_table_scans.t (j) (SELECT j*2 FROM v_statements_with_full_table_scans.t);
INSERT INTO v_statements_with_full_table_scans.t (j) (SELECT j*2 FROM v_statements_with_full_table_scans.t);
INSERT INTO v_statements_with_full_table_scans.t (j) (SELECT j*2 FROM v_statements_with_full_table_scans.t);
INSERT INTO v_statements_with_full_table_scans.t (j) (SELECT j*2 FROM v_statements_with_full_table_scans.t);
INSERT INTO v_statements_with_full_table_scans.t (j) (SELECT j*2 FROM v_statements_with_full_table_scans.t);
CALL sys.ps_truncate_all_tables(false);
summary
Truncated 44 tables
SELECT i, j, RAND() FROM v_statements_with_full_table_scans.t WHERE j = 12;
SELECT db, query, rows_examined FROM sys.statements_with_full_table_scans WHERE query LIKE '%v_statements_with_full_table_scans%' ORDER BY rows_examined DESC;
db query rows_examined
SELECT db, query, rows_examined FROM sys.x$statements_with_full_table_scans WHERE query LIKE '%v_statements_with_full_table_scans%' ORDER BY rows_examined DESC;
db query rows_examined
test SELECT `i` , `j` , `RAND` ( ) FROM `v_statements_with_full_table_scans` . `t` WHERE `j` = ? 768
SELECT i, j, RAND() FROM v_statements_with_full_table_scans.t WHERE j = 12;
SELECT db, query, rows_examined FROM sys.statements_with_full_table_scans WHERE query LIKE '%v_statements_with_full_table_scans%' ORDER BY rows_examined DESC;
db query rows_examined
SELECT db, query, rows_examined FROM sys.x$statements_with_full_table_scans WHERE query LIKE '%v_statements_with_full_table_scans%' ORDER BY rows_examined DESC;
db query rows_examined
test SELECT `i` , `j` , `RAND` ( ) FROM `v_statements_with_full_table_scans` . `t` WHERE `j` = ? 1536
SELECT * FROM v_statements_with_full_table_scans.t WHERE i = 10;
i j
10 4
SELECT db, query, rows_examined FROM sys.statements_with_full_table_scans WHERE query LIKE '%v_statements_with_full_table_scans%' ORDER BY rows_examined DESC;
db query rows_examined
SELECT db, query, rows_examined FROM sys.x$statements_with_full_table_scans WHERE query LIKE '%v_statements_with_full_table_scans%' ORDER BY rows_examined DESC;
db query rows_examined
test SELECT `i` , `j` , `RAND` ( ) FROM `v_statements_with_full_table_scans` . `t` WHERE `j` = ? 1536
DROP DATABASE v_statements_with_full_table_scans;
DESC sys.statements_with_runtimes_in_95th_percentile;
Field Type Null Key Default Extra
query longtext YES NULL
db varchar(64) YES NULL
full_scan varchar(1) NO
exec_count bigint(20) unsigned NO NULL
err_count bigint(20) unsigned NO NULL
warn_count bigint(20) unsigned NO NULL
total_latency text YES NULL
max_latency text YES NULL
avg_latency text YES NULL
rows_sent bigint(20) unsigned NO NULL
rows_sent_avg decimal(21,0) NO 0
rows_examined bigint(20) unsigned NO NULL
rows_examined_avg decimal(21,0) NO 0
first_seen timestamp NO 0000-00-00 00:00:00
last_seen timestamp NO 0000-00-00 00:00:00
digest varchar(32) YES NULL
SELECT * FROM sys.statements_with_runtimes_in_95th_percentile;
DESC sys.x$statements_with_runtimes_in_95th_percentile;
Field Type Null Key Default Extra
query longtext YES NULL
db varchar(64) YES NULL
full_scan varchar(1) NO
exec_count bigint(20) unsigned NO NULL
err_count bigint(20) unsigned NO NULL
warn_count bigint(20) unsigned NO NULL
total_latency bigint(20) unsigned NO NULL
max_latency bigint(20) unsigned NO NULL
avg_latency bigint(20) unsigned NO NULL
rows_sent bigint(20) unsigned NO NULL
rows_sent_avg decimal(21,0) NO 0
rows_examined bigint(20) unsigned NO NULL
rows_examined_avg decimal(21,0) NO 0
first_seen timestamp NO 0000-00-00 00:00:00
last_seen timestamp NO 0000-00-00 00:00:00
digest varchar(32) YES NULL
SELECT * FROM sys.x$statements_with_runtimes_in_95th_percentile;
DESC sys.statements_with_sorting;
Field Type Null Key Default Extra
query longtext YES NULL
db varchar(64) YES NULL
exec_count bigint(20) unsigned NO NULL
total_latency text YES NULL
sort_merge_passes bigint(20) unsigned NO NULL
avg_sort_merges decimal(21,0) NO 0
sorts_using_scans bigint(20) unsigned NO NULL
sort_using_range bigint(20) unsigned NO NULL
rows_sorted bigint(20) unsigned NO NULL
avg_rows_sorted decimal(21,0) NO 0
first_seen timestamp NO 0000-00-00 00:00:00
last_seen timestamp NO 0000-00-00 00:00:00
digest varchar(32) YES NULL
SELECT * FROM sys.statements_with_sorting;
DESC sys.x$statements_with_sorting;
Field Type Null Key Default Extra
query longtext YES NULL
db varchar(64) YES NULL
exec_count bigint(20) unsigned NO NULL
total_latency bigint(20) unsigned NO NULL
sort_merge_passes bigint(20) unsigned NO NULL
avg_sort_merges decimal(21,0) NO 0
sorts_using_scans bigint(20) unsigned NO NULL
sort_using_range bigint(20) unsigned NO NULL
rows_sorted bigint(20) unsigned NO NULL
avg_rows_sorted decimal(21,0) NO 0
first_seen timestamp NO 0000-00-00 00:00:00
last_seen timestamp NO 0000-00-00 00:00:00
digest varchar(32) YES NULL
SELECT * FROM sys.x$statements_with_sorting;
DESC sys.statements_with_temp_tables;
Field Type Null Key Default Extra
query longtext YES NULL
db varchar(64) YES NULL
exec_count bigint(20) unsigned NO NULL
total_latency text YES NULL
memory_tmp_tables bigint(20) unsigned NO NULL
disk_tmp_tables bigint(20) unsigned NO NULL
avg_tmp_tables_per_query decimal(21,0) NO 0
tmp_tables_to_disk_pct decimal(24,0) NO 0
first_seen timestamp NO 0000-00-00 00:00:00
last_seen timestamp NO 0000-00-00 00:00:00
digest varchar(32) YES NULL
SELECT * FROM sys.statements_with_temp_tables;
DESC sys.x$statements_with_temp_tables;
Field Type Null Key Default Extra
query longtext YES NULL
db varchar(64) YES NULL
exec_count bigint(20) unsigned NO NULL
total_latency bigint(20) unsigned NO NULL
memory_tmp_tables bigint(20) unsigned NO NULL
disk_tmp_tables bigint(20) unsigned NO NULL
avg_tmp_tables_per_query decimal(21,0) NO 0
tmp_tables_to_disk_pct decimal(24,0) NO 0
first_seen timestamp NO 0000-00-00 00:00:00
last_seen timestamp NO 0000-00-00 00:00:00
digest varchar(32) YES NULL
SELECT * FROM sys.x$statements_with_temp_tables;
DESC sys.user_summary;
Field Type Null Key Default Extra
user varchar(128) YES NULL
statements decimal(64,0) YES NULL
statement_latency text YES NULL
statement_avg_latency text YES NULL
table_scans decimal(65,0) YES NULL
file_ios decimal(64,0) YES NULL
file_io_latency text YES NULL
current_connections decimal(41,0) YES NULL
total_connections decimal(41,0) YES NULL
unique_hosts bigint(21) NO 0
current_memory text YES NULL
total_memory_allocated text YES NULL
SELECT * FROM sys.user_summary;
DESC sys.x$user_summary;
Field Type Null Key Default Extra
user varchar(128) YES NULL
statements decimal(64,0) YES NULL
statement_latency decimal(64,0) YES NULL
statement_avg_latency decimal(65,4) NO 0.0000
table_scans decimal(65,0) YES NULL
file_ios decimal(64,0) YES NULL
file_io_latency decimal(64,0) YES NULL
current_connections decimal(41,0) YES NULL
total_connections decimal(41,0) YES NULL
unique_hosts bigint(21) NO 0
current_memory decimal(63,0) YES NULL
total_memory_allocated decimal(64,0) YES NULL
SELECT * FROM sys.x$user_summary;
DESC sys.user_summary_by_file_io;
Field Type Null Key Default Extra
user varchar(128) YES NULL
ios decimal(42,0) YES NULL
io_latency text YES NULL
SELECT * FROM sys.user_summary_by_file_io;
DESC sys.x$user_summary_by_file_io;
Field Type Null Key Default Extra
user varchar(128) YES NULL
ios decimal(42,0) YES NULL
io_latency decimal(42,0) YES NULL
SELECT * FROM sys.x$user_summary_by_file_io;
DESC sys.user_summary_by_file_io_type;
Field Type Null Key Default Extra
user varchar(128) YES NULL
event_name varchar(128) NO NULL
total bigint(20) unsigned NO NULL
latency text YES NULL
max_latency text YES NULL
SELECT * FROM sys.user_summary_by_file_io_type;
DESC sys.x$user_summary_by_file_io_type;
Field Type Null Key Default Extra
user varchar(128) YES NULL
event_name varchar(128) NO NULL
total bigint(20) unsigned NO NULL
latency bigint(20) unsigned NO NULL
max_latency bigint(20) unsigned NO NULL
SELECT * FROM sys.x$user_summary_by_file_io_type;
DESC sys.user_summary_by_stages;
Field Type Null Key Default Extra
user varchar(128) YES NULL
event_name varchar(128) NO NULL
total bigint(20) unsigned NO NULL
total_latency text YES NULL
avg_latency text YES NULL
SELECT * FROM sys.user_summary_by_stages;
DESC sys.x$user_summary_by_stages;
Field Type Null Key Default Extra
user varchar(128) YES NULL
event_name varchar(128) NO NULL
total bigint(20) unsigned NO NULL
total_latency bigint(20) unsigned NO NULL
avg_latency bigint(20) unsigned NO NULL
SELECT * FROM sys.x$user_summary_by_stages;
DESC sys.user_summary_by_statement_latency;
Field Type Null Key Default Extra
user varchar(128) YES NULL
total decimal(42,0) YES NULL
total_latency text YES NULL
max_latency text YES NULL
lock_latency text YES NULL
rows_sent decimal(42,0) YES NULL
rows_examined decimal(42,0) YES NULL
rows_affected decimal(42,0) YES NULL
full_scans decimal(43,0) YES NULL
SELECT * FROM sys.user_summary_by_statement_latency;
DESC sys.x$user_summary_by_statement_latency;
Field Type Null Key Default Extra
user varchar(128) YES NULL
total decimal(42,0) YES NULL
total_latency decimal(42,0) YES NULL
max_latency decimal(42,0) YES NULL
lock_latency decimal(42,0) YES NULL
rows_sent decimal(42,0) YES NULL
rows_examined decimal(42,0) YES NULL
rows_affected decimal(42,0) YES NULL
full_scans decimal(43,0) YES NULL
SELECT * FROM sys.x$user_summary_by_statement_latency;
DESC sys.user_summary_by_statement_type;
Field Type Null Key Default Extra
user varchar(128) YES NULL
statement varchar(128) YES NULL
total bigint(20) unsigned NO NULL
total_latency text YES NULL
max_latency text YES NULL
lock_latency text YES NULL
rows_sent bigint(20) unsigned NO NULL
rows_examined bigint(20) unsigned NO NULL
rows_affected bigint(20) unsigned NO NULL
full_scans bigint(21) unsigned NO 0
SELECT * FROM sys.user_summary_by_statement_type;
DESC sys.x$user_summary_by_statement_type;
Field Type Null Key Default Extra
user varchar(128) YES NULL
statement varchar(128) YES NULL
total bigint(20) unsigned NO NULL
total_latency bigint(20) unsigned NO NULL
max_latency bigint(20) unsigned NO NULL
lock_latency bigint(20) unsigned NO NULL
rows_sent bigint(20) unsigned NO NULL
rows_examined bigint(20) unsigned NO NULL
rows_affected bigint(20) unsigned NO NULL
full_scans bigint(21) unsigned NO 0
SELECT * FROM sys.x$user_summary_by_statement_type;
SELECT sys_version FROM sys.version;
sys_version
1.5.1
DESC sys.wait_classes_global_by_avg_latency;
Field Type Null Key Default Extra
event_class varchar(128) YES NULL
total decimal(42,0) YES NULL
total_latency text YES NULL
min_latency text YES NULL
avg_latency text YES NULL
max_latency text YES NULL
SELECT * FROM sys.wait_classes_global_by_avg_latency;
DESC sys.x$wait_classes_global_by_avg_latency;
Field Type Null Key Default Extra
event_class varchar(128) YES NULL
total decimal(42,0) YES NULL
total_latency decimal(42,0) YES NULL
min_latency bigint(20) unsigned YES NULL
avg_latency decimal(46,4) NO 0.0000
max_latency bigint(20) unsigned YES NULL
SELECT * FROM sys.x$wait_classes_global_by_avg_latency;
DESC sys.wait_classes_global_by_latency;
Field Type Null Key Default Extra
event_class varchar(128) YES NULL
total decimal(42,0) YES NULL
total_latency text YES NULL
min_latency text YES NULL
avg_latency text YES NULL
max_latency text YES NULL
SELECT * FROM sys.wait_classes_global_by_latency;
DESC sys.x$wait_classes_global_by_latency;
Field Type Null Key Default Extra
event_class varchar(128) YES NULL
total decimal(42,0) YES NULL
total_latency decimal(42,0) YES NULL
min_latency bigint(20) unsigned YES NULL
avg_latency decimal(46,4) NO 0.0000
max_latency bigint(20) unsigned YES NULL
SELECT * FROM sys.x$wait_classes_global_by_latency;
DESC sys.waits_by_host_by_latency;
Field Type Null Key Default Extra
host varchar(60) YES NULL
event varchar(128) NO NULL
total bigint(20) unsigned NO NULL
total_latency text YES NULL
avg_latency text YES NULL
max_latency text YES NULL
SELECT * FROM sys.waits_by_host_by_latency;
DESC sys.x$waits_by_host_by_latency;
Field Type Null Key Default Extra
host varchar(60) YES NULL
event varchar(128) NO NULL
total bigint(20) unsigned NO NULL
total_latency bigint(20) unsigned NO NULL
avg_latency bigint(20) unsigned NO NULL
max_latency bigint(20) unsigned NO NULL
SELECT * FROM sys.x$waits_by_host_by_latency;
DESC sys.waits_by_user_by_latency;
Field Type Null Key Default Extra
user varchar(128) YES NULL
event varchar(128) NO NULL
total bigint(20) unsigned NO NULL
total_latency text YES NULL
avg_latency text YES NULL
max_latency text YES NULL
SELECT * FROM sys.waits_by_user_by_latency;
DESC sys.x$waits_by_user_by_latency;
Field Type Null Key Default Extra
user varchar(128) YES NULL
event varchar(128) NO NULL
total bigint(20) unsigned NO NULL
total_latency bigint(20) unsigned NO NULL
avg_latency bigint(20) unsigned NO NULL
max_latency bigint(20) unsigned NO NULL
SELECT * FROM sys.x$waits_by_user_by_latency;
DESC sys.waits_global_by_latency;
Field Type Null Key Default Extra
events varchar(128) NO NULL
total bigint(20) unsigned NO NULL
total_latency text YES NULL
avg_latency text YES NULL
max_latency text YES NULL
SELECT * FROM sys.waits_global_by_latency;
DESC sys.x$waits_global_by_latency;
Field Type Null Key Default Extra
events varchar(128) NO NULL
total bigint(20) unsigned NO NULL
total_latency bigint(20) unsigned NO NULL
avg_latency bigint(20) unsigned NO NULL
max_latency bigint(20) unsigned NO NULL
SELECT * FROM sys.x$waits_global_by_latency;
SELECT sys.version_major();
SELECT sys.version_minor();
SELECT sys.version_patch();
SELECT @my_version = SUBSTRING(VERSION(), 1, CHAR_LENGTH(@my_version));
@my_version = SUBSTRING(VERSION(), 1, CHAR_LENGTH(@my_version))
1
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment