fixed sys schema in sandbox

This commit is contained in:
frank-cizmich
2016-01-12 22:29:35 -03:00
parent 7728e4fd23
commit e9acc636e5
698 changed files with 53769 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
# Reset the performance_schema.setup_actors table
TRUNCATE TABLE performance_schema.setup_actors;
INSERT INTO performance_schema.setup_actors VALUES ('%', '%', '%', 'YES', 'YES');

View File

@@ -0,0 +1,3 @@
# Reset the performance_schema.setup_consumers table
UPDATE performance_schema.setup_consumers SET enabled = 'YES';

View File

@@ -0,0 +1,3 @@
# Reset the performance_schema.setup_instruments table
UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES';

View File

@@ -0,0 +1,9 @@
# 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

View File

@@ -0,0 +1,3 @@
# Reset the performance_schema.setup_consumers table
UPDATE performance_schema.threads SET instrumented = 'YES';

View File

@@ -0,0 +1,6 @@
# Reset all underlying Performance Schema data
--disable_result_log
--disable_query_log ONCE
CALL sys.ps_truncate_all_tables(FALSE);
--enable_result_log

View File

@@ -0,0 +1,17 @@
# 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;

View File

@@ -0,0 +1,160 @@
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
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.0

View File

@@ -0,0 +1,6 @@
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

View File

@@ -0,0 +1,6 @@
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

View File

@@ -0,0 +1,39 @@
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

View File

@@ -0,0 +1,18 @@
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
SET @mypath := CONCAT(@@global.innodb_log_group_home_dir, 'foo/bar.foo');
SELECT sys.format_path(@mypath);
sys.format_path(@mypath)
@@innodb_log_group_home_dir/foo/bar.foo
SELECT sys.format_path('/foo/bar/baz.foo');
sys.format_path('/foo/bar/baz.foo')
/foo/bar/baz.foo

View File

@@ -0,0 +1,10 @@
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'

View File

@@ -0,0 +1,57 @@
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

View File

@@ -0,0 +1,28 @@
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
ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,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,ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,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;

View File

@@ -0,0 +1,32 @@
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
ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
SET SESSION sql_mode = sys.list_drop(@@sql_mode, 'STRICT_TRANS_TABLES');
Warnings:
Warning 3135 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
SELECT @@sql_mode;
@@sql_mode
ONLY_FULL_GROUP_BY,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
SET SESSION sql_mode = @sqlmode;
SET @sqlmode := NULL;

View File

@@ -0,0 +1,14 @@
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');

View File

@@ -0,0 +1,42 @@
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';

View File

@@ -0,0 +1,48 @@
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

View File

@@ -0,0 +1,48 @@
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

View File

@@ -0,0 +1,14 @@
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';

View File

@@ -0,0 +1,11 @@
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(-1);
ERROR 22003: Out of range value for column 'in_thread_id' at row 1
SELECT sys.ps_thread_account(sys.ps_thread_id(NULL));
sys.ps_thread_account(sys.ps_thread_id(NULL))
root@localhost

View File

@@ -0,0 +1,9 @@
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

View File

@@ -0,0 +1,88 @@
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));
USE trx;
START TRANSACTION;
INSERT INTO info VALUES (1, 'foo');
COMMIT;
START TRANSACTION;
INSERT INTO info VALUES (2, 'bar');
COMMIT;
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]'))
["gtid", "mode", "time", "state", "isolation", "autocommitted", "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')
1
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]'))
["time", "schema", "sql_text", "rows_sent", "sort_rows", "tmp_tables", "rows_affected", "rows_examined", "tmp_disk_tables", "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 12 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
DROP DATABASE trx;

View File

@@ -0,0 +1,8 @@
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

View File

@@ -0,0 +1,59 @@
CREATE TEMPORARY TABLE tmp_user AS SELECT * FROM mysql.user;
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
mysql.columns_priv OK
mysql.db OK
mysql.engine_cost OK
mysql.event OK
mysql.func OK
mysql.general_log OK
mysql.gtid_executed OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.innodb_index_stats OK
mysql.innodb_table_stats OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.server_cost OK
mysql.servers OK
mysql.slave_master_info OK
mysql.slave_relay_log_info OK
mysql.slave_worker_info OK
mysql.slow_log OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
mtr.global_suppressions OK
mtr.test_suppressions OK
sys.sys_config OK
SHOW DATABASES;
Database
information_schema
mtr
mysql
performance_schema
sys
test
TRUNCATE TABLE mysql.user;
INSERT INTO mysql.user (SELECT * FROM tmp_user);
DROP TEMPORARY TABLE tmp_user;
TRUNCATE TABLE mysql.tables_priv;
INSERT INTO mysql.tables_priv (SELECT * FROM tmp_tables_priv);
DROP TEMPORARY TABLE tmp_tables_priv;
FLUSH PRIVILEGES;

View File

@@ -0,0 +1,21 @@
SET @sys.debug = 'ON',
@sys.diagnostics.allow_i_s_tables = 'ON',
@sys.diagnostics.include_raw = 'ON';
SET @tmp_show_compatibility_56 = @@global.show_compatibility_56,
GLOBAL show_compatibility_56 = ON;
CALL sys.diagnostics(4, 2, 'full');
SET GLOBAL show_compatibility_56 = OFF;
CALL sys.diagnostics(4, 2, 'full');
SET GLOBAL show_compatibility_56 = @tmp_show_compatibility_56,
@tmp_show_compatibility_56 = NULL;
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

View File

@@ -0,0 +1,21 @@
SET @sql := "CREATE TABLE test.t1 (i INT)";
CALL sys.execute_prepared_stmt(@sql);
SHOW CREATE TABLE test.t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) DEFAULT NULL
) ENGINE=InnoDB 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

View File

@@ -0,0 +1,27 @@
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';

View File

