--
-- Host: localhost    Database: ps_tools
-- ------------------------------------------------------

SET @MYSQLDUMP_TEMP_LOG_BIN = @@SESSION.SQL_LOG_BIN;

--
-- GTID state at the beginning of the backup 
--


--
-- Table structure for table `debug`
--

CREATE TABLE `debug` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `date` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
  `message` longtext,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Dumping data for table `debug`
--


--
-- Temporary table structure for view `is_engine_data`
--

/*!50001 DROP VIEW IF EXISTS `is_engine_data`*/;
/*!50001 CREATE TABLE `is_engine_data` (
  `ENGINE` tinyint NOT NULL,
  `COUNT(*)` tinyint NOT NULL,
  `Data Length (MB)` tinyint NOT NULL,
  `Index Length (MB)` tinyint NOT NULL,
  `Total (MB)` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `is_innodb_locks_waits`
--

/*!50001 DROP VIEW IF EXISTS `is_innodb_locks_waits`*/;
/*!50001 CREATE TABLE `is_innodb_locks_waits` (
  `waiting_trx_id` tinyint NOT NULL,
  `waiting_thread` tinyint NOT NULL,
  `waiting_query` tinyint NOT NULL,
  `blocking_trx_id` tinyint NOT NULL,
  `blocking_thread` tinyint NOT NULL,
  `blocking_query` tinyint NOT NULL,
  `blocking_lock_id` tinyint NOT NULL,
  `blocking_lock_mode` tinyint NOT NULL,
  `blocking_lock_type` tinyint NOT NULL,
  `blocking_lock_table` tinyint NOT NULL,
  `blocking_lock_index` tinyint NOT NULL,
  `waiting_lock_id` tinyint NOT NULL,
  `waiting_lock_mode` tinyint NOT NULL,
  `waiting_lock_type` tinyint NOT NULL,
  `waiting_lock_table` tinyint NOT NULL,
  `waiting_lock_index` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `is_innodb_table_cached`
--

/*!50001 DROP VIEW IF EXISTS `is_innodb_table_cached`*/;
/*!50001 CREATE TABLE `is_innodb_table_cached` (
  `TABLE_SCHEMA` tinyint NOT NULL,
  `TABLE_NAME` tinyint NOT NULL,
  `DataPct` tinyint NOT NULL,
  `IndexPct` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `ps_accounts_enabled`
--

/*!50001 DROP VIEW IF EXISTS `ps_accounts_enabled`*/;
/*!50001 CREATE TABLE `ps_accounts_enabled` (
  `User` tinyint NOT NULL,
  `Host` tinyint NOT NULL,
  `Enabled` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `ps_memory_by_thread_by_event_raw`
--

/*!50001 DROP VIEW IF EXISTS `ps_memory_by_thread_by_event_raw`*/;
/*!50001 CREATE TABLE `ps_memory_by_thread_by_event_raw` (
  `thd_id` tinyint NOT NULL,
  `conn_id` tinyint NOT NULL,
  `event` tinyint NOT NULL,
  `alloc` tinyint NOT NULL,
  `free` tinyint NOT NULL,
  `bytes_alloc` tinyint NOT NULL,
  `bytes_free` tinyint NOT NULL,
  `low` tinyint NOT NULL,
  `current` tinyint NOT NULL,
  `high` tinyint NOT NULL,
  `bytes_low` tinyint NOT NULL,
  `bytes_current` tinyint NOT NULL,
  `bytes_high` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `ps_memory_current_by_thread_by_event`
--

/*!50001 DROP VIEW IF EXISTS `ps_memory_current_by_thread_by_event`*/;
/*!50001 CREATE TABLE `ps_memory_current_by_thread_by_event` (
  `thd_id` tinyint NOT NULL,
  `conn_id` tinyint NOT NULL,
  `event` tinyint NOT NULL,
  `alloc` tinyint NOT NULL,
  `free` tinyint NOT NULL,
  `bytes_alloc` tinyint NOT NULL,
  `bytes_free` tinyint NOT NULL,
  `low` tinyint NOT NULL,
  `current` tinyint NOT NULL,
  `high` tinyint NOT NULL,
  `bytes_low` tinyint NOT NULL,
  `bytes_current` tinyint NOT NULL,
  `bytes_high` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `ps_memory_high_by_thread_by_event`
--

/*!50001 DROP VIEW IF EXISTS `ps_memory_high_by_thread_by_event`*/;
/*!50001 CREATE TABLE `ps_memory_high_by_thread_by_event` (
  `thd_id` tinyint NOT NULL,
  `conn_id` tinyint NOT NULL,
  `event` tinyint NOT NULL,
  `alloc` tinyint NOT NULL,
  `free` tinyint NOT NULL,
  `bytes_alloc` tinyint NOT NULL,
  `bytes_free` tinyint NOT NULL,
  `low` tinyint NOT NULL,
  `current` tinyint NOT NULL,
  `high` tinyint NOT NULL,
  `bytes_low` tinyint NOT NULL,
  `bytes_current` tinyint NOT NULL,
  `bytes_high` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `ps_mutex`
--

/*!50001 DROP VIEW IF EXISTS `ps_mutex`*/;
/*!50001 CREATE TABLE `ps_mutex` (
  `Victim_Thread_ID` tinyint NOT NULL,
  `Victim_Event_ID` tinyint NOT NULL,
  `Victim_Event_Name` tinyint NOT NULL,
  `Victim_Source` tinyint NOT NULL,
  `Victim_Thread_Name` tinyint NOT NULL,
  `Victim_Process_ID` tinyint NOT NULL,
  `Victim_SQL` tinyint NOT NULL,
  `Culprit_Thread_ID` tinyint NOT NULL,
  `Culprit_Event_ID` tinyint NOT NULL,
  `Culprit_Event_Name` tinyint NOT NULL,
  `Culprit_Source` tinyint NOT NULL,
  `Culprit_Thread_Name` tinyint NOT NULL,
  `Culprit_Process_ID` tinyint NOT NULL,
  `Culprit_SQL` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `ps_mystatements`
--

/*!50001 DROP VIEW IF EXISTS `ps_mystatements`*/;
/*!50001 CREATE TABLE `ps_mystatements` (
  `Duration` tinyint NOT NULL,
  `SQL_TEXT` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `ps_mythread`
--

/*!50001 DROP VIEW IF EXISTS `ps_mythread`*/;
/*!50001 CREATE TABLE `ps_mythread` (
  `THREAD_ID` tinyint NOT NULL,
  `PROCESSLIST_ID` tinyint NOT NULL,
  `STATEMENTS_HISTORY_LENGTH` tinyint NOT NULL,
  `STATEMENTS_HISTORY_LONG_LENGTH` tinyint NOT NULL,
  `WAITS_HISTORY_LENGTH` tinyint NOT NULL,
  `WAITS_HISTORY_LONG_LENGTH` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `ps_processlist`
--

/*!50001 DROP VIEW IF EXISTS `ps_processlist`*/;
/*!50001 CREATE TABLE `ps_processlist` (
  `Id` tinyint NOT NULL,
  `User` tinyint NOT NULL,
  `Host` tinyint NOT NULL,
  `db` tinyint NOT NULL,
  `Command` tinyint NOT NULL,
  `Time` tinyint NOT NULL,
  `TotalExecTime` tinyint NOT NULL,
  `State` tinyint NOT NULL,
  `IsExecuting` tinyint NOT NULL,
  `TotalStatements` tinyint NOT NULL,
  `Errors` tinyint NOT NULL,
  `TotalErrors` tinyint NOT NULL,
  `Warnings` tinyint NOT NULL,
  `TotalWarnings` tinyint NOT NULL,
  `RowsAffected` tinyint NOT NULL,
  `TotalRowsAffected` tinyint NOT NULL,
  `RowsSent` tinyint NOT NULL,
  `TotalRowsSent` tinyint NOT NULL,
  `RowsExamined` tinyint NOT NULL,
  `TotalRowsExamined` tinyint NOT NULL,
  `TmpDiskTables` tinyint NOT NULL,
  `TotalTmpDiskTables` tinyint NOT NULL,
  `TmpTables` tinyint NOT NULL,
  `TotalTmpTables` tinyint NOT NULL,
  `FullJoin` tinyint NOT NULL,
  `TotalFullJoin` tinyint NOT NULL,
  `FullRangeJoin` tinyint NOT NULL,
  `TotalFullRangeJoin` tinyint NOT NULL,
  `Range` tinyint NOT NULL,
  `TotalRange` tinyint NOT NULL,
  `RangeCheck` tinyint NOT NULL,
  `TotalRangeCheck` tinyint NOT NULL,
  `Scan` tinyint NOT NULL,
  `TotalScan` tinyint NOT NULL,
  `SortMergePasses` tinyint NOT NULL,
  `TotalSortMergePasses` tinyint NOT NULL,
  `SortRange` tinyint NOT NULL,
  `TotalSortRange` tinyint NOT NULL,
  `SortRows` tinyint NOT NULL,
  `TotalSortRows` tinyint NOT NULL,
  `SortScan` tinyint NOT NULL,
  `TotalSortScan` tinyint NOT NULL,
  `NoIndex` tinyint NOT NULL,
  `TotalNoIndex` tinyint NOT NULL,
  `NoGoodIndex` tinyint NOT NULL,
  `TotalNoGoodIndex` tinyint NOT NULL,
  `Info` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `ps_setup_consumers`
--

/*!50001 DROP VIEW IF EXISTS `ps_setup_consumers`*/;
/*!50001 CREATE TABLE `ps_setup_consumers` (
  `NAME` tinyint NOT NULL,
  `ENABLED` tinyint NOT NULL,
  `COLLECTS` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `ps_threads`
--

/*!50001 DROP VIEW IF EXISTS `ps_threads`*/;
/*!50001 CREATE TABLE `ps_threads` (
  `THREAD_ID` tinyint NOT NULL,
  `PROCESSLIST_ID` tinyint NOT NULL,
  `STATEMENTS_HISTORY_LENGTH` tinyint NOT NULL,
  `STATEMENTS_HISTORY_LONG_LENGTH` tinyint NOT NULL,
  `WAITS_HISTORY_LENGTH` tinyint NOT NULL,
  `WAITS_HISTORY_LONG_LENGTH` tinyint NOT NULL,
  `LAST_SQL` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `ps_waits`
--

/*!50001 DROP VIEW IF EXISTS `ps_waits`*/;
/*!50001 CREATE TABLE `ps_waits` (
  `THREAD_ID` tinyint NOT NULL,
  `EVENT_NAME` tinyint NOT NULL,
  `OBJECT_SCHEMA` tinyint NOT NULL,
  `OBJECT_NAME` tinyint NOT NULL,
  `OBJECT_INSTANCE_BEGIN` tinyint NOT NULL,
  `s_OBJECT_INSTANCE_BEGIN` tinyint NOT NULL,
  `s_EVENT_NAME` tinyint NOT NULL,
  `st_EVENT_NAME` tinyint NOT NULL,
  `MUTEX` tinyint NOT NULL,
  `COND` tinyint NOT NULL,
  `SOCKET` tinyint NOT NULL,
  `SOCKET2` tinyint NOT NULL,
  `RWLOCK` tinyint NOT NULL,
  `MUTEX_LOCKED_BY_THREAD_ID` tinyint NOT NULL,
  `WRITE_LOCKED_BY_THREAD_ID` tinyint NOT NULL,
  `SAME_SOCKET` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `schema_unused_routines`
--

/*!50001 DROP VIEW IF EXISTS `schema_unused_routines`*/;
/*!50001 CREATE TABLE `schema_unused_routines` (
  `object_schema` tinyint NOT NULL,
  `object_name` tinyint NOT NULL,
  `object_type` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Table structure for table `timing`
--

CREATE TABLE `timing` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `date` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
  `label` varchar(20) NOT NULL,
  `time` double NOT NULL,
  PRIMARY KEY (`id`),
  KEY `date` (`date`,`label`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Dumping data for table `timing`
--


--
-- Final view structure for view `is_engine_data`
--

/*!50001 DROP TABLE IF EXISTS `is_engine_data`*/;
/*!50001 DROP VIEW IF EXISTS `is_engine_data`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY INVOKER */
/*!50001 VIEW `is_engine_data` AS select `information_schema`.`TABLES`.`ENGINE` AS `ENGINE`,count(0) AS `COUNT(*)`,((sum(`information_schema`.`TABLES`.`DATA_LENGTH`) / 1024) / 1024) AS `Data Length (MB)`,((sum(`information_schema`.`TABLES`.`INDEX_LENGTH`) / 1024) / 1024) AS `Index Length (MB)`,((sum((`information_schema`.`TABLES`.`DATA_LENGTH` + `information_schema`.`TABLES`.`INDEX_LENGTH`)) / 1024) / 1024) AS `Total (MB)` from `information_schema`.`TABLES` group by `information_schema`.`TABLES`.`ENGINE` order by ((sum((`information_schema`.`TABLES`.`DATA_LENGTH` + `information_schema`.`TABLES`.`INDEX_LENGTH`)) / 1024) / 1024) desc */;

