diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-01-31 09:48:19 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-01-31 09:48:19 +0100 |
commit | ab83952f293ea46c00e421c81b81a394c9cae2b4 (patch) | |
tree | 6a3e995bd1330828a0e988d896bca218863fc74c /scripts | |
parent | 055b62f404ee0a0463ee8ff98a0e24c083b95f1d (diff) | |
parent | 5267af5e9e5e601d4f4b1ef40730da1e36d38d9d (diff) | |
download | mariadb-git-ab83952f293ea46c00e421c81b81a394c9cae2b4.tar.gz |
10.0-base merge
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/CMakeLists.txt | 8 | ||||
-rw-r--r-- | scripts/mysql_install_db.pl.in | 16 | ||||
-rw-r--r-- | scripts/mysql_install_db.sh | 7 | ||||
-rw-r--r-- | scripts/mysql_performance_tables.sql | 1451 | ||||
-rw-r--r-- | scripts/mysql_system_tables.sql | 1453 | ||||
-rw-r--r-- | scripts/mysql_system_tables_fix.sql | 23 | ||||
-rw-r--r-- | scripts/mysqlaccess.sh | 6 | ||||
-rw-r--r-- | scripts/mysqld_multi.sh | 22 | ||||
-rw-r--r-- | scripts/mysqld_safe.sh | 83 |
9 files changed, 1561 insertions, 1508 deletions
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 91a47bf3d48..76e92899c2a 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -29,7 +29,7 @@ ENDIF() IF(CAT_EXECUTABLE) SET(CAT_COMMAND COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR} - ${CAT_EXECUTABLE} mysql_system_tables.sql mysql_system_tables_fix.sql > + ${CAT_EXECUTABLE} mysql_system_tables.sql mysql_system_tables_fix.sql mysql_performance_tables.sql > ${CMAKE_CURRENT_BINARY_DIR}/mysql_fix_privilege_tables.sql ) ELSEIF(WIN32) @@ -37,7 +37,7 @@ ELSEIF(WIN32) native_outfile ) SET(CAT_COMMAND COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR} - cmd /c copy /b mysql_system_tables.sql + mysql_system_tables_fix.sql + cmd /c copy /b mysql_system_tables.sql + mysql_system_tables_fix.sql + mysql_performance_tables.sql ${native_outfile} ) ELSE() MESSAGE(FATAL_ERROR "Cannot concatenate files") @@ -55,6 +55,7 @@ ADD_CUSTOM_COMMAND( DEPENDS comp_sql ${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables.sql ${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables_fix.sql + ${CMAKE_CURRENT_SOURCE_DIR}/mysql_performance_tables.sql ) # Add target for the above to be built @@ -74,6 +75,7 @@ ENDIF() INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables.sql ${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables_data.sql + ${CMAKE_CURRENT_SOURCE_DIR}/mysql_performance_tables.sql ${CMAKE_CURRENT_SOURCE_DIR}/fill_help_tables.sql ${CMAKE_CURRENT_SOURCE_DIR}/mysql_test_data_timezone.sql ${FIX_PRIVILEGES_SQL} @@ -283,7 +285,7 @@ SET(mysql_config_COMPONENT COMPONENT Development) SET(msql2mysql_COMPONENT COMPONENT Client) SET(mysqlaccess_COMPONENT COMPONENT Client) SET(mysql_find_rows_COMPONENT COMPONENT Client) -SET(mytop_COMPONENT Client) +SET(mytop_COMPONENT Mytop) IF(WIN32) # On Windows, some .sh and some .pl.in files are configured diff --git a/scripts/mysql_install_db.pl.in b/scripts/mysql_install_db.pl.in index d4e22ea0340..1bc2603a718 100644 --- a/scripts/mysql_install_db.pl.in +++ b/scripts/mysql_install_db.pl.in @@ -423,7 +423,9 @@ my $mysqld_install_cmd_line = quote_options($mysqld_bootstrap, "--bootstrap", "--basedir=$opt->{basedir}", "--datadir=$opt->{ldata}", + "--log-warnings=0", "--max_allowed_packet=8M", + "--default-storage-engine=MyISAM", "--net_buffer_length=16K", @args, ); @@ -436,6 +438,8 @@ report_verbose_wait($opt,"Installing MySQL system tables..."); open(SQL, $create_system_tables) or error($opt,"can't open $create_system_tables for reading: $!"); +open(SQL2, $fill_system_tables) + or error($opt,"can't open $fill_system_tables for reading: $!"); # FIXME > /dev/null ? if ( open(PIPE, "| $mysqld_install_cmd_line") ) { @@ -449,8 +453,20 @@ if ( open(PIPE, "| $mysqld_install_cmd_line") ) print PIPE $_; } + while ( <SQL2> ) + { + # TODO: make it similar to the above condition when we're sure + # @@hostname returns a fqdn + # When doing a "cross bootstrap" install, no reference to the current + # host should be added to the system tables. So we filter out any + # lines which contain the current host name. + next if /\@current_hostname/; + + print PIPE $_; + } close PIPE; close SQL; + close SQL2; report_verbose($opt,"OK"); diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index 1a511524e84..639b2209b5b 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -1,6 +1,6 @@ #!/bin/sh # Copyright (c) 2000, 2011, Oracle and/or its affiliates. -# Copyright (c) 2009, 2011, Monty Program Ab +# Copyright (c) 2009, 2011,2013 Monty Program Ab # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -305,9 +305,10 @@ fi # Set up paths to SQL scripts required for bootstrap fill_help_tables="$pkgdatadir/fill_help_tables.sql" create_system_tables="$pkgdatadir/mysql_system_tables.sql" +create_system_tables2="$pkgdatadir/mysql_performance_tables.sql" fill_system_tables="$pkgdatadir/mysql_system_tables_data.sql" -for f in "$fill_help_tables" "$create_system_tables" "$fill_system_tables" +for f in "$fill_help_tables" "$create_system_tables" "$create_system_tables2" "$fill_system_tables" do if test ! -f "$f" then @@ -424,7 +425,7 @@ mysqld_install_cmd_line() # Create the system and help tables by passing them to "mysqld --bootstrap" s_echo "Installing MariaDB/MySQL system tables in '$ldata' ..." -if { echo "use mysql;"; cat "$create_system_tables" "$fill_system_tables"; } | eval "$filter_cmd_line" | mysqld_install_cmd_line > /dev/null +if { echo "use mysql;"; cat "$create_system_tables" "$create_system_tables2" "$fill_system_tables"; } | eval "$filter_cmd_line" | mysqld_install_cmd_line > /dev/null then s_echo "OK" else diff --git a/scripts/mysql_performance_tables.sql b/scripts/mysql_performance_tables.sql new file mode 100644 index 00000000000..d08ef13a8a9 --- /dev/null +++ b/scripts/mysql_performance_tables.sql @@ -0,0 +1,1451 @@ +-- +-- PERFORMANCE SCHEMA INSTALLATION +-- Note that this script is also reused by mysql_upgrade, +-- so we have to be very careful here to not destroy any +-- existing database named 'performance_schema' if it +-- can contain user data. +-- In case of downgrade, it's ok to drop unknown tables +-- from a future version, as long as they belong to the +-- performance schema engine. +-- + +set @have_old_pfs= (select count(*) from information_schema.schemata where schema_name='performance_schema'); + +SET @cmd="SET @broken_tables = (select count(*) from information_schema.tables where engine != 'PERFORMANCE_SCHEMA' and table_schema='performance_schema')"; + +-- Work around for bug#49542 +SET @str = IF(@have_old_pfs = 1, @cmd, 'SET @broken_tables = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +SET @cmd="SET @broken_views = (select count(*) from information_schema.views where table_schema='performance_schema')"; + +-- Work around for bug#49542 +SET @str = IF(@have_old_pfs = 1, @cmd, 'SET @broken_views = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +SET @broken_routines = (select count(*) from mysql.proc where db='performance_schema'); + +SET @broken_events = (select count(*) from mysql.event where db='performance_schema'); + +SET @broken_pfs= (select @broken_tables + @broken_views + @broken_routines + @broken_events); + +-- +-- The performance schema database. +-- Only drop and create the database if this is safe (no broken_pfs). +-- This database is created, even in --without-perfschema builds, +-- so that the database name is always reserved by the MySQL implementation. +-- + +SET @cmd= "DROP DATABASE IF EXISTS performance_schema"; + +SET @str = IF(@broken_pfs = 0, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +SET @cmd= "CREATE DATABASE performance_schema character set utf8"; + +SET @str = IF(@broken_pfs = 0, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- From this point, only create the performance schema tables +-- if the server is built with performance schema +-- + +set @have_pfs= (select count(engine) from information_schema.engines where engine='PERFORMANCE_SCHEMA' and support != 'NO'); + +-- +-- TABLE COND_INSTANCES +-- + +SET @cmd="CREATE TABLE performance_schema.cond_instances(" + "NAME VARCHAR(128) not null," + "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_WAITS_CURRENT +-- + +SET @cmd="CREATE TABLE performance_schema.events_waits_current(" + "THREAD_ID INTEGER not null," + "EVENT_ID BIGINT unsigned not null," + "END_EVENT_ID BIGINT unsigned," + "EVENT_NAME VARCHAR(128) not null," + "SOURCE VARCHAR(64)," + "TIMER_START BIGINT unsigned," + "TIMER_END BIGINT unsigned," + "TIMER_WAIT BIGINT unsigned," + "SPINS INTEGER unsigned," + "OBJECT_SCHEMA VARCHAR(64)," + "OBJECT_NAME VARCHAR(512)," + "INDEX_NAME VARCHAR(64)," + "OBJECT_TYPE VARCHAR(64)," + "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null," + "NESTING_EVENT_ID BIGINT unsigned," + "NESTING_EVENT_TYPE ENUM('STATEMENT', 'STAGE', 'WAIT')," + "OPERATION VARCHAR(32) not null," + "NUMBER_OF_BYTES BIGINT," + "FLAGS INTEGER unsigned" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_WAITS_HISTORY +-- + +SET @cmd="CREATE TABLE performance_schema.events_waits_history(" + "THREAD_ID INTEGER not null," + "EVENT_ID BIGINT unsigned not null," + "END_EVENT_ID BIGINT unsigned," + "EVENT_NAME VARCHAR(128) not null," + "SOURCE VARCHAR(64)," + "TIMER_START BIGINT unsigned," + "TIMER_END BIGINT unsigned," + "TIMER_WAIT BIGINT unsigned," + "SPINS INTEGER unsigned," + "OBJECT_SCHEMA VARCHAR(64)," + "OBJECT_NAME VARCHAR(512)," + "INDEX_NAME VARCHAR(64)," + "OBJECT_TYPE VARCHAR(64)," + "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null," + "NESTING_EVENT_ID BIGINT unsigned," + "NESTING_EVENT_TYPE ENUM('STATEMENT', 'STAGE', 'WAIT')," + "OPERATION VARCHAR(32) not null," + "NUMBER_OF_BYTES BIGINT," + "FLAGS INTEGER unsigned" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_WAITS_HISTORY_LONG +-- + +SET @cmd="CREATE TABLE performance_schema.events_waits_history_long(" + "THREAD_ID INTEGER not null," + "EVENT_ID BIGINT unsigned not null," + "END_EVENT_ID BIGINT unsigned," + "EVENT_NAME VARCHAR(128) not null," + "SOURCE VARCHAR(64)," + "TIMER_START BIGINT unsigned," + "TIMER_END BIGINT unsigned," + "TIMER_WAIT BIGINT unsigned," + "SPINS INTEGER unsigned," + "OBJECT_SCHEMA VARCHAR(64)," + "OBJECT_NAME VARCHAR(512)," + "INDEX_NAME VARCHAR(64)," + "OBJECT_TYPE VARCHAR(64)," + "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null," + "NESTING_EVENT_ID BIGINT unsigned," + "NESTING_EVENT_TYPE ENUM('STATEMENT', 'STAGE', 'WAIT')," + "OPERATION VARCHAR(32) not null," + "NUMBER_OF_BYTES BIGINT," + "FLAGS INTEGER unsigned" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_WAITS_SUMMARY_BY_INSTANCE +-- + +SET @cmd="CREATE TABLE performance_schema.events_waits_summary_by_instance(" + "EVENT_NAME VARCHAR(128) not null," + "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null," + "COUNT_STAR BIGINT unsigned not null," + "SUM_TIMER_WAIT BIGINT unsigned not null," + "MIN_TIMER_WAIT BIGINT unsigned not null," + "AVG_TIMER_WAIT BIGINT unsigned not null," + "MAX_TIMER_WAIT BIGINT unsigned not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_WAITS_SUMMARY_BY_HOST_BY_EVENT_NAME +-- + +SET @cmd="CREATE TABLE performance_schema.events_waits_summary_by_host_by_event_name(" + "HOST CHAR(60) collate utf8_bin default null," + "EVENT_NAME VARCHAR(128) not null," + "COUNT_STAR BIGINT unsigned not null," + "SUM_TIMER_WAIT BIGINT unsigned not null," + "MIN_TIMER_WAIT BIGINT unsigned not null," + "AVG_TIMER_WAIT BIGINT unsigned not null," + "MAX_TIMER_WAIT BIGINT unsigned not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_WAITS_SUMMARY_BY_USER_BY_EVENT_NAME +-- + +SET @cmd="CREATE TABLE performance_schema.events_waits_summary_by_user_by_event_name(" + "USER CHAR(16) collate utf8_bin default null," + "EVENT_NAME VARCHAR(128) not null," + "COUNT_STAR BIGINT unsigned not null," + "SUM_TIMER_WAIT BIGINT unsigned not null," + "MIN_TIMER_WAIT BIGINT unsigned not null," + "AVG_TIMER_WAIT BIGINT unsigned not null," + "MAX_TIMER_WAIT BIGINT unsigned not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_WAITS_SUMMARY_BY_ACCOUNT_BY_EVENT_NAME +-- + +SET @cmd="CREATE TABLE performance_schema.events_waits_summary_by_account_by_event_name(" + "USER CHAR(16) collate utf8_bin default null," + "HOST CHAR(60) collate utf8_bin default null," + "EVENT_NAME VARCHAR(128) not null," + "COUNT_STAR BIGINT unsigned not null," + "SUM_TIMER_WAIT BIGINT unsigned not null," + "MIN_TIMER_WAIT BIGINT unsigned not null," + "AVG_TIMER_WAIT BIGINT unsigned not null," + "MAX_TIMER_WAIT BIGINT unsigned not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +-- + +SET @cmd="CREATE TABLE performance_schema.events_waits_summary_by_thread_by_event_name(" + "THREAD_ID INTEGER not null," + "EVENT_NAME VARCHAR(128) not null," + "COUNT_STAR BIGINT unsigned not null," + "SUM_TIMER_WAIT BIGINT unsigned not null," + "MIN_TIMER_WAIT BIGINT unsigned not null," + "AVG_TIMER_WAIT BIGINT unsigned not null," + "MAX_TIMER_WAIT BIGINT unsigned not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME +-- + +SET @cmd="CREATE TABLE performance_schema.events_waits_summary_global_by_event_name(" + "EVENT_NAME VARCHAR(128) not null," + "COUNT_STAR BIGINT unsigned not null," + "SUM_TIMER_WAIT BIGINT unsigned not null," + "MIN_TIMER_WAIT BIGINT unsigned not null," + "AVG_TIMER_WAIT BIGINT unsigned not null," + "MAX_TIMER_WAIT BIGINT unsigned not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE FILE_INSTANCES +-- + +SET @cmd="CREATE TABLE performance_schema.file_instances(" + "FILE_NAME VARCHAR(512) not null," + "EVENT_NAME VARCHAR(128) not null," + "OPEN_COUNT INTEGER unsigned not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE FILE_SUMMARY_BY_EVENT_NAME +-- + +SET @cmd="CREATE TABLE performance_schema.file_summary_by_event_name(" + "EVENT_NAME VARCHAR(128) not null," + "COUNT_STAR BIGINT unsigned not null," + "SUM_TIMER_WAIT BIGINT unsigned not null," + "MIN_TIMER_WAIT BIGINT unsigned not null," + "AVG_TIMER_WAIT BIGINT unsigned not null," + "MAX_TIMER_WAIT BIGINT unsigned not null," + "COUNT_READ BIGINT unsigned not null," + "SUM_TIMER_READ BIGINT unsigned not null," + "MIN_TIMER_READ BIGINT unsigned not null," + "AVG_TIMER_READ BIGINT unsigned not null," + "MAX_TIMER_READ BIGINT unsigned not null," + "SUM_NUMBER_OF_BYTES_READ BIGINT not null," + "COUNT_WRITE BIGINT unsigned not null," + "SUM_TIMER_WRITE BIGINT unsigned not null," + "MIN_TIMER_WRITE BIGINT unsigned not null," + "AVG_TIMER_WRITE BIGINT unsigned not null," + "MAX_TIMER_WRITE BIGINT unsigned not null," + "SUM_NUMBER_OF_BYTES_WRITE BIGINT not null," + "COUNT_MISC BIGINT unsigned not null," + "SUM_TIMER_MISC BIGINT unsigned not null," + "MIN_TIMER_MISC BIGINT unsigned not null," + "AVG_TIMER_MISC BIGINT unsigned not null," + "MAX_TIMER_MISC BIGINT unsigned not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE FILE_SUMMARY_BY_INSTANCE +-- + +SET @cmd="CREATE TABLE performance_schema.file_summary_by_instance(" + "FILE_NAME VARCHAR(512) not null," + "EVENT_NAME VARCHAR(128) not null," + "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null," + "COUNT_STAR BIGINT unsigned not null," + "SUM_TIMER_WAIT BIGINT unsigned not null," + "MIN_TIMER_WAIT BIGINT unsigned not null," + "AVG_TIMER_WAIT BIGINT unsigned not null," + "MAX_TIMER_WAIT BIGINT unsigned not null," + "COUNT_READ BIGINT unsigned not null," + "SUM_TIMER_READ BIGINT unsigned not null," + "MIN_TIMER_READ BIGINT unsigned not null," + "AVG_TIMER_READ BIGINT unsigned not null," + "MAX_TIMER_READ BIGINT unsigned not null," + "SUM_NUMBER_OF_BYTES_READ BIGINT not null," + "COUNT_WRITE BIGINT unsigned not null," + "SUM_TIMER_WRITE BIGINT unsigned not null," + "MIN_TIMER_WRITE BIGINT unsigned not null," + "AVG_TIMER_WRITE BIGINT unsigned not null," + "MAX_TIMER_WRITE BIGINT unsigned not null," + "SUM_NUMBER_OF_BYTES_WRITE BIGINT not null," + "COUNT_MISC BIGINT unsigned not null," + "SUM_TIMER_MISC BIGINT unsigned not null," + "MIN_TIMER_MISC BIGINT unsigned not null," + "AVG_TIMER_MISC BIGINT unsigned not null," + "MAX_TIMER_MISC BIGINT unsigned not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + + +-- +-- TABLE SOCKET_INSTANCES +-- + +SET @cmd="CREATE TABLE performance_schema.socket_instances(" + "EVENT_NAME VARCHAR(128) not null," + "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null," + "THREAD_ID INTEGER," + "SOCKET_ID INTEGER not null," + "IP VARCHAR(64) not null," + "PORT INTEGER not null," + "STATE ENUM('IDLE','ACTIVE') not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE SOCKET_SUMMARY_BY_INSTANCE +-- + +SET @cmd="CREATE TABLE performance_schema.socket_summary_by_instance(" + "EVENT_NAME VARCHAR(128) not null," + "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null," + "COUNT_STAR BIGINT unsigned not null," + "SUM_TIMER_WAIT BIGINT unsigned not null," + "MIN_TIMER_WAIT BIGINT unsigned not null," + "AVG_TIMER_WAIT BIGINT unsigned not null," + "MAX_TIMER_WAIT BIGINT unsigned not null," + "COUNT_READ BIGINT unsigned not null," + "SUM_TIMER_READ BIGINT unsigned not null," + "MIN_TIMER_READ BIGINT unsigned not null," + "AVG_TIMER_READ BIGINT unsigned not null," + "MAX_TIMER_READ BIGINT unsigned not null," + "SUM_NUMBER_OF_BYTES_READ BIGINT unsigned not null," + "COUNT_WRITE BIGINT unsigned not null," + "SUM_TIMER_WRITE BIGINT unsigned not null," + "MIN_TIMER_WRITE BIGINT unsigned not null," + "AVG_TIMER_WRITE BIGINT unsigned not null," + "MAX_TIMER_WRITE BIGINT unsigned not null," + "SUM_NUMBER_OF_BYTES_WRITE BIGINT unsigned not null," + "COUNT_MISC BIGINT unsigned not null," + "SUM_TIMER_MISC BIGINT unsigned not null," + "MIN_TIMER_MISC BIGINT unsigned not null," + "AVG_TIMER_MISC BIGINT unsigned not null," + "MAX_TIMER_MISC BIGINT unsigned not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE SOCKET_SUMMARY_BY_INSTANCE +-- + +SET @cmd="CREATE TABLE performance_schema.socket_summary_by_event_name(" + "EVENT_NAME VARCHAR(128) not null," + "COUNT_STAR BIGINT unsigned not null," + "SUM_TIMER_WAIT BIGINT unsigned not null," + "MIN_TIMER_WAIT BIGINT unsigned not null," + "AVG_TIMER_WAIT BIGINT unsigned not null," + "MAX_TIMER_WAIT BIGINT unsigned not null," + "COUNT_READ BIGINT unsigned not null," + "SUM_TIMER_READ BIGINT unsigned not null," + "MIN_TIMER_READ BIGINT unsigned not null," + "AVG_TIMER_READ BIGINT unsigned not null," + "MAX_TIMER_READ BIGINT unsigned not null," + "SUM_NUMBER_OF_BYTES_READ BIGINT unsigned not null," + "COUNT_WRITE BIGINT unsigned not null," + "SUM_TIMER_WRITE BIGINT unsigned not null," + "MIN_TIMER_WRITE BIGINT unsigned not null," + "AVG_TIMER_WRITE BIGINT unsigned not null," + "MAX_TIMER_WRITE BIGINT unsigned not null," + "SUM_NUMBER_OF_BYTES_WRITE BIGINT unsigned not null," + "COUNT_MISC BIGINT unsigned not null," + "SUM_TIMER_MISC BIGINT unsigned not null," + "MIN_TIMER_MISC BIGINT unsigned not null," + "AVG_TIMER_MISC BIGINT unsigned not null," + "MAX_TIMER_MISC BIGINT unsigned not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE HOST_CACHE +-- + +SET @cmd="CREATE TABLE performance_schema.host_cache(" + "IP VARCHAR(64) not null," + "HOST VARCHAR(255) collate utf8_bin," + "HOST_VALIDATED ENUM ('YES', 'NO') not null," + "SUM_CONNECT_ERRORS BIGINT not null," + "COUNT_HOST_BLOCKED_ERRORS BIGINT not null," + "COUNT_NAMEINFO_TRANSIENT_ERRORS BIGINT not null," + "COUNT_NAMEINFO_PERMANENT_ERRORS BIGINT not null," + "COUNT_FORMAT_ERRORS BIGINT not null," + "COUNT_ADDRINFO_TRANSIENT_ERRORS BIGINT not null," + "COUNT_ADDRINFO_PERMANENT_ERRORS BIGINT not null," + "COUNT_FCRDNS_ERRORS BIGINT not null," + "COUNT_HOST_ACL_ERRORS BIGINT not null," + "COUNT_NO_AUTH_PLUGIN_ERRORS BIGINT not null," + "COUNT_AUTH_PLUGIN_ERRORS BIGINT not null," + "COUNT_HANDSHAKE_ERRORS BIGINT not null," + "COUNT_PROXY_USER_ERRORS BIGINT not null," + "COUNT_PROXY_USER_ACL_ERRORS BIGINT not null," + "COUNT_AUTHENTICATION_ERRORS BIGINT not null," + "COUNT_SSL_ERRORS BIGINT not null," + "COUNT_MAX_USER_CONNECTIONS_ERRORS BIGINT not null," + "COUNT_MAX_USER_CONNECTIONS_PER_HOUR_ERRORS BIGINT not null," + "COUNT_DEFAULT_DATABASE_ERRORS BIGINT not null," + "COUNT_INIT_CONNECT_ERRORS BIGINT not null," + "COUNT_LOCAL_ERRORS BIGINT not null," + "COUNT_UNKNOWN_ERRORS BIGINT not null," + "FIRST_SEEN TIMESTAMP(0) default 0," + "LAST_SEEN TIMESTAMP(0) default 0," + "FIRST_ERROR_SEEN TIMESTAMP(0) null default 0," + "LAST_ERROR_SEEN TIMESTAMP(0) null default 0" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +#PREPARE stmt FROM @str; +#EXECUTE stmt; +#DROP PREPARE stmt; + +-- +-- TABLE MUTEX_INSTANCES +-- + +SET @cmd="CREATE TABLE performance_schema.mutex_instances(" + "NAME VARCHAR(128) not null," + "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null," + "LOCKED_BY_THREAD_ID INTEGER" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE OBJECTS_SUMMARY_GLOBAL_BY_TYPE +-- + +SET @cmd="CREATE TABLE performance_schema.objects_summary_global_by_type(" + "OBJECT_TYPE VARCHAR(64)," + "OBJECT_SCHEMA VARCHAR(64)," + "OBJECT_NAME VARCHAR(64)," + "COUNT_STAR BIGINT unsigned not null," + "SUM_TIMER_WAIT BIGINT unsigned not null," + "MIN_TIMER_WAIT BIGINT unsigned not null," + "AVG_TIMER_WAIT BIGINT unsigned not null," + "MAX_TIMER_WAIT BIGINT unsigned not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE PERFORMANCE_TIMERS +-- + +SET @cmd="CREATE TABLE performance_schema.performance_timers(" + "TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null," + "TIMER_FREQUENCY BIGINT," + "TIMER_RESOLUTION BIGINT," + "TIMER_OVERHEAD BIGINT" + ") ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE RWLOCK_INSTANCES +-- + +SET @cmd="CREATE TABLE performance_schema.rwlock_instances(" + "NAME VARCHAR(128) not null," + "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null," + "WRITE_LOCKED_BY_THREAD_ID INTEGER," + "READ_LOCKED_BY_COUNT INTEGER unsigned not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE SETUP_ACTORS +-- + +SET @cmd="CREATE TABLE performance_schema.setup_actors(" + "HOST CHAR(60) collate utf8_bin default '%' not null," + "USER CHAR(16) collate utf8_bin default '%' not null," + "ROLE CHAR(16) collate utf8_bin default '%' not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE SETUP_CONSUMERS +-- + +SET @cmd="CREATE TABLE performance_schema.setup_consumers(" + "NAME VARCHAR(64) not null," + "ENABLED ENUM ('YES', 'NO') not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE SETUP_INSTRUMENTS +-- + +SET @cmd="CREATE TABLE performance_schema.setup_instruments(" + "NAME VARCHAR(128) not null," + "ENABLED ENUM ('YES', 'NO') not null," + "TIMED ENUM ('YES', 'NO') not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE SETUP_OBJECTS +-- + +SET @cmd="CREATE TABLE performance_schema.setup_objects(" + "OBJECT_TYPE ENUM ('TABLE') not null default 'TABLE'," + "OBJECT_SCHEMA VARCHAR(64) default '%'," + "OBJECT_NAME VARCHAR(64) not null default '%'," + "ENABLED ENUM ('YES', 'NO') not null default 'YES'," + "TIMED ENUM ('YES', 'NO') not null default 'YES'" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE SETUP_TIMERS +-- + +SET @cmd="CREATE TABLE performance_schema.setup_timers(" + "NAME VARCHAR(64) not null," + "TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE TABLE_IO_WAITS_SUMMARY_BY_INDEX_USAGE +-- + +SET @cmd="CREATE TABLE performance_schema.table_io_waits_summary_by_index_usage(" + "OBJECT_TYPE VARCHAR(64)," + "OBJECT_SCHEMA VARCHAR(64)," + "OBJECT_NAME VARCHAR(64)," + "INDEX_NAME VARCHAR(64)," + "COUNT_STAR BIGINT unsigned not null," + "SUM_TIMER_WAIT BIGINT unsigned not null," + "MIN_TIMER_WAIT BIGINT unsigned not null," + "AVG_TIMER_WAIT BIGINT unsigned not null," + "MAX_TIMER_WAIT BIGINT unsigned not null," + "COUNT_READ BIGINT unsigned not null," + "SUM_TIMER_READ BIGINT unsigned not null," + "MIN_TIMER_READ BIGINT unsigned not null," + "AVG_TIMER_READ BIGINT unsigned not null," + "MAX_TIMER_READ BIGINT unsigned not null," + "COUNT_WRITE BIGINT unsigned not null," + "SUM_TIMER_WRITE BIGINT unsigned not null," + "MIN_TIMER_WRITE BIGINT unsigned not null," + "AVG_TIMER_WRITE BIGINT unsigned not null," + "MAX_TIMER_WRITE BIGINT unsigned not null," + "COUNT_FETCH BIGINT unsigned not null," + "SUM_TIMER_FETCH BIGINT unsigned not null," + "MIN_TIMER_FETCH BIGINT unsigned not null," + "AVG_TIMER_FETCH BIGINT unsigned not null," + "MAX_TIMER_FETCH BIGINT unsigned not null," + "COUNT_INSERT BIGINT unsigned not null," + "SUM_TIMER_INSERT BIGINT unsigned not null," + "MIN_TIMER_INSERT BIGINT unsigned not null," + "AVG_TIMER_INSERT BIGINT unsigned not null," + "MAX_TIMER_INSERT BIGINT unsigned not null," + "COUNT_UPDATE BIGINT unsigned not null," + "SUM_TIMER_UPDATE BIGINT unsigned not null," + "MIN_TIMER_UPDATE BIGINT unsigned not null," + "AVG_TIMER_UPDATE BIGINT unsigned not null," + "MAX_TIMER_UPDATE BIGINT unsigned not null," + "COUNT_DELETE BIGINT unsigned not null," + "SUM_TIMER_DELETE BIGINT unsigned not null," + "MIN_TIMER_DELETE BIGINT unsigned not null," + "AVG_TIMER_DELETE BIGINT unsigned not null," + "MAX_TIMER_DELETE BIGINT unsigned not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE TABLE_IO_WAITS_SUMMARY_BY_TABLE +-- + +SET @cmd="CREATE TABLE performance_schema.table_io_waits_summary_by_table(" + "OBJECT_TYPE VARCHAR(64)," + "OBJECT_SCHEMA VARCHAR(64)," + "OBJECT_NAME VARCHAR(64)," + "COUNT_STAR BIGINT unsigned not null," + "SUM_TIMER_WAIT BIGINT unsigned not null," + "MIN_TIMER_WAIT BIGINT unsigned not null," + "AVG_TIMER_WAIT BIGINT unsigned not null," + "MAX_TIMER_WAIT BIGINT unsigned not null," + "COUNT_READ BIGINT unsigned not null," + "SUM_TIMER_READ BIGINT unsigned not null," + "MIN_TIMER_READ BIGINT unsigned not null," + "AVG_TIMER_READ BIGINT unsigned not null," + "MAX_TIMER_READ BIGINT unsigned not null," + "COUNT_WRITE BIGINT unsigned not null," + "SUM_TIMER_WRITE BIGINT unsigned not null," + "MIN_TIMER_WRITE BIGINT unsigned not null," + "AVG_TIMER_WRITE BIGINT unsigned not null," + "MAX_TIMER_WRITE BIGINT unsigned not null," + "COUNT_FETCH BIGINT unsigned not null," + "SUM_TIMER_FETCH BIGINT unsigned not null," + "MIN_TIMER_FETCH BIGINT unsigned not null," + "AVG_TIMER_FETCH BIGINT unsigned not null," + "MAX_TIMER_FETCH BIGINT unsigned not null," + "COUNT_INSERT BIGINT unsigned not null," + "SUM_TIMER_INSERT BIGINT unsigned not null," + "MIN_TIMER_INSERT BIGINT unsigned not null," + "AVG_TIMER_INSERT BIGINT unsigned not null," + "MAX_TIMER_INSERT BIGINT unsigned not null," + "COUNT_UPDATE BIGINT unsigned not null," + "SUM_TIMER_UPDATE BIGINT unsigned not null," + "MIN_TIMER_UPDATE BIGINT unsigned not null," + "AVG_TIMER_UPDATE BIGINT unsigned not null," + "MAX_TIMER_UPDATE BIGINT unsigned not null," + "COUNT_DELETE BIGINT unsigned not null," + "SUM_TIMER_DELETE BIGINT unsigned not null," + "MIN_TIMER_DELETE BIGINT unsigned not null," + "AVG_TIMER_DELETE BIGINT unsigned not null," + "MAX_TIMER_DELETE BIGINT unsigned not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE TABLE_LOCK_WAITS_SUMMARY_BY_TABLE +-- + +SET @cmd="CREATE TABLE performance_schema.table_lock_waits_summary_by_table(" + "OBJECT_TYPE VARCHAR(64)," + "OBJECT_SCHEMA VARCHAR(64)," + "OBJECT_NAME VARCHAR(64)," + "COUNT_STAR BIGINT unsigned not null," + "SUM_TIMER_WAIT BIGINT unsigned not null," + "MIN_TIMER_WAIT BIGINT unsigned not null," + "AVG_TIMER_WAIT BIGINT unsigned not null," + "MAX_TIMER_WAIT BIGINT unsigned not null," + "COUNT_READ BIGINT unsigned not null," + "SUM_TIMER_READ BIGINT unsigned not null," + "MIN_TIMER_READ BIGINT unsigned not null," + "AVG_TIMER_READ BIGINT unsigned not null," + "MAX_TIMER_READ BIGINT unsigned not null," + "COUNT_WRITE BIGINT unsigned not null," + "SUM_TIMER_WRITE BIGINT unsigned not null," + "MIN_TIMER_WRITE BIGINT unsigned not null," + "AVG_TIMER_WRITE BIGINT unsigned not null," + "MAX_TIMER_WRITE BIGINT unsigned not null," + "COUNT_READ_NORMAL BIGINT unsigned not null," + "SUM_TIMER_READ_NORMAL BIGINT unsigned not null," + "MIN_TIMER_READ_NORMAL BIGINT unsigned not null," + "AVG_TIMER_READ_NORMAL BIGINT unsigned not null," + "MAX_TIMER_READ_NORMAL BIGINT unsigned not null," + "COUNT_READ_WITH_SHARED_LOCKS BIGINT unsigned not null," + "SUM_TIMER_READ_WITH_SHARED_LOCKS BIGINT unsigned not null," + "MIN_TIMER_READ_WITH_SHARED_LOCKS BIGINT unsigned not null," + "AVG_TIMER_READ_WITH_SHARED_LOCKS BIGINT unsigned not null," + "MAX_TIMER_READ_WITH_SHARED_LOCKS BIGINT unsigned not null," + "COUNT_READ_HIGH_PRIORITY BIGINT unsigned not null," + "SUM_TIMER_READ_HIGH_PRIORITY BIGINT unsigned not null," + "MIN_TIMER_READ_HIGH_PRIORITY BIGINT unsigned not null," + "AVG_TIMER_READ_HIGH_PRIORITY BIGINT unsigned not null," + "MAX_TIMER_READ_HIGH_PRIORITY BIGINT unsigned not null," + "COUNT_READ_NO_INSERT BIGINT unsigned not null," + "SUM_TIMER_READ_NO_INSERT BIGINT unsigned not null," + "MIN_TIMER_READ_NO_INSERT BIGINT unsigned not null," + "AVG_TIMER_READ_NO_INSERT BIGINT unsigned not null," + "MAX_TIMER_READ_NO_INSERT BIGINT unsigned not null," + "COUNT_READ_EXTERNAL BIGINT unsigned not null," + "SUM_TIMER_READ_EXTERNAL BIGINT unsigned not null," + "MIN_TIMER_READ_EXTERNAL BIGINT unsigned not null," + "AVG_TIMER_READ_EXTERNAL BIGINT unsigned not null," + "MAX_TIMER_READ_EXTERNAL BIGINT unsigned not null," + "COUNT_WRITE_ALLOW_WRITE BIGINT unsigned not null," + "SUM_TIMER_WRITE_ALLOW_WRITE BIGINT unsigned not null," + "MIN_TIMER_WRITE_ALLOW_WRITE BIGINT unsigned not null," + "AVG_TIMER_WRITE_ALLOW_WRITE BIGINT unsigned not null," + "MAX_TIMER_WRITE_ALLOW_WRITE BIGINT unsigned not null," + "COUNT_WRITE_CONCURRENT_INSERT BIGINT unsigned not null," + "SUM_TIMER_WRITE_CONCURRENT_INSERT BIGINT unsigned not null," + "MIN_TIMER_WRITE_CONCURRENT_INSERT BIGINT unsigned not null," + "AVG_TIMER_WRITE_CONCURRENT_INSERT BIGINT unsigned not null," + "MAX_TIMER_WRITE_CONCURRENT_INSERT BIGINT unsigned not null," + "COUNT_WRITE_DELAYED BIGINT unsigned not null," + "SUM_TIMER_WRITE_DELAYED BIGINT unsigned not null," + "MIN_TIMER_WRITE_DELAYED BIGINT unsigned not null," + "AVG_TIMER_WRITE_DELAYED BIGINT unsigned not null," + "MAX_TIMER_WRITE_DELAYED BIGINT unsigned not null," + "COUNT_WRITE_LOW_PRIORITY BIGINT unsigned not null," + "SUM_TIMER_WRITE_LOW_PRIORITY BIGINT unsigned not null," + "MIN_TIMER_WRITE_LOW_PRIORITY BIGINT unsigned not null," + "AVG_TIMER_WRITE_LOW_PRIORITY BIGINT unsigned not null," + "MAX_TIMER_WRITE_LOW_PRIORITY BIGINT unsigned not null," + "COUNT_WRITE_NORMAL BIGINT unsigned not null," + "SUM_TIMER_WRITE_NORMAL BIGINT unsigned not null," + "MIN_TIMER_WRITE_NORMAL BIGINT unsigned not null," + "AVG_TIMER_WRITE_NORMAL BIGINT unsigned not null," + "MAX_TIMER_WRITE_NORMAL BIGINT unsigned not null," + "COUNT_WRITE_EXTERNAL BIGINT unsigned not null," + "SUM_TIMER_WRITE_EXTERNAL BIGINT unsigned not null," + "MIN_TIMER_WRITE_EXTERNAL BIGINT unsigned not null," + "AVG_TIMER_WRITE_EXTERNAL BIGINT unsigned not null," + "MAX_TIMER_WRITE_EXTERNAL BIGINT unsigned not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE THREADS +-- + +SET @cmd="CREATE TABLE performance_schema.threads(" + "THREAD_ID INTEGER not null," + "NAME VARCHAR(128) not null," + "TYPE VARCHAR(10) not null," + "PROCESSLIST_ID INTEGER," + "PROCESSLIST_USER VARCHAR(16)," + "PROCESSLIST_HOST VARCHAR(60)," + "PROCESSLIST_DB VARCHAR(64)," + "PROCESSLIST_COMMAND VARCHAR(16)," + "PROCESSLIST_TIME BIGINT," + "PROCESSLIST_STATE VARCHAR(64)," + "PROCESSLIST_INFO LONGTEXT," + "PARENT_THREAD_ID INTEGER," + "ROLE VARCHAR(64)," + "INSTRUMENTED ENUM ('YES', 'NO') not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_STAGES_CURRENT +-- + +SET @cmd="CREATE TABLE performance_schema.events_stages_current(" + "THREAD_ID INTEGER not null," + "EVENT_ID BIGINT unsigned not null," + "END_EVENT_ID BIGINT unsigned," + "EVENT_NAME VARCHAR(128) not null," + "SOURCE VARCHAR(64)," + "TIMER_START BIGINT unsigned," + "TIMER_END BIGINT unsigned," + "TIMER_WAIT BIGINT unsigned," + "NESTING_EVENT_ID BIGINT unsigned," + "NESTING_EVENT_TYPE ENUM('STATEMENT', 'STAGE', 'WAIT')" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_STAGES_HISTORY +-- + +SET @cmd="CREATE TABLE performance_schema.events_stages_history(" + "THREAD_ID INTEGER not null," + "EVENT_ID BIGINT unsigned not null," + "END_EVENT_ID BIGINT unsigned," + "EVENT_NAME VARCHAR(128) not null," + "SOURCE VARCHAR(64)," + "TIMER_START BIGINT unsigned," + "TIMER_END BIGINT unsigned," + "TIMER_WAIT BIGINT unsigned," + "NESTING_EVENT_ID BIGINT unsigned," + "NESTING_EVENT_TYPE ENUM('STATEMENT', 'STAGE', 'WAIT')" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_STAGES_HISTORY_LONG +-- + +SET @cmd="CREATE TABLE performance_schema.events_stages_history_long(" + "THREAD_ID INTEGER not null," + "EVENT_ID BIGINT unsigned not null," + "END_EVENT_ID BIGINT unsigned," + "EVENT_NAME VARCHAR(128) not null," + "SOURCE VARCHAR(64)," + "TIMER_START BIGINT unsigned," + "TIMER_END BIGINT unsigned," + "TIMER_WAIT BIGINT unsigned," + "NESTING_EVENT_ID BIGINT unsigned," + "NESTING_EVENT_TYPE ENUM('STATEMENT', 'STAGE', 'WAIT')" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_STAGES_SUMMARY_BY_THREAD_BY_EVENT_NAME +-- + +SET @cmd="CREATE TABLE performance_schema.events_stages_summary_by_thread_by_event_name(" + "THREAD_ID INTEGER not null," + "EVENT_NAME VARCHAR(128) not null," + "COUNT_STAR BIGINT unsigned not null," + "SUM_TIMER_WAIT BIGINT unsigned not null," + "MIN_TIMER_WAIT BIGINT unsigned not null," + "AVG_TIMER_WAIT BIGINT unsigned not null," + "MAX_TIMER_WAIT BIGINT unsigned not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_STAGES_SUMMARY_BY_HOST_BY_EVENT_NAME +-- + +SET @cmd="CREATE TABLE performance_schema.events_stages_summary_by_host_by_event_name(" + "HOST CHAR(60) collate utf8_bin default null," + "EVENT_NAME VARCHAR(128) not null," + "COUNT_STAR BIGINT unsigned not null," + "SUM_TIMER_WAIT BIGINT unsigned not null," + "MIN_TIMER_WAIT BIGINT unsigned not null," + "AVG_TIMER_WAIT BIGINT unsigned not null," + "MAX_TIMER_WAIT BIGINT unsigned not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_STAGES_SUMMARY_BY_USER_BY_EVENT_NAME +-- + +SET @cmd="CREATE TABLE performance_schema.events_stages_summary_by_user_by_event_name(" + "USER CHAR(16) collate utf8_bin default null," + "EVENT_NAME VARCHAR(128) not null," + "COUNT_STAR BIGINT unsigned not null," + "SUM_TIMER_WAIT BIGINT unsigned not null," + "MIN_TIMER_WAIT BIGINT unsigned not null," + "AVG_TIMER_WAIT BIGINT unsigned not null," + "MAX_TIMER_WAIT BIGINT unsigned not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_STAGES_SUMMARY_BY_ACCOUNT_BY_EVENT_NAME +-- + +SET @cmd="CREATE TABLE performance_schema.events_stages_summary_by_account_by_event_name(" + "USER CHAR(16) collate utf8_bin default null," + "HOST CHAR(60) collate utf8_bin default null," + "EVENT_NAME VARCHAR(128) not null," + "COUNT_STAR BIGINT unsigned not null," + "SUM_TIMER_WAIT BIGINT unsigned not null," + "MIN_TIMER_WAIT BIGINT unsigned not null," + "AVG_TIMER_WAIT BIGINT unsigned not null," + "MAX_TIMER_WAIT BIGINT unsigned not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_STAGES_SUMMARY_GLOBAL_BY_EVENT_NAME +-- + +SET @cmd="CREATE TABLE performance_schema.events_stages_summary_global_by_event_name(" + "EVENT_NAME VARCHAR(128) not null," + "COUNT_STAR BIGINT unsigned not null," + "SUM_TIMER_WAIT BIGINT unsigned not null," + "MIN_TIMER_WAIT BIGINT unsigned not null," + "AVG_TIMER_WAIT BIGINT unsigned not null," + "MAX_TIMER_WAIT BIGINT unsigned not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_STATEMENTS_CURRENT +-- + +SET @cmd="CREATE TABLE performance_schema.events_statements_current(" + "THREAD_ID INTEGER not null," + "EVENT_ID BIGINT unsigned not null," + "END_EVENT_ID BIGINT unsigned," + "EVENT_NAME VARCHAR(128) not null," + "SOURCE VARCHAR(64)," + "TIMER_START BIGINT unsigned," + "TIMER_END BIGINT unsigned," + "TIMER_WAIT BIGINT unsigned," + "LOCK_TIME bigint unsigned not null," + "SQL_TEXT LONGTEXT," + "DIGEST VARCHAR(32)," + "DIGEST_TEXT LONGTEXT," + "CURRENT_SCHEMA VARCHAR(64)," + "OBJECT_TYPE VARCHAR(64)," + "OBJECT_SCHEMA VARCHAR(64)," + "OBJECT_NAME VARCHAR(64)," + "OBJECT_INSTANCE_BEGIN BIGINT unsigned," + "MYSQL_ERRNO INTEGER," + "RETURNED_SQLSTATE VARCHAR(5)," + "MESSAGE_TEXT VARCHAR(128)," + "ERRORS BIGINT unsigned not null," + "WARNINGS BIGINT unsigned not null," + "ROWS_AFFECTED BIGINT unsigned not null," + "ROWS_SENT BIGINT unsigned not null," + "ROWS_EXAMINED BIGINT unsigned not null," + "CREATED_TMP_DISK_TABLES BIGINT unsigned not null," + "CREATED_TMP_TABLES BIGINT unsigned not null," + "SELECT_FULL_JOIN BIGINT unsigned not null," + "SELECT_FULL_RANGE_JOIN BIGINT unsigned not null," + "SELECT_RANGE BIGINT unsigned not null," + "SELECT_RANGE_CHECK BIGINT unsigned not null," + "SELECT_SCAN BIGINT unsigned not null," + "SORT_MERGE_PASSES BIGINT unsigned not null," + "SORT_RANGE BIGINT unsigned not null," + "SORT_ROWS BIGINT unsigned not null," + "SORT_SCAN BIGINT unsigned not null," + "NO_INDEX_USED BIGINT unsigned not null," + "NO_GOOD_INDEX_USED BIGINT unsigned not null," + "NESTING_EVENT_ID BIGINT unsigned," + "NESTING_EVENT_TYPE ENUM('STATEMENT', 'STAGE', 'WAIT')" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_STATEMENTS_HISTORY +-- + +SET @cmd="CREATE TABLE performance_schema.events_statements_history(" + "THREAD_ID INTEGER not null," + "EVENT_ID BIGINT unsigned not null," + "END_EVENT_ID BIGINT unsigned," + "EVENT_NAME VARCHAR(128) not null," + "SOURCE VARCHAR(64)," + "TIMER_START BIGINT unsigned," + "TIMER_END BIGINT unsigned," + "TIMER_WAIT BIGINT unsigned," + "LOCK_TIME bigint unsigned not null," + "SQL_TEXT LONGTEXT," + "DIGEST VARCHAR(32)," + "DIGEST_TEXT LONGTEXT," + "CURRENT_SCHEMA VARCHAR(64)," + "OBJECT_TYPE VARCHAR(64)," + "OBJECT_SCHEMA VARCHAR(64)," + "OBJECT_NAME VARCHAR(64)," + "OBJECT_INSTANCE_BEGIN BIGINT unsigned," + "MYSQL_ERRNO INTEGER," + "RETURNED_SQLSTATE VARCHAR(5)," + "MESSAGE_TEXT VARCHAR(128)," + "ERRORS BIGINT unsigned not null," + "WARNINGS BIGINT unsigned not null," + "ROWS_AFFECTED BIGINT unsigned not null," + "ROWS_SENT BIGINT unsigned not null," + "ROWS_EXAMINED BIGINT unsigned not null," + "CREATED_TMP_DISK_TABLES BIGINT unsigned not null," + "CREATED_TMP_TABLES BIGINT unsigned not null," + "SELECT_FULL_JOIN BIGINT unsigned not null," + "SELECT_FULL_RANGE_JOIN BIGINT unsigned not null," + "SELECT_RANGE BIGINT unsigned not null," + "SELECT_RANGE_CHECK BIGINT unsigned not null," + "SELECT_SCAN BIGINT unsigned not null," + "SORT_MERGE_PASSES BIGINT unsigned not null," + "SORT_RANGE BIGINT unsigned not null," + "SORT_ROWS BIGINT unsigned not null," + "SORT_SCAN BIGINT unsigned not null," + "NO_INDEX_USED BIGINT unsigned not null," + "NO_GOOD_INDEX_USED BIGINT unsigned not null," + "NESTING_EVENT_ID BIGINT unsigned," + "NESTING_EVENT_TYPE ENUM('STATEMENT', 'STAGE', 'WAIT')" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_STATEMENTS_HISTORY_LONG +-- + +SET @cmd="CREATE TABLE performance_schema.events_statements_history_long(" + "THREAD_ID INTEGER not null," + "EVENT_ID BIGINT unsigned not null," + "END_EVENT_ID BIGINT unsigned," + "EVENT_NAME VARCHAR(128) not null," + "SOURCE VARCHAR(64)," + "TIMER_START BIGINT unsigned," + "TIMER_END BIGINT unsigned," + "TIMER_WAIT BIGINT unsigned," + "LOCK_TIME bigint unsigned not null," + "SQL_TEXT LONGTEXT," + "DIGEST VARCHAR(32)," + "DIGEST_TEXT LONGTEXT," + "CURRENT_SCHEMA VARCHAR(64)," + "OBJECT_TYPE VARCHAR(64)," + "OBJECT_SCHEMA VARCHAR(64)," + "OBJECT_NAME VARCHAR(64)," + "OBJECT_INSTANCE_BEGIN BIGINT unsigned," + "MYSQL_ERRNO INTEGER," + "RETURNED_SQLSTATE VARCHAR(5)," + "MESSAGE_TEXT VARCHAR(128)," + "ERRORS BIGINT unsigned not null," + "WARNINGS BIGINT unsigned not null," + "ROWS_AFFECTED BIGINT unsigned not null," + "ROWS_SENT BIGINT unsigned not null," + "ROWS_EXAMINED BIGINT unsigned not null," + "CREATED_TMP_DISK_TABLES BIGINT unsigned not null," + "CREATED_TMP_TABLES BIGINT unsigned not null," + "SELECT_FULL_JOIN BIGINT unsigned not null," + "SELECT_FULL_RANGE_JOIN BIGINT unsigned not null," + "SELECT_RANGE BIGINT unsigned not null," + "SELECT_RANGE_CHECK BIGINT unsigned not null," + "SELECT_SCAN BIGINT unsigned not null," + "SORT_MERGE_PASSES BIGINT unsigned not null," + "SORT_RANGE BIGINT unsigned not null," + "SORT_ROWS BIGINT unsigned not null," + "SORT_SCAN BIGINT unsigned not null," + "NO_INDEX_USED BIGINT unsigned not null," + "NO_GOOD_INDEX_USED BIGINT unsigned not null," + "NESTING_EVENT_ID BIGINT unsigned," + "NESTING_EVENT_TYPE ENUM('STATEMENT', 'STAGE', 'WAIT')" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_STATEMENTS_SUMMARY_BY_THREAD_BY_EVENT_NAME +-- + +SET @cmd="CREATE TABLE performance_schema.events_statements_summary_by_thread_by_event_name(" + "THREAD_ID INTEGER not null," + "EVENT_NAME VARCHAR(128) not null," + "COUNT_STAR BIGINT unsigned not null," + "SUM_TIMER_WAIT BIGINT unsigned not null," + "MIN_TIMER_WAIT BIGINT unsigned not null," + "AVG_TIMER_WAIT BIGINT unsigned not null," + "MAX_TIMER_WAIT BIGINT unsigned not null," + "SUM_LOCK_TIME BIGINT unsigned not null," + "SUM_ERRORS BIGINT unsigned not null," + "SUM_WARNINGS BIGINT unsigned not null," + "SUM_ROWS_AFFECTED BIGINT unsigned not null," + "SUM_ROWS_SENT BIGINT unsigned not null," + "SUM_ROWS_EXAMINED BIGINT unsigned not null," + "SUM_CREATED_TMP_DISK_TABLES BIGINT unsigned not null," + "SUM_CREATED_TMP_TABLES BIGINT unsigned not null," + "SUM_SELECT_FULL_JOIN BIGINT unsigned not null," + "SUM_SELECT_FULL_RANGE_JOIN BIGINT unsigned not null," + "SUM_SELECT_RANGE BIGINT unsigned not null," + "SUM_SELECT_RANGE_CHECK BIGINT unsigned not null," + "SUM_SELECT_SCAN BIGINT unsigned not null," + "SUM_SORT_MERGE_PASSES BIGINT unsigned not null," + "SUM_SORT_RANGE BIGINT unsigned not null," + "SUM_SORT_ROWS BIGINT unsigned not null," + "SUM_SORT_SCAN BIGINT unsigned not null," + "SUM_NO_INDEX_USED BIGINT unsigned not null," + "SUM_NO_GOOD_INDEX_USED BIGINT unsigned not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_STATEMENTS_SUMMARY_BY_HOST_BY_EVENT_NAME +-- + +SET @cmd="CREATE TABLE performance_schema.events_statements_summary_by_host_by_event_name(" + "HOST CHAR(60) collate utf8_bin default null," + "EVENT_NAME VARCHAR(128) not null," + "COUNT_STAR BIGINT unsigned not null," + "SUM_TIMER_WAIT BIGINT unsigned not null," + "MIN_TIMER_WAIT BIGINT unsigned not null," + "AVG_TIMER_WAIT BIGINT unsigned not null," + "MAX_TIMER_WAIT BIGINT unsigned not null," + "SUM_LOCK_TIME BIGINT unsigned not null," + "SUM_ERRORS BIGINT unsigned not null," + "SUM_WARNINGS BIGINT unsigned not null," + "SUM_ROWS_AFFECTED BIGINT unsigned not null," + "SUM_ROWS_SENT BIGINT unsigned not null," + "SUM_ROWS_EXAMINED BIGINT unsigned not null," + "SUM_CREATED_TMP_DISK_TABLES BIGINT unsigned not null," + "SUM_CREATED_TMP_TABLES BIGINT unsigned not null," + "SUM_SELECT_FULL_JOIN BIGINT unsigned not null," + "SUM_SELECT_FULL_RANGE_JOIN BIGINT unsigned not null," + "SUM_SELECT_RANGE BIGINT unsigned not null," + "SUM_SELECT_RANGE_CHECK BIGINT unsigned not null," + "SUM_SELECT_SCAN BIGINT unsigned not null," + "SUM_SORT_MERGE_PASSES BIGINT unsigned not null," + "SUM_SORT_RANGE BIGINT unsigned not null," + "SUM_SORT_ROWS BIGINT unsigned not null," + "SUM_SORT_SCAN BIGINT unsigned not null," + "SUM_NO_INDEX_USED BIGINT unsigned not null," + "SUM_NO_GOOD_INDEX_USED BIGINT unsigned not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_STATEMENTS_SUMMARY_BY_USER_BY_EVENT_NAME +-- + +SET @cmd="CREATE TABLE performance_schema.events_statements_summary_by_user_by_event_name(" + "USER CHAR(16) collate utf8_bin default null," + "EVENT_NAME VARCHAR(128) not null," + "COUNT_STAR BIGINT unsigned not null," + "SUM_TIMER_WAIT BIGINT unsigned not null," + "MIN_TIMER_WAIT BIGINT unsigned not null," + "AVG_TIMER_WAIT BIGINT unsigned not null," + "MAX_TIMER_WAIT BIGINT unsigned not null," + "SUM_LOCK_TIME BIGINT unsigned not null," + "SUM_ERRORS BIGINT unsigned not null," + "SUM_WARNINGS BIGINT unsigned not null," + "SUM_ROWS_AFFECTED BIGINT unsigned not null," + "SUM_ROWS_SENT BIGINT unsigned not null," + "SUM_ROWS_EXAMINED BIGINT unsigned not null," + "SUM_CREATED_TMP_DISK_TABLES BIGINT unsigned not null," + "SUM_CREATED_TMP_TABLES BIGINT unsigned not null," + "SUM_SELECT_FULL_JOIN BIGINT unsigned not null," + "SUM_SELECT_FULL_RANGE_JOIN BIGINT unsigned not null," + "SUM_SELECT_RANGE BIGINT unsigned not null," + "SUM_SELECT_RANGE_CHECK BIGINT unsigned not null," + "SUM_SELECT_SCAN BIGINT unsigned not null," + "SUM_SORT_MERGE_PASSES BIGINT unsigned not null," + "SUM_SORT_RANGE BIGINT unsigned not null," + "SUM_SORT_ROWS BIGINT unsigned not null," + "SUM_SORT_SCAN BIGINT unsigned not null," + "SUM_NO_INDEX_USED BIGINT unsigned not null," + "SUM_NO_GOOD_INDEX_USED BIGINT unsigned not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_STATEMENTS_SUMMARY_BY_ACCOUNT_BY_EVENT_NAME +-- + +SET @cmd="CREATE TABLE performance_schema.events_statements_summary_by_account_by_event_name(" + "USER CHAR(16) collate utf8_bin default null," + "HOST CHAR(60) collate utf8_bin default null," + "EVENT_NAME VARCHAR(128) not null," + "COUNT_STAR BIGINT unsigned not null," + "SUM_TIMER_WAIT BIGINT unsigned not null," + "MIN_TIMER_WAIT BIGINT unsigned not null," + "AVG_TIMER_WAIT BIGINT unsigned not null," + "MAX_TIMER_WAIT BIGINT unsigned not null," + "SUM_LOCK_TIME BIGINT unsigned not null," + "SUM_ERRORS BIGINT unsigned not null," + "SUM_WARNINGS BIGINT unsigned not null," + "SUM_ROWS_AFFECTED BIGINT unsigned not null," + "SUM_ROWS_SENT BIGINT unsigned not null," + "SUM_ROWS_EXAMINED BIGINT unsigned not null," + "SUM_CREATED_TMP_DISK_TABLES BIGINT unsigned not null," + "SUM_CREATED_TMP_TABLES BIGINT unsigned not null," + "SUM_SELECT_FULL_JOIN BIGINT unsigned not null," + "SUM_SELECT_FULL_RANGE_JOIN BIGINT unsigned not null," + "SUM_SELECT_RANGE BIGINT unsigned not null," + "SUM_SELECT_RANGE_CHECK BIGINT unsigned not null," + "SUM_SELECT_SCAN BIGINT unsigned not null," + "SUM_SORT_MERGE_PASSES BIGINT unsigned not null," + "SUM_SORT_RANGE BIGINT unsigned not null," + "SUM_SORT_ROWS BIGINT unsigned not null," + "SUM_SORT_SCAN BIGINT unsigned not null," + "SUM_NO_INDEX_USED BIGINT unsigned not null," + "SUM_NO_GOOD_INDEX_USED BIGINT unsigned not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_STATEMENTS_SUMMARY_GLOBAL_BY_EVENT_NAME +-- + +SET @cmd="CREATE TABLE performance_schema.events_statements_summary_global_by_event_name(" + "EVENT_NAME VARCHAR(128) not null," + "COUNT_STAR BIGINT unsigned not null," + "SUM_TIMER_WAIT BIGINT unsigned not null," + "MIN_TIMER_WAIT BIGINT unsigned not null," + "AVG_TIMER_WAIT BIGINT unsigned not null," + "MAX_TIMER_WAIT BIGINT unsigned not null," + "SUM_LOCK_TIME BIGINT unsigned not null," + "SUM_ERRORS BIGINT unsigned not null," + "SUM_WARNINGS BIGINT unsigned not null," + "SUM_ROWS_AFFECTED BIGINT unsigned not null," + "SUM_ROWS_SENT BIGINT unsigned not null," + "SUM_ROWS_EXAMINED BIGINT unsigned not null," + "SUM_CREATED_TMP_DISK_TABLES BIGINT unsigned not null," + "SUM_CREATED_TMP_TABLES BIGINT unsigned not null," + "SUM_SELECT_FULL_JOIN BIGINT unsigned not null," + "SUM_SELECT_FULL_RANGE_JOIN BIGINT unsigned not null," + "SUM_SELECT_RANGE BIGINT unsigned not null," + "SUM_SELECT_RANGE_CHECK BIGINT unsigned not null," + "SUM_SELECT_SCAN BIGINT unsigned not null," + "SUM_SORT_MERGE_PASSES BIGINT unsigned not null," + "SUM_SORT_RANGE BIGINT unsigned not null," + "SUM_SORT_ROWS BIGINT unsigned not null," + "SUM_SORT_SCAN BIGINT unsigned not null," + "SUM_NO_INDEX_USED BIGINT unsigned not null," + "SUM_NO_GOOD_INDEX_USED BIGINT unsigned not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE HOSTS +-- + +SET @cmd="CREATE TABLE performance_schema.hosts(" + "HOST CHAR(60) collate utf8_bin default null," + "CURRENT_CONNECTIONS bigint not null," + "TOTAL_CONNECTIONS bigint not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE USERS +-- + +SET @cmd="CREATE TABLE performance_schema.users(" + "USER CHAR(16) collate utf8_bin default null," + "CURRENT_CONNECTIONS bigint not null," + "TOTAL_CONNECTIONS bigint not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE ACCOUNTS +-- + +SET @cmd="CREATE TABLE performance_schema.accounts(" + "USER CHAR(16) collate utf8_bin default null," + "HOST CHAR(60) collate utf8_bin default null," + "CURRENT_CONNECTIONS bigint not null," + "TOTAL_CONNECTIONS bigint not null" + ")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_STATEMENTS_SUMMARY_BY_DIGEST +-- + +SET @cmd="CREATE TABLE performance_schema.events_statements_summary_by_digest(" + "DIGEST VARCHAR(32)," + "DIGEST_TEXT LONGTEXT," + "COUNT_STAR BIGINT unsigned not null," + "SUM_TIMER_WAIT BIGINT unsigned not null," + "MIN_TIMER_WAIT BIGINT unsigned not null," + "AVG_TIMER_WAIT BIGINT unsigned not null," + "MAX_TIMER_WAIT BIGINT unsigned not null," + "SUM_LOCK_TIME BIGINT unsigned not null," + "SUM_ERRORS BIGINT unsigned not null," + "SUM_WARNINGS BIGINT unsigned not null," + "SUM_ROWS_AFFECTED BIGINT unsigned not null," + "SUM_ROWS_SENT BIGINT unsigned not null," + "SUM_ROWS_EXAMINED BIGINT unsigned not null," + "SUM_CREATED_TMP_DISK_TABLES BIGINT unsigned not null," + "SUM_CREATED_TMP_TABLES BIGINT unsigned not null," + "SUM_SELECT_FULL_JOIN BIGINT unsigned not null," + "SUM_SELECT_FULL_RANGE_JOIN BIGINT unsigned not null," + "SUM_SELECT_RANGE BIGINT unsigned not null," + "SUM_SELECT_RANGE_CHECK BIGINT unsigned not null," + "SUM_SELECT_SCAN BIGINT unsigned not null," + "SUM_SORT_MERGE_PASSES BIGINT unsigned not null," + "SUM_SORT_RANGE BIGINT unsigned not null," + "SUM_SORT_ROWS BIGINT unsigned not null," + "SUM_SORT_SCAN BIGINT unsigned not null," + "SUM_NO_INDEX_USED BIGINT unsigned not null," + "SUM_NO_GOOD_INDEX_USED BIGINT unsigned not null," + "FIRST_SEEN TIMESTAMP(0) default 0," + "LAST_SEEN TIMESTAMP(0) default 0" + ")ENGINE=PERFORMANCE_SCHEMA;"; + + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql index b822a164614..e76ba3d3077 100644 --- a/scripts/mysql_system_tables.sql +++ b/scripts/mysql_system_tables.sql @@ -21,6 +21,7 @@ set sql_mode=''; set storage_engine=myisam; +flush tables; CREATE TABLE IF NOT EXISTS db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges'; @@ -139,1458 +140,6 @@ CREATE TABLE IF NOT EXISTS innodb_index_stats ( SET SESSION sql_mode=@sql_mode_orig; - --- --- PERFORMANCE SCHEMA INSTALLATION --- Note that this script is also reused by mysql_upgrade, --- so we have to be very careful here to not destroy any --- existing database named 'performance_schema' if it --- can contain user data. --- In case of downgrade, it's ok to drop unknown tables --- from a future version, as long as they belong to the --- performance schema engine. --- - -set @have_old_pfs= (select count(*) from information_schema.schemata where schema_name='performance_schema'); - -SET @cmd="SET @broken_tables = (select count(*) from information_schema.tables where engine != 'PERFORMANCE_SCHEMA' and table_schema='performance_schema')"; - --- Work around for bug#49542 -SET @str = IF(@have_old_pfs = 1, @cmd, 'SET @broken_tables = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - -SET @cmd="SET @broken_views = (select count(*) from information_schema.views where table_schema='performance_schema')"; - --- Work around for bug#49542 -SET @str = IF(@have_old_pfs = 1, @cmd, 'SET @broken_views = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - -SET @broken_routines = (select count(*) from mysql.proc where db='performance_schema'); - -SET @broken_events = (select count(*) from mysql.event where db='performance_schema'); - -SET @broken_pfs= (select @broken_tables + @broken_views + @broken_routines + @broken_events); - --- --- The performance schema database. --- Only drop and create the database if this is safe (no broken_pfs). --- This database is created, even in --without-perfschema builds, --- so that the database name is always reserved by the MySQL implementation. --- - -SET @cmd= "DROP DATABASE IF EXISTS performance_schema"; - -SET @str = IF(@broken_pfs = 0, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - -SET @cmd= "CREATE DATABASE performance_schema character set utf8"; - -SET @str = IF(@broken_pfs = 0, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- From this point, only create the performance schema tables --- if the server is built with performance schema --- - -set @have_pfs= (select count(engine) from information_schema.engines where engine='PERFORMANCE_SCHEMA' and support != 'NO'); - --- --- TABLE COND_INSTANCES --- - -SET @cmd="CREATE TABLE performance_schema.cond_instances(" - "NAME VARCHAR(128) not null," - "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_WAITS_CURRENT --- - -SET @cmd="CREATE TABLE performance_schema.events_waits_current(" - "THREAD_ID INTEGER not null," - "EVENT_ID BIGINT unsigned not null," - "END_EVENT_ID BIGINT unsigned," - "EVENT_NAME VARCHAR(128) not null," - "SOURCE VARCHAR(64)," - "TIMER_START BIGINT unsigned," - "TIMER_END BIGINT unsigned," - "TIMER_WAIT BIGINT unsigned," - "SPINS INTEGER unsigned," - "OBJECT_SCHEMA VARCHAR(64)," - "OBJECT_NAME VARCHAR(512)," - "INDEX_NAME VARCHAR(64)," - "OBJECT_TYPE VARCHAR(64)," - "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null," - "NESTING_EVENT_ID BIGINT unsigned," - "NESTING_EVENT_TYPE ENUM('STATEMENT', 'STAGE', 'WAIT')," - "OPERATION VARCHAR(32) not null," - "NUMBER_OF_BYTES BIGINT," - "FLAGS INTEGER unsigned" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_WAITS_HISTORY --- - -SET @cmd="CREATE TABLE performance_schema.events_waits_history(" - "THREAD_ID INTEGER not null," - "EVENT_ID BIGINT unsigned not null," - "END_EVENT_ID BIGINT unsigned," - "EVENT_NAME VARCHAR(128) not null," - "SOURCE VARCHAR(64)," - "TIMER_START BIGINT unsigned," - "TIMER_END BIGINT unsigned," - "TIMER_WAIT BIGINT unsigned," - "SPINS INTEGER unsigned," - "OBJECT_SCHEMA VARCHAR(64)," - "OBJECT_NAME VARCHAR(512)," - "INDEX_NAME VARCHAR(64)," - "OBJECT_TYPE VARCHAR(64)," - "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null," - "NESTING_EVENT_ID BIGINT unsigned," - "NESTING_EVENT_TYPE ENUM('STATEMENT', 'STAGE', 'WAIT')," - "OPERATION VARCHAR(32) not null," - "NUMBER_OF_BYTES BIGINT," - "FLAGS INTEGER unsigned" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_WAITS_HISTORY_LONG --- - -SET @cmd="CREATE TABLE performance_schema.events_waits_history_long(" - "THREAD_ID INTEGER not null," - "EVENT_ID BIGINT unsigned not null," - "END_EVENT_ID BIGINT unsigned," - "EVENT_NAME VARCHAR(128) not null," - "SOURCE VARCHAR(64)," - "TIMER_START BIGINT unsigned," - "TIMER_END BIGINT unsigned," - "TIMER_WAIT BIGINT unsigned," - "SPINS INTEGER unsigned," - "OBJECT_SCHEMA VARCHAR(64)," - "OBJECT_NAME VARCHAR(512)," - "INDEX_NAME VARCHAR(64)," - "OBJECT_TYPE VARCHAR(64)," - "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null," - "NESTING_EVENT_ID BIGINT unsigned," - "NESTING_EVENT_TYPE ENUM('STATEMENT', 'STAGE', 'WAIT')," - "OPERATION VARCHAR(32) not null," - "NUMBER_OF_BYTES BIGINT," - "FLAGS INTEGER unsigned" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_WAITS_SUMMARY_BY_INSTANCE --- - -SET @cmd="CREATE TABLE performance_schema.events_waits_summary_by_instance(" - "EVENT_NAME VARCHAR(128) not null," - "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null," - "COUNT_STAR BIGINT unsigned not null," - "SUM_TIMER_WAIT BIGINT unsigned not null," - "MIN_TIMER_WAIT BIGINT unsigned not null," - "AVG_TIMER_WAIT BIGINT unsigned not null," - "MAX_TIMER_WAIT BIGINT unsigned not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_WAITS_SUMMARY_BY_HOST_BY_EVENT_NAME --- - -SET @cmd="CREATE TABLE performance_schema.events_waits_summary_by_host_by_event_name(" - "HOST CHAR(60) collate utf8_bin default null," - "EVENT_NAME VARCHAR(128) not null," - "COUNT_STAR BIGINT unsigned not null," - "SUM_TIMER_WAIT BIGINT unsigned not null," - "MIN_TIMER_WAIT BIGINT unsigned not null," - "AVG_TIMER_WAIT BIGINT unsigned not null," - "MAX_TIMER_WAIT BIGINT unsigned not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_WAITS_SUMMARY_BY_USER_BY_EVENT_NAME --- - -SET @cmd="CREATE TABLE performance_schema.events_waits_summary_by_user_by_event_name(" - "USER CHAR(16) collate utf8_bin default null," - "EVENT_NAME VARCHAR(128) not null," - "COUNT_STAR BIGINT unsigned not null," - "SUM_TIMER_WAIT BIGINT unsigned not null," - "MIN_TIMER_WAIT BIGINT unsigned not null," - "AVG_TIMER_WAIT BIGINT unsigned not null," - "MAX_TIMER_WAIT BIGINT unsigned not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_WAITS_SUMMARY_BY_ACCOUNT_BY_EVENT_NAME --- - -SET @cmd="CREATE TABLE performance_schema.events_waits_summary_by_account_by_event_name(" - "USER CHAR(16) collate utf8_bin default null," - "HOST CHAR(60) collate utf8_bin default null," - "EVENT_NAME VARCHAR(128) not null," - "COUNT_STAR BIGINT unsigned not null," - "SUM_TIMER_WAIT BIGINT unsigned not null," - "MIN_TIMER_WAIT BIGINT unsigned not null," - "AVG_TIMER_WAIT BIGINT unsigned not null," - "MAX_TIMER_WAIT BIGINT unsigned not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME --- - -SET @cmd="CREATE TABLE performance_schema.events_waits_summary_by_thread_by_event_name(" - "THREAD_ID INTEGER not null," - "EVENT_NAME VARCHAR(128) not null," - "COUNT_STAR BIGINT unsigned not null," - "SUM_TIMER_WAIT BIGINT unsigned not null," - "MIN_TIMER_WAIT BIGINT unsigned not null," - "AVG_TIMER_WAIT BIGINT unsigned not null," - "MAX_TIMER_WAIT BIGINT unsigned not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME --- - -SET @cmd="CREATE TABLE performance_schema.events_waits_summary_global_by_event_name(" - "EVENT_NAME VARCHAR(128) not null," - "COUNT_STAR BIGINT unsigned not null," - "SUM_TIMER_WAIT BIGINT unsigned not null," - "MIN_TIMER_WAIT BIGINT unsigned not null," - "AVG_TIMER_WAIT BIGINT unsigned not null," - "MAX_TIMER_WAIT BIGINT unsigned not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE FILE_INSTANCES --- - -SET @cmd="CREATE TABLE performance_schema.file_instances(" - "FILE_NAME VARCHAR(512) not null," - "EVENT_NAME VARCHAR(128) not null," - "OPEN_COUNT INTEGER unsigned not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE FILE_SUMMARY_BY_EVENT_NAME --- - -SET @cmd="CREATE TABLE performance_schema.file_summary_by_event_name(" - "EVENT_NAME VARCHAR(128) not null," - "COUNT_STAR BIGINT unsigned not null," - "SUM_TIMER_WAIT BIGINT unsigned not null," - "MIN_TIMER_WAIT BIGINT unsigned not null," - "AVG_TIMER_WAIT BIGINT unsigned not null," - "MAX_TIMER_WAIT BIGINT unsigned not null," - "COUNT_READ BIGINT unsigned not null," - "SUM_TIMER_READ BIGINT unsigned not null," - "MIN_TIMER_READ BIGINT unsigned not null," - "AVG_TIMER_READ BIGINT unsigned not null," - "MAX_TIMER_READ BIGINT unsigned not null," - "SUM_NUMBER_OF_BYTES_READ BIGINT not null," - "COUNT_WRITE BIGINT unsigned not null," - "SUM_TIMER_WRITE BIGINT unsigned not null," - "MIN_TIMER_WRITE BIGINT unsigned not null," - "AVG_TIMER_WRITE BIGINT unsigned not null," - "MAX_TIMER_WRITE BIGINT unsigned not null," - "SUM_NUMBER_OF_BYTES_WRITE BIGINT not null," - "COUNT_MISC BIGINT unsigned not null," - "SUM_TIMER_MISC BIGINT unsigned not null," - "MIN_TIMER_MISC BIGINT unsigned not null," - "AVG_TIMER_MISC BIGINT unsigned not null," - "MAX_TIMER_MISC BIGINT unsigned not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE FILE_SUMMARY_BY_INSTANCE --- - -SET @cmd="CREATE TABLE performance_schema.file_summary_by_instance(" - "FILE_NAME VARCHAR(512) not null," - "EVENT_NAME VARCHAR(128) not null," - "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null," - "COUNT_STAR BIGINT unsigned not null," - "SUM_TIMER_WAIT BIGINT unsigned not null," - "MIN_TIMER_WAIT BIGINT unsigned not null," - "AVG_TIMER_WAIT BIGINT unsigned not null," - "MAX_TIMER_WAIT BIGINT unsigned not null," - "COUNT_READ BIGINT unsigned not null," - "SUM_TIMER_READ BIGINT unsigned not null," - "MIN_TIMER_READ BIGINT unsigned not null," - "AVG_TIMER_READ BIGINT unsigned not null," - "MAX_TIMER_READ BIGINT unsigned not null," - "SUM_NUMBER_OF_BYTES_READ BIGINT not null," - "COUNT_WRITE BIGINT unsigned not null," - "SUM_TIMER_WRITE BIGINT unsigned not null," - "MIN_TIMER_WRITE BIGINT unsigned not null," - "AVG_TIMER_WRITE BIGINT unsigned not null," - "MAX_TIMER_WRITE BIGINT unsigned not null," - "SUM_NUMBER_OF_BYTES_WRITE BIGINT not null," - "COUNT_MISC BIGINT unsigned not null," - "SUM_TIMER_MISC BIGINT unsigned not null," - "MIN_TIMER_MISC BIGINT unsigned not null," - "AVG_TIMER_MISC BIGINT unsigned not null," - "MAX_TIMER_MISC BIGINT unsigned not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - - --- --- TABLE SOCKET_INSTANCES --- - -SET @cmd="CREATE TABLE performance_schema.socket_instances(" - "EVENT_NAME VARCHAR(128) not null," - "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null," - "THREAD_ID INTEGER," - "SOCKET_ID INTEGER not null," - "IP VARCHAR(64) not null," - "PORT INTEGER not null," - "STATE ENUM('IDLE','ACTIVE') not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE SOCKET_SUMMARY_BY_INSTANCE --- - -SET @cmd="CREATE TABLE performance_schema.socket_summary_by_instance(" - "EVENT_NAME VARCHAR(128) not null," - "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null," - "COUNT_STAR BIGINT unsigned not null," - "SUM_TIMER_WAIT BIGINT unsigned not null," - "MIN_TIMER_WAIT BIGINT unsigned not null," - "AVG_TIMER_WAIT BIGINT unsigned not null," - "MAX_TIMER_WAIT BIGINT unsigned not null," - "COUNT_READ BIGINT unsigned not null," - "SUM_TIMER_READ BIGINT unsigned not null," - "MIN_TIMER_READ BIGINT unsigned not null," - "AVG_TIMER_READ BIGINT unsigned not null," - "MAX_TIMER_READ BIGINT unsigned not null," - "SUM_NUMBER_OF_BYTES_READ BIGINT unsigned not null," - "COUNT_WRITE BIGINT unsigned not null," - "SUM_TIMER_WRITE BIGINT unsigned not null," - "MIN_TIMER_WRITE BIGINT unsigned not null," - "AVG_TIMER_WRITE BIGINT unsigned not null," - "MAX_TIMER_WRITE BIGINT unsigned not null," - "SUM_NUMBER_OF_BYTES_WRITE BIGINT unsigned not null," - "COUNT_MISC BIGINT unsigned not null," - "SUM_TIMER_MISC BIGINT unsigned not null," - "MIN_TIMER_MISC BIGINT unsigned not null," - "AVG_TIMER_MISC BIGINT unsigned not null," - "MAX_TIMER_MISC BIGINT unsigned not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE SOCKET_SUMMARY_BY_INSTANCE --- - -SET @cmd="CREATE TABLE performance_schema.socket_summary_by_event_name(" - "EVENT_NAME VARCHAR(128) not null," - "COUNT_STAR BIGINT unsigned not null," - "SUM_TIMER_WAIT BIGINT unsigned not null," - "MIN_TIMER_WAIT BIGINT unsigned not null," - "AVG_TIMER_WAIT BIGINT unsigned not null," - "MAX_TIMER_WAIT BIGINT unsigned not null," - "COUNT_READ BIGINT unsigned not null," - "SUM_TIMER_READ BIGINT unsigned not null," - "MIN_TIMER_READ BIGINT unsigned not null," - "AVG_TIMER_READ BIGINT unsigned not null," - "MAX_TIMER_READ BIGINT unsigned not null," - "SUM_NUMBER_OF_BYTES_READ BIGINT unsigned not null," - "COUNT_WRITE BIGINT unsigned not null," - "SUM_TIMER_WRITE BIGINT unsigned not null," - "MIN_TIMER_WRITE BIGINT unsigned not null," - "AVG_TIMER_WRITE BIGINT unsigned not null," - "MAX_TIMER_WRITE BIGINT unsigned not null," - "SUM_NUMBER_OF_BYTES_WRITE BIGINT unsigned not null," - "COUNT_MISC BIGINT unsigned not null," - "SUM_TIMER_MISC BIGINT unsigned not null," - "MIN_TIMER_MISC BIGINT unsigned not null," - "AVG_TIMER_MISC BIGINT unsigned not null," - "MAX_TIMER_MISC BIGINT unsigned not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE HOST_CACHE --- - -SET @cmd="CREATE TABLE performance_schema.host_cache(" - "IP VARCHAR(64) not null," - "HOST VARCHAR(255) collate utf8_bin," - "HOST_VALIDATED ENUM ('YES', 'NO') not null," - "SUM_CONNECT_ERRORS BIGINT not null," - "COUNT_HOST_BLOCKED_ERRORS BIGINT not null," - "COUNT_NAMEINFO_TRANSIENT_ERRORS BIGINT not null," - "COUNT_NAMEINFO_PERMANENT_ERRORS BIGINT not null," - "COUNT_FORMAT_ERRORS BIGINT not null," - "COUNT_ADDRINFO_TRANSIENT_ERRORS BIGINT not null," - "COUNT_ADDRINFO_PERMANENT_ERRORS BIGINT not null," - "COUNT_FCRDNS_ERRORS BIGINT not null," - "COUNT_HOST_ACL_ERRORS BIGINT not null," - "COUNT_NO_AUTH_PLUGIN_ERRORS BIGINT not null," - "COUNT_AUTH_PLUGIN_ERRORS BIGINT not null," - "COUNT_HANDSHAKE_ERRORS BIGINT not null," - "COUNT_PROXY_USER_ERRORS BIGINT not null," - "COUNT_PROXY_USER_ACL_ERRORS BIGINT not null," - "COUNT_AUTHENTICATION_ERRORS BIGINT not null," - "COUNT_SSL_ERRORS BIGINT not null," - "COUNT_MAX_USER_CONNECTIONS_ERRORS BIGINT not null," - "COUNT_MAX_USER_CONNECTIONS_PER_HOUR_ERRORS BIGINT not null," - "COUNT_DEFAULT_DATABASE_ERRORS BIGINT not null," - "COUNT_INIT_CONNECT_ERRORS BIGINT not null," - "COUNT_LOCAL_ERRORS BIGINT not null," - "COUNT_UNKNOWN_ERRORS BIGINT not null," - "FIRST_SEEN TIMESTAMP(0) default 0," - "LAST_SEEN TIMESTAMP(0) default 0," - "FIRST_ERROR_SEEN TIMESTAMP(0) null default 0," - "LAST_ERROR_SEEN TIMESTAMP(0) null default 0" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -#PREPARE stmt FROM @str; -#EXECUTE stmt; -#DROP PREPARE stmt; - --- --- TABLE MUTEX_INSTANCES --- - -SET @cmd="CREATE TABLE performance_schema.mutex_instances(" - "NAME VARCHAR(128) not null," - "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null," - "LOCKED_BY_THREAD_ID INTEGER" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE OBJECTS_SUMMARY_GLOBAL_BY_TYPE --- - -SET @cmd="CREATE TABLE performance_schema.objects_summary_global_by_type(" - "OBJECT_TYPE VARCHAR(64)," - "OBJECT_SCHEMA VARCHAR(64)," - "OBJECT_NAME VARCHAR(64)," - "COUNT_STAR BIGINT unsigned not null," - "SUM_TIMER_WAIT BIGINT unsigned not null," - "MIN_TIMER_WAIT BIGINT unsigned not null," - "AVG_TIMER_WAIT BIGINT unsigned not null," - "MAX_TIMER_WAIT BIGINT unsigned not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE PERFORMANCE_TIMERS --- - -SET @cmd="CREATE TABLE performance_schema.performance_timers(" - "TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null," - "TIMER_FREQUENCY BIGINT," - "TIMER_RESOLUTION BIGINT," - "TIMER_OVERHEAD BIGINT" - ") ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE RWLOCK_INSTANCES --- - -SET @cmd="CREATE TABLE performance_schema.rwlock_instances(" - "NAME VARCHAR(128) not null," - "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null," - "WRITE_LOCKED_BY_THREAD_ID INTEGER," - "READ_LOCKED_BY_COUNT INTEGER unsigned not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE SETUP_ACTORS --- - -SET @cmd="CREATE TABLE performance_schema.setup_actors(" - "HOST CHAR(60) collate utf8_bin default '%' not null," - "USER CHAR(16) collate utf8_bin default '%' not null," - "ROLE CHAR(16) collate utf8_bin default '%' not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE SETUP_CONSUMERS --- - -SET @cmd="CREATE TABLE performance_schema.setup_consumers(" - "NAME VARCHAR(64) not null," - "ENABLED ENUM ('YES', 'NO') not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE SETUP_INSTRUMENTS --- - -SET @cmd="CREATE TABLE performance_schema.setup_instruments(" - "NAME VARCHAR(128) not null," - "ENABLED ENUM ('YES', 'NO') not null," - "TIMED ENUM ('YES', 'NO') not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE SETUP_OBJECTS --- - -SET @cmd="CREATE TABLE performance_schema.setup_objects(" - "OBJECT_TYPE ENUM ('TABLE') not null default 'TABLE'," - "OBJECT_SCHEMA VARCHAR(64) default '%'," - "OBJECT_NAME VARCHAR(64) not null default '%'," - "ENABLED ENUM ('YES', 'NO') not null default 'YES'," - "TIMED ENUM ('YES', 'NO') not null default 'YES'" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE SETUP_TIMERS --- - -SET @cmd="CREATE TABLE performance_schema.setup_timers(" - "NAME VARCHAR(64) not null," - "TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE TABLE_IO_WAITS_SUMMARY_BY_INDEX_USAGE --- - -SET @cmd="CREATE TABLE performance_schema.table_io_waits_summary_by_index_usage(" - "OBJECT_TYPE VARCHAR(64)," - "OBJECT_SCHEMA VARCHAR(64)," - "OBJECT_NAME VARCHAR(64)," - "INDEX_NAME VARCHAR(64)," - "COUNT_STAR BIGINT unsigned not null," - "SUM_TIMER_WAIT BIGINT unsigned not null," - "MIN_TIMER_WAIT BIGINT unsigned not null," - "AVG_TIMER_WAIT BIGINT unsigned not null," - "MAX_TIMER_WAIT BIGINT unsigned not null," - "COUNT_READ BIGINT unsigned not null," - "SUM_TIMER_READ BIGINT unsigned not null," - "MIN_TIMER_READ BIGINT unsigned not null," - "AVG_TIMER_READ BIGINT unsigned not null," - "MAX_TIMER_READ BIGINT unsigned not null," - "COUNT_WRITE BIGINT unsigned not null," - "SUM_TIMER_WRITE BIGINT unsigned not null," - "MIN_TIMER_WRITE BIGINT unsigned not null," - "AVG_TIMER_WRITE BIGINT unsigned not null," - "MAX_TIMER_WRITE BIGINT unsigned not null," - "COUNT_FETCH BIGINT unsigned not null," - "SUM_TIMER_FETCH BIGINT unsigned not null," - "MIN_TIMER_FETCH BIGINT unsigned not null," - "AVG_TIMER_FETCH BIGINT unsigned not null," - "MAX_TIMER_FETCH BIGINT unsigned not null," - "COUNT_INSERT BIGINT unsigned not null," - "SUM_TIMER_INSERT BIGINT unsigned not null," - "MIN_TIMER_INSERT BIGINT unsigned not null," - "AVG_TIMER_INSERT BIGINT unsigned not null," - "MAX_TIMER_INSERT BIGINT unsigned not null," - "COUNT_UPDATE BIGINT unsigned not null," - "SUM_TIMER_UPDATE BIGINT unsigned not null," - "MIN_TIMER_UPDATE BIGINT unsigned not null," - "AVG_TIMER_UPDATE BIGINT unsigned not null," - "MAX_TIMER_UPDATE BIGINT unsigned not null," - "COUNT_DELETE BIGINT unsigned not null," - "SUM_TIMER_DELETE BIGINT unsigned not null," - "MIN_TIMER_DELETE BIGINT unsigned not null," - "AVG_TIMER_DELETE BIGINT unsigned not null," - "MAX_TIMER_DELETE BIGINT unsigned not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE TABLE_IO_WAITS_SUMMARY_BY_TABLE --- - -SET @cmd="CREATE TABLE performance_schema.table_io_waits_summary_by_table(" - "OBJECT_TYPE VARCHAR(64)," - "OBJECT_SCHEMA VARCHAR(64)," - "OBJECT_NAME VARCHAR(64)," - "COUNT_STAR BIGINT unsigned not null," - "SUM_TIMER_WAIT BIGINT unsigned not null," - "MIN_TIMER_WAIT BIGINT unsigned not null," - "AVG_TIMER_WAIT BIGINT unsigned not null," - "MAX_TIMER_WAIT BIGINT unsigned not null," - "COUNT_READ BIGINT unsigned not null," - "SUM_TIMER_READ BIGINT unsigned not null," - "MIN_TIMER_READ BIGINT unsigned not null," - "AVG_TIMER_READ BIGINT unsigned not null," - "MAX_TIMER_READ BIGINT unsigned not null," - "COUNT_WRITE BIGINT unsigned not null," - "SUM_TIMER_WRITE BIGINT unsigned not null," - "MIN_TIMER_WRITE BIGINT unsigned not null," - "AVG_TIMER_WRITE BIGINT unsigned not null," - "MAX_TIMER_WRITE BIGINT unsigned not null," - "COUNT_FETCH BIGINT unsigned not null," - "SUM_TIMER_FETCH BIGINT unsigned not null," - "MIN_TIMER_FETCH BIGINT unsigned not null," - "AVG_TIMER_FETCH BIGINT unsigned not null," - "MAX_TIMER_FETCH BIGINT unsigned not null," - "COUNT_INSERT BIGINT unsigned not null," - "SUM_TIMER_INSERT BIGINT unsigned not null," - "MIN_TIMER_INSERT BIGINT unsigned not null," - "AVG_TIMER_INSERT BIGINT unsigned not null," - "MAX_TIMER_INSERT BIGINT unsigned not null," - "COUNT_UPDATE BIGINT unsigned not null," - "SUM_TIMER_UPDATE BIGINT unsigned not null," - "MIN_TIMER_UPDATE BIGINT unsigned not null," - "AVG_TIMER_UPDATE BIGINT unsigned not null," - "MAX_TIMER_UPDATE BIGINT unsigned not null," - "COUNT_DELETE BIGINT unsigned not null," - "SUM_TIMER_DELETE BIGINT unsigned not null," - "MIN_TIMER_DELETE BIGINT unsigned not null," - "AVG_TIMER_DELETE BIGINT unsigned not null," - "MAX_TIMER_DELETE BIGINT unsigned not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE TABLE_LOCK_WAITS_SUMMARY_BY_TABLE --- - -SET @cmd="CREATE TABLE performance_schema.table_lock_waits_summary_by_table(" - "OBJECT_TYPE VARCHAR(64)," - "OBJECT_SCHEMA VARCHAR(64)," - "OBJECT_NAME VARCHAR(64)," - "COUNT_STAR BIGINT unsigned not null," - "SUM_TIMER_WAIT BIGINT unsigned not null," - "MIN_TIMER_WAIT BIGINT unsigned not null," - "AVG_TIMER_WAIT BIGINT unsigned not null," - "MAX_TIMER_WAIT BIGINT unsigned not null," - "COUNT_READ BIGINT unsigned not null," - "SUM_TIMER_READ BIGINT unsigned not null," - "MIN_TIMER_READ BIGINT unsigned not null," - "AVG_TIMER_READ BIGINT unsigned not null," - "MAX_TIMER_READ BIGINT unsigned not null," - "COUNT_WRITE BIGINT unsigned not null," - "SUM_TIMER_WRITE BIGINT unsigned not null," - "MIN_TIMER_WRITE BIGINT unsigned not null," - "AVG_TIMER_WRITE BIGINT unsigned not null," - "MAX_TIMER_WRITE BIGINT unsigned not null," - "COUNT_READ_NORMAL BIGINT unsigned not null," - "SUM_TIMER_READ_NORMAL BIGINT unsigned not null," - "MIN_TIMER_READ_NORMAL BIGINT unsigned not null," - "AVG_TIMER_READ_NORMAL BIGINT unsigned not null," - "MAX_TIMER_READ_NORMAL BIGINT unsigned not null," - "COUNT_READ_WITH_SHARED_LOCKS BIGINT unsigned not null," - "SUM_TIMER_READ_WITH_SHARED_LOCKS BIGINT unsigned not null," - "MIN_TIMER_READ_WITH_SHARED_LOCKS BIGINT unsigned not null," - "AVG_TIMER_READ_WITH_SHARED_LOCKS BIGINT unsigned not null," - "MAX_TIMER_READ_WITH_SHARED_LOCKS BIGINT unsigned not null," - "COUNT_READ_HIGH_PRIORITY BIGINT unsigned not null," - "SUM_TIMER_READ_HIGH_PRIORITY BIGINT unsigned not null," - "MIN_TIMER_READ_HIGH_PRIORITY BIGINT unsigned not null," - "AVG_TIMER_READ_HIGH_PRIORITY BIGINT unsigned not null," - "MAX_TIMER_READ_HIGH_PRIORITY BIGINT unsigned not null," - "COUNT_READ_NO_INSERT BIGINT unsigned not null," - "SUM_TIMER_READ_NO_INSERT BIGINT unsigned not null," - "MIN_TIMER_READ_NO_INSERT BIGINT unsigned not null," - "AVG_TIMER_READ_NO_INSERT BIGINT unsigned not null," - "MAX_TIMER_READ_NO_INSERT BIGINT unsigned not null," - "COUNT_READ_EXTERNAL BIGINT unsigned not null," - "SUM_TIMER_READ_EXTERNAL BIGINT unsigned not null," - "MIN_TIMER_READ_EXTERNAL BIGINT unsigned not null," - "AVG_TIMER_READ_EXTERNAL BIGINT unsigned not null," - "MAX_TIMER_READ_EXTERNAL BIGINT unsigned not null," - "COUNT_WRITE_ALLOW_WRITE BIGINT unsigned not null," - "SUM_TIMER_WRITE_ALLOW_WRITE BIGINT unsigned not null," - "MIN_TIMER_WRITE_ALLOW_WRITE BIGINT unsigned not null," - "AVG_TIMER_WRITE_ALLOW_WRITE BIGINT unsigned not null," - "MAX_TIMER_WRITE_ALLOW_WRITE BIGINT unsigned not null," - "COUNT_WRITE_CONCURRENT_INSERT BIGINT unsigned not null," - "SUM_TIMER_WRITE_CONCURRENT_INSERT BIGINT unsigned not null," - "MIN_TIMER_WRITE_CONCURRENT_INSERT BIGINT unsigned not null," - "AVG_TIMER_WRITE_CONCURRENT_INSERT BIGINT unsigned not null," - "MAX_TIMER_WRITE_CONCURRENT_INSERT BIGINT unsigned not null," - "COUNT_WRITE_DELAYED BIGINT unsigned not null," - "SUM_TIMER_WRITE_DELAYED BIGINT unsigned not null," - "MIN_TIMER_WRITE_DELAYED BIGINT unsigned not null," - "AVG_TIMER_WRITE_DELAYED BIGINT unsigned not null," - "MAX_TIMER_WRITE_DELAYED BIGINT unsigned not null," - "COUNT_WRITE_LOW_PRIORITY BIGINT unsigned not null," - "SUM_TIMER_WRITE_LOW_PRIORITY BIGINT unsigned not null," - "MIN_TIMER_WRITE_LOW_PRIORITY BIGINT unsigned not null," - "AVG_TIMER_WRITE_LOW_PRIORITY BIGINT unsigned not null," - "MAX_TIMER_WRITE_LOW_PRIORITY BIGINT unsigned not null," - "COUNT_WRITE_NORMAL BIGINT unsigned not null," - "SUM_TIMER_WRITE_NORMAL BIGINT unsigned not null," - "MIN_TIMER_WRITE_NORMAL BIGINT unsigned not null," - "AVG_TIMER_WRITE_NORMAL BIGINT unsigned not null," - "MAX_TIMER_WRITE_NORMAL BIGINT unsigned not null," - "COUNT_WRITE_EXTERNAL BIGINT unsigned not null," - "SUM_TIMER_WRITE_EXTERNAL BIGINT unsigned not null," - "MIN_TIMER_WRITE_EXTERNAL BIGINT unsigned not null," - "AVG_TIMER_WRITE_EXTERNAL BIGINT unsigned not null," - "MAX_TIMER_WRITE_EXTERNAL BIGINT unsigned not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE THREADS --- - -SET @cmd="CREATE TABLE performance_schema.threads(" - "THREAD_ID INTEGER not null," - "NAME VARCHAR(128) not null," - "TYPE VARCHAR(10) not null," - "PROCESSLIST_ID INTEGER," - "PROCESSLIST_USER VARCHAR(16)," - "PROCESSLIST_HOST VARCHAR(60)," - "PROCESSLIST_DB VARCHAR(64)," - "PROCESSLIST_COMMAND VARCHAR(16)," - "PROCESSLIST_TIME BIGINT," - "PROCESSLIST_STATE VARCHAR(64)," - "PROCESSLIST_INFO LONGTEXT," - "PARENT_THREAD_ID INTEGER," - "ROLE VARCHAR(64)," - "INSTRUMENTED ENUM ('YES', 'NO') not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_STAGES_CURRENT --- - -SET @cmd="CREATE TABLE performance_schema.events_stages_current(" - "THREAD_ID INTEGER not null," - "EVENT_ID BIGINT unsigned not null," - "END_EVENT_ID BIGINT unsigned," - "EVENT_NAME VARCHAR(128) not null," - "SOURCE VARCHAR(64)," - "TIMER_START BIGINT unsigned," - "TIMER_END BIGINT unsigned," - "TIMER_WAIT BIGINT unsigned," - "NESTING_EVENT_ID BIGINT unsigned," - "NESTING_EVENT_TYPE ENUM('STATEMENT', 'STAGE', 'WAIT')" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_STAGES_HISTORY --- - -SET @cmd="CREATE TABLE performance_schema.events_stages_history(" - "THREAD_ID INTEGER not null," - "EVENT_ID BIGINT unsigned not null," - "END_EVENT_ID BIGINT unsigned," - "EVENT_NAME VARCHAR(128) not null," - "SOURCE VARCHAR(64)," - "TIMER_START BIGINT unsigned," - "TIMER_END BIGINT unsigned," - "TIMER_WAIT BIGINT unsigned," - "NESTING_EVENT_ID BIGINT unsigned," - "NESTING_EVENT_TYPE ENUM('STATEMENT', 'STAGE', 'WAIT')" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_STAGES_HISTORY_LONG --- - -SET @cmd="CREATE TABLE performance_schema.events_stages_history_long(" - "THREAD_ID INTEGER not null," - "EVENT_ID BIGINT unsigned not null," - "END_EVENT_ID BIGINT unsigned," - "EVENT_NAME VARCHAR(128) not null," - "SOURCE VARCHAR(64)," - "TIMER_START BIGINT unsigned," - "TIMER_END BIGINT unsigned," - "TIMER_WAIT BIGINT unsigned," - "NESTING_EVENT_ID BIGINT unsigned," - "NESTING_EVENT_TYPE ENUM('STATEMENT', 'STAGE', 'WAIT')" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_STAGES_SUMMARY_BY_THREAD_BY_EVENT_NAME --- - -SET @cmd="CREATE TABLE performance_schema.events_stages_summary_by_thread_by_event_name(" - "THREAD_ID INTEGER not null," - "EVENT_NAME VARCHAR(128) not null," - "COUNT_STAR BIGINT unsigned not null," - "SUM_TIMER_WAIT BIGINT unsigned not null," - "MIN_TIMER_WAIT BIGINT unsigned not null," - "AVG_TIMER_WAIT BIGINT unsigned not null," - "MAX_TIMER_WAIT BIGINT unsigned not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_STAGES_SUMMARY_BY_HOST_BY_EVENT_NAME --- - -SET @cmd="CREATE TABLE performance_schema.events_stages_summary_by_host_by_event_name(" - "HOST CHAR(60) collate utf8_bin default null," - "EVENT_NAME VARCHAR(128) not null," - "COUNT_STAR BIGINT unsigned not null," - "SUM_TIMER_WAIT BIGINT unsigned not null," - "MIN_TIMER_WAIT BIGINT unsigned not null," - "AVG_TIMER_WAIT BIGINT unsigned not null," - "MAX_TIMER_WAIT BIGINT unsigned not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_STAGES_SUMMARY_BY_USER_BY_EVENT_NAME --- - -SET @cmd="CREATE TABLE performance_schema.events_stages_summary_by_user_by_event_name(" - "USER CHAR(16) collate utf8_bin default null," - "EVENT_NAME VARCHAR(128) not null," - "COUNT_STAR BIGINT unsigned not null," - "SUM_TIMER_WAIT BIGINT unsigned not null," - "MIN_TIMER_WAIT BIGINT unsigned not null," - "AVG_TIMER_WAIT BIGINT unsigned not null," - "MAX_TIMER_WAIT BIGINT unsigned not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_STAGES_SUMMARY_BY_ACCOUNT_BY_EVENT_NAME --- - -SET @cmd="CREATE TABLE performance_schema.events_stages_summary_by_account_by_event_name(" - "USER CHAR(16) collate utf8_bin default null," - "HOST CHAR(60) collate utf8_bin default null," - "EVENT_NAME VARCHAR(128) not null," - "COUNT_STAR BIGINT unsigned not null," - "SUM_TIMER_WAIT BIGINT unsigned not null," - "MIN_TIMER_WAIT BIGINT unsigned not null," - "AVG_TIMER_WAIT BIGINT unsigned not null," - "MAX_TIMER_WAIT BIGINT unsigned not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_STAGES_SUMMARY_GLOBAL_BY_EVENT_NAME --- - -SET @cmd="CREATE TABLE performance_schema.events_stages_summary_global_by_event_name(" - "EVENT_NAME VARCHAR(128) not null," - "COUNT_STAR BIGINT unsigned not null," - "SUM_TIMER_WAIT BIGINT unsigned not null," - "MIN_TIMER_WAIT BIGINT unsigned not null," - "AVG_TIMER_WAIT BIGINT unsigned not null," - "MAX_TIMER_WAIT BIGINT unsigned not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_STATEMENTS_CURRENT --- - -SET @cmd="CREATE TABLE performance_schema.events_statements_current(" - "THREAD_ID INTEGER not null," - "EVENT_ID BIGINT unsigned not null," - "END_EVENT_ID BIGINT unsigned," - "EVENT_NAME VARCHAR(128) not null," - "SOURCE VARCHAR(64)," - "TIMER_START BIGINT unsigned," - "TIMER_END BIGINT unsigned," - "TIMER_WAIT BIGINT unsigned," - "LOCK_TIME bigint unsigned not null," - "SQL_TEXT LONGTEXT," - "DIGEST VARCHAR(32)," - "DIGEST_TEXT LONGTEXT," - "CURRENT_SCHEMA VARCHAR(64)," - "OBJECT_TYPE VARCHAR(64)," - "OBJECT_SCHEMA VARCHAR(64)," - "OBJECT_NAME VARCHAR(64)," - "OBJECT_INSTANCE_BEGIN BIGINT unsigned," - "MYSQL_ERRNO INTEGER," - "RETURNED_SQLSTATE VARCHAR(5)," - "MESSAGE_TEXT VARCHAR(128)," - "ERRORS BIGINT unsigned not null," - "WARNINGS BIGINT unsigned not null," - "ROWS_AFFECTED BIGINT unsigned not null," - "ROWS_SENT BIGINT unsigned not null," - "ROWS_EXAMINED BIGINT unsigned not null," - "CREATED_TMP_DISK_TABLES BIGINT unsigned not null," - "CREATED_TMP_TABLES BIGINT unsigned not null," - "SELECT_FULL_JOIN BIGINT unsigned not null," - "SELECT_FULL_RANGE_JOIN BIGINT unsigned not null," - "SELECT_RANGE BIGINT unsigned not null," - "SELECT_RANGE_CHECK BIGINT unsigned not null," - "SELECT_SCAN BIGINT unsigned not null," - "SORT_MERGE_PASSES BIGINT unsigned not null," - "SORT_RANGE BIGINT unsigned not null," - "SORT_ROWS BIGINT unsigned not null," - "SORT_SCAN BIGINT unsigned not null," - "NO_INDEX_USED BIGINT unsigned not null," - "NO_GOOD_INDEX_USED BIGINT unsigned not null," - "NESTING_EVENT_ID BIGINT unsigned," - "NESTING_EVENT_TYPE ENUM('STATEMENT', 'STAGE', 'WAIT')" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_STATEMENTS_HISTORY --- - -SET @cmd="CREATE TABLE performance_schema.events_statements_history(" - "THREAD_ID INTEGER not null," - "EVENT_ID BIGINT unsigned not null," - "END_EVENT_ID BIGINT unsigned," - "EVENT_NAME VARCHAR(128) not null," - "SOURCE VARCHAR(64)," - "TIMER_START BIGINT unsigned," - "TIMER_END BIGINT unsigned," - "TIMER_WAIT BIGINT unsigned," - "LOCK_TIME bigint unsigned not null," - "SQL_TEXT LONGTEXT," - "DIGEST VARCHAR(32)," - "DIGEST_TEXT LONGTEXT," - "CURRENT_SCHEMA VARCHAR(64)," - "OBJECT_TYPE VARCHAR(64)," - "OBJECT_SCHEMA VARCHAR(64)," - "OBJECT_NAME VARCHAR(64)," - "OBJECT_INSTANCE_BEGIN BIGINT unsigned," - "MYSQL_ERRNO INTEGER," - "RETURNED_SQLSTATE VARCHAR(5)," - "MESSAGE_TEXT VARCHAR(128)," - "ERRORS BIGINT unsigned not null," - "WARNINGS BIGINT unsigned not null," - "ROWS_AFFECTED BIGINT unsigned not null," - "ROWS_SENT BIGINT unsigned not null," - "ROWS_EXAMINED BIGINT unsigned not null," - "CREATED_TMP_DISK_TABLES BIGINT unsigned not null," - "CREATED_TMP_TABLES BIGINT unsigned not null," - "SELECT_FULL_JOIN BIGINT unsigned not null," - "SELECT_FULL_RANGE_JOIN BIGINT unsigned not null," - "SELECT_RANGE BIGINT unsigned not null," - "SELECT_RANGE_CHECK BIGINT unsigned not null," - "SELECT_SCAN BIGINT unsigned not null," - "SORT_MERGE_PASSES BIGINT unsigned not null," - "SORT_RANGE BIGINT unsigned not null," - "SORT_ROWS BIGINT unsigned not null," - "SORT_SCAN BIGINT unsigned not null," - "NO_INDEX_USED BIGINT unsigned not null," - "NO_GOOD_INDEX_USED BIGINT unsigned not null," - "NESTING_EVENT_ID BIGINT unsigned," - "NESTING_EVENT_TYPE ENUM('STATEMENT', 'STAGE', 'WAIT')" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_STATEMENTS_HISTORY_LONG --- - -SET @cmd="CREATE TABLE performance_schema.events_statements_history_long(" - "THREAD_ID INTEGER not null," - "EVENT_ID BIGINT unsigned not null," - "END_EVENT_ID BIGINT unsigned," - "EVENT_NAME VARCHAR(128) not null," - "SOURCE VARCHAR(64)," - "TIMER_START BIGINT unsigned," - "TIMER_END BIGINT unsigned," - "TIMER_WAIT BIGINT unsigned," - "LOCK_TIME bigint unsigned not null," - "SQL_TEXT LONGTEXT," - "DIGEST VARCHAR(32)," - "DIGEST_TEXT LONGTEXT," - "CURRENT_SCHEMA VARCHAR(64)," - "OBJECT_TYPE VARCHAR(64)," - "OBJECT_SCHEMA VARCHAR(64)," - "OBJECT_NAME VARCHAR(64)," - "OBJECT_INSTANCE_BEGIN BIGINT unsigned," - "MYSQL_ERRNO INTEGER," - "RETURNED_SQLSTATE VARCHAR(5)," - "MESSAGE_TEXT VARCHAR(128)," - "ERRORS BIGINT unsigned not null," - "WARNINGS BIGINT unsigned not null," - "ROWS_AFFECTED BIGINT unsigned not null," - "ROWS_SENT BIGINT unsigned not null," - "ROWS_EXAMINED BIGINT unsigned not null," - "CREATED_TMP_DISK_TABLES BIGINT unsigned not null," - "CREATED_TMP_TABLES BIGINT unsigned not null," - "SELECT_FULL_JOIN BIGINT unsigned not null," - "SELECT_FULL_RANGE_JOIN BIGINT unsigned not null," - "SELECT_RANGE BIGINT unsigned not null," - "SELECT_RANGE_CHECK BIGINT unsigned not null," - "SELECT_SCAN BIGINT unsigned not null," - "SORT_MERGE_PASSES BIGINT unsigned not null," - "SORT_RANGE BIGINT unsigned not null," - "SORT_ROWS BIGINT unsigned not null," - "SORT_SCAN BIGINT unsigned not null," - "NO_INDEX_USED BIGINT unsigned not null," - "NO_GOOD_INDEX_USED BIGINT unsigned not null," - "NESTING_EVENT_ID BIGINT unsigned," - "NESTING_EVENT_TYPE ENUM('STATEMENT', 'STAGE', 'WAIT')" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_STATEMENTS_SUMMARY_BY_THREAD_BY_EVENT_NAME --- - -SET @cmd="CREATE TABLE performance_schema.events_statements_summary_by_thread_by_event_name(" - "THREAD_ID INTEGER not null," - "EVENT_NAME VARCHAR(128) not null," - "COUNT_STAR BIGINT unsigned not null," - "SUM_TIMER_WAIT BIGINT unsigned not null," - "MIN_TIMER_WAIT BIGINT unsigned not null," - "AVG_TIMER_WAIT BIGINT unsigned not null," - "MAX_TIMER_WAIT BIGINT unsigned not null," - "SUM_LOCK_TIME BIGINT unsigned not null," - "SUM_ERRORS BIGINT unsigned not null," - "SUM_WARNINGS BIGINT unsigned not null," - "SUM_ROWS_AFFECTED BIGINT unsigned not null," - "SUM_ROWS_SENT BIGINT unsigned not null," - "SUM_ROWS_EXAMINED BIGINT unsigned not null," - "SUM_CREATED_TMP_DISK_TABLES BIGINT unsigned not null," - "SUM_CREATED_TMP_TABLES BIGINT unsigned not null," - "SUM_SELECT_FULL_JOIN BIGINT unsigned not null," - "SUM_SELECT_FULL_RANGE_JOIN BIGINT unsigned not null," - "SUM_SELECT_RANGE BIGINT unsigned not null," - "SUM_SELECT_RANGE_CHECK BIGINT unsigned not null," - "SUM_SELECT_SCAN BIGINT unsigned not null," - "SUM_SORT_MERGE_PASSES BIGINT unsigned not null," - "SUM_SORT_RANGE BIGINT unsigned not null," - "SUM_SORT_ROWS BIGINT unsigned not null," - "SUM_SORT_SCAN BIGINT unsigned not null," - "SUM_NO_INDEX_USED BIGINT unsigned not null," - "SUM_NO_GOOD_INDEX_USED BIGINT unsigned not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_STATEMENTS_SUMMARY_BY_HOST_BY_EVENT_NAME --- - -SET @cmd="CREATE TABLE performance_schema.events_statements_summary_by_host_by_event_name(" - "HOST CHAR(60) collate utf8_bin default null," - "EVENT_NAME VARCHAR(128) not null," - "COUNT_STAR BIGINT unsigned not null," - "SUM_TIMER_WAIT BIGINT unsigned not null," - "MIN_TIMER_WAIT BIGINT unsigned not null," - "AVG_TIMER_WAIT BIGINT unsigned not null," - "MAX_TIMER_WAIT BIGINT unsigned not null," - "SUM_LOCK_TIME BIGINT unsigned not null," - "SUM_ERRORS BIGINT unsigned not null," - "SUM_WARNINGS BIGINT unsigned not null," - "SUM_ROWS_AFFECTED BIGINT unsigned not null," - "SUM_ROWS_SENT BIGINT unsigned not null," - "SUM_ROWS_EXAMINED BIGINT unsigned not null," - "SUM_CREATED_TMP_DISK_TABLES BIGINT unsigned not null," - "SUM_CREATED_TMP_TABLES BIGINT unsigned not null," - "SUM_SELECT_FULL_JOIN BIGINT unsigned not null," - "SUM_SELECT_FULL_RANGE_JOIN BIGINT unsigned not null," - "SUM_SELECT_RANGE BIGINT unsigned not null," - "SUM_SELECT_RANGE_CHECK BIGINT unsigned not null," - "SUM_SELECT_SCAN BIGINT unsigned not null," - "SUM_SORT_MERGE_PASSES BIGINT unsigned not null," - "SUM_SORT_RANGE BIGINT unsigned not null," - "SUM_SORT_ROWS BIGINT unsigned not null," - "SUM_SORT_SCAN BIGINT unsigned not null," - "SUM_NO_INDEX_USED BIGINT unsigned not null," - "SUM_NO_GOOD_INDEX_USED BIGINT unsigned not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_STATEMENTS_SUMMARY_BY_USER_BY_EVENT_NAME --- - -SET @cmd="CREATE TABLE performance_schema.events_statements_summary_by_user_by_event_name(" - "USER CHAR(16) collate utf8_bin default null," - "EVENT_NAME VARCHAR(128) not null," - "COUNT_STAR BIGINT unsigned not null," - "SUM_TIMER_WAIT BIGINT unsigned not null," - "MIN_TIMER_WAIT BIGINT unsigned not null," - "AVG_TIMER_WAIT BIGINT unsigned not null," - "MAX_TIMER_WAIT BIGINT unsigned not null," - "SUM_LOCK_TIME BIGINT unsigned not null," - "SUM_ERRORS BIGINT unsigned not null," - "SUM_WARNINGS BIGINT unsigned not null," - "SUM_ROWS_AFFECTED BIGINT unsigned not null," - "SUM_ROWS_SENT BIGINT unsigned not null," - "SUM_ROWS_EXAMINED BIGINT unsigned not null," - "SUM_CREATED_TMP_DISK_TABLES BIGINT unsigned not null," - "SUM_CREATED_TMP_TABLES BIGINT unsigned not null," - "SUM_SELECT_FULL_JOIN BIGINT unsigned not null," - "SUM_SELECT_FULL_RANGE_JOIN BIGINT unsigned not null," - "SUM_SELECT_RANGE BIGINT unsigned not null," - "SUM_SELECT_RANGE_CHECK BIGINT unsigned not null," - "SUM_SELECT_SCAN BIGINT unsigned not null," - "SUM_SORT_MERGE_PASSES BIGINT unsigned not null," - "SUM_SORT_RANGE BIGINT unsigned not null," - "SUM_SORT_ROWS BIGINT unsigned not null," - "SUM_SORT_SCAN BIGINT unsigned not null," - "SUM_NO_INDEX_USED BIGINT unsigned not null," - "SUM_NO_GOOD_INDEX_USED BIGINT unsigned not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_STATEMENTS_SUMMARY_BY_ACCOUNT_BY_EVENT_NAME --- - -SET @cmd="CREATE TABLE performance_schema.events_statements_summary_by_account_by_event_name(" - "USER CHAR(16) collate utf8_bin default null," - "HOST CHAR(60) collate utf8_bin default null," - "EVENT_NAME VARCHAR(128) not null," - "COUNT_STAR BIGINT unsigned not null," - "SUM_TIMER_WAIT BIGINT unsigned not null," - "MIN_TIMER_WAIT BIGINT unsigned not null," - "AVG_TIMER_WAIT BIGINT unsigned not null," - "MAX_TIMER_WAIT BIGINT unsigned not null," - "SUM_LOCK_TIME BIGINT unsigned not null," - "SUM_ERRORS BIGINT unsigned not null," - "SUM_WARNINGS BIGINT unsigned not null," - "SUM_ROWS_AFFECTED BIGINT unsigned not null," - "SUM_ROWS_SENT BIGINT unsigned not null," - "SUM_ROWS_EXAMINED BIGINT unsigned not null," - "SUM_CREATED_TMP_DISK_TABLES BIGINT unsigned not null," - "SUM_CREATED_TMP_TABLES BIGINT unsigned not null," - "SUM_SELECT_FULL_JOIN BIGINT unsigned not null," - "SUM_SELECT_FULL_RANGE_JOIN BIGINT unsigned not null," - "SUM_SELECT_RANGE BIGINT unsigned not null," - "SUM_SELECT_RANGE_CHECK BIGINT unsigned not null," - "SUM_SELECT_SCAN BIGINT unsigned not null," - "SUM_SORT_MERGE_PASSES BIGINT unsigned not null," - "SUM_SORT_RANGE BIGINT unsigned not null," - "SUM_SORT_ROWS BIGINT unsigned not null," - "SUM_SORT_SCAN BIGINT unsigned not null," - "SUM_NO_INDEX_USED BIGINT unsigned not null," - "SUM_NO_GOOD_INDEX_USED BIGINT unsigned not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_STATEMENTS_SUMMARY_GLOBAL_BY_EVENT_NAME --- - -SET @cmd="CREATE TABLE performance_schema.events_statements_summary_global_by_event_name(" - "EVENT_NAME VARCHAR(128) not null," - "COUNT_STAR BIGINT unsigned not null," - "SUM_TIMER_WAIT BIGINT unsigned not null," - "MIN_TIMER_WAIT BIGINT unsigned not null," - "AVG_TIMER_WAIT BIGINT unsigned not null," - "MAX_TIMER_WAIT BIGINT unsigned not null," - "SUM_LOCK_TIME BIGINT unsigned not null," - "SUM_ERRORS BIGINT unsigned not null," - "SUM_WARNINGS BIGINT unsigned not null," - "SUM_ROWS_AFFECTED BIGINT unsigned not null," - "SUM_ROWS_SENT BIGINT unsigned not null," - "SUM_ROWS_EXAMINED BIGINT unsigned not null," - "SUM_CREATED_TMP_DISK_TABLES BIGINT unsigned not null," - "SUM_CREATED_TMP_TABLES BIGINT unsigned not null," - "SUM_SELECT_FULL_JOIN BIGINT unsigned not null," - "SUM_SELECT_FULL_RANGE_JOIN BIGINT unsigned not null," - "SUM_SELECT_RANGE BIGINT unsigned not null," - "SUM_SELECT_RANGE_CHECK BIGINT unsigned not null," - "SUM_SELECT_SCAN BIGINT unsigned not null," - "SUM_SORT_MERGE_PASSES BIGINT unsigned not null," - "SUM_SORT_RANGE BIGINT unsigned not null," - "SUM_SORT_ROWS BIGINT unsigned not null," - "SUM_SORT_SCAN BIGINT unsigned not null," - "SUM_NO_INDEX_USED BIGINT unsigned not null," - "SUM_NO_GOOD_INDEX_USED BIGINT unsigned not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE HOSTS --- - -SET @cmd="CREATE TABLE performance_schema.hosts(" - "HOST CHAR(60) collate utf8_bin default null," - "CURRENT_CONNECTIONS bigint not null," - "TOTAL_CONNECTIONS bigint not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE USERS --- - -SET @cmd="CREATE TABLE performance_schema.users(" - "USER CHAR(16) collate utf8_bin default null," - "CURRENT_CONNECTIONS bigint not null," - "TOTAL_CONNECTIONS bigint not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE ACCOUNTS --- - -SET @cmd="CREATE TABLE performance_schema.accounts(" - "USER CHAR(16) collate utf8_bin default null," - "HOST CHAR(60) collate utf8_bin default null," - "CURRENT_CONNECTIONS bigint not null," - "TOTAL_CONNECTIONS bigint not null" - ")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_STATEMENTS_SUMMARY_BY_DIGEST --- - -SET @cmd="CREATE TABLE performance_schema.events_statements_summary_by_digest(" - "DIGEST VARCHAR(32)," - "DIGEST_TEXT LONGTEXT," - "COUNT_STAR BIGINT unsigned not null," - "SUM_TIMER_WAIT BIGINT unsigned not null," - "MIN_TIMER_WAIT BIGINT unsigned not null," - "AVG_TIMER_WAIT BIGINT unsigned not null," - "MAX_TIMER_WAIT BIGINT unsigned not null," - "SUM_LOCK_TIME BIGINT unsigned not null," - "SUM_ERRORS BIGINT unsigned not null," - "SUM_WARNINGS BIGINT unsigned not null," - "SUM_ROWS_AFFECTED BIGINT unsigned not null," - "SUM_ROWS_SENT BIGINT unsigned not null," - "SUM_ROWS_EXAMINED BIGINT unsigned not null," - "SUM_CREATED_TMP_DISK_TABLES BIGINT unsigned not null," - "SUM_CREATED_TMP_TABLES BIGINT unsigned not null," - "SUM_SELECT_FULL_JOIN BIGINT unsigned not null," - "SUM_SELECT_FULL_RANGE_JOIN BIGINT unsigned not null," - "SUM_SELECT_RANGE BIGINT unsigned not null," - "SUM_SELECT_RANGE_CHECK BIGINT unsigned not null," - "SUM_SELECT_SCAN BIGINT unsigned not null," - "SUM_SORT_MERGE_PASSES BIGINT unsigned not null," - "SUM_SORT_RANGE BIGINT unsigned not null," - "SUM_SORT_ROWS BIGINT unsigned not null," - "SUM_SORT_SCAN BIGINT unsigned not null," - "SUM_NO_INDEX_USED BIGINT unsigned not null," - "SUM_NO_GOOD_INDEX_USED BIGINT unsigned not null," - "FIRST_SEEN TIMESTAMP(0) default 0," - "LAST_SEEN TIMESTAMP(0) default 0" - ")ENGINE=PERFORMANCE_SCHEMA;"; - - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - CREATE TABLE IF NOT EXISTS proxies_priv (Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Proxied_host char(60) binary DEFAULT '' NOT NULL, Proxied_user char(16) binary DEFAULT '' NOT NULL, With_grant BOOL DEFAULT 0 NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp, PRIMARY KEY Host (Host,User,Proxied_host,Proxied_user), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User proxy privileges'; -- Remember for later if proxies_priv table already existed diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql index 9f67ae37497..abe1f487915 100644 --- a/scripts/mysql_system_tables_fix.sql +++ b/scripts/mysql_system_tables_fix.sql @@ -621,29 +621,6 @@ ALTER TABLE user MODIFY Create_tablespace_priv enum('N','Y') COLLATE utf8_genera UPDATE user SET Create_tablespace_priv = Super_priv WHERE @hadCreateTablespacePriv = 0; --- --- Unlike 'performance_schema', the 'mysql' database is reserved already, --- so no user procedure is supposed to be there. --- --- NOTE: until upgrade is finished, stored routines are not available, --- because system tables (e.g. mysql.proc) might be not usable. --- -drop procedure if exists mysql.die; -create procedure mysql.die() signal sqlstate 'HY000' set message_text='Unexpected content found in the performance_schema database.'; - --- --- For broken upgrades, SIGNAL the error --- - -SET @cmd="call mysql.die()"; - -SET @str = IF(@broken_pfs > 0, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - -drop procedure mysql.die; - ALTER TABLE user ADD plugin char(64) DEFAULT '', ADD authentication_string TEXT; ALTER TABLE user MODIFY plugin char(64) CHARACTER SET latin1 DEFAULT '' NOT NULL; ALTER TABLE user MODIFY authentication_string TEXT NOT NULL; diff --git a/scripts/mysqlaccess.sh b/scripts/mysqlaccess.sh index 9fb9e78e753..43844e5ec68 100644 --- a/scripts/mysqlaccess.sh +++ b/scripts/mysqlaccess.sh @@ -930,7 +930,7 @@ sub MergeConfigFile { $unsafeConfig = $fname; } } - if ( $group eq 'client' ) { + if ( $group eq 'client' || $group eq "client-server") { $MYSQL_CNF{'mysql'}{$item} = $value; $MYSQL_CNF{'mysqldump'}{$item} = $value; } else { @@ -2423,7 +2423,7 @@ sub Print_Header { sub Print_Footer { if ($MySQLaccess::CMD) { #command-line mode print "\n" - ."BUGs can be reported by email to bugs\@mysql.com\n"; + ."BUGs can be reported trough https://mariadb.atlassian.net/browse/MDEV\n"; } if ($MySQLaccess::CGI) { #CGI-BIN mode if ($MySQLaccess::Param{'brief'}) { @@ -2431,7 +2431,7 @@ sub Print_Footer { } print "<HR>\n" ."<ADDRESS>\n" - ."BUGs can be reported by email to <a href=mailto:bugs\@mysql.com>bugs\@mysql.com</a><BR>\n" + ."BUGs can be reported through <a href=\"https://mariadb.atlassian.net/browse/MDEV\">MariaDB JIRA</a><BR>\n" # ."Don't forget to mention the version $VERSION!<BR>\n" ."</ADDRESS>\n" ."</BODY>\n" diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh index 99ce187fcd4..81015746ae9 100644 --- a/scripts/mysqld_multi.sh +++ b/scripts/mysqld_multi.sh @@ -64,6 +64,28 @@ $homedir = $ENV{HOME}; $my_progname = $0; $my_progname =~ s/.*[\/]//; + +if (defined($ENV{UMASK})) { + my $UMASK = $ENV{UMASK}; + my $m; + my $fmode = "0640"; + + if(($UMASK =~ m/[^0246]/) || ($UMASK =~ m/^[^0]/) || (length($UMASK) != 4)) { + printf("UMASK must be a 3-digit mode with an additional leading 0 to indicate octal.\n"); + printf("The first digit will be corrected to 6, the others may be 0, 2, 4, or 6.\n"); } + else { + $fmode= substr $UMASK, 2, 2; + $fmode= "06${fmode}"; } + + if($fmode != $UMASK) { + printf("UMASK corrected from $UMASK to $fmode ...\n"); } + + $fmode= oct($fmode); + + umask($fmode); +} + + main(); #### diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index aaf1936afe1..f49f885bf5a 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -32,7 +32,28 @@ syslog_tag_mysqld_safe=mysqld_safe trap '' 1 2 3 15 # we shouldn't let anyone kill us -umask 007 +# MySQL-specific environment variable. First off, it's not really a umask, +# it's the desired mode. Second, it follows umask(2), not umask(3) in that +# octal needs to be explicit. Our shell might be a proper sh without printf, +# multiple-base arithmetic, and binary arithmetic, so this will get ugly. +# We reject decimal values to keep things at least half-sane. +umask 007 # fallback +UMASK="${UMASK-0640}" +fmode=`echo "$UMASK" | sed -e 's/[^0246]//g'` +octalp=`echo "$fmode"|cut -c1` +fmlen=`echo "$fmode"|wc -c|sed -e 's/ //g'` +if [ "x$octalp" != "x0" -o "x$UMASK" != "x$fmode" -o "x$fmlen" != "x5" ] +then + fmode=0640 + echo "UMASK must be a 3-digit mode with an additional leading 0 to indicate octal." >&2 + echo "The first digit will be corrected to 6, the others may be 0, 2, 4, or 6." >&2 +fi +fmode=`echo "$fmode"|cut -c3-4` +fmode="6$fmode" +if [ "x$UMASK" != "x0$fmode" ] +then + echo "UMASK corrected from $UMASK to 0$fmode ..." +fi defaults= case "$1" in @@ -429,29 +450,6 @@ else DATADIR=@localstatedir@ fi -# -# Try to find the plugin directory -# - -# Use user-supplied argument -if [ -n "${PLUGIN_DIR}" ]; then - plugin_dir="${PLUGIN_DIR}" -else - # Try to find plugin dir relative to basedir - for dir in lib/mysql/plugin lib/plugin - do - if [ -d "${MY_BASEDIR_VERSION}/${dir}" ]; then - plugin_dir="${MY_BASEDIR_VERSION}/${dir}" - break - fi - done - # Give up and use compiled-in default - if [ -z "${plugin_dir}" ]; then - plugin_dir='@pkgplugindir@' - fi -fi -plugin_dir="${plugin_dir}${PLUGIN_VARIANT}" - if test -z "$MYSQL_HOME" then if test -r "$MY_BASEDIR_VERSION/my.cnf" && test -r "$DATADIR/my.cnf" @@ -512,6 +510,31 @@ fi parse_arguments `$print_defaults $defaults --loose-verbose mysqld_safe safe_mysqld` parse_arguments PICK-ARGS-FROM-ARGV "$@" + +# +# Try to find the plugin directory +# + +# Use user-supplied argument +if [ -n "${PLUGIN_DIR}" ]; then + plugin_dir="${PLUGIN_DIR}" +else + # Try to find plugin dir relative to basedir + for dir in lib/mysql/plugin lib/plugin + do + if [ -d "${MY_BASEDIR_VERSION}/${dir}" ]; then + plugin_dir="${MY_BASEDIR_VERSION}/${dir}" + break + fi + done + # Give up and use compiled-in default + if [ -z "${plugin_dir}" ]; then + plugin_dir='@pkgplugindir@' + fi +fi +plugin_dir="${plugin_dir}${PLUGIN_VARIANT}" + + # Determine what logging facility to use # Ensure that 'logger' exists, if it's requested @@ -561,6 +584,12 @@ then # Log to err_log file log_notice "Logging to '$err_log'." logging=file + + if [ ! -e "$err_log" ]; then # if error log already exists, + touch "$err_log" # we just append. otherwise, + chmod "$fmode" "$err_log" # fix the permissions here! + fi + else if [ -n "$syslog_tag" ] then @@ -776,6 +805,12 @@ do eval_log_error "$cmd" + if [ $want_syslog -eq 0 -a ! -e "$err_log" ]; then + touch "$err_log" # hypothetical: log was renamed but not + chown $user "$err_log" # flushed yet. we'd recreate it with + chmod "$fmode" "$err_log" # wrong owner next time we log, so set + fi # it up correctly while we can! + end_time=`date +%M%S` if test ! -f "$pid_file" # This is removed if normal shutdown |