@@ -0,0 +1,474 @@
use test;
DROP TABLE IF EXISTS t1;
DROP TEMPORARY TABLE IF EXISTS tmp_digests_ini;
DROP VIEW IF EXISTS view_digests;
CREATE TABLE t1 (id INT PRIMARY KEY, val int);
use test;
CALL sys.ps_setup_disable_thread(CONNECTION_ID());
CALL sys.ps_setup_enable_consumer('events_statements_history_long');
CALL sys.ps_truncate_all_tables(FALSE);
INSERT INTO t1 VALUES (1, SLEEP(0.2));
UPDATE t1 SET val = 1+SLEEP(1.6) WHERE id = 1;
SELECT t1a.* FROM t1 AS t1a LEFT OUTER JOIN (SELECT * FROM t1 AS t1b1 INNER JOIN t1 AS t1b2 USING (id, val)) AS t1b ON t1b.id > t1a.id ORDER BY t1a.val, t1a.id+SLEEP(1.2);
id val
1 1
CALL sys.statement_performance_analyzer('create_tmp', 'test.tmp_digests_ini', NULL);
CALL sys.statement_performance_analyzer('snapshot', NULL, NULL);
CALL sys.statement_performance_analyzer('save', 'test.tmp_digests_ini', NULL);
DO SLEEP(1.2);
INSERT INTO t1 VALUES (2, SLEEP(0.6));
UPDATE t1 SET val = 1+SLEEP(3.0) WHERE id = 2;
SELECT t1a.* FROM t1 AS t1a LEFT OUTER JOIN (SELECT * FROM t1 AS t1b1 INNER JOIN t1 AS t1b2 USING (id, val)) AS t1b ON t1b.id > t1a.id ORDER BY t1a.val, t1a.id+SLEEP(0.8);
id val
1 1
2 1
CALL sys.statement_performance_analyzer('snapshot', NULL, NULL);
SELECT DIGEST, COUNT_STAR FROM performance_schema.events_statements_summary_by_digest ORDER BY first_seen;
DIGEST COUNT_STAR
DIGEST_INSERT 2
DIGEST_UPDATE 2
DIGEST_SELECT 2
CALL sys.statement_performance_analyzer('overall', NULL, 'with_runtimes_in_95th_percentile');;
Next Output Queries with Runtime in 95th Percentile
query UPDATE `t1` SET `val` = ? + `SLEEP` (?) WHERE `id` = ?
db test
full_scan
exec_count 2
err_count 0
warn_count 0
total_latency O_UPD_TOTAL_LATENCY
max_latency O_UPD_MAX_LATENCY
avg_latency O_UPD_AVG_LATENCY
rows_sent 0
rows_sent_avg 0
rows_examined 2
rows_examined_avg 1
first_seen O_UPD_FIRST_SEEN
last_seen O_UPD_LAST_SEEN
digest DIGEST_UPDATE
CALL sys.statement_performance_analyzer('delta', 'test.tmp_digests_ini', 'with_runtimes_in_95th_percentile');;
Next Output Queries with Runtime in 95th Percentile
query UPDATE `t1` SET `val` = ? + `SLEEP` (?) WHERE `id` = ?
db test
full_scan
exec_count 1
err_count 0
warn_count 0
total_latency D_UPD_LATENCY
max_latency D_UPD_LATENCY
avg_latency D_UPD_LATENCY
rows_sent 0
rows_sent_avg 0
rows_examined 1
rows_examined_avg 1
first_seen O_UPD_FIRST_SEEN
last_seen O_UPD_LAST_SEEN
digest DIGEST_UPDATE
CALL sys.statement_performance_analyzer('overall', NULL, 'analysis');;
Next Output Top 100 Queries Ordered by Total Latency
query UPDATE `t1` SET `val` = ? + `SLEEP` (?) WHERE `id` = ?
db test
full_scan
exec_count 2
err_count 0
warn_count 0
total_latency O_UPD_TOTAL_LATENCY
max_latency O_UPD_MAX_LATENCY
avg_latency O_UPD_AVG_LATENCY
lock_latency LOCK_LATENCY
rows_sent 0
rows_sent_avg 0
rows_examined 2
rows_examined_avg 1
rows_affected 2
rows_affected_avg 1
tmp_tables 0
tmp_disk_tables 0
rows_sorted 0
sort_merge_passes 0
digest DIGEST_UPDATE
first_seen O_UPD_FIRST_SEEN
last_seen O_UPD_LAST_SEEN
query SELECT `t1a` . * FROM `t1` AS ... , `t1a` . `id` + `SLEEP` (?)
db test
full_scan *
exec_count 2
err_count 0
warn_count 0
total_latency O_SEL_TOTAL_LATENCY
max_latency O_SEL_MAX_LATENCY
avg_latency O_SEL_AVG_LATENCY
lock_latency LOCK_LATENCY
rows_sent 3
rows_sent_avg 2
rows_examined 15
rows_examined_avg 8
rows_affected 0
rows_affected_avg 0
tmp_tables 2
tmp_disk_tables 0
rows_sorted 3
sort_merge_passes 0
digest DIGEST_SELECT
first_seen O_SEL_FIRST_SEEN
last_seen O_SEL_LAST_SEEN
query INSERT INTO `t1` VALUES ( ? , `SLEEP` (?) )
db test
full_scan
exec_count 2
err_count 0
warn_count 0
total_latency O_INS_TOTAL_LATENCY
max_latency O_INS_MAX_LATENCY
avg_latency O_INS_AVG_LATENCY
lock_latency LOCK_LATENCY
rows_sent 0
rows_sent_avg 0
rows_examined 0
rows_examined_avg 0
rows_affected 2
rows_affected_avg 1
tmp_tables 0
tmp_disk_tables 0
rows_sorted 0
sort_merge_passes 0
digest DIGEST_INSERT
first_seen O_INS_FIRST_SEEN
last_seen O_INS_LAST_SEEN
CALL sys.statement_performance_analyzer('delta', 'test.tmp_digests_ini', 'analysis');;
Next Output Top 100 Queries Ordered by Total Latency
query UPDATE `t1` SET `val` = ? + `SLEEP` (?) WHERE `id` = ?
db test
full_scan
exec_count 1
err_count 0
warn_count 0
total_latency D_UPD_LATENCY
max_latency D_UPD_LATENCY
avg_latency D_UPD_LATENCY
lock_latency LOCK_LATENCY
rows_sent 0
rows_sent_avg 0
rows_examined 1
rows_examined_avg 1
rows_affected 1
rows_affected_avg 1
tmp_tables 0
tmp_disk_tables 0
rows_sorted 0
sort_merge_passes 0
digest DIGEST_UPDATE
first_seen O_UPD_FIRST_SEEN
last_seen O_UPD_LAST_SEEN
query SELECT `t1a` . * FROM `t1` AS ... , `t1a` . `id` + `SLEEP` (?)
db test
full_scan *
exec_count 1
err_count 0
warn_count 0
total_latency D_SEL_LATENCY
max_latency D_SEL_LATENCY
avg_latency D_SEL_LATENCY
lock_latency LOCK_LATENCY
rows_sent 2
rows_sent_avg 2
rows_examined 10
rows_examined_avg 10
rows_affected 0
rows_affected_avg 0
tmp_tables 1
tmp_disk_tables 0
rows_sorted 2
sort_merge_passes 0
digest DIGEST_SELECT
first_seen O_SEL_FIRST_SEEN
last_seen O_SEL_LAST_SEEN
query INSERT INTO `t1` VALUES ( ? , `SLEEP` (?) )
db test
full_scan
exec_count 1
err_count 0
warn_count 0
total_latency D_INS_LATENCY
max_latency D_INS_LATENCY
avg_latency D_INS_LATENCY
lock_latency LOCK_LATENCY
rows_sent 0
rows_sent_avg 0
rows_examined 0
rows_examined_avg 0
rows_affected 1
rows_affected_avg 1
tmp_tables 0
tmp_disk_tables 0
rows_sorted 0
sort_merge_passes 0
digest DIGEST_INSERT
first_seen O_INS_FIRST_SEEN
last_seen O_INS_LAST_SEEN
CALL sys.statement_performance_analyzer('overall', NULL, 'with_errors_or_warnings');;
Next Output Top 100 Queries with Errors
CALL sys.statement_performance_analyzer('delta', 'test.tmp_digests_ini', 'with_errors_or_warnings');;
Next Output Top 100 Queries with Errors
CALL sys.statement_performance_analyzer('overall', NULL, 'with_full_table_scans');;
Next Output Top 100 Queries with Full Table Scan
query SELECT `t1a` . * FROM `t1` AS ... , `t1a` . `id` + `SLEEP` (?)
db test
exec_count 2
total_latency O_SEL_TOTAL_LATENCY
no_index_used_count 2
no_good_index_used_count 0
no_index_used_pct 100
rows_sent 3
rows_examined 15
rows_sent_avg 2
rows_examined_avg 8
first_seen O_SEL_FIRST_SEEN
last_seen O_SEL_LAST_SEEN
digest DIGEST_SELECT
CALL sys.statement_performance_analyzer('delta', 'test.tmp_digests_ini', 'with_full_table_scans');;
Next Output Top 100 Queries with Full Table Scan
query SELECT `t1a` . * FROM `t1` AS ... , `t1a` . `id` + `SLEEP` (?)
db test
exec_count 1
total_latency D_SEL_TOTAL_LATENCY
no_index_used_count 1
no_good_index_used_count 0
no_index_used_pct 100
rows_sent 2
rows_examined 10
rows_sent_avg 2
rows_examined_avg 10
first_seen O_SEL_FIRST_SEEN
last_seen O_SEL_LAST_SEEN
digest DIGEST_SELECT
CALL sys.statement_performance_analyzer('overall', NULL, 'with_sorting');;
Next Output Top 100 Queries with Sorting
query SELECT `t1a` . * FROM `t1` AS ... , `t1a` . `id` + `SLEEP` (?)
db test
exec_count 2
total_latency O_SEL_TOTAL_LATENCY
sort_merge_passes 0
avg_sort_merges 0
sorts_using_scans 2
sort_using_range 0
rows_sorted 3
avg_rows_sorted 2
first_seen O_SEL_FIRST_SEEN
last_seen O_SEL_LAST_SEEN
digest DIGEST_SELECT
CALL sys.statement_performance_analyzer('delta', 'test.tmp_digests_ini', 'with_sorting');;
Next Output Top 100 Queries with Sorting
query SELECT `t1a` . * FROM `t1` AS ... , `t1a` . `id` + `SLEEP` (?)
db test
exec_count 1
total_latency D_SEL_TOTAL_LATENCY
sort_merge_passes 0
avg_sort_merges 0
sorts_using_scans 1
sort_using_range 0
rows_sorted 2
avg_rows_sorted 2
first_seen O_SEL_FIRST_SEEN
last_seen O_SEL_LAST_SEEN
digest DIGEST_SELECT
CALL sys.statement_performance_analyzer('overall', NULL, 'with_temp_tables');;
Next Output Top 100 Queries with Internal Temporary Tables
query SELECT `t1a` . * FROM `t1` AS ... , `t1a` . `id` + `SLEEP` (?)
db test
exec_count 2
total_latency O_SEL_TOTAL_LATENCY
memory_tmp_tables 2
disk_tmp_tables 0
avg_tmp_tables_per_query 1
tmp_tables_to_disk_pct 0
first_seen O_SEL_FIRST_SEEN
last_seen O_SEL_LAST_SEEN
digest DIGEST_SELECT
CALL sys.statement_performance_analyzer('delta', 'test.tmp_digests_ini', 'with_temp_tables');;
Next Output Top 100 Queries with Internal Temporary Tables
query SELECT `t1a` . * FROM `t1` AS ... , `t1a` . `id` + `SLEEP` (?)
db test
exec_count 1
total_latency D_SEL_TOTAL_LATENCY
memory_tmp_tables 1
disk_tmp_tables 0
avg_tmp_tables_per_query 1
tmp_tables_to_disk_pct 0
first_seen O_SEL_FIRST_SEEN
last_seen O_SEL_LAST_SEEN
digest DIGEST_SELECT
CREATE VIEW test.view_digests AS
SELECT sys.format_statement(DIGEST_TEXT) AS query,
SCHEMA_NAME AS db,
COUNT_STAR AS exec_count,
sys.format_time(SUM_TIMER_WAIT) AS total_latency,
sys.format_time(AVG_TIMER_WAIT) AS avg_latency,
ROUND(IFNULL(SUM_ROWS_SENT / NULLIF(COUNT_STAR, 0), 0)) AS rows_sent_avg,
ROUND(IFNULL(SUM_ROWS_EXAMINED / NULLIF(COUNT_STAR, 0), 0)) AS rows_examined_avg,
ROUND(IFNULL(SUM_ROWS_AFFECTED / NULLIF(COUNT_STAR, 0), 0)) AS rows_affected_avg,
DIGEST AS digest
FROM performance_schema.events_statements_summary_by_digest
ORDER BY SUM_TIMER_WAIT DESC;
SET @sys.statement_performance_analyzer.view = 'test.view_digests';
CALL sys.statement_performance_analyzer('overall', NULL, 'custom');;
Next Output Top 100 Queries Using Custom View
query UPDATE `t1` SET `val` = ? + `SLEEP` (?) WHERE `id` = ?
db test
exec_count 2
total_latency O_UPD_TOTAL_LATENCY
avg_latency O_UPD_AVG_LATENCY
rows_sent_avg 0
rows_examined_avg 1
rows_affected_avg 1
digest DIGEST_UPDATE
query SELECT `t1a` . * FROM `t1` AS ... , `t1a` . `id` + `SLEEP` (?)
db test
exec_count 2
total_latency O_SEL_TOTAL_LATENCY
avg_latency O_SEL_AVG_LATENCY
rows_sent_avg 2
rows_examined_avg 8
rows_affected_avg 0
digest DIGEST_SELECT
query INSERT INTO `t1` VALUES ( ? , `SLEEP` (?) )
db test
exec_count 2
total_latency O_INS_TOTAL_LATENCY
avg_latency O_INS_AVG_LATENCY
rows_sent_avg 0
rows_examined_avg 0
rows_affected_avg 1
digest DIGEST_INSERT
CALL sys.statement_performance_analyzer('delta', 'test.tmp_digests_ini', 'custom');;
Next Output Top 100 Queries Using Custom View
query UPDATE `t1` SET `val` = ? + `SLEEP` (?) WHERE `id` = ?
db test
exec_count 1
total_latency D_UPD_TOTAL_LATENCY
avg_latency D_UPD_TOTAL_LATENCY
rows_sent_avg 0
rows_examined_avg 1
rows_affected_avg 1
digest DIGEST_UPDATE
query SELECT `t1a` . * FROM `t1` AS ... , `t1a` . `id` + `SLEEP` (?)
db test
exec_count 1
total_latency D_SEL_TOTAL_LATENCY
avg_latency D_SEL_TOTAL_LATENCY
rows_sent_avg 2
rows_examined_avg 10
rows_affected_avg 0
digest DIGEST_SELECT
query INSERT INTO `t1` VALUES ( ? , `SLEEP` (?) )
db test
exec_count 1
total_latency D_INS_TOTAL_LATENCY
avg_latency D_INS_TOTAL_LATENCY
rows_sent_avg 0
rows_examined_avg 0
rows_affected_avg 1
digest DIGEST_INSERT
SET @sys.statement_performance_analyzer.limit = 2;
CALL sys.statement_performance_analyzer('overall', NULL, 'custom');;
Next Output Top 2 Queries Using Custom View
query UPDATE `t1` SET `val` = ? + `SLEEP` (?) WHERE `id` = ?
db test
exec_count 2
total_latency O_UPD_TOTAL_LATENCY
avg_latency O_UPD_AVG_LATENCY
rows_sent_avg 0
rows_examined_avg 1
rows_affected_avg 1
digest DIGEST_UPDATE
query SELECT `t1a` . * FROM `t1` AS ... , `t1a` . `id` + `SLEEP` (?)
db test
exec_count 2
total_latency O_SEL_TOTAL_LATENCY
avg_latency O_SEL_AVG_LATENCY
rows_sent_avg 2
rows_examined_avg 8
rows_affected_avg 0
digest DIGEST_SELECT
SET SESSION sql_mode = 'NO_AUTO_CREATE_USER';
CALL sys.statement_performance_analyzer('do magic', NULL, NULL);
ERROR 45000: Unknown action. Supported actions are: cleanup, create_table, create_tmp, delta, overall, save, snapshot
SET SESSION sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
CALL sys.statement_performance_analyzer('do magic', NULL, NULL);
ERROR 01000: Data truncated for column 'in_action' at row 1
CALL sys.statement_performance_analyzer('create_tmp', 'sys.tmp_digests', NULL);
ERROR 45000: Invalid value for in_table: `sys`.`tmp_digests` is reserved table name.
CALL sys.statement_performance_analyzer('create_tmp', 'sys.tmp_digests_delta', NULL);
ERROR 45000: Invalid value for in_table: `sys`.`tmp_digests_delta` is reserved table name.
CALL sys.statement_performance_analyzer('create_tmp', 'tmp_digests', NULL);
ERROR 45000: Invalid value for in_table: `sys`.`tmp_digests` is reserved table name.
CALL sys.statement_performance_analyzer('create_tmp', 'test.tmp_digests', NULL);
CREATE TABLE test.tmp_unsupported LIKE test.tmp_digests_ini;
CALL sys.statement_performance_analyzer('create_tmp', 'test.tmp_digests_ini', NULL);
ERROR 45000: Cannot create the table `test`.`tmp_digests_ini` as it already exists.
CALL sys.statement_performance_analyzer('create_table', 'test.tmp_digests_ini', NULL);
ERROR 45000: Cannot create the table `test`.`tmp_digests_ini` as it already exists as a temporary table.
CALL sys.statement_performance_analyzer('create_table', 'test.tmp_unsupported', NULL);
ERROR 45000: Cannot create the table `test`.`tmp_unsupported` as it already exists.
ALTER TABLE test.tmp_unsupported ADD COLUMN myvar int DEFAULT 0;
CALL sys.statement_performance_analyzer('save', 'test.tmp_unsupported', NULL);
ERROR 45000: The table `test`.`tmp_unsupported` has the wrong definition.
CALL sys.statement_performance_analyzer('snapshot', 'test.new_table', NULL);
ERROR 45000: The snapshot action requires in_table to be NULL, NOW() or specify an existing table. The table ...`.`new_table` does not exist.
CALL sys.statement_performance_analyzer('overall', 'test.new_table', 'analysis');
ERROR 45000: The overall action requires in_table to be NULL, NOW() or specify an existing table. The table ...`.`new_table` does not exist.
CALL sys.statement_performance_analyzer('delta', 'test.new_table', 'analysis');
ERROR 45000: The delta action requires in_table to be an existing table. The table `test`.`new_table` does not exist.
CALL sys.statement_performance_analyzer('save', 'test.new_table', NULL);
ERROR 45000: The save action requires in_table to be an existing table. The table `test`.`new_table` does not exist.
SET @sys.statement_performance_analyzer.view = NULL;
DELETE FROM sys.sys_config WHERE variable = 'statement_performance_analyzer.view';
CALL sys.statement_performance_analyzer('overall', NULL, 'custom');
Next Output
Top 2 Queries Using Custom View
ERROR 45000: The @sys.statement_performance_analyzer.view user variable must be set with the view or query to use.
SET @sys.statement_performance_analyzer.view = 'test.tmp_unsupported';
CALL sys.statement_performance_analyzer('overall', NULL, 'custom');
Next Output
Top 2 Queries Using Custom View
ERROR 45000: The @sys.statement_performance_analyzer.view user variable is set but specified neither an existing view nor a query.
CALL sys.table_exists('sys', 'tmp_digests', @exists);
SELECT @exists;
@exists
TEMPORARY
CALL sys.table_exists('sys', 'tmp_digests_delta', @exists);
SELECT @exists;
@exists
TEMPORARY
CALL sys.statement_performance_analyzer('cleanup', NULL, NULL);
DROP TEMPORARY TABLE sys.tmp_digests;
ERROR 42S02: Unknown table 'sys.tmp_digests'
DROP TEMPORARY TABLE sys.tmp_digests_delta;
ERROR 42S02: Unknown table 'sys.tmp_digests_delta'
CALL sys.statement_performance_analyzer('delta', 'test.tmp_digests_ini', 'analysis');
ERROR 45000: An existing snapshot generated with the statement_performance_analyzer() must exist.
DROP TEMPORARY TABLE sys.tmp_digests_delta;
ERROR 42S02: Unknown table 'sys.tmp_digests_delta'
SET @identifier := REPEAT('a', 65);
CALL sys.statement_performance_analyzer('snapshot', CONCAT(@identifier, '.', @identifier), NULL);
ERROR 22001: Data too long for column 'in_table' at row 1
DROP TEMPORARY TABLE test.tmp_digests_ini;
DROP TEMPORARY TABLE test.tmp_digests;
DROP TABLE test.tmp_unsupported;
DROP TABLE test.t1;
DROP VIEW view_digests;
SET @identifier := NULL;
SET SESSION sql_mode = @@global.sql_mode;
SET @sys.statement_performance_analyzer.limit = NULL;
SET @sys.statement_performance_analyzer.view = NULL;
UPDATE performance_schema.setup_consumers SET enabled = 'YES';
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;