--
-- Final view structure for view `is_innodb_locks_waits`
--

/*!50001 DROP TABLE IF EXISTS `is_innodb_locks_waits`*/;
/*!50001 DROP VIEW IF EXISTS `is_innodb_locks_waits`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY INVOKER */
/*!50001 VIEW `is_innodb_locks_waits` AS select `r`.`trx_id` AS `waiting_trx_id`,`r`.`trx_mysql_thread_id` AS `waiting_thread`,`r`.`trx_query` AS `waiting_query`,`b`.`trx_id` AS `blocking_trx_id`,`b`.`trx_mysql_thread_id` AS `blocking_thread`,`b`.`trx_query` AS `blocking_query`,`bl`.`lock_id` AS `blocking_lock_id`,`bl`.`lock_mode` AS `blocking_lock_mode`,`bl`.`lock_type` AS `blocking_lock_type`,`bl`.`lock_table` AS `blocking_lock_table`,`bl`.`lock_index` AS `blocking_lock_index`,`rl`.`lock_id` AS `waiting_lock_id`,`rl`.`lock_mode` AS `waiting_lock_mode`,`rl`.`lock_type` AS `waiting_lock_type`,`rl`.`lock_table` AS `waiting_lock_table`,`rl`.`lock_index` AS `waiting_lock_index` from ((((`information_schema`.`INNODB_LOCK_WAITS` `w` join `information_schema`.`INNODB_TRX` `b` on((`b`.`trx_id` = `w`.`blocking_trx_id`))) join `information_schema`.`INNODB_TRX` `r` on((`r`.`trx_id` = `w`.`requesting_trx_id`))) join `information_schema`.`INNODB_LOCKS` `bl` on((`bl`.`lock_id` = `w`.`blocking_lock_id`))) join `information_schema`.`INNODB_LOCKS` `rl` on((`rl`.`lock_id` = `w`.`requested_lock_id`))) */;

