summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMarc Alff <marc.alff@sun.com>2010-01-11 18:47:27 -0700
committerMarc Alff <marc.alff@sun.com>2010-01-11 18:47:27 -0700
commite0e0f9e3d46917fe9b611fc9769e64032c267446 (patch)
treec111d4c62b1e1eb7a74ec68860756418e29cb61e /scripts
parent3d915225611a921fad03934e58bf281b48fc15b0 (diff)
downloadmariadb-git-e0e0f9e3d46917fe9b611fc9769e64032c267446.tar.gz
WL#2360 Performance schema
Part V: performance schema implementation
Diffstat (limited to 'scripts')
-rw-r--r--scripts/mysql_system_tables.sql359
1 files changed, 359 insertions, 0 deletions
diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql
index e3ddf7ffc30..bcbedae4d0f 100644
--- a/scripts/mysql_system_tables.sql
+++ b/scripts/mysql_system_tables.sql
@@ -1,3 +1,18 @@
+-- Copyright (C) 2008-2009 Sun Microsystems, Inc
+--
+-- 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
+-- the Free Software Foundation; version 2 of the License.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
--
-- The system tables of MySQL Server
--
@@ -85,3 +100,347 @@ CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_b
CREATE TABLE IF NOT EXISTS ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM;
+
+--
+-- The performance schema database.
+-- This database is always created, even in --without-perfschema builds,
+-- so that the database name is always reserved by the MySQL implementation.
+--
+
+set @have_pfs= (select count(engine) from information_schema.engines where engine='PERFORMANCE_SCHEMA' and support != 'NO');
+
+DROP DATABASE IF EXISTS performance_schema;
+
+CREATE DATABASE performance_schema character set utf8;
+
+--
+-- TABLE COND_INSTANCES
+--
+
+SET @l1="CREATE TABLE performance_schema.COND_INSTANCES(";
+SET @l2="NAME VARCHAR(128) not null,";
+SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null";
+SET @l4=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE EVENTS_WAITS_CURRENT
+--
+
+SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_CURRENT(";
+SET @l2="THREAD_ID INTEGER not null,";
+SET @l3="EVENT_ID BIGINT unsigned not null,";
+SET @l4="EVENT_NAME VARCHAR(128) not null,";
+SET @l5="SOURCE VARCHAR(64),";
+SET @l6="TIMER_START BIGINT unsigned,";
+SET @l7="TIMER_END BIGINT unsigned,";
+SET @l8="TIMER_WAIT BIGINT unsigned,";
+SET @l9="SPINS INTEGER unsigned,";
+SET @l10="OBJECT_SCHEMA VARCHAR(64),";
+SET @l11="OBJECT_NAME VARCHAR(512),";
+SET @l12="OBJECT_TYPE VARCHAR(64),";
+SET @l13="OBJECT_INSTANCE_BEGIN BIGINT not null,";
+SET @l14="NESTING_EVENT_ID BIGINT unsigned,";
+SET @l15="OPERATION VARCHAR(16) not null,";
+SET @l16="NUMBER_OF_BYTES BIGINT unsigned,";
+SET @l17="FLAGS INTEGER unsigned";
+SET @l18=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9,@l10,@l11,@l12,@l13,@l14,@l15,@l16,@l17,@l18);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE EVENTS_WAITS_HISTORY
+--
+
+SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_HISTORY(";
+-- lines 2 to 18 are unchanged from EVENTS_WAITS_CURRENT
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9,@l10,@l11,@l12,@l13,@l14,@l15,@l16,@l17,@l18);
+
+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 @l1="CREATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG(";
+-- lines 2 to 18 are unchanged from EVENTS_WAITS_CURRENT
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9,@l10,@l11,@l12,@l13,@l14,@l15,@l16,@l17,@l18);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
+--
+
+SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME(";
+SET @l2="EVENT_NAME VARCHAR(128) not null,";
+SET @l3="COUNT_STAR BIGINT unsigned not null,";
+SET @l4="SUM_TIMER_WAIT BIGINT unsigned not null,";
+SET @l5="MIN_TIMER_WAIT BIGINT unsigned not null,";
+SET @l6="AVG_TIMER_WAIT BIGINT unsigned not null,";
+SET @l7="MAX_TIMER_WAIT BIGINT unsigned not null";
+SET @l8=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8);
+
+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 @l1="CREATE TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE(";
+SET @l2="EVENT_NAME VARCHAR(128) not null,";
+SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,";
+SET @l4="COUNT_STAR BIGINT unsigned not null,";
+SET @l5="SUM_TIMER_WAIT BIGINT unsigned not null,";
+SET @l6="MIN_TIMER_WAIT BIGINT unsigned not null,";
+SET @l7="AVG_TIMER_WAIT BIGINT unsigned not null,";
+SET @l8="MAX_TIMER_WAIT BIGINT unsigned not null";
+SET @l9=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9);
+
+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 @l1="CREATE TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME(";
+SET @l2="THREAD_ID INTEGER not null,";
+SET @l3="EVENT_NAME VARCHAR(128) not null,";
+SET @l4="COUNT_STAR BIGINT unsigned not null,";
+SET @l5="SUM_TIMER_WAIT BIGINT unsigned not null,";
+SET @l6="MIN_TIMER_WAIT BIGINT unsigned not null,";
+SET @l7="AVG_TIMER_WAIT BIGINT unsigned not null,";
+SET @l8="MAX_TIMER_WAIT BIGINT unsigned not null";
+SET @l9=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE FILE_INSTANCES
+--
+
+SET @l1="CREATE TABLE performance_schema.FILE_INSTANCES(";
+SET @l2="FILE_NAME VARCHAR(512) not null,";
+SET @l3="EVENT_NAME VARCHAR(128) not null,";
+SET @l4="OPEN_COUNT INTEGER unsigned not null";
+SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
+
+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 @l1="CREATE TABLE performance_schema.FILE_SUMMARY_BY_EVENT_NAME(";
+SET @l2="EVENT_NAME VARCHAR(128) not null,";
+SET @l3="COUNT_READ BIGINT unsigned not null,";
+SET @l4="COUNT_WRITE BIGINT unsigned not null,";
+SET @l5="SUM_NUMBER_OF_BYTES_READ BIGINT unsigned not null,";
+SET @l6="SUM_NUMBER_OF_BYTES_WRITE BIGINT unsigned not null";
+SET @l7=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7);
+
+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 @l1="CREATE TABLE performance_schema.FILE_SUMMARY_BY_INSTANCE(";
+SET @l2="FILE_NAME VARCHAR(512) not null,";
+SET @l3="EVENT_NAME VARCHAR(128) not null,";
+SET @l4="COUNT_READ BIGINT unsigned not null,";
+SET @l5="COUNT_WRITE BIGINT unsigned not null,";
+SET @l6="SUM_NUMBER_OF_BYTES_READ BIGINT unsigned not null,";
+SET @l7="SUM_NUMBER_OF_BYTES_WRITE BIGINT unsigned not null";
+SET @l8=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE MUTEX_INSTANCES
+--
+
+SET @l1="CREATE TABLE performance_schema.MUTEX_INSTANCES(";
+SET @l2="NAME VARCHAR(128) not null,";
+SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,";
+SET @l4="LOCKED_BY_THREAD_ID INTEGER";
+SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE PERFORMANCE_TIMERS
+--
+
+SET @l1="CREATE TABLE performance_schema.PERFORMANCE_TIMERS(";
+SET @l2="TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null,";
+SET @l3="TIMER_FREQUENCY BIGINT,";
+SET @l4="TIMER_RESOLUTION BIGINT,";
+SET @l5="TIMER_OVERHEAD BIGINT";
+SET @l6=") ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE PROCESSLIST
+--
+
+SET @l1="CREATE TABLE performance_schema.PROCESSLIST(";
+SET @l2="THREAD_ID INTEGER not null,";
+SET @l3="ID INTEGER not null,";
+SET @l4="NAME VARCHAR(64) not null";
+SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE RWLOCK_INSTANCES
+--
+
+SET @l1="CREATE TABLE performance_schema.RWLOCK_INSTANCES(";
+SET @l2="NAME VARCHAR(128) not null,";
+SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,";
+SET @l4="WRITE_LOCKED_BY_THREAD_ID INTEGER,";
+SET @l5="READ_LOCKED_BY_COUNT INTEGER unsigned not null";
+SET @l6=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE SETUP_CONSUMERS
+--
+
+SET @l1="CREATE TABLE performance_schema.SETUP_CONSUMERS(";
+SET @l2="NAME VARCHAR(64) not null,";
+SET @l3="ENABLED ENUM ('YES', 'NO') not null";
+SET @l4=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE SETUP_INSTRUMENTS
+--
+
+SET @l1="CREATE TABLE performance_schema.SETUP_INSTRUMENTS(";
+SET @l2="NAME VARCHAR(128) not null,";
+SET @l3="ENABLED ENUM ('YES', 'NO') not null,";
+SET @l4="TIMED ENUM ('YES', 'NO') not null";
+SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE SETUP_OBJECTS
+--
+
+SET @l1="CREATE TABLE performance_schema.SETUP_OBJECTS(";
+SET @l2="OBJECT_TYPE VARCHAR(64),";
+SET @l3="OBJECT_SCHEMA VARCHAR(64),";
+SET @l4="OBJECT_NAME VARCHAR(64),";
+SET @l5="ENABLED ENUM ('YES', 'NO') not null,";
+SET @l6="TIMED ENUM ('YES', 'NO') not null,";
+SET @l7="AGGREGATED ENUM ('YES', 'NO') not null";
+SET @l8=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE SETUP_TIMERS
+--
+
+SET @l1="CREATE TABLE performance_schema.SETUP_TIMERS(";
+SET @l2="NAME VARCHAR(64) not null,";
+SET @l3="TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null";
+SET @l4=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+