View File

@@ -0,0 +1,30 @@
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;

View File

@@ -0,0 +1,43 @@
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;
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;
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;
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;

View File

@@ -0,0 +1,30 @@
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;

View File

@@ -0,0 +1,12 @@
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;

View File

@@ -0,0 +1,16 @@
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;

View File

@@ -0,0 +1,16 @@
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;

View File

@@ -0,0 +1,24 @@
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 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$host_summary_by_statement_latency;

View File

@@ -0,0 +1,26 @@
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;

View File

@@ -0,0 +1,20 @@
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;

View File

@@ -0,0 +1,22 @@
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;

View File

@@ -0,0 +1,58 @@
DESC sys.innodb_lock_waits;
Field Type Null Key Default Extra
wait_started datetime YES NULL
wait_age time YES NULL
wait_age_secs bigint(21) YES NULL
locked_table varchar(1024) NO
locked_index varchar(1024) YES NULL
locked_type varchar(32) NO
waiting_trx_id varchar(18) NO
waiting_trx_started datetime NO 0000-00-00 00:00:00
waiting_trx_age time 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 varchar(32) NO
blocking_trx_id varchar(18) NO
blocking_pid bigint(21) unsigned NO 0
blocking_query longtext YES NULL
blocking_lock_id varchar(81) NO
blocking_lock_mode varchar(32) NO
blocking_trx_started datetime NO 0000-00-00 00:00:00
blocking_trx_age time 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 YES NULL
wait_age_secs bigint(21) YES NULL
locked_table varchar(1024) NO
locked_index varchar(1024) YES NULL
locked_type varchar(32) NO
waiting_trx_id varchar(18) NO
waiting_trx_started datetime NO 0000-00-00 00:00:00
waiting_trx_age time 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 varchar(32) NO
blocking_trx_id varchar(18) NO
blocking_pid bigint(21) unsigned NO 0
blocking_query varchar(1024) YES NULL
blocking_lock_id varchar(81) NO
blocking_lock_mode varchar(32) NO
blocking_trx_started datetime NO 0000-00-00 00:00:00
blocking_trx_age time 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;