--
-- Final view structure for view `is_innodb_table_cached`
--

/*!50001 DROP TABLE IF EXISTS `is_innodb_table_cached`*/;
/*!50001 DROP VIEW IF EXISTS `is_innodb_table_cached`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY INVOKER */
/*!50001 VIEW `is_innodb_table_cached` AS select `t`.`TABLE_SCHEMA` AS `TABLE_SCHEMA`,`t`.`TABLE_NAME` AS `TABLE_NAME`,round(((100 * ifnull(sum(if((`b`.`INDEX_NAME` = 'PRIMARY'),`b`.`DATA_SIZE`,0)),0)) / `t`.`DATA_LENGTH`),2) AS `DataPct`,round(((100 * ifnull(sum(if((`b`.`INDEX_NAME` <> 'PRIMARY'),`b`.`DATA_SIZE`,0)),0)) / `t`.`INDEX_LENGTH`),2) AS `IndexPct` from (`information_schema`.`TABLES` `t` left join `information_schema`.`INNODB_BUFFER_PAGE` `b` on((`b`.`TABLE_NAME` = concat('`',`t`.`TABLE_SCHEMA`,'`.`',`t`.`TABLE_NAME`,'`')))) where (`t`.`ENGINE` = 'InnoDB') group by `t`.`TABLE_SCHEMA`,`t`.`TABLE_NAME` */;

--
-- Final view structure for view `ps_accounts_enabled`
--

/*!50001 DROP TABLE IF EXISTS `ps_accounts_enabled`*/;
/*!50001 DROP VIEW IF EXISTS `ps_accounts_enabled`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY INVOKER */
/*!50001 VIEW `ps_accounts_enabled` AS select `mysql`.`user`.`User` AS `User`,`mysql`.`user`.`Host` AS `Host`,`ps_account_enabled`(`mysql`.`user`.`Host`,`mysql`.`user`.`User`) AS `Enabled` from `mysql`.`user` */;

--
-- Final view structure for view `ps_memory_by_thread_by_event_raw`
--

/*!50001 DROP TABLE IF EXISTS `ps_memory_by_thread_by_event_raw`*/;
/*!50001 DROP VIEW IF EXISTS `ps_memory_by_thread_by_event_raw`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY INVOKER */
/*!50001 VIEW `ps_memory_by_thread_by_event_raw` AS select `t`.`THREAD_ID` AS `thd_id`,`t`.`PROCESSLIST_ID` AS `conn_id`,`mem`.`EVENT_NAME` AS `event`,`mem`.`COUNT_ALLOC` AS `alloc`,`mem`.`COUNT_FREE` AS `free`,`mem`.`SUM_NUMBER_OF_BYTES_ALLOC` AS `bytes_alloc`,`mem`.`SUM_NUMBER_OF_BYTES_FREE` AS `bytes_free`,`mem`.`LOW_COUNT_USED` AS `low`,`mem`.`CURRENT_COUNT_USED` AS `current`,`mem`.`HIGH_COUNT_USED` AS `high`,`mem`.`LOW_NUMBER_OF_BYTES_USED` AS `bytes_low`,`mem`.`CURRENT_NUMBER_OF_BYTES_USED` AS `bytes_current`,`mem`.`HIGH_NUMBER_OF_BYTES_USED` AS `bytes_high` from (`performance_schema`.`threads` `t` join `performance_schema`.`memory_summary_by_thread_by_event_name` `mem` on((`t`.`THREAD_ID` = `mem`.`THREAD_ID`))) where (`mem`.`COUNT_ALLOC` > 0) */;

--
-- Final view structure for view `ps_memory_current_by_thread_by_event`
--