View File

@@ -0,0 +1,22 @@
DESC sys.io_by_thread_by_latency;
Field Type Null Key Default Extra
user 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
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(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(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;

View File

@@ -0,0 +1,24 @@
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;

View File

@@ -0,0 +1,24 @@
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;

View File

@@ -0,0 +1,32 @@
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;

View File

@@ -0,0 +1,34 @@
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;

View File

@@ -0,0 +1,16 @@
DESC sys.latest_file_io;
Field Type Null Key Default Extra
thread varchar(149) 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(149) 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;

View File

@@ -0,0 +1,18 @@
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;

View File

@@ -0,0 +1,20 @@
DESC sys.memory_by_thread_by_current_bytes;
Field Type Null Key Default Extra
thread_id bigint(20) unsigned NO NULL
user varchar(128) 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(128) 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;

View File

@@ -0,0 +1,18 @@
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;

View File

@@ -0,0 +1,20 @@
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;

View File

@@ -0,0 +1,8 @@
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;

View File

@@ -0,0 +1,7 @@
DESC sys.metrics;
Field Type Null Key Default Extra
Variable_name varchar(193) YES NULL
Variable_value text YES NULL
Type varchar(210) YES NULL
Enabled varchar(7) NO
SELECT * FROM sys.metrics;

View File

@@ -0,0 +1,62 @@
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(128) 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 text 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) NO
last_statement longtext YES NULL
last_statement_latency text YES NULL
current_memory text YES NULL
last_wait varchar(128) YES NULL
last_wait_latency text 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(128) 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) NO
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;

View File

@@ -0,0 +1,5 @@
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;

View File

@@ -0,0 +1,18 @@
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;

View File

@@ -0,0 +1,18 @@
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;

View File

@@ -0,0 +1,50 @@
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;

View File

@@ -0,0 +1,143 @@
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;

View File

@@ -0,0 +1,28 @@
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;

View File

@@ -0,0 +1,6 @@
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;

View File

@@ -0,0 +1,37 @@
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 text YES NULL
redundant_index_non_unique bigint(1) YES NULL
dominant_index_name varchar(64) NO
dominant_index_columns text YES NULL
dominant_index_non_unique bigint(1) YES NULL
subpart_exists int(1) NO 0
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 text 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;

View File

@@ -0,0 +1,63 @@
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;
CREATE TABLE test.lock_waits (i INT PRIMARY KEY, j INT) ENGINE = InnoDB;
LOCK TABLE lock_waits WRITE;
ALTER TABLE test.lock_waits ADD k VARCHAR(20);
SELECT SLEEP(1);
SLEEP(1)
0
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
SELECT SLEEP(1);
SLEEP(1)
0
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
DROP TABLE test.lock_waits;

View File

@@ -0,0 +1,44 @@
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;

View File

@@ -0,0 +1,56 @@
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;

View File

@@ -0,0 +1,59 @@
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 DATABASE v_schema_tables_with_full_table_scans;
CREATE TABLE v_schema_tables_with_full_table_scans.t (i BIGINT AUTO_INCREMENT PRIMARY KEY, j BIGINT) ENGINE = innodb;
INSERT INTO v_schema_tables_with_full_table_scans.t (j) VALUES (1), (2), (3);
INSERT INTO v_schema_tables_with_full_table_scans.t (j) (SELECT j*2 FROM v_schema_tables_with_full_table_scans.t);
INSERT INTO v_schema_tables_with_full_table_scans.t (j) (SELECT j*2 FROM v_schema_tables_with_full_table_scans.t);
INSERT INTO v_schema_tables_with_full_table_scans.t (j) (SELECT j*2 FROM v_schema_tables_with_full_table_scans.t);
INSERT INTO v_schema_tables_with_full_table_scans.t (j) (SELECT j*2 FROM v_schema_tables_with_full_table_scans.t);
INSERT INTO v_schema_tables_with_full_table_scans.t (j) (SELECT j*2 FROM v_schema_tables_with_full_table_scans.t);
INSERT INTO v_schema_tables_with_full_table_scans.t (j) (SELECT j*2 FROM v_schema_tables_with_full_table_scans.t);
INSERT INTO v_schema_tables_with_full_table_scans.t (j) (SELECT j*2 FROM v_schema_tables_with_full_table_scans.t);
INSERT INTO v_schema_tables_with_full_table_scans.t (j) (SELECT j*2 FROM v_schema_tables_with_full_table_scans.t);
CALL sys.ps_truncate_all_tables(false);
summary
Truncated 44 tables
SELECT i, j, RAND() FROM v_schema_tables_with_full_table_scans.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
v_schema_tables_with_full_table_scans 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
v_schema_tables_with_full_table_scans t 768
SELECT i, j, RAND() FROM v_schema_tables_with_full_table_scans.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
v_schema_tables_with_full_table_scans 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
v_schema_tables_with_full_table_scans t 1536
SELECT * FROM v_schema_tables_with_full_table_scans.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
v_schema_tables_with_full_table_scans 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
v_schema_tables_with_full_table_scans t 1536
DROP DATABASE v_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;