/*!50001 DROP TABLE IF EXISTS `ps_memory_current_by_thread_by_event`*/;
/*!50001 DROP VIEW IF EXISTS `ps_memory_current_by_thread_by_event`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY INVOKER */
/*!50001 VIEW `ps_memory_current_by_thread_by_event` AS select `t`.`THREAD_ID` AS `thd_id`,`t`.`PROCESSLIST_ID` AS `conn_id`,`mem`.`EVENT_NAME` AS `event`,`mem`.`COUNT_ALLOC` AS `alloc`,`mem`.`COUNT_FREE` AS `free`,`ps_helper`.`format_bytes`(`mem`.`SUM_NUMBER_OF_BYTES_ALLOC`) AS `bytes_alloc`,`ps_helper`.`format_bytes`(`mem`.`SUM_NUMBER_OF_BYTES_FREE`) AS `bytes_free`,`mem`.`LOW_COUNT_USED` AS `low`,`mem`.`CURRENT_COUNT_USED` AS `current`,`mem`.`HIGH_COUNT_USED` AS `high`,`ps_helper`.`format_bytes`(`mem`.`LOW_NUMBER_OF_BYTES_USED`) AS `bytes_low`,`ps_helper`.`format_bytes`(`mem`.`CURRENT_NUMBER_OF_BYTES_USED`) AS `bytes_current`,`ps_helper`.`format_bytes`(`mem`.`HIGH_NUMBER_OF_BYTES_USED`) AS `bytes_high` from (`performance_schema`.`threads` `t` join `performance_schema`.`memory_summary_by_thread_by_event_name` `mem` on((`t`.`THREAD_ID` = `mem`.`THREAD_ID`))) where (`mem`.`COUNT_ALLOC` > 0) order by `mem`.`CURRENT_NUMBER_OF_BYTES_USED` desc */;

--
-- Final view structure for view `ps_memory_high_by_thread_by_event`
--

/*!50001 DROP TABLE IF EXISTS `ps_memory_high_by_thread_by_event`*/;
/*!50001 DROP VIEW IF EXISTS `ps_memory_high_by_thread_by_event`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY INVOKER */
/*!50001 VIEW `ps_memory_high_by_thread_by_event` AS select `t`.`THREAD_ID` AS `thd_id`,`t`.`PROCESSLIST_ID` AS `conn_id`,`mem`.`EVENT_NAME` AS `event`,`mem`.`COUNT_ALLOC` AS `alloc`,`mem`.`COUNT_FREE` AS `free`,`ps_helper`.`format_bytes`(`mem`.`SUM_NUMBER_OF_BYTES_ALLOC`) AS `bytes_alloc`,`ps_helper`.`format_bytes`(`mem`.`SUM_NUMBER_OF_BYTES_FREE`) AS `bytes_free`,`mem`.`LOW_COUNT_USED` AS `low`,`mem`.`CURRENT_COUNT_USED` AS `current`,`mem`.`HIGH_COUNT_USED` AS `high`,`ps_helper`.`format_bytes`(`mem`.`LOW_NUMBER_OF_BYTES_USED`) AS `bytes_low`,`ps_helper`.`format_bytes`(`mem`.`CURRENT_NUMBER_OF_BYTES_USED`) AS `bytes_current`,`ps_helper`.`format_bytes`(`mem`.`HIGH_NUMBER_OF_BYTES_USED`) AS `bytes_high` from (`performance_schema`.`threads` `t` join `performance_schema`.`memory_summary_by_thread_by_event_name` `mem` on((`t`.`THREAD_ID` = `mem`.`THREAD_ID`))) where (`mem`.`COUNT_ALLOC` > 0) order by `mem`.`HIGH_NUMBER_OF_BYTES_USED` desc */;

--
-- Final view structure for view `ps_mutex`
--

/*!50001 DROP TABLE IF EXISTS `ps_mutex`*/;
/*!50001 DROP VIEW IF EXISTS `ps_mutex`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY INVOKER */
/*!50001 VIEW `ps_mutex` AS select `w1`.`THREAD_ID` AS `Victim_Thread_ID`,`w1`.`EVENT_ID` AS `Victim_Event_ID`,`w1`.`EVENT_NAME` AS `Victim_Event_Name`,`w1`.`SOURCE` AS `Victim_Source`,`t1`.`NAME` AS `Victim_Thread_Name`,`t1`.`PROCESSLIST_ID` AS `Victim_Process_ID`,`t1`.`PROCESSLIST_INFO` AS `Victim_SQL`,`w2`.`THREAD_ID` AS `Culprit_Thread_ID`,`w2`.`EVENT_ID` AS `Culprit_Event_ID`,`w2`.`EVENT_NAME` AS `Culprit_Event_Name`,`w2`.`SOURCE` AS `Culprit_Source`,`t2`.`NAME` AS `Culprit_Thread_Name`,`t2`.`PROCESSLIST_ID` AS `Culprit_Process_ID`,`t2`.`PROCESSLIST_INFO` AS `Culprit_SQL` from ((((`performance_schema`.`events_waits_current` `w1` join `performance_schema`.`mutex_instances` `mi` on((`mi`.`OBJECT_INSTANCE_BEGIN` = `w1`.`OBJECT_INSTANCE_BEGIN`))) join `performance_schema`.`events_waits_current` `w2` on((`w2`.`THREAD_ID` = `mi`.`LOCKED_BY_THREAD_ID`))) join `performance_schema`.`threads` `t1` on((`t1`.`THREAD_ID` = `w1`.`THREAD_ID`))) join `performance_schema`.`threads` `t2` on((`t2`.`THREAD_ID` = `w2`.`THREAD_ID`))) */;