View File

@@ -0,0 +1,6 @@
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;

View File

@@ -0,0 +1,62 @@
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(128) 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 text 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) NO
last_statement longtext YES NULL
last_statement_latency text YES NULL
current_memory text YES NULL
last_wait varchar(128) YES NULL
last_wait_latency text 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(128) 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) NO
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;

View File

@@ -0,0 +1,7 @@
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;

View File

@@ -0,0 +1,52 @@
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;

View File

@@ -0,0 +1,26 @@
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;

View File

@@ -0,0 +1,69 @@
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;

View File

@@ -0,0 +1,38 @@
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;

View File

@@ -0,0 +1,32 @@
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;

View File

@@ -0,0 +1,28 @@
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;

View File

@@ -0,0 +1,30 @@
DESC sys.user_summary;
Field Type Null Key Default Extra
user varchar(32) 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(32) 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;

View File

@@ -0,0 +1,12 @@
DESC sys.user_summary_by_file_io;
Field Type Null Key Default Extra
user varchar(32) 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(32) YES NULL
ios decimal(42,0) YES NULL
io_latency decimal(42,0) YES NULL
SELECT * FROM sys.x$user_summary_by_file_io;

View File

@@ -0,0 +1,16 @@
DESC sys.user_summary_by_file_io_type;
Field Type Null Key Default Extra
user varchar(32) 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(32) 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;

View File

@@ -0,0 +1,16 @@
DESC sys.user_summary_by_stages;
Field Type Null Key Default Extra
user varchar(32) 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(32) 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;

View File

@@ -0,0 +1,24 @@
DESC sys.user_summary_by_statement_latency;
Field Type Null Key Default Extra
user varchar(32) 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(32) 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;

View File

@@ -0,0 +1,26 @@
DESC sys.user_summary_by_statement_type;
Field Type Null Key Default Extra
user varchar(32) 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(32) 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;

View File

@@ -0,0 +1,3 @@
SELECT sys_version FROM sys.version;
sys_version
1.5.0

View File

@@ -0,0 +1,18 @@
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;

View File

@@ -0,0 +1,18 @@
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;

View File

@@ -0,0 +1,18 @@
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;

View File

@@ -0,0 +1,18 @@
DESC sys.waits_by_user_by_latency;
Field Type Null Key Default Extra
user varchar(32) 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(32) 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;

View File

@@ -0,0 +1,16 @@
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;

View File

@@ -0,0 +1,6 @@
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

View File

@@ -0,0 +1,16 @@
-- source include/not_embedded.inc
# Ensure database exists
USE sys;
# Ensure all views are created
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'sys' ORDER BY TABLE_NAME;
# Ensure all functions and routines are created
SELECT ROUTINE_NAME, ROUTINE_TYPE FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA = 'sys' ORDER BY ROUTINE_TYPE, ROUTINE_NAME;
# Ensure all triggers are created
SELECT TRIGGER_NAME FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_SCHEMA = 'sys' ORDER BY TRIGGER_NAME;
# Check the version of the schema (and ensure no updates slip in undetected)
SELECT sys_version FROM sys.version;

View File

@@ -0,0 +1,9 @@
-- source include/not_embedded.inc
# Tests for sys schema
# Verify the sys.extract_schema_from_file_name() function perfoms as expected
# Passing NULL should return NULL
SELECT sys.extract_schema_from_file_name(NULL);
# Ensure the right part of the path is extracted
SELECT sys.extract_schema_from_file_name('/var/lib/mysql/employees/employee.ibd');

View File

@@ -0,0 +1,9 @@
-- source include/not_embedded.inc
# Tests for sys schema
# Verify the sys.extract_table_from_file_name() function perfoms as expected
# Passing NULL should return NULL
SELECT sys.extract_table_from_file_name(NULL);
# Ensure the right part of the path is extracted
SELECT sys.extract_table_from_file_name('/var/lib/mysql/employees/employee.ibd');

View File

@@ -0,0 +1,30 @@
-- source include/not_embedded.inc
# Tests for sys schema
# Verify the sys.format_bytes() function perfoms as expected
# Passing NULL/nothing should return NULL
SELECT sys.format_bytes(NULL);
# Format bytes
SELECT sys.format_bytes(1);
SELECT sys.format_bytes(1023);
# Format kilobytes
SELECT sys.format_bytes(1024);
SELECT sys.format_bytes(1048575);
# Format megabytes
SELECT sys.format_bytes(1048576);
SELECT sys.format_bytes(1073741823);
# Format gigabytes
SELECT sys.format_bytes(1073741824);
SELECT sys.format_bytes(1099511627775);
# Format terabytes
SELECT sys.format_bytes(1099511627776);
SELECT sys.format_bytes(1125899906842623);
# Formate petabytes
SELECT sys.format_bytes(1125899906842624);
SELECT sys.format_bytes(1125899906842624238947293);

View File

@@ -0,0 +1,28 @@
-- source include/not_embedded.inc
# Tests for sys schema
# Verify the sys.format_path() function perfoms as expected
#
# Note, innodb_data_home_dir replacement is not tested,
# as this is not set by default
#
# Passing NULL should return NULL
SELECT sys.format_path(NULL);
# Ensure datadir is recognized and stripped
SET @mypath := CONCAT(@@global.datadir, 'foo/bar.foo');
SELECT sys.format_path(@mypath);
# Ensure tmpdir is recognized and stripped
SET @mypath := CONCAT(@@global.tmpdir, 'foo/bar.foo');
SELECT sys.format_path(@mypath);
# Ensure innodb_log_group_home_dir is recognized and stripped
SET @mypath := CONCAT(@@global.innodb_log_group_home_dir, 'foo/bar.foo');
SELECT sys.format_path(@mypath);
# Unrecognized paths should return the full path
SELECT sys.format_path('/foo/bar/baz.foo');

View File

@@ -0,0 +1,13 @@
-- source include/not_embedded.inc
# Tests for sys schema
# Verify the sys.format_statement() function perfoms as expected
# Passing NULL should return NULL
SELECT sys.format_statement(NULL);
# Ensure long statements are truncated correctly
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;
# Increase truncation limit and test that it takes effect
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;

View File

@@ -0,0 +1,42 @@
-- source include/not_embedded.inc
# Tests for sys schema
# Verify the sys.format_time() function perfoms as expected
# Passing NULL should return NULL
SELECT sys.format_time(NULL);
# Format picoseconds
SELECT sys.format_time(1);
SELECT sys.format_time(999);
# Format nanoseconds
SELECT sys.format_time(1000);
SELECT sys.format_time(999999);
# Format microseconds
SELECT sys.format_time(1000000);
SELECT sys.format_time(999999999);
# Format milliseconds
SELECT sys.format_time(1000000000);
SELECT sys.format_time(999999999999);
# Format seconds
SELECT sys.format_time(1000000000000);
SELECT sys.format_time(59999999999999);
# Format minutes
SELECT sys.format_time(60000000000000);
SELECT sys.format_time(3599999999999999);
# Format hours
SELECT sys.format_time(3600000000000000);
SELECT sys.format_time(86399999999999988);
# Format days
SELECT sys.format_time(86400000000000000);
SELECT sys.format_time(604799999999999888);
# Format weeks
SELECT sys.format_time(604800000000000000);
SELECT sys.format_time(2389472398472389748237429837423984728374);

View File