--
-- Final view structure for view `ps_mystatements`
--

/*!50001 DROP TABLE IF EXISTS `ps_mystatements`*/;
/*!50001 DROP VIEW IF EXISTS `ps_mystatements`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY INVOKER */
/*!50001 VIEW `ps_mystatements` AS select `ps_helper`.`format_time`(`performance_schema`.`events_statements_history`.`TIMER_WAIT`) AS `Duration`,`performance_schema`.`events_statements_history`.`SQL_TEXT` AS `SQL_TEXT` from (`performance_schema`.`threads` join `performance_schema`.`events_statements_history` on((`performance_schema`.`threads`.`THREAD_ID` = `performance_schema`.`events_statements_history`.`THREAD_ID`))) where (`performance_schema`.`threads`.`PROCESSLIST_ID` = connection_id()) */;

--
-- Final view structure for view `ps_mythread`
--

/*!50001 DROP TABLE IF EXISTS `ps_mythread`*/;
/*!50001 DROP VIEW IF EXISTS `ps_mythread`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY INVOKER */
/*!50001 VIEW `ps_mythread` AS select `ps_threads`.`THREAD_ID` AS `THREAD_ID`,`ps_threads`.`PROCESSLIST_ID` AS `PROCESSLIST_ID`,`ps_threads`.`STATEMENTS_HISTORY_LENGTH` AS `STATEMENTS_HISTORY_LENGTH`,`ps_threads`.`STATEMENTS_HISTORY_LONG_LENGTH` AS `STATEMENTS_HISTORY_LONG_LENGTH`,`ps_threads`.`WAITS_HISTORY_LENGTH` AS `WAITS_HISTORY_LENGTH`,`ps_threads`.`WAITS_HISTORY_LONG_LENGTH` AS `WAITS_HISTORY_LONG_LENGTH` from `ps_tools`.`ps_threads` where (`ps_threads`.`PROCESSLIST_ID` = connection_id()) */;

--
-- Final view structure for view `ps_processlist`
--