@@ -0,0 +1,39 @@
-- source include/not_embedded.inc
# Tests for sys schema
# Verify the sys.list_add() function perfoms as expected
# Should init with a single value
SELECT sys.list_add(NULL, 'foo');
# Should init with a single value
SELECT sys.list_add('', 'foo');
# Should add to the list with a comma
SELECT sys.list_add('bar', 'foo');
# Should add to the list with a single comma
SELECT sys.list_add('bar, ', 'foo');
# Should return an error with a NULL value to add
--error 1138
SELECT sys.list_add('foo', NULL);
# Test the sql mode update use case
# save old mode to restore
SET @sqlmode := @@sql_mode;
SELECT @@sql_mode;
SET SESSION sql_mode = sys.list_add(@@sql_mode, 'ANSI_QUOTES');
SELECT @@sql_mode;
# restore old mode
SET SESSION sql_mode = @sqlmode;
SET @sqlmode := NULL;
# Check too large a value
SET @input := REPEAT('a', 4194304);
-- error 1406
SELECT sys.list_add(@input, 'foo');
SET @input := NULL;

View File

@@ -0,0 +1,35 @@
-- source include/not_embedded.inc
# Tests for sys schema
# Verify the sys.sql_mode_drop() function perfoms as expected
# Remove from front of list
SELECT sys.list_drop('1,2,3,4,5', '1');
# Remove from middle of list
SELECT sys.list_drop('1,2,3,4,5', '3');
# Remove from end of list
SELECT sys.list_drop('1,2,3,4,5', '5');
# Make sure spaces are appropriately dealt with
SELECT sys.list_drop('1, 2, 3, 4, 5', '1');
SELECT sys.list_drop('1, 2, 3, 4, 5', '3');
SELECT sys.list_drop('1, 2, 3, 4, 5', '5');
# Should return an error with a NULL value to drop
--error 1138
SELECT sys.list_drop('1,2,3,4,5', NULL);
# Test the sql mode update use case
# save old mode to restore
SET @sqlmode := @@sql_mode;
SELECT @@sql_mode;
SET SESSION sql_mode = sys.list_drop(@@sql_mode, 'STRICT_TRANS_TABLES');
SELECT @@sql_mode;
# restore old mode
SET SESSION sql_mode = @sqlmode;
SET @sqlmode := NULL;

View File

@@ -0,0 +1,20 @@
-- source include/not_embedded.inc
# Tests for sys schema
# Verify the sys.ps_is_account_enabled() function perfoms as expected
# First test with the default "all enabled" for any random user
SELECT sys.ps_is_account_enabled('foo', 'bar');
# Now remove the wild card entry, and add some specific users to testx
DELETE FROM performance_schema.setup_actors;
INSERT INTO performance_schema.setup_actors VALUES
('test', 'test', '%', 'YES', 'NO');
# Now the random account should not be enabled
SELECT sys.ps_is_account_enabled('foo', 'bar');
# But the specified one should
SELECT sys.ps_is_account_enabled('test', 'test');
--source ../include/ps_setup_actors_cleanup.inc

View File

@@ -0,0 +1,39 @@
-- source include/not_embedded.inc
# Tests for sys schema
# Verify the sys.ps_is_consumer_enabled() function perfoms as expected
# Should be disabled by default
UPDATE performance_schema.setup_consumers SET enabled = 'NO' WHERE name = 'events_stages_history';
SELECT sys.ps_is_consumer_enabled('events_stages_history');
# Should be enabled by default
SELECT sys.ps_is_consumer_enabled('global_instrumentation');
#
# Check that hierarchy is properly reflected
#
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';
# Should still be disabled, as events_stages_current not enabled
SELECT sys.ps_is_consumer_enabled('events_stages_history');
UPDATE performance_schema.setup_consumers SET enabled = 'YES' WHERE name = 'events_stages_current';
# Now it should be enabled
SELECT sys.ps_is_consumer_enabled('events_stages_history');
# Toggling global_instrumentation should disable all other consumers
UPDATE performance_schema.setup_consumers SET enabled = 'NO' WHERE name = 'global_instrumentation';
SELECT sys.ps_is_consumer_enabled('thread_instrumentation');
SELECT sys.ps_is_consumer_enabled('statements_digest');
SELECT sys.ps_is_consumer_enabled('events_stages_current');
SELECT sys.ps_is_consumer_enabled('events_stages_history');
SELECT sys.ps_is_consumer_enabled('events_stages_history_long');
SELECT sys.ps_is_consumer_enabled('events_statements_current');
SELECT sys.ps_is_consumer_enabled('events_statements_history');
SELECT sys.ps_is_consumer_enabled('events_statements_history_long');
--source ../include/ps_setup_consumers_cleanup.inc

View File

@@ -0,0 +1,23 @@
-- source include/not_embedded.inc
# Tests for sys schema
# Verify the sys.ps_is_instrument_default_enabled() function perfoms as expected
# Should all be enabled
SELECT sys.ps_is_instrument_default_enabled('memory/performance_schema/internal_buffers');
SELECT sys.ps_is_instrument_default_enabled('statement/sql/select');
SELECT sys.ps_is_instrument_default_enabled('statement/sp/error');
SELECT sys.ps_is_instrument_default_enabled('statement/com/Prepare');
SELECT sys.ps_is_instrument_default_enabled('wait/io/file/sql/binlog');
SELECT sys.ps_is_instrument_default_enabled('wait/io/table/sql/handler');
SELECT sys.ps_is_instrument_default_enabled('wait/lock/table/sql/handler');
SELECT sys.ps_is_instrument_default_enabled('idle');
# Should all be disabled
SELECT sys.ps_is_instrument_default_enabled('wait/synch/mutex/sql/LOCK_plugin');
SELECT sys.ps_is_instrument_default_enabled('wait/synch/rwlock/sql/LOCK_grant');
SELECT sys.ps_is_instrument_default_enabled('wait/synch/sxlock/innodb/btr_search_latch');
SELECT sys.ps_is_instrument_default_enabled('wait/synch/cond/sql/MYSQL_BIN_LOG::update_cond');
SELECT sys.ps_is_instrument_default_enabled('stage/sql/end');
SELECT sys.ps_is_instrument_default_enabled('transaction');
SELECT sys.ps_is_instrument_default_enabled('wait/io/socket/sql/server_tcpip_socket');
SELECT sys.ps_is_instrument_default_enabled('wait/lock/metadata/sql/mdl');

Some files were not shown because too many files have changed in this diff Show More