/*!50001 DROP TABLE IF EXISTS `ps_processlist`*/;
/*!50001 DROP VIEW IF EXISTS `ps_processlist`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY INVOKER */
/*!50001 VIEW `ps_processlist` AS select `t`.`PROCESSLIST_ID` AS `Id`,`t`.`PROCESSLIST_USER` AS `User`,`t`.`PROCESSLIST_HOST` AS `Host`,`t`.`PROCESSLIST_DB` AS `db`,`t`.`PROCESSLIST_COMMAND` AS `Command`,`t`.`PROCESSLIST_TIME` AS `Time`,`ps_helper`.`format_time`(sum(`ste`.`SUM_TIMER_WAIT`)) AS `TotalExecTime`,if(isnull(`t`.`PROCESSLIST_INFO`),'',`t`.`PROCESSLIST_STATE`) AS `State`,if(isnull(`s`.`TIMER_END`),'YES','NO') AS `IsExecuting`,sum(`ste`.`COUNT_STAR`) AS `TotalStatements`,`s`.`ERRORS` AS `Errors`,sum(`ste`.`SUM_ERRORS`) AS `TotalErrors`,`s`.`WARNINGS` AS `Warnings`,sum(`ste`.`SUM_WARNINGS`) AS `TotalWarnings`,`s`.`ROWS_AFFECTED` AS `RowsAffected`,sum(`ste`.`SUM_ROWS_AFFECTED`) AS `TotalRowsAffected`,`s`.`ROWS_SENT` AS `RowsSent`,sum(`ste`.`SUM_ROWS_SENT`) AS `TotalRowsSent`,`s`.`ROWS_EXAMINED` AS `RowsExamined`,sum(`ste`.`SUM_ROWS_EXAMINED`) AS `TotalRowsExamined`,`s`.`CREATED_TMP_DISK_TABLES` AS `TmpDiskTables`,sum(`ste`.`SUM_CREATED_TMP_DISK_TABLES`) AS `TotalTmpDiskTables`,`s`.`CREATED_TMP_TABLES` AS `TmpTables`,sum(`ste`.`SUM_CREATED_TMP_TABLES`) AS `TotalTmpTables`,`s`.`SELECT_FULL_JOIN` AS `FullJoin`,sum(`ste`.`SUM_SELECT_FULL_JOIN`) AS `TotalFullJoin`,`s`.`SELECT_FULL_RANGE_JOIN` AS `FullRangeJoin`,sum(`ste`.`SUM_SELECT_FULL_RANGE_JOIN`) AS `TotalFullRangeJoin`,`s`.`SELECT_RANGE` AS `Range`,sum(`ste`.`SUM_SELECT_RANGE`) AS `TotalRange`,`s`.`SELECT_RANGE_CHECK` AS `RangeCheck`,sum(`ste`.`SUM_SELECT_RANGE_CHECK`) AS `TotalRangeCheck`,`s`.`SELECT_SCAN` AS `Scan`,sum(`ste`.`SUM_SELECT_SCAN`) AS `TotalScan`,`s`.`SORT_MERGE_PASSES` AS `SortMergePasses`,sum(`ste`.`SUM_SORT_MERGE_PASSES`) AS `TotalSortMergePasses`,`s`.`SORT_RANGE` AS `SortRange`,sum(`ste`.`SUM_SORT_RANGE`) AS `TotalSortRange`,`s`.`SORT_ROWS` AS `SortRows`,sum(`ste`.`SUM_SORT_ROWS`) AS `TotalSortRows`,`s`.`SORT_SCAN` AS `SortScan`,sum(`ste`.`SUM_SORT_SCAN`) AS `TotalSortScan`,`s`.`NO_INDEX_USED` AS `NoIndex`,sum(`ste`.`SUM_NO_INDEX_USED`) AS `TotalNoIndex`,`s`.`NO_GOOD_INDEX_USED` AS `NoGoodIndex`,sum(`ste`.`SUM_NO_GOOD_INDEX_USED`) AS `TotalNoGoodIndex`,left(`s`.`SQL_TEXT`,100) AS `Info` from ((`performance_schema`.`threads` `t` join `performance_schema`.`events_statements_current` `s` on((`t`.`THREAD_ID` = `s`.`THREAD_ID`))) join `performance_schema`.`events_statements_summary_by_thread_by_event_name` `ste` on((`t`.`THREAD_ID` = `ste`.`THREAD_ID`))) where (`t`.`TYPE` = 'FOREGROUND') group by `t`.`THREAD_ID`,`t`.`PROCESSLIST_ID`,`t`.`PROCESSLIST_USER`,`t`.`PROCESSLIST_HOST`,`t`.`PROCESSLIST_DB`,`t`.`PROCESSLIST_COMMAND`,`t`.`PROCESSLIST_TIME`,`State`,`IsExecuting`,`Info` */;

--
-- Final view structure for view `ps_setup_consumers`
--

/*!50001 DROP TABLE IF EXISTS `ps_setup_consumers`*/;
/*!50001 DROP VIEW IF EXISTS `ps_setup_consumers`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY INVOKER */
/*!50001 VIEW `ps_setup_consumers` AS select `c`.`NAME` AS `NAME`,`c`.`ENABLED` AS `ENABLED`,`ps_consumer_enabled`(`c`.`NAME`) AS `COLLECTS` from ((`performance_schema`.`setup_consumers` `c` join `performance_schema`.`setup_consumers` `cg`) join `performance_schema`.`setup_consumers` `ct`) where ((`cg`.`NAME` = 'global_instrumentation') and (`ct`.`NAME` = 'thread_instrumentation')) */;

--
-- Final view structure for view `ps_threads`
--

/*!50001 DROP TABLE IF EXISTS `ps_threads`*/;
/*!50001 DROP VIEW IF EXISTS `ps_threads`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY INVOKER */
/*!50001 VIEW `ps_threads` AS select `t`.`THREAD_ID` AS `THREAD_ID`,`t`.`PROCESSLIST_ID` AS `PROCESSLIST_ID`,(select count(0) from `performance_schema`.`events_statements_history` `sh` where (`sh`.`THREAD_ID` = `t`.`THREAD_ID`)) AS `STATEMENTS_HISTORY_LENGTH`,(select count(0) from `performance_schema`.`events_statements_history_long` `sh` where (`sh`.`THREAD_ID` = `t`.`THREAD_ID`)) AS `STATEMENTS_HISTORY_LONG_LENGTH`,(select count(0) from `performance_schema`.`events_waits_history` `wh` where (`wh`.`THREAD_ID` = `t`.`THREAD_ID`)) AS `WAITS_HISTORY_LENGTH`,(select count(0) from `performance_schema`.`events_waits_history_long` `wh` where (`wh`.`THREAD_ID` = `t`.`THREAD_ID`)) AS `WAITS_HISTORY_LONG_LENGTH`,`ps_helper`.`format_statement`(`esc`.`SQL_TEXT`) AS `LAST_SQL` from (`performance_schema`.`threads` `t` left join `performance_schema`.`events_statements_current` `esc` on((`t`.`THREAD_ID` = `esc`.`THREAD_ID`))) */;

--
-- Final view structure for view `ps_waits`
--

/*!50001 DROP TABLE IF EXISTS `ps_waits`*/;
/*!50001 DROP VIEW IF EXISTS `ps_waits`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY INVOKER */
/*!50001 VIEW `ps_waits` AS select `w`.`THREAD_ID` AS `THREAD_ID`,`w`.`EVENT_NAME` AS `EVENT_NAME`,`w`.`OBJECT_SCHEMA` AS `OBJECT_SCHEMA`,`w`.`OBJECT_NAME` AS `OBJECT_NAME`,`w`.`OBJECT_INSTANCE_BEGIN` AS `OBJECT_INSTANCE_BEGIN`,`s`.`OBJECT_INSTANCE_BEGIN` AS `s_OBJECT_INSTANCE_BEGIN`,`s`.`EVENT_NAME` AS `s_EVENT_NAME`,`st`.`EVENT_NAME` AS `st_EVENT_NAME`,`mi`.`NAME` AS `MUTEX`,`ci`.`NAME` AS `COND`,`si`.`EVENT_NAME` AS `SOCKET`,`si2`.`EVENT_NAME` AS `SOCKET2`,`rwi`.`NAME` AS `RWLOCK`,`mi`.`LOCKED_BY_THREAD_ID` AS `MUTEX_LOCKED_BY_THREAD_ID`,`rwi`.`WRITE_LOCKED_BY_THREAD_ID` AS `WRITE_LOCKED_BY_THREAD_ID`,if(((`si`.`THREAD_ID` = `si2`.`THREAD_ID`) and (`si`.`OBJECT_INSTANCE_BEGIN` = `si2`.`OBJECT_INSTANCE_BEGIN`) and (`si`.`EVENT_NAME` = `si2`.`EVENT_NAME`)),'YES','NO') AS `SAME_SOCKET` from (((((((`performance_schema`.`events_waits_current` `w` left join `performance_schema`.`events_statements_current` `s` on((`s`.`THREAD_ID` = `w`.`THREAD_ID`))) left join `performance_schema`.`events_stages_current` `st` on((`st`.`THREAD_ID` = `w`.`THREAD_ID`))) left join `performance_schema`.`mutex_instances` `mi` on((`mi`.`OBJECT_INSTANCE_BEGIN` = `w`.`OBJECT_INSTANCE_BEGIN`))) left join `performance_schema`.`cond_instances` `ci` on((`ci`.`OBJECT_INSTANCE_BEGIN` = `w`.`OBJECT_INSTANCE_BEGIN`))) left join `performance_schema`.`socket_instances` `si` on((`si`.`THREAD_ID` = `w`.`THREAD_ID`))) left join `performance_schema`.`socket_instances` `si2` on((`si2`.`OBJECT_INSTANCE_BEGIN` = `w`.`OBJECT_INSTANCE_BEGIN`))) left join `performance_schema`.`rwlock_instances` `rwi` on((`rwi`.`OBJECT_INSTANCE_BEGIN` = `w`.`OBJECT_INSTANCE_BEGIN`))) */;

--
-- Final view structure for view `schema_unused_routines`
--

/*!50001 DROP TABLE IF EXISTS `schema_unused_routines`*/;
/*!50001 DROP VIEW IF EXISTS `schema_unused_routines`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY INVOKER */
/*!50001 VIEW `schema_unused_routines` AS select `r`.`ROUTINE_SCHEMA` AS `object_schema`,`r`.`ROUTINE_NAME` AS `object_name`,`r`.`ROUTINE_TYPE` AS `object_type` from (`information_schema`.`ROUTINES` `r` left join `performance_schema`.`events_statements_summary_by_program` `e` on(((`e`.`OBJECT_SCHEMA` = `r`.`ROUTINE_SCHEMA`) and (`e`.`OBJECT_NAME` = `r`.`ROUTINE_NAME`) and (`e`.`OBJECT_TYPE` = `r`.`ROUTINE_TYPE`)))) where isnull(`e`.`COUNT_STAR`) order by `object_schema`,`object_name` */;


