-- Table structure for table `settings`
--

CREATE TABLE `settings` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `type` varchar(125) DEFAULT NULL,
  `content` longtext DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `settings`
--

INSERT INTO `settings` VALUES (1,'currency','{\"base_currency\":\"USD\"}','2023-07-12 13:29:33','2023-12-12 10:04:50');

--
-- Table structure for table `user_settings`
--

CREATE TABLE `user_settings` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL DEFAULT 0,
  `buffer_days` int(11) DEFAULT NULL,
  `pay_channel` varchar(125) DEFAULT NULL,
  `pay_later` tinyint(1) DEFAULT NULL,
  `balance_notification_limit` int(11) DEFAULT NULL,
  `balance_margin` int(11) DEFAULT NULL,
  `search_timeout` int(11) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `FK_user_settings_users` (`user_id`),
  CONSTRAINT `FK_user_settings_users` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `user_settings`
--

INSERT INTO `user_settings` VALUES (1,2,NULL,'all',0,2000,NULL,0,'2023-07-16 22:52:43','2023-07-16 22:52:54');

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `first_name` varchar(125) DEFAULT NULL,
  `last_name` varchar(125) DEFAULT NULL,
  `mobile` varchar(125) DEFAULT NULL,
  `email` varchar(125) NOT NULL,
  `email_verified_at` timestamp NULL DEFAULT NULL,
  `password` varchar(125) NOT NULL,
  `remember_token` varchar(100) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `is_email_verified` tinyint(1) NOT NULL DEFAULT 0,
  `active` tinyint(1) NOT NULL DEFAULT 1,
  `title` varchar(125) DEFAULT NULL,
  `type` varchar(125) DEFAULT NULL,
  `modules` longtext DEFAULT NULL,
  `parent_id` int(11) DEFAULT NULL,
  `credit_amount` decimal(18,3) DEFAULT NULL,
  `credit_allowed_amount` decimal(18,3) DEFAULT NULL,
  `image` varchar(125) DEFAULT NULL,
  `company` varchar(125) DEFAULT NULL,
  `last_seen_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `users_email_unique` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `users`
--

INSERT INTO `users` VALUES (1,'b2b','account','01033434440','b2b@wow-ws.com',NULL,'$1$EX9MhEcB$EWI3fj0A5vdRO/6WnUVXG1',NULL,'2023-05-25 04:27:59','2024-03-29 09:19:33',0,1,NULL,'super_admin',NULL,NULL,19957.000,11000.000,'DLs3dCOLFfC85rC79jfD5h8T1CEsbdVlgbRFBNWu.jpg','Demo B2B Client','2024-03-29 09:19:33'),(2,'operation','sata','','operation@sata.com',NULL,'$2y$10$74OzK./gT6WcZ1klmH3zIenFLpDBjfqWx3o.WBXziPIT/7LSnRdAq',NULL,'2023-05-25 04:27:59','2023-07-16 23:01:14',0,1,NULL,'employee',NULL,1,7035.000,150.000,NULL,NULL,'2023-07-16 23:01:14'),(3,'accountant','sata','+201234678979','accountant@sata.com',NULL,'$2y$10$mnNKlNIARD2QD1V3NCwZ5eiv3.i7ZoP60GEqK2UEN/DF.yUP8csQC',NULL,'2023-05-25 04:27:59','2023-05-28 22:28:29',0,1,'MR','employee',NULL,1,NULL,NULL,NULL,NULL,NULL),(4,'','','+201022245787','sata2@wow-ws.com',NULL,'$2y$10$D16zhDU.RzqPAHJ7CRFdYeXwI4JeDfBS/OBdu/gLeBFdlNhsG1Ksi',NULL,'2023-07-16 21:31:48','2023-07-16 21:31:48',0,1,'','company',NULL,1,NULL,NULL,NULL,'sata2',NULL),(5,'','','+201245487555','sata3@wow-ws.com',NULL,'$2y$10$KrxZmaZ/Zsj7gQ5Oot.OC.3g0S8N/1tIOgMISfOM5uzQk/g8JilOm',NULL,'2023-07-16 21:32:38','2023-07-16 21:32:38',0,1,'','company',NULL,1,NULL,NULL,NULL,'sata3',NULL),(6,'ahmed','ras','+201112225548','ahmed@wow-ws.com',NULL,'$2y$10$9oVGOpdG3i6z9Yb1b68cIeAEuKqLqTaZpTPr9KWuzqCyvvZyVYZj.',NULL,'2023-11-04 22:44:52','2023-11-04 22:44:52',0,1,'MR','employee',NULL,1,NULL,NULL,NULL,NULL,NULL),(7,NULL,NULL,NULL,'cuja@mailinator.com',NULL,'',NULL,'2023-11-04 22:59:24','2023-11-04 22:59:24',0,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(8,NULL,NULL,NULL,'herede@mailinator.com',NULL,'',NULL,'2023-11-04 23:06:10','2023-11-04 23:06:10',0,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(9,'opw','Voluptas cupiditate','01033434440','mumavuhah@mailinator.com',NULL,'$2y$10$7Avkgy.0x50ZMQK9IwGbtuTFofEQ4mDYGzDFzAcYsFvNSEQ1sO5Y6',NULL,'2023-11-07 18:22:09','2023-11-07 18:34:23',0,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(10,'loeprpel','Laudantium ut enim','+20299948883','nezacuj@mailinator.com',NULL,'$2y$10$lZDkvtT3ay4c1BPnPVhneuUHZbji4o5L0vAsucr1h7EAIO1mL8zoy',NULL,'2023-11-07 18:35:16','2023-11-07 18:37:17',0,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(11,'Eaque eu mollitia al','Hic enim libero temp','01033434440','gosawe@mailinator.com',NULL,'$2y$10$IbCX9fxR3AROCcBuxCjLQuidC1.l1DBE7ot1EIJknS8.X39zUbkxm',NULL,'2023-11-07 19:22:15','2023-11-07 19:22:15',0,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(12,'Reprehenderit est e','Proident dolor non','01033434440','zyvi@mailinator.com',NULL,'$2y$10$YllBZWa9y0AP3kmGEMMoher1ieVJcdAycOdqlAU3oxcP0Vp.V1.B.',NULL,'2023-11-07 19:31:00','2023-11-07 19:31:00',0,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(13,'Vel sed officia saep','Quia non quo in cons','01033434440','powuziroz@mailinator.com',NULL,'$2y$10$ikTN2.XENdnB1tXKdtnrZOs6DnLu6o.g0mvIJSd3tW/dabMxjSinC',NULL,'2023-11-07 20:09:39','2023-11-07 20:09:39',0,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(14,'Officia esse incidu','Accusamus ea ut duci','01033434440','hila@mailinator.com',NULL,'$2y$10$GrTMb01QzpI0/MilR4yfZe12qwagQDbkHv6J2.YhXNcdK5y.WsBqC',NULL,'2023-11-07 20:12:17','2023-11-07 20:12:17',0,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(15,'Qui nihil ut aut con','Quasi nostrum enim e','01033434440','suse@mailinator.com',NULL,'$2y$10$UxxuKRcTbyC7eEHolraIy.9QJl5PWBaRWWd5mH3AOktjmQpUeNPLi',NULL,'2023-11-07 20:14:32','2023-11-07 20:14:32',0,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(16,'Qui deserunt dolore','Aute porro velit do','01033434440','tybypi@mailinator.com',NULL,'$2y$10$x4fGkNGAO3zVErqsCC4ql.T8e2T/tjocA/H56kmABCEGIqRjkyDgC',NULL,'2023-11-07 20:23:25','2023-11-07 20:23:25',0,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(17,'Placeat delectus e','Nostrum earum magna','01033434440','cezi@mailinator.com',NULL,'$2y$10$PKl23t.Qq7FizHbZry39wuhNuZvz9NnoUmelPXYHrx.0F6Hg2QSH.',NULL,'2023-11-07 22:12:47','2023-11-07 22:12:47',0,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(18,'sata','group','01023667745','sata_group@sata.com',NULL,'$2y$10$FrTtQD2qi/j3F/UN97LDQOPFmyKcCC/iKOllaaCsECUdaxQe/X8hi',NULL,'2024-03-22 00:56:38','2024-03-22 00:56:38',0,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);

--
-- Table structure for table `users_verify`
--

CREATE TABLE `users_verify` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL DEFAULT 0,
  `token` varchar(125) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `FK_users_verify_users` (`user_id`),
  CONSTRAINT `FK_users_verify_users` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `users_verify`
--

INSERT INTO `users_verify` VALUES (1,18,'v3QESNIviQLalAXopBOwgjPXnT14fg66wTdTCuPF0yk8tizRy0PJyhN7hKmuM8aL','2024-03-22 00:56:38','2024-03-22 00:56:38');

--
-- Current Database: `mysql`
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysql` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci */;

USE `mysql`;

--
-- Table structure for table `general_log`
--

CREATE TABLE IF NOT EXISTS `general_log` (
  `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
  `user_host` mediumtext NOT NULL,
  `thread_id` bigint(21) unsigned NOT NULL,
  `server_id` int(10) unsigned NOT NULL,
  `command_type` varchar(64) NOT NULL,
  `argument` mediumtext NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='General log';

--
-- Table structure for table `slow_log`
--

CREATE TABLE IF NOT EXISTS `slow_log` (
  `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
  `user_host` mediumtext NOT NULL,
  `query_time` time(6) NOT NULL,
  `lock_time` time(6) NOT NULL,
  `rows_sent` int(11) NOT NULL,
  `rows_examined` int(11) NOT NULL,
  `db` varchar(512) NOT NULL,
  `last_insert_id` int(11) NOT NULL,
  `insert_id` int(11) NOT NULL,
  `server_id` int(10) unsigned NOT NULL,
  `sql_text` mediumtext NOT NULL,
  `thread_id` bigint(21) unsigned NOT NULL,
  `rows_affected` int(11) NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Slow log';

--
-- Table structure for table `column_stats`
--

CREATE TABLE `column_stats` (
  `db_name` varchar(64) NOT NULL,
  `table_name` varchar(64) NOT NULL,
  `column_name` varchar(64) NOT NULL,
  `min_value` varbinary(255) DEFAULT NULL,
  `max_value` varbinary(255) DEFAULT NULL,
  `nulls_ratio` decimal(12,4) DEFAULT NULL,
  `avg_length` decimal(12,4) DEFAULT NULL,
  `avg_frequency` decimal(12,4) DEFAULT NULL,
  `hist_size` tinyint(3) unsigned DEFAULT NULL,
  `hist_type` enum('SINGLE_PREC_HB','DOUBLE_PREC_HB') DEFAULT NULL,
  `histogram` varbinary(255) DEFAULT NULL,
  PRIMARY KEY (`db_name`,`table_name`,`column_name`)
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='Statistics on Columns';

--
-- Dumping data for table `column_stats`
--


--
-- Table structure for table `columns_priv`
--

CREATE TABLE `columns_priv` (
  `Host` char(255) NOT NULL DEFAULT '',
  `Db` char(64) NOT NULL DEFAULT '',
  `User` char(128) NOT NULL DEFAULT '',
  `Table_name` char(64) NOT NULL DEFAULT '',
  `Column_name` char(64) NOT NULL DEFAULT '',
  `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '',
  PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`)
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Column privileges';

--
-- Dumping data for table `columns_priv`
--


--
-- Table structure for table `db`
--

CREATE TABLE `db` (
  `Host` char(255) NOT NULL DEFAULT '',
  `Db` char(64) NOT NULL DEFAULT '',
  `User` char(128) NOT NULL DEFAULT '',
  `Select_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
  `Insert_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
  `Update_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
  `Delete_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
  `Create_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
  `Drop_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
  `Grant_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
  `References_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
  `Index_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
  `Alter_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
  `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
  `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
  `Create_view_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
  `Show_view_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
  `Create_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
  `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
  `Execute_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
  `Event_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
  `Trigger_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
  `Delete_history_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
  PRIMARY KEY (`Host`,`Db`,`User`),
  KEY `User` (`User`)
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Database privileges';

--
-- Dumping data for table `db`
--

INSERT INTO `db` VALUES ('localhost','phpmyadmin','phpmyadmin','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');

--
-- Table structure for table `event`
--

CREATE TABLE `event` (
  `db` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '',
  `name` char(64) NOT NULL DEFAULT '',
  `body` longblob NOT NULL,
  `definer` varchar(384) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '',
  `execute_at` datetime DEFAULT NULL,
  `interval_value` int(11) DEFAULT NULL,
  `interval_field` enum('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') DEFAULT NULL,
  `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `last_executed` datetime DEFAULT NULL,
  `starts` datetime DEFAULT NULL,
  `ends` datetime DEFAULT NULL,
  `status` enum('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL DEFAULT 'ENABLED',
  `on_completion` enum('DROP','PRESERVE') NOT NULL DEFAULT 'DROP',
  `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') NOT NULL DEFAULT '',
  `comment` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '',
  `originator` int(10) unsigned NOT NULL,
  `time_zone` char(64) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT 'SYSTEM',
  `character_set_client` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,
  `collation_connection` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,
  `db_collation` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,
  `body_utf8` longblob DEFAULT NULL,
  PRIMARY KEY (`db`,`name`)
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Events';

--
-- Table structure for table `func`
--

CREATE TABLE `func` (
  `name` char(64) NOT NULL DEFAULT '',
  `ret` tinyint(1) NOT NULL DEFAULT 0,
  `dl` char(128) NOT NULL DEFAULT '',
  `type` enum('function','aggregate') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
  PRIMARY KEY (`name`)
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='User defined functions';

--
-- Dumping data for table `func`
--


--
-- Table structure for table `global_priv`
--

CREATE TABLE `global_priv` (
  `Host` char(255) NOT NULL DEFAULT '',
  `User` char(128) NOT NULL DEFAULT '',
  `Priv` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '{}' CHECK (json_valid(`Priv`)),
  PRIMARY KEY (`Host`,`User`)
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Users and global privileges';

--
-- Dumping data for table `global_priv`
--

INSERT INTO `global_priv` VALUES ('localhost','mariadb.sys','{\"access\":0,\"plugin\":\"mysql_native_password\",\"authentication_string\":\"\",\"account_locked\":true,\"password_last_changed\":0}'),('localhost','root','{\"access\":18446744073709551615,\"plugin\":\"mysql_native_password\",\"authentication_string\":\"*9576D6A15BD67F7161A51660197A1762B59AF3D3\",\"auth_or\":[{},{\"plugin\":\"unix_socket\"}],\"password_last_changed\":1698628014}'),('localhost','mysql','{\"access\":18446744073709551615,\"plugin\":\"mysql_native_password\",\"authentication_string\":\"invalid\",\"auth_or\":[{},{\"plugin\":\"unix_socket\"}]}'),('localhost','phpmyadmin','{\"access\":0,\"version_id\":100612,\"plugin\":\"mysql_native_password\",\"authentication_string\":\"*72372E6BABDBA1C0372452C860C49761AC4227D5\",\"password_last_changed\":1698623062}');

--
-- Table structure for table `gtid_slave_pos`
--

CREATE TABLE `gtid_slave_pos` (
  `domain_id` int(10) unsigned NOT NULL,
  `sub_id` bigint(20) unsigned NOT NULL,
  `server_id` int(10) unsigned NOT NULL,
  `seq_no` bigint(20) unsigned NOT NULL,
  PRIMARY KEY (`domain_id`,`sub_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='Replication slave GTID position';

--
-- Dumping data for table `gtid_slave_pos`
--


--
-- Table structure for table `help_category`
--

CREATE TABLE `help_category` (
  `help_category_id` smallint(5) unsigned NOT NULL,
  `name` char(64) NOT NULL,
  `parent_category_id` smallint(5) unsigned DEFAULT NULL,
  `url` text NOT NULL,
  PRIMARY KEY (`help_category_id`),
  UNIQUE KEY `name` (`name`)
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='help categories';

--
-- Dumping data for table `help_category`
--

INSERT INTO `help_category` VALUES (1,'Contents',0,''),(2,'Polygon Properties',34,''),(3,'WKT',34,''),(4,'Numeric Functions',37,''),(5,'Plugins',1,''),(6,'MBR',34,''),(7,'Control Flow Functions',37,''),(8,'Transactions',1,''),(9,'Help Metadata',1,''),(10,'Account Management',1,''),(11,'Point Properties',34,''),(12,'Encryption Functions',37,''),(13,'LineString Properties',34,''),(14,'Miscellaneous Functions',37,''),(15,'Logical Operators',47,''),(16,'Functions and Modifiers for Use with GROUP BY',1,''),(17,'Information Functions',37,''),(18,'Assignment Operators',47,''),(19,'Comparison Operators',47,''),(20,'Bit Functions',37,''),(21,'Table Maintenance',1,''),(22,'User-Defined Functions',1,''),(23,'Data Types',1,''),(24,'Compound Statements',1,''),(25,'Geometry Constructors',34,''),(26,'Administration',1,''),(27,'Data Manipulation',1,''),(28,'Utility',1,''),(29,'Language Structure',1,''),(30,'Geometry Relations',34,''),(31,'Date and Time Functions',37,''),(32,'WKB',34,''),(33,'Procedures',1,''),(34,'Geographic Features',1,''),(35,'Geometry Properties',34,''),(36,'String Functions',37,''),(37,'Functions',1,''),(38,'Data Definition',1,''),(39,'Sequences',1,''),(40,'JSON Functions',37,''),(41,'Window Functions',37,''),(42,'Spider Functions',37,''),(43,'Dynamic Column Functions',37,''),(44,'Galera Functions',37,''),(45,'Temporal Tables',1,''),(46,'GeoJSON',34,''),(47,'Operators',1,''),(48,'Arithmetic Operators',47,''),(49,'Replication',1,''),(50,'Prepared Statements',1,'');

--
-- Table structure for table `help_keyword`
--

CREATE TABLE `help_keyword` (
  `help_keyword_id` int(10) unsigned NOT NULL,
  `name` char(64) NOT NULL,
  PRIMARY KEY (`help_keyword_id`),
  UNIQUE KEY `name` (`name`)
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='help keywords';

--
-- Dumping data for table `help_keyword`
--

INSERT INTO `help_keyword` VALUES (1,'work'),(2,'locks'),(3,'locking'),(4,'drop'),(5,'super'),(6,'usage'),(7,'binlog admin'),(8,'binlog monitor'),(9,'binlog replay'),(10,'connection admin'),(11,'federated admin'),(12,'grant option'),(13,'read_only admin'),(14,'replica monitor'),(15,'replication replica'),(16,'roles'),(17,'values'),(18,'value'),(19,'not'),(20,'and'),(21,'or'),(22,':='),(23,'assignment operator'),(24,'='),(25,'!='),(26,'<>'),(27,'not equal'),(28,'less than'),(29,'less than or equal'),(30,'NULL-safe equal'),(31,'equal'),(32,'greater than'),(33,'greater than or equal'),(34,'bitwise and'),(35,'shift left'),(36,'shift right'),(37,'bitwise xor'),(38,'bitwise or'),(39,'bitwise not'),(40,'returns'),(41,'udfs'),(42,'udf calling sequences'),(43,'udf security'),(44,'int1'),(45,'int2'),(46,'int3'),(47,'integer'),(48,'int4'),(49,'int8'),(50,'dec'),(51,'numeric'),(52,'fixed'),(53,'number'),(54,'real'),(55,'double precision'),(56,'nchar'),(57,'long'),(58,'long varchar'),(59,'repeat'),(60,'declare'),(61,'cursor'),(62,'show'),(63,'columns'),(64,'kill connection'),(65,'kill query'),(66,'delete returning'),(67,'sql_big_result'),(68,'minus'),(69,'cte'),(70,'insert returning'),(71,'queries'),(72,'query'),(73,'explain format'),(74,'explain format json'),(75,'rlike'),(76,'character_length'),(77,'escape'),(78,'mode'),(79,'trim_oracle'),(80,'schedule'),(81,'row_format'),(82,'starts'),(83,'host'),(84,'generated columns'),(85,'virtual columns'),(86,'computed columns'),(87,'hidden columns'),(88,'nextval'),(89,'lastval'),(90,'+'),(91,'addition operator'),(92,'/'),(93,'division operator'),(94,'%'),(95,'modulo operator'),(96,'*'),(97,'multiplication operator'),(98,'-'),(99,'subtraction operator'),(100,'master_ssl_verify_cert'),(101,'start replica'),(102,'stop replica'),(103,'reset slave'),(104,'reset replica'),(105,'drop prepare'),(106,'deallocate prepare');

--
-- Table structure for table `help_relation`
--

CREATE TABLE `help_relation` (
  `help_topic_id` int(10) unsigned NOT NULL,
  `help_keyword_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`help_keyword_id`,`help_topic_id`),
  KEY `help_topic_id` (`help_topic_id`)
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='keyword-topic relation';

--
-- Dumping data for table `help_relation`
--

INSERT INTO `help_relation` VALUES (94,1),(97,2),(99,2),(101,2),(116,2),(147,2),(152,2),(157,2),(161,2),(162,2),(340,2),(440,2),(97,3),(99,3),(101,3),(116,3),(147,3),(152,3),(157,3),(161,3),(162,3),(340,3),(440,3),(106,4),(112,4),(252,4),(691,4),(701,4),(717,4),(718,4),(719,4),(720,4),(721,4),(722,4),(723,4),(724,4),(726,4),(727,4),(735,4),(107,5),(107,6),(107,7),(107,8),(107,9),(107,10),(107,11),(107,12),(107,13),(107,14),(107,15),(115,16),(167,17),(167,18),(168,19),(169,20),(171,21),(212,22),(212,23),(213,23),(213,24),(214,25),(214,26),(214,27),(215,28),(216,29),(217,30),(218,31),(219,32),(220,33),(234,34),(235,35),(236,36),(238,37),(239,38),(240,39),(251,40),(253,41),(254,42),(255,43),(257,44),(259,45),(260,46),(261,47),(261,48),(262,49),(263,50),(263,51),(263,52),(263,53),(265,54),(265,55),(271,56),(277,57),(277,58),(306,59),(667,59),(313,60),(313,61),(333,62),(334,62),(335,62),(336,62),(337,62),(344,62),(345,62),(346,62),(347,62),(348,62),(349,62),(356,62),(358,62),(359,62),(360,62),(361,62),(362,62),(363,62),(364,62),(365,62),(366,62),(367,62),(368,62),(369,62),(370,62),(371,62),(372,62),(373,62),(374,62),(375,62),(376,62),(377,62),(378,62),(379,62),(380,62),(381,62),(382,62),(383,62),(384,62),(385,62),(386,62),(387,62),(388,62),(389,62),(390,62),(391,62),(392,62),(393,62),(394,62),(395,62),(396,62),(397,62),(398,62),(399,62),(400,62),(410,62),(411,62),(335,63),(405,64),(405,65),(412,66),(416,67),(427,68),(433,69),(434,69),(435,69),(455,70),(462,71),(462,72),(468,73),(468,74),(625,75),(635,76),(654,77),(660,78),(682,79),(693,80),(700,81),(705,82),(711,83),(715,84),(715,85),(715,86),(716,87),(736,88),(737,89),(809,90),(809,91),(810,92),(810,93),(811,94),(811,95),(812,96),(812,97),(813,98),(813,99),(814,100),(815,101),(816,102),(817,103),(817,104),(821,105),(821,106);

--
-- Table structure for table `help_topic`
--

CREATE TABLE `help_topic` (
  `help_topic_id` int(10) unsigned NOT NULL,
  `name` char(64) NOT NULL,
  `help_category_id` smallint(5) unsigned NOT NULL,
  `description` text NOT NULL,
  `example` text NOT NULL,
  `url` text NOT NULL,
  PRIMARY KEY (`help_topic_id`),
  UNIQUE KEY `name` (`name`)
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='help topics';

--
-- Dumping data for table `help_topic`
--




--
-- Table structure for table `index_stats`
--

CREATE TABLE `index_stats` (
  `db_name` varchar(64) NOT NULL,
  `table_name` varchar(64) NOT NULL,
  `index_name` varchar(64) NOT NULL,
  `prefix_arity` int(11) unsigned NOT NULL,
  `avg_frequency` decimal(12,4) DEFAULT NULL,
  PRIMARY KEY (`db_name`,`table_name`,`index_name`,`prefix_arity`)
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='Statistics on Indexes';

--
-- Dumping data for table `index_stats`
--


--
-- Table structure for table `innodb_index_stats`
--

CREATE TABLE `innodb_index_stats` (
  `database_name` varchar(64) NOT NULL,
  `table_name` varchar(199) NOT NULL,
  `index_name` varchar(64) NOT NULL,
  `last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `stat_name` varchar(64) NOT NULL,
  `stat_value` bigint(20) unsigned NOT NULL,
  `sample_size` bigint(20) unsigned DEFAULT NULL,
  `stat_description` varchar(1024) NOT NULL,
  PRIMARY KEY (`database_name`,`table_name`,`index_name`,`stat_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin STATS_PERSISTENT=0;

--
-- Table structure for table `innodb_table_stats`
--

CREATE TABLE `innodb_table_stats` (
  `database_name` varchar(64) NOT NULL,
  `table_name` varchar(199) NOT NULL,
  `last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `n_rows` bigint(20) unsigned NOT NULL,
  `clustered_index_size` bigint(20) unsigned NOT NULL,
  `sum_of_other_index_sizes` bigint(20) unsigned NOT NULL,
  PRIMARY KEY (`database_name`,`table_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin STATS_PERSISTENT=0;

--
-- Table structure for table `plugin`
--

CREATE TABLE `plugin` (
  `name` varchar(64) NOT NULL DEFAULT '',
  `dl` varchar(128) NOT NULL DEFAULT '',
  PRIMARY KEY (`name`)
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='MySQL plugins';

--
-- Dumping data for table `plugin`
--


--
-- Table structure for table `proc`
--

CREATE TABLE `proc` (
  `db` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '',
  `name` char(64) NOT NULL DEFAULT '',
  `type` enum('FUNCTION','PROCEDURE','PACKAGE','PACKAGE BODY') NOT NULL,
  `specific_name` char(64) NOT NULL DEFAULT '',
  `language` enum('SQL') NOT NULL DEFAULT 'SQL',
  `sql_data_access` enum('CONTAINS_SQL','NO_SQL','READS_SQL_DATA','MODIFIES_SQL_DATA') NOT NULL DEFAULT 'CONTAINS_SQL',
  `is_deterministic` enum('YES','NO') NOT NULL DEFAULT 'NO',
  `security_type` enum('INVOKER','DEFINER') NOT NULL DEFAULT 'DEFINER',
  `param_list` blob NOT NULL,
  `returns` longblob NOT NULL,
  `body` longblob NOT NULL,
  `definer` varchar(384) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '',
  `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') NOT NULL DEFAULT '',
  `comment` text CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL,
  `character_set_client` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,
  `collation_connection` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,
  `db_collation` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,
  `body_utf8` longblob DEFAULT NULL,
  `aggregate` enum('NONE','GROUP') NOT NULL DEFAULT 'NONE',
  PRIMARY KEY (`db`,`name`,`type`)
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Stored Procedures';

--
-- Dumping data for table `proc`
--

INSERT INTO `proc` VALUES ('mysql','AddGeometryColumn','PROCEDURE','AddGeometryColumn','SQL','CONTAINS_SQL','NO','INVOKER','catalog varchar(64), t_schema varchar(64),\n   t_name varchar(64), geometry_column varchar(64), t_srid int','','begin\n  set @qwe= concat(\'ALTER TABLE \', t_schema, \'.\', t_name, \' ADD \', geometry_column,\' GEOMETRY REF_SYSTEM_ID=\', t_srid); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','','utf8mb3','utf8mb3_general_ci','utf8mb4_general_ci','begin\n  set @qwe= concat(\'ALTER TABLE \', t_schema, \'.\', t_name, \' ADD \', geometry_column,\' GEOMETRY REF_SYSTEM_ID=\', t_srid); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end','NONE'),('mysql','DropGeometryColumn','PROCEDURE','DropGeometryColumn','SQL','CONTAINS_SQL','NO','INVOKER','catalog varchar(64), t_schema varchar(64),\n   t_name varchar(64), geometry_column varchar(64)','','begin\n  set @qwe= concat(\'ALTER TABLE \', t_schema, \'.\', t_name, \' DROP \', geometry_column); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','','utf8mb3','utf8mb3_general_ci','utf8mb4_general_ci','begin\n  set @qwe= concat(\'ALTER TABLE \', t_schema, \'.\', t_name, \' DROP \', geometry_column); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end','NONE'),('sys','extract_schema_from_file_name','FUNCTION','extract_schema_from_file_name','SQL','NO_SQL','YES','INVOKER','path VARCHAR(512)\n    ','varchar(64) CHARSET utf8mb3 COLLATE utf8mb3_general_ci','BEGIN\n    RETURN LEFT(SUBSTRING_INDEX(SUBSTRING_INDEX(REPLACE(path, \'\\\\\', \'/\'), \'/\', -2), \'/\', 1), 64);\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Takes a raw file path, and attempts to extract the schema name from it.\n             Useful for when interacting with Performance Schema data\n             concerning IO statistics, for example.\n             Currently relies on the fact that a table data file will be within a\n             specified database directory (will not work with partitions or tables\n             that specify an individual DATA_DIRECTORY).\n             Parameters\n             path (VARCHAR(512)):\n               The full file path to a data file to extract the schema name from.\n             Returns\n             VARCHAR(64)\n             Example\n             mysql> SELECT sys.extract_schema_from_file_name(\'/var/lib/mysql/employees/employee.ibd\');\n             +----------------------------------------------------------------------------+\n             | sys.extract_schema_from_file_name(\'/var/lib/mysql/employees/employee.ibd\') |\n             +----------------------------------------------------------------------------+\n             | employees                                                                  |\n             +----------------------------------------------------------------------------+\n             1 row in set (0.00 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    RETURN LEFT(SUBSTRING_INDEX(SUBSTRING_INDEX(REPLACE(path, \'\\\', \'/\'), \'/\', -2), \'/\', 1), 64);\nEND','NONE'),('sys','extract_table_from_file_name','FUNCTION','extract_table_from_file_name','SQL','NO_SQL','YES','INVOKER','path VARCHAR(512)\n    ','varchar(64) CHARSET utf8mb3 COLLATE utf8mb3_general_ci','BEGIN\n    RETURN LEFT(SUBSTRING_INDEX(REPLACE(SUBSTRING_INDEX(REPLACE(path, \'\\\\\', \'/\'), \'/\', -1), \'@0024\', \'$\'), \'.\', 1), 64);\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Takes a raw file path, and extracts the table name from it.\n             Useful for when interacting with Performance Schema data\n             concerning IO statistics, for example.\n             Parameters\n             path (VARCHAR(512)):\n               The full file path to a data file to extract the table name from.\n             Returns\n             VARCHAR(64)\n             Example\n             mysql> SELECT sys.extract_table_from_file_name(\'/var/lib/mysql/employees/employee.ibd\');\n             +---------------------------------------------------------------------------+\n             | sys.extract_table_from_file_name(\'/var/lib/mysql/employees/employee.ibd\') |\n             +---------------------------------------------------------------------------+\n             | employee                                                                  |\n             +---------------------------------------------------------------------------+\n             1 row in set (0.02 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    RETURN LEFT(SUBSTRING_INDEX(REPLACE(SUBSTRING_INDEX(REPLACE(path, \'\\\', \'/\'), \'/\', -1), \'@0024\', \'$\'), \'.\', 1), 64);\nEND','NONE'),('sys','format_bytes','FUNCTION','format_bytes','SQL','NO_SQL','YES','INVOKER','bytes TEXT\n    ','text CHARSET utf8mb3 COLLATE utf8mb3_general_ci','BEGIN\n  IF bytes IS NULL THEN RETURN NULL;\n  ELSEIF bytes >= 1125899906842624 THEN RETURN CONCAT(ROUND(bytes / 1125899906842624, 2), \' PiB\');\n  ELSEIF bytes >= 1099511627776 THEN RETURN CONCAT(ROUND(bytes / 1099511627776, 2), \' TiB\');\n  ELSEIF bytes >= 1073741824 THEN RETURN CONCAT(ROUND(bytes / 1073741824, 2), \' GiB\');\n  ELSEIF bytes >= 1048576 THEN RETURN CONCAT(ROUND(bytes / 1048576, 2), \' MiB\');\n  ELSEIF bytes >= 1024 THEN RETURN CONCAT(ROUND(bytes / 1024, 2), \' KiB\');\n  ELSE RETURN CONCAT(ROUND(bytes, 0), \' bytes\');\n  END IF;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Takes a raw bytes value, and converts it to a human readable format.\n             Parameters\n             bytes (TEXT):\n               A raw bytes value.\n             Returns\n             TEXT\n             Example\n             mysql> SELECT sys.format_bytes(2348723492723746) AS size;\n             +----------+\n             | size     |\n             +----------+\n             | 2.09 PiB |\n             +----------+\n             1 row in set (0.00 sec)\n             mysql> SELECT sys.format_bytes(2348723492723) AS size;\n             +----------+\n             | size     |\n             +----------+\n             | 2.14 TiB |\n             +----------+\n             1 row in set (0.00 sec)\n             mysql> SELECT sys.format_bytes(23487234) AS size;\n             +-----------+\n             | size      |\n             +-----------+\n             | 22.40 MiB |\n             +-----------+\n             1 row in set (0.00 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n  IF bytes IS NULL THEN RETURN NULL;\n  ELSEIF bytes >= 1125899906842624 THEN RETURN CONCAT(ROUND(bytes / 1125899906842624, 2), \' PiB\');\n  ELSEIF bytes >= 1099511627776 THEN RETURN CONCAT(ROUND(bytes / 1099511627776, 2), \' TiB\');\n  ELSEIF bytes >= 1073741824 THEN RETURN CONCAT(ROUND(bytes / 1073741824, 2), \' GiB\');\n  ELSEIF bytes >= 1048576 THEN RETURN CONCAT(ROUND(bytes / 1048576, 2), \' MiB\');\n  ELSEIF bytes >= 1024 THEN RETURN CONCAT(ROUND(bytes / 1024, 2), \' KiB\');\n  ELSE RETURN CONCAT(ROUND(bytes, 0), \' bytes\');\n  END IF;\nEND','NONE'),('sys','ps_thread_stack','FUNCTION','ps_thread_stack','SQL','READS_SQL_DATA','NO','INVOKER','thd_id BIGINT UNSIGNED,\n        debug BOOLEAN\n    ','longtext CHARSET latin1 COLLATE latin1_swedish_ci','BEGIN\n    DECLARE json_objects LONGTEXT;\n    \n    UPDATE performance_schema.threads\n       SET instrumented = \'NO\'\n     WHERE processlist_id = CONNECTION_ID();\n    \n    SET SESSION group_concat_max_len=@@global.max_allowed_packet;\n    SELECT GROUP_CONCAT(CONCAT( \'{\'\n              , CONCAT_WS( \', \'\n              , CONCAT(\'\"nesting_event_id\": \"\', IF(nesting_event_id IS NULL, \'0\', nesting_event_id), \'\"\')\n              , CONCAT(\'\"event_id\": \"\', event_id, \'\"\')\n              , CONCAT( \'\"timer_wait\": \', ROUND(timer_wait/1000000, 2))\n              , CONCAT( \'\"event_info\": \"\'\n                  , CASE\n                        WHEN event_name NOT LIKE \'wait/io%\' THEN REPLACE(SUBSTRING_INDEX(event_name, \'/\', -2), \'\\\\\', \'\\\\\\\\\')\n                        WHEN event_name NOT LIKE \'wait/io/file%\' OR event_name NOT LIKE \'wait/io/socket%\' THEN REPLACE(SUBSTRING_INDEX(event_name, \'/\', -4), \'\\\\\', \'\\\\\\\\\')\n                        ELSE event_name\n                    END\n                  , \'\"\'\n              )\n              , CONCAT( \'\"wait_info\": \"\', IFNULL(wait_info, \'\'), \'\"\')\n              , CONCAT( \'\"source\": \"\', IF(true AND event_name LIKE \'wait%\', IFNULL(wait_info, \'\'), \'\'), \'\"\')\n              , CASE\n                     WHEN event_name LIKE \'wait/io/file%\'      THEN \'\"event_type\": \"io/file\"\'\n                     WHEN event_name LIKE \'wait/io/table%\'     THEN \'\"event_type\": \"io/table\"\'\n                     WHEN event_name LIKE \'wait/io/socket%\'    THEN \'\"event_type\": \"io/socket\"\'\n                     WHEN event_name LIKE \'wait/synch/mutex%\'  THEN \'\"event_type\": \"synch/mutex\"\'\n                     WHEN event_name LIKE \'wait/synch/cond%\'   THEN \'\"event_type\": \"synch/cond\"\'\n                     WHEN event_name LIKE \'wait/synch/rwlock%\' THEN \'\"event_type\": \"synch/rwlock\"\'\n                     WHEN event_name LIKE \'wait/lock%\'         THEN \'\"event_type\": \"lock\"\'\n                     WHEN event_name LIKE \'statement/%\'        THEN \'\"event_type\": \"stmt\"\'\n                     WHEN event_name LIKE \'stage/%\'            THEN \'\"event_type\": \"stage\"\'\n                     WHEN event_name LIKE \'%idle%\'             THEN \'\"event_type\": \"idle\"\'\n                     ELSE \'\'\n                END\n            )\n            , \'}\'\n          )\n          ORDER BY event_id ASC SEPARATOR \',\') event\n    INTO json_objects\n    FROM (\n          \n          (SELECT thread_id, event_id, event_name, timer_wait, timer_start, nesting_event_id,\n                  CONCAT(sql_text, \'\\\\n\',\n                         \'errors: \', errors, \'\\\\n\',\n                         \'warnings: \', warnings, \'\\\\n\',\n                         \'lock time: \', ROUND(lock_time/1000000, 2),\'us\\\\n\',\n                         \'rows affected: \', rows_affected, \'\\\\n\',\n                         \'rows sent: \', rows_sent, \'\\\\n\',\n                         \'rows examined: \', rows_examined, \'\\\\n\',\n                         \'tmp tables: \', created_tmp_tables, \'\\\\n\',\n                         \'tmp disk tables: \', created_tmp_disk_tables, \'\\\\n\',\n                         \'select scan: \', select_scan, \'\\\\n\',\n                         \'select full join: \', select_full_join, \'\\\\n\',\n                         \'select full range join: \', select_full_range_join, \'\\\\n\',\n                         \'select range: \', select_range, \'\\\\n\',\n                         \'select range check: \', select_range_check, \'\\\\n\',\n                         \'sort merge passes: \', sort_merge_passes, \'\\\\n\',\n                         \'sort rows: \', sort_rows, \'\\\\n\',\n                         \'sort range: \', sort_range, \'\\\\n\',\n                         \'sort scan: \', sort_scan, \'\\\\n\',\n                         \'no index used: \', IF(no_index_used, \'TRUE\', \'FALSE\'), \'\\\\n\',\n                         \'no good index used: \', IF(no_good_index_used, \'TRUE\', \'FALSE\'), \'\\\\n\'\n                         ) AS wait_info\n             FROM performance_schema.events_statements_history_long WHERE thread_id = thd_id)\n          UNION\n          (SELECT thread_id, event_id, event_name, timer_wait, timer_start, nesting_event_id, null AS wait_info\n             FROM performance_schema.events_stages_history_long WHERE thread_id = thd_id)\n          UNION \n          (SELECT thread_id, event_id,\n                  CONCAT(event_name ,\n                         IF(event_name NOT LIKE \'wait/synch/mutex%\', IFNULL(CONCAT(\' - \', operation), \'\'), \'\'),\n                         IF(number_of_bytes IS NOT NULL, CONCAT(\' \', number_of_bytes, \' bytes\'), \'\'),\n                         IF(event_name LIKE \'wait/io/file%\', \'\\\\n\', \'\'),\n                         IF(object_schema IS NOT NULL, CONCAT(\'\\\\nObject: \', object_schema, \'.\'), \'\'),\n                         IF(object_name IS NOT NULL,\n                            IF (event_name LIKE \'wait/io/socket%\',\n                                CONCAT(IF (object_name LIKE \':0%\', @@socket, object_name)),\n                                object_name),\n                            \'\'),\n                          IF(index_name IS NOT NULL, CONCAT(\' Index: \', index_name), \'\'),\'\\\\n\'\n                         ) AS event_name,\n                  timer_wait, timer_start, nesting_event_id, source AS wait_info\n             FROM performance_schema.events_waits_history_long WHERE thread_id = thd_id)) events\n    ORDER BY event_id;\n    RETURN CONCAT(\'{\',\n                  CONCAT_WS(\',\',\n                            \'\"rankdir\": \"LR\"\',\n                            \'\"nodesep\": \"0.10\"\',\n                            CONCAT(\'\"stack_created\": \"\', NOW(), \'\"\'),\n                            CONCAT(\'\"mysql_version\": \"\', VERSION(), \'\"\'),\n                            CONCAT(\'\"mysql_user\": \"\', CURRENT_USER(), \'\"\'),\n                            CONCAT(\'\"events\": [\', IFNULL(json_objects,\'\'), \']\')\n                           ),\n                  \'}\');\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Outputs a JSON formatted stack of all statements, stages and events\n             within Performance Schema for the specified thread.\n             Parameters\n             thd_id (BIGINT UNSIGNED):\n               The id of the thread to trace. This should match the thread_id\n               column from the performance_schema.threads table.\n             in_verbose (BOOLEAN):\n               Include file:lineno information in the events.\n             Example\n             (line separation added for output)\n             mysql> SELECT sys.ps_thread_stack(37, FALSE) AS thread_stack\\G\n             *************************** 1. row ***************************\n             thread_stack: {\"rankdir\": \"LR\",\"nodesep\": \"0.10\",\"stack_created\": \"2014-02-19 13:39:03\",\n             \"mysql_version\": \"5.7.3-m13\",\"mysql_user\": \"root@localhost\",\"events\":\n             [{\"nesting_event_id\": \"0\", \"event_id\": \"10\", \"timer_wait\": 256.35, \"event_info\":\n             \"sql/select\", \"wait_info\": \"select @@version_comment limit 1\\nerrors: 0\\nwarnings: 0\\nlock time:\n             ...\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    DECLARE json_objects LONGTEXT;\n    \n    UPDATE performance_schema.threads\n       SET instrumented = \'NO\'\n     WHERE processlist_id = CONNECTION_ID();\n    \n    SET SESSION group_concat_max_len=@@global.max_allowed_packet;\n    SELECT GROUP_CONCAT(CONCAT( \'{\'\n              , CONCAT_WS( \', \'\n              , CONCAT(\'\"nesting_event_id\": \"\', IF(nesting_event_id IS NULL, \'0\', nesting_event_id), \'\"\')\n              , CONCAT(\'\"event_id\": \"\', event_id, \'\"\')\n              , CONCAT( \'\"timer_wait\": \', ROUND(timer_wait/1000000, 2))\n              , CONCAT( \'\"event_info\": \"\'\n                  , CASE\n                        WHEN event_name NOT LIKE \'wait/io%\' THEN REPLACE(SUBSTRING_INDEX(event_name, \'/\', -2), \'\\\', \'\\\\\')\n                        WHEN event_name NOT LIKE \'wait/io/file%\' OR event_name NOT LIKE \'wait/io/socket%\' THEN REPLACE(SUBSTRING_INDEX(event_name, \'/\', -4), \'\\\', \'\\\\\')\n                        ELSE event_name\n                    END\n                  , \'\"\'\n              )\n              , CONCAT( \'\"wait_info\": \"\', IFNULL(wait_info, \'\'), \'\"\')\n              , CONCAT( \'\"source\": \"\', IF(true AND event_name LIKE \'wait%\', IFNULL(wait_info, \'\'), \'\'), \'\"\')\n              , CASE\n                     WHEN event_name LIKE \'wait/io/file%\'      THEN \'\"event_type\": \"io/file\"\'\n                     WHEN event_name LIKE \'wait/io/table%\'     THEN \'\"event_type\": \"io/table\"\'\n                     WHEN event_name LIKE \'wait/io/socket%\'    THEN \'\"event_type\": \"io/socket\"\'\n                     WHEN event_name LIKE \'wait/synch/mutex%\'  THEN \'\"event_type\": \"synch/mutex\"\'\n                     WHEN event_name LIKE \'wait/synch/cond%\'   THEN \'\"event_type\": \"synch/cond\"\'\n                     WHEN event_name LIKE \'wait/synch/rwlock%\' THEN \'\"event_type\": \"synch/rwlock\"\'\n                     WHEN event_name LIKE \'wait/lock%\'         THEN \'\"event_type\": \"lock\"\'\n                     WHEN event_name LIKE \'statement/%\'        THEN \'\"event_type\": \"stmt\"\'\n                     WHEN event_name LIKE \'stage/%\'            THEN \'\"event_type\": \"stage\"\'\n                     WHEN event_name LIKE \'%idle%\'             THEN \'\"event_type\": \"idle\"\'\n                     ELSE \'\'\n                END\n            )\n            , \'}\'\n          )\n          ORDER BY event_id ASC SEPARATOR \',\') event\n    INTO json_objects\n    FROM (\n          \n          (SELECT thread_id, event_id, event_name, timer_wait, timer_start, nesting_event_id,\n                  CONCAT(sql_text, \'\\n\',\n                         \'errors: \', errors, \'\\n\',\n                         \'warnings: \', warnings, \'\\n\',\n                         \'lock time: \', ROUND(lock_time/1000000, 2),\'us\\n\',\n                         \'rows affected: \', rows_affected, \'\\n\',\n                         \'rows sent: \', rows_sent, \'\\n\',\n                         \'rows examined: \', rows_examined, \'\\n\',\n                         \'tmp tables: \', created_tmp_tables, \'\\n\',\n                         \'tmp disk tables: \', created_tmp_disk_tables, \'\\n\',\n                         \'select scan: \', select_scan, \'\\n\',\n                         \'select full join: \', select_full_join, \'\\n\',\n                         \'select full range join: \', select_full_range_join, \'\\n\',\n                         \'select range: \', select_range, \'\\n\',\n                         \'select range check: \', select_range_check, \'\\n\',\n                         \'sort merge passes: \', sort_merge_passes, \'\\n\',\n                         \'sort rows: \', sort_rows, \'\\n\',\n                         \'sort range: \', sort_range, \'\\n\',\n                         \'sort scan: \', sort_scan, \'\\n\',\n                         \'no index used: \', IF(no_index_used, \'TRUE\', \'FALSE\'), \'\\n\',\n                         \'no good index used: \', IF(no_good_index_used, \'TRUE\', \'FALSE\'), \'\\n\'\n                         ) AS wait_info\n             FROM performance_schema.events_statements_history_long WHERE thread_id = thd_id)\n          UNION\n          (SELECT thread_id, event_id, event_name, timer_wait, timer_start, nesting_event_id, null AS wait_info\n             FROM performance_schema.events_stages_history_long WHERE thread_id = thd_id)\n          UNION \n          (SELECT thread_id, event_id,\n                  CONCAT(event_name ,\n                         IF(event_name NOT LIKE \'wait/synch/mutex%\', IFNULL(CONCAT(\' - \', operation), \'\'), \'\'),\n                         IF(number_of_bytes IS NOT NULL, CONCAT(\' \', number_of_bytes, \' bytes\'), \'\'),\n                         IF(event_name LIKE \'wait/io/file%\', \'\\n\', \'\'),\n                         IF(object_schema IS NOT NULL, CONCAT(\'\\nObject: \', object_schema, \'.\'), \'\'),\n                         IF(object_name IS NOT NULL,\n                            IF (event_name LIKE \'wait/io/socket%\',\n                                CONCAT(IF (object_name LIKE \':0%\', @@socket, object_name)),\n                                object_name),\n                            \'\'),\n                          IF(index_name IS NOT NULL, CONCAT(\' Index: \', index_name), \'\'),\'\\n\'\n                         ) AS event_name,\n                  timer_wait, timer_start, nesting_event_id, source AS wait_info\n             FROM performance_schema.events_waits_history_long WHERE thread_id = thd_id)) events\n    ORDER BY event_id;\n    RETURN CONCAT(\'{\',\n                  CONCAT_WS(\',\',\n                            \'\"rankdir\": \"LR\"\',\n                            \'\"nodesep\": \"0.10\"\',\n                            CONCAT(\'\"stack_created\": \"\', NOW(), \'\"\'),\n                            CONCAT(\'\"mysql_version\": \"\', VERSION(), \'\"\'),\n                            CONCAT(\'\"mysql_user\": \"\', CURRENT_USER(), \'\"\'),\n                            CONCAT(\'\"events\": [\', IFNULL(json_objects,\'\'), \']\')\n                           ),\n                  \'}\');\nEND','NONE'),('sys','ps_thread_trx_info','FUNCTION','ps_thread_trx_info','SQL','READS_SQL_DATA','NO','INVOKER','in_thread_id BIGINT UNSIGNED\n    ','longtext CHARSET utf8mb3 COLLATE utf8mb3_general_ci','BEGIN\n    DECLARE v_output LONGTEXT DEFAULT \'{}\';\n    DECLARE v_msg_text TEXT DEFAULT \'\';\n    DECLARE v_signal_msg TEXT DEFAULT \'\';\n    DECLARE v_mysql_errno INT;\n    DECLARE v_max_output_len BIGINT;\n    DECLARE EXIT HANDLER FOR SQLWARNING, SQLEXCEPTION\n    BEGIN\n        GET DIAGNOSTICS CONDITION 1\n            v_msg_text = MESSAGE_TEXT,\n            v_mysql_errno = MYSQL_ERRNO;\n        IF v_mysql_errno = 1260 THEN\n            SET v_signal_msg = CONCAT(\'{ \"error\": \"Trx info truncated: \', v_msg_text, \'\" }\');\n        ELSE\n            SET v_signal_msg = CONCAT(\'{ \"error\": \"\', v_msg_text, \'\" }\');\n        END IF;\n        RETURN v_signal_msg;\n    END;\n    IF (@sys.ps_thread_trx_info.max_length IS NULL) THEN\n        SET @sys.ps_thread_trx_info.max_length = sys.sys_get_config(\'ps_thread_trx_info.max_length\', 65535);\n    END IF;\n    IF (@sys.ps_thread_trx_info.max_length != @@session.group_concat_max_len) THEN\n        SET @old_group_concat_max_len = @@session.group_concat_max_len;\n        SET v_max_output_len = (@sys.ps_thread_trx_info.max_length - 5);\n        SET SESSION group_concat_max_len = v_max_output_len;\n    END IF;\n    SET v_output = (\n        SELECT CONCAT(\'[\', IFNULL(GROUP_CONCAT(trx_info ORDER BY event_id), \'\'), \'\\n]\') AS trx_info\n          FROM (SELECT trxi.thread_id,\n                       trxi.event_id,\n                       GROUP_CONCAT(\n                         IFNULL(\n                           CONCAT(\'\\n  {\\n\',\n                                  \'    \"time\": \"\', IFNULL(sys.format_time(trxi.timer_wait), \'\'), \'\",\\n\',\n                                  \'    \"state\": \"\', IFNULL(trxi.state, \'\'), \'\",\\n\',\n                                  \'    \"mode\": \"\', IFNULL(trxi.access_mode, \'\'), \'\",\\n\',\n                                  \'    \"autocommitted\": \"\', IFNULL(trxi.autocommit, \'\'), \'\",\\n\',\n                                  \'    \"gtid\": \"\', IFNULL(trxi.gtid, \'\'), \'\",\\n\',\n                                  \'    \"isolation\": \"\', IFNULL(trxi.isolation_level, \'\'), \'\",\\n\',\n                                  \'    \"statements_executed\": [\', IFNULL(s.stmts, \'\'), IF(s.stmts IS NULL, \' ]\\n\', \'\\n    ]\\n\'),\n                                  \'  }\'\n                           ),\n                           \'\')\n                         ORDER BY event_id) AS trx_info\n                  FROM (\n                        (SELECT thread_id, event_id, timer_wait, state,access_mode, autocommit, gtid, isolation_level\n                           FROM performance_schema.events_transactions_current\n                          WHERE thread_id = in_thread_id\n                            AND end_event_id IS NULL)\n                        UNION\n                        (SELECT thread_id, event_id, timer_wait, state,access_mode, autocommit, gtid, isolation_level\n                           FROM performance_schema.events_transactions_history\n                          WHERE thread_id = in_thread_id)\n                       ) AS trxi\n                  LEFT JOIN (SELECT thread_id,\n                                    nesting_event_id,\n                                    GROUP_CONCAT(\n                                      IFNULL(\n                                        CONCAT(\'\\n      {\\n\',\n                                               \'        \"sql_text\": \"\', IFNULL(sys.format_statement(REPLACE(sql_text, \'\\\\\', \'\\\\\\\\\')), \'\'), \'\",\\n\',\n                                               \'        \"time\": \"\', IFNULL(sys.format_time(timer_wait), \'\'), \'\",\\n\',\n                                               \'        \"schema\": \"\', IFNULL(current_schema, \'\'), \'\",\\n\',\n                                               \'        \"rows_examined\": \', IFNULL(rows_examined, \'\'), \',\\n\',\n                                               \'        \"rows_affected\": \', IFNULL(rows_affected, \'\'), \',\\n\',\n                                               \'        \"rows_sent\": \', IFNULL(rows_sent, \'\'), \',\\n\',\n                                               \'        \"tmp_tables\": \', IFNULL(created_tmp_tables, \'\'), \',\\n\',\n                                               \'        \"tmp_disk_tables\": \', IFNULL(created_tmp_disk_tables, \'\'), \',\\n\',\n                                               \'        \"sort_rows\": \', IFNULL(sort_rows, \'\'), \',\\n\',\n                                               \'        \"sort_merge_passes\": \', IFNULL(sort_merge_passes, \'\'), \'\\n\',\n                                               \'      }\'), \'\') ORDER BY event_id) AS stmts\n                               FROM performance_schema.events_statements_history\n                              WHERE sql_text IS NOT NULL\n                                AND thread_id = in_thread_id\n                              GROUP BY thread_id, nesting_event_id\n                            ) AS s\n                    ON trxi.thread_id = s.thread_id\n                   AND trxi.event_id = s.nesting_event_id\n                 WHERE trxi.thread_id = in_thread_id\n                 GROUP BY trxi.thread_id, trxi.event_id\n                ) trxs\n          GROUP BY thread_id\n    );\n    IF (@old_group_concat_max_len IS NOT NULL) THEN\n        SET SESSION group_concat_max_len = @old_group_concat_max_len;\n    END IF;\n    RETURN v_output;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Returns a JSON object with info on the given threads current transaction,\n             and the statements it has already executed, derived from the\n             performance_schema.events_transactions_current and\n             performance_schema.events_statements_history tables (so the consumers\n             for these also have to be enabled within Performance Schema to get full\n             data in the object).\n             When the output exceeds the default truncation length (65535), a JSON error\n             object is returned, such as:\n             { \"error\": \"Trx info truncated: Row 6 was cut by GROUP_CONCAT()\" }\n             Similar error objects are returned for other warnings/and exceptions raised\n             when calling the function.\n             The max length of the output of this function can be controlled with the\n             ps_thread_trx_info.max_length variable set via sys_config, or the\n             @sys.ps_thread_trx_info.max_length user variable, as appropriate.\n             Parameters\n             in_thread_id (BIGINT UNSIGNED):\n               The id of the thread to return the transaction info for.\n             Example\n             SELECT sys.ps_thread_trx_info(48)\\G\n             *************************** 1. row ***************************\n             sys.ps_thread_trx_info(48): [\n               {\n                 \"time\": \"790.70 us\",\n                 \"state\": \"COMMITTED\",\n                 \"mode\": \"READ WRITE\",\n                 \"autocommitted\": \"NO\",\n                 \"gtid\": \"AUTOMATIC\",\n                 \"isolation\": \"REPEATABLE READ\",\n                 \"statements_executed\": [\n                   {\n                     \"sql_text\": \"INSERT INTO info VALUES (1, \'foo\')\",\n                     \"time\": \"471.02 us\",\n                     \"schema\": \"trx\",\n                     \"rows_examined\": 0,\n                     \"rows_affected\": 1,\n                     \"rows_sent\": 0,\n                     \"tmp_tables\": 0,\n                     \"tmp_disk_tables\": 0,\n                     \"sort_rows\": 0,\n                     \"sort_merge_passes\": 0\n                   },\n                   {\n                     \"sql_text\": \"COMMIT\",\n                     \"time\": \"254.42 us\",\n                     \"schema\": \"trx\",\n                     \"rows_examined\": 0,\n                     \"rows_affected\": 0,\n                     \"rows_sent\": 0,\n                     \"tmp_tables\": 0,\n                     \"tmp_disk_tables\": 0,\n                     \"sort_rows\": 0,\n                     \"sort_merge_passes\": 0\n                   }\n                 ]\n               },\n               {\n                 \"time\": \"426.20 us\",\n                 \"state\": \"COMMITTED\",\n                 \"mode\": \"READ WRITE\",\n                 \"autocommitted\": \"NO\",\n                 \"gtid\": \"AUTOMATIC\",\n                 \"isolation\": \"REPEATABLE READ\",\n                 \"statements_executed\": [\n                   {\n                     \"sql_text\": \"INSERT INTO info VALUES (2, \'bar\')\",\n                     \"time\": \"107.33 us\",\n                     \"schema\": \"trx\",\n                     \"rows_examined\": 0,\n                     \"rows_affected\": 1,\n                     \"rows_sent\": 0,\n                     \"tmp_tables\": 0,\n                     \"tmp_disk_tables\": 0,\n                     \"sort_rows\": 0,\n                     \"sort_merge_passes\": 0\n                   },\n                   {\n                     \"sql_text\": \"COMMIT\",\n                     \"time\": \"213.23 us\",\n                     \"schema\": \"trx\",\n                     \"rows_examined\": 0,\n                     \"rows_affected\": 0,\n                     \"rows_sent\": 0,\n                     \"tmp_tables\": 0,\n                     \"tmp_disk_tables\": 0,\n                     \"sort_rows\": 0,\n                     \"sort_merge_passes\": 0\n                   }\n                 ]\n               }\n             ]\n             1 row in set (0.03 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    DECLARE v_output LONGTEXT DEFAULT \'{}\';\n    DECLARE v_msg_text TEXT DEFAULT \'\';\n    DECLARE v_signal_msg TEXT DEFAULT \'\';\n    DECLARE v_mysql_errno INT;\n    DECLARE v_max_output_len BIGINT;\n    DECLARE EXIT HANDLER FOR SQLWARNING, SQLEXCEPTION\n    BEGIN\n        GET DIAGNOSTICS CONDITION 1\n            v_msg_text = MESSAGE_TEXT,\n            v_mysql_errno = MYSQL_ERRNO;\n        IF v_mysql_errno = 1260 THEN\n            SET v_signal_msg = CONCAT(\'{ \"error\": \"Trx info truncated: \', v_msg_text, \'\" }\');\n        ELSE\n            SET v_signal_msg = CONCAT(\'{ \"error\": \"\', v_msg_text, \'\" }\');\n        END IF;\n        RETURN v_signal_msg;\n    END;\n    IF (@sys.ps_thread_trx_info.max_length IS NULL) THEN\n        SET @sys.ps_thread_trx_info.max_length = sys.sys_get_config(\'ps_thread_trx_info.max_length\', 65535);\n    END IF;\n    IF (@sys.ps_thread_trx_info.max_length != @@session.group_concat_max_len) THEN\n        SET @old_group_concat_max_len = @@session.group_concat_max_len;\n        SET v_max_output_len = (@sys.ps_thread_trx_info.max_length - 5);\n        SET SESSION group_concat_max_len = v_max_output_len;\n    END IF;\n    SET v_output = (\n        SELECT CONCAT(\'[\', IFNULL(GROUP_CONCAT(trx_info ORDER BY event_id), \'\'), \'\\n]\') AS trx_info\n          FROM (SELECT trxi.thread_id,\n                       trxi.event_id,\n                       GROUP_CONCAT(\n                         IFNULL(\n                           CONCAT(\'\\n  {\\n\',\n                                  \'    \"time\": \"\', IFNULL(sys.format_time(trxi.timer_wait), \'\'), \'\",\\n\',\n                                  \'    \"state\": \"\', IFNULL(trxi.state, \'\'), \'\",\\n\',\n                                  \'    \"mode\": \"\', IFNULL(trxi.access_mode, \'\'), \'\",\\n\',\n                                  \'    \"autocommitted\": \"\', IFNULL(trxi.autocommit, \'\'), \'\",\\n\',\n                                  \'    \"gtid\": \"\', IFNULL(trxi.gtid, \'\'), \'\",\\n\',\n                                  \'    \"isolation\": \"\', IFNULL(trxi.isolation_level, \'\'), \'\",\\n\',\n                                  \'    \"statements_executed\": [\', IFNULL(s.stmts, \'\'), IF(s.stmts IS NULL, \' ]\\n\', \'\\n    ]\\n\'),\n                                  \'  }\'\n                           ),\n                           \'\')\n                         ORDER BY event_id) AS trx_info\n                  FROM (\n                        (SELECT thread_id, event_id, timer_wait, state,access_mode, autocommit, gtid, isolation_level\n                           FROM performance_schema.events_transactions_current\n                          WHERE thread_id = in_thread_id\n                            AND end_event_id IS NULL)\n                        UNION\n                        (SELECT thread_id, event_id, timer_wait, state,access_mode, autocommit, gtid, isolation_level\n                           FROM performance_schema.events_transactions_history\n                          WHERE thread_id = in_thread_id)\n                       ) AS trxi\n                  LEFT JOIN (SELECT thread_id,\n                                    nesting_event_id,\n                                    GROUP_CONCAT(\n                                      IFNULL(\n                                        CONCAT(\'\\n      {\\n\',\n                                               \'        \"sql_text\": \"\', IFNULL(sys.format_statement(REPLACE(sql_text, \'\\\', \'\\\\\')), \'\'), \'\",\\n\',\n                                               \'        \"time\": \"\', IFNULL(sys.format_time(timer_wait), \'\'), \'\",\\n\',\n                                               \'        \"schema\": \"\', IFNULL(current_schema, \'\'), \'\",\\n\',\n                                               \'        \"rows_examined\": \', IFNULL(rows_examined, \'\'), \',\\n\',\n                                               \'        \"rows_affected\": \', IFNULL(rows_affected, \'\'), \',\\n\',\n                                               \'        \"rows_sent\": \', IFNULL(rows_sent, \'\'), \',\\n\',\n                                               \'        \"tmp_tables\": \', IFNULL(created_tmp_tables, \'\'), \',\\n\',\n                                               \'        \"tmp_disk_tables\": \', IFNULL(created_tmp_disk_tables, \'\'), \',\\n\',\n                                               \'        \"sort_rows\": \', IFNULL(sort_rows, \'\'), \',\\n\',\n                                               \'        \"sort_merge_passes\": \', IFNULL(sort_merge_passes, \'\'), \'\\n\',\n                                               \'      }\'), \'\') ORDER BY event_id) AS stmts\n                               FROM performance_schema.events_statements_history\n                              WHERE sql_text IS NOT NULL\n                                AND thread_id = in_thread_id\n                              GROUP BY thread_id, nesting_event_id\n                            ) AS s\n                    ON trxi.thread_id = s.thread_id\n                   AND trxi.event_id = s.nesting_event_id\n                 WHERE trxi.thread_id = in_thread_id\n                 GROUP BY trxi.thread_id, trxi.event_id\n                ) trxs\n          GROUP BY thread_id\n    );\n    IF (@old_group_concat_max_len IS NOT NULL) THEN\n        SET SESSION group_concat_max_len = @old_group_concat_max_len;\n    END IF;\n    RETURN v_output;\nEND','NONE'),('sys','create_synonym_db','PROCEDURE','create_synonym_db','SQL','MODIFIES_SQL_DATA','NO','INVOKER','\n        IN in_db_name VARCHAR(64),\n        IN in_synonym VARCHAR(64)\n    ','','BEGIN\n    DECLARE v_done bool DEFAULT FALSE;\n    DECLARE v_db_name_check VARCHAR(64);\n    DECLARE v_db_err_msg TEXT;\n    DECLARE v_table VARCHAR(64);\n    DECLARE v_views_created INT DEFAULT 0;\n    DECLARE v_table_exists ENUM(\'\', \'BASE TABLE\', \'VIEW\', \'TEMPORARY\') DEFAULT \'\';\n    DECLARE v_temp_table TEXT;\n    DECLARE c_table_names CURSOR FOR\n        SELECT TABLE_NAME\n          FROM INFORMATION_SCHEMA.TABLES\n         WHERE TABLE_SCHEMA = in_db_name;\n    DECLARE CONTINUE HANDLER FOR NOT FOUND SET v_done = TRUE;\n    SELECT SCHEMA_NAME INTO v_db_name_check\n      FROM INFORMATION_SCHEMA.SCHEMATA\n     WHERE SCHEMA_NAME = in_db_name;\n    IF v_db_name_check IS NULL THEN\n        SET v_db_err_msg = CONCAT(\'Unknown database \', in_db_name);\n        SIGNAL SQLSTATE \'HY000\'\n            SET MESSAGE_TEXT = v_db_err_msg;\n    END IF;\n    SELECT SCHEMA_NAME INTO v_db_name_check\n      FROM INFORMATION_SCHEMA.SCHEMATA\n     WHERE SCHEMA_NAME = in_synonym;\n    IF v_db_name_check = in_synonym THEN\n        SET v_db_err_msg = CONCAT(\'Can\\\'t create database \', in_synonym, \'; database exists\');\n        SIGNAL SQLSTATE \'HY000\'\n            SET MESSAGE_TEXT = v_db_err_msg;\n    END IF;\n    SET @create_db_stmt := CONCAT(\'CREATE DATABASE \', sys.quote_identifier(in_synonym));\n    PREPARE create_db_stmt FROM @create_db_stmt;\n    EXECUTE create_db_stmt;\n    DEALLOCATE PREPARE create_db_stmt;\n    SET v_done = FALSE;\n    OPEN c_table_names;\n    c_table_names: LOOP\n        FETCH c_table_names INTO v_table;\n        IF v_done THEN\n            LEAVE c_table_names;\n        END IF;\n        CALL sys.table_exists(in_db_name, v_table, v_table_exists);\n        IF (v_table_exists = \'TEMPORARY\') THEN\n            SET v_temp_table =\n            CONCAT(\n                \'Table\',\n                 sys.quote_identifier(in_db_name),\n                 \'.\',\n                 sys.quote_identifier(v_table),\n                 \'shadows base table. View cannot be created! Terminating!\');\n             SIGNAL SQLSTATE \'HY000\'\n                 SET MESSAGE_TEXT = v_temp_table;\n             LEAVE c_table_names;\n        END IF;\n        SET @create_view_stmt = CONCAT(\n            \'CREATE SQL SECURITY INVOKER VIEW \',\n            sys.quote_identifier(in_synonym),\n            \'.\',\n            sys.quote_identifier(v_table),\n            \' AS SELECT * FROM \',\n            sys.quote_identifier(in_db_name),\n            \'.\',\n            sys.quote_identifier(v_table)\n        );\n        PREPARE create_view_stmt FROM @create_view_stmt;\n        EXECUTE create_view_stmt;\n        DEALLOCATE PREPARE create_view_stmt;\n        SET v_views_created = v_views_created + 1;\n    END LOOP;\n    CLOSE c_table_names;\n    SELECT CONCAT(\n        \'Created \', v_views_created, \' view\',\n        IF(v_views_created != 1, \'s\', \'\'), \' in the \',\n        sys.quote_identifier(in_synonym), \' database\'\n    ) AS summary;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Takes a source database name and synonym name, and then creates the\n             synonym database with views that point to all of the tables within\n             the source database.\n             Useful for creating a \"ps\" synonym for \"performance_schema\",\n             or \"is\" instead of \"information_schema\", for example.\n             Parameters\n             in_db_name (VARCHAR(64)):\n               The database name that you would like to create a synonym for.\n             in_synonym (VARCHAR(64)):\n               The database synonym name.\n             Example\n             mysql> SHOW DATABASES;\n             +--------------------+\n             | Database           |\n             +--------------------+\n             | information_schema |\n             | mysql              |\n             | performance_schema |\n             | sys                |\n             | test               |\n             +--------------------+\n             5 rows in set (0.00 sec)\n             mysql> CALL sys.create_synonym_db(\'performance_schema\', \'ps\');\n             +---------------------------------------+\n             | summary                               |\n             +---------------------------------------+\n             | Created 74 views in the `ps` database |\n             +---------------------------------------+\n             1 row in set (8.57 sec)\n             Query OK, 0 rows affected (8.57 sec)\n             mysql> SHOW DATABASES;\n             +--------------------+\n             | Database           |\n             +--------------------+\n             | information_schema |\n             | mysql              |\n             | performance_schema |\n             | ps                 |\n             | sys                |\n             | test               |\n             +--------------------+\n             6 rows in set (0.00 sec)\n             mysql> SHOW FULL TABLES FROM ps;\n             +------------------------------------------------------+------------+\n             | Tables_in_ps                                         | Table_type |\n             +------------------------------------------------------+------------+\n             | accounts                                             | VIEW       |\n             | cond_instances                                       | VIEW       |\n             | events_stages_current                                | VIEW       |\n             | events_stages_history                                | VIEW       |\n             ...\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    DECLARE v_done bool DEFAULT FALSE;\n    DECLARE v_db_name_check VARCHAR(64);\n    DECLARE v_db_err_msg TEXT;\n    DECLARE v_table VARCHAR(64);\n    DECLARE v_views_created INT DEFAULT 0;\n    DECLARE v_table_exists ENUM(\'\', \'BASE TABLE\', \'VIEW\', \'TEMPORARY\') DEFAULT \'\';\n    DECLARE v_temp_table TEXT;\n    DECLARE c_table_names CURSOR FOR\n        SELECT TABLE_NAME\n          FROM INFORMATION_SCHEMA.TABLES\n         WHERE TABLE_SCHEMA = in_db_name;\n    DECLARE CONTINUE HANDLER FOR NOT FOUND SET v_done = TRUE;\n    SELECT SCHEMA_NAME INTO v_db_name_check\n      FROM INFORMATION_SCHEMA.SCHEMATA\n     WHERE SCHEMA_NAME = in_db_name;\n    IF v_db_name_check IS NULL THEN\n        SET v_db_err_msg = CONCAT(\'Unknown database \', in_db_name);\n        SIGNAL SQLSTATE \'HY000\'\n            SET MESSAGE_TEXT = v_db_err_msg;\n    END IF;\n    SELECT SCHEMA_NAME INTO v_db_name_check\n      FROM INFORMATION_SCHEMA.SCHEMATA\n     WHERE SCHEMA_NAME = in_synonym;\n    IF v_db_name_check = in_synonym THEN\n        SET v_db_err_msg = CONCAT(\'Can\'\'t create database \', in_synonym, \'; database exists\');\n        SIGNAL SQLSTATE \'HY000\'\n            SET MESSAGE_TEXT = v_db_err_msg;\n    END IF;\n    SET @create_db_stmt := CONCAT(\'CREATE DATABASE \', sys.quote_identifier(in_synonym));\n    PREPARE create_db_stmt FROM @create_db_stmt;\n    EXECUTE create_db_stmt;\n    DEALLOCATE PREPARE create_db_stmt;\n    SET v_done = FALSE;\n    OPEN c_table_names;\n    c_table_names: LOOP\n        FETCH c_table_names INTO v_table;\n        IF v_done THEN\n            LEAVE c_table_names;\n        END IF;\n        CALL sys.table_exists(in_db_name, v_table, v_table_exists);\n        IF (v_table_exists = \'TEMPORARY\') THEN\n            SET v_temp_table =\n            CONCAT(\n                \'Table\',\n                 sys.quote_identifier(in_db_name),\n                 \'.\',\n                 sys.quote_identifier(v_table),\n                 \'shadows base table. View cannot be created! Terminating!\');\n             SIGNAL SQLSTATE \'HY000\'\n                 SET MESSAGE_TEXT = v_temp_table;\n             LEAVE c_table_names;\n        END IF;\n        SET @create_view_stmt = CONCAT(\n            \'CREATE SQL SECURITY INVOKER VIEW \',\n            sys.quote_identifier(in_synonym),\n            \'.\',\n            sys.quote_identifier(v_table),\n            \' AS SELECT * FROM \',\n            sys.quote_identifier(in_db_name),\n            \'.\',\n            sys.quote_identifier(v_table)\n        );\n        PREPARE create_view_stmt FROM @create_view_stmt;\n        EXECUTE create_view_stmt;\n        DEALLOCATE PREPARE create_view_stmt;\n        SET v_views_created = v_views_created + 1;\n    END LOOP;\n    CLOSE c_table_names;\n    SELECT CONCAT(\n        \'Created \', v_views_created, \' view\',\n        IF(v_views_created != 1, \'s\', \'\'), \' in the \',\n        sys.quote_identifier(in_synonym), \' database\'\n    ) AS summary;\nEND','NONE'),('sys','format_path','FUNCTION','format_path','SQL','NO_SQL','YES','INVOKER','in_path VARCHAR(512)\n    ','varchar(512) CHARSET utf8mb3 COLLATE utf8mb3_general_ci','BEGIN\n  DECLARE v_dir VARCHAR(1024);\n  DECLARE v_path VARCHAR(512);\n  DECLARE path_separator CHAR(1) DEFAULT \'/\';\n  IF @@global.version_compile_os LIKE \'win%\' THEN\n    SET path_separator = \'\\\\\';\n  END IF;\n  IF in_path LIKE \'/private/%\' THEN\n    SET v_path = REPLACE(in_path, \'/private\', \'\');\n  ELSE\n    SET v_path = in_path;\n  END IF;\n  SET v_dir= IFNULL((SELECT VARIABLE_VALUE FROM information_schema.global_variables WHERE VARIABLE_NAME = \'innodb_data_home_dir\'), \'\');\n  IF v_path IS NULL THEN\n    RETURN NULL;\n  END IF;\n  IF v_path LIKE CONCAT(@@global.datadir, IF(SUBSTRING(@@global.datadir, -1) = path_separator, \'%\', CONCAT(path_separator, \'%\'))) ESCAPE \'|\' THEN\n    SET v_path = REPLACE(v_path, @@global.datadir, CONCAT(\'@@datadir\', IF(SUBSTRING(@@global.datadir, -1) = path_separator, path_separator, \'\')));\n    RETURN v_path;\n  END IF;\n  IF v_path LIKE CONCAT(@@global.tmpdir, IF(SUBSTRING(@@global.tmpdir, -1) = path_separator, \'%\', CONCAT(path_separator, \'%\'))) ESCAPE \'|\' THEN\n    SET v_path = REPLACE(v_path, @@global.tmpdir, CONCAT(\'@@tmpdir\', IF(SUBSTRING(@@global.tmpdir, -1) = path_separator, path_separator, \'\')));\n    RETURN v_path;\n  END IF;\n  SET v_dir= IFNULL((SELECT VARIABLE_VALUE FROM information_schema.global_variables WHERE VARIABLE_NAME = \'innodb_data_home_dir\'), \'\');\n  IF v_path LIKE CONCAT(v_dir, IF(SUBSTRING(v_dir, -1) = path_separator, \'%\', CONCAT(path_separator, \'%\'))) ESCAPE \'|\' THEN\n    SET v_path = REPLACE(v_path, v_dir, CONCAT(\'@@innodb_data_home_dir\', IF(SUBSTRING(v_dir, -1) = path_separator, path_separator, \'\')));\n    RETURN v_path;\n  END IF;\n  SET v_dir= IFNULL((SELECT VARIABLE_VALUE FROM information_schema.global_variables WHERE VARIABLE_NAME = \'innodb_log_group_home_dir\'), \'\');\n  IF v_path LIKE CONCAT(v_dir, IF(SUBSTRING(v_dir, -1) = path_separator, \'%\', CONCAT(path_separator, \'%\'))) ESCAPE \'|\' THEN\n    SET v_path = REPLACE(v_path, v_dir, CONCAT(\'@@innodb_log_group_home_dir\', IF(SUBSTRING(v_dir, -1) = path_separator, path_separator, \'\')));\n    RETURN v_path;\n  END IF;\n  SET v_dir= IFNULL((SELECT VARIABLE_VALUE FROM information_schema.global_variables WHERE VARIABLE_NAME = \'slave_load_tmpdir\'), \'\');\n  IF v_path LIKE CONCAT(v_dir, IF(SUBSTRING(v_dir, -1) = path_separator, \'%\', CONCAT(path_separator, \'%\'))) ESCAPE \'|\' THEN\n    SET v_path = REPLACE(v_path, v_dir, CONCAT(\'@@slave_load_tmpdir\', IF(SUBSTRING(v_dir, -1) = path_separator, path_separator, \'\')));\n    RETURN v_path;\n  END IF;\n  SET v_dir = IFNULL((SELECT VARIABLE_VALUE FROM information_schema.global_variables WHERE VARIABLE_NAME = \'innodb_undo_directory\'), \'\');\n  IF v_path LIKE CONCAT(v_dir, IF(SUBSTRING(v_dir, -1) = path_separator, \'%\', CONCAT(path_separator, \'%\'))) ESCAPE \'|\' THEN\n    SET v_path = REPLACE(v_path, v_dir, CONCAT(\'@@innodb_undo_directory\', IF(SUBSTRING(v_dir, -1) = path_separator, path_separator, \'\')));\n    RETURN v_path;\n  END IF;\n  IF v_path LIKE CONCAT(@@global.basedir, IF(SUBSTRING(@@global.basedir, -1) = path_separator, \'%\', CONCAT(path_separator, \'%\'))) ESCAPE \'|\' THEN\n    SET v_path = REPLACE(v_path, @@global.basedir, CONCAT(\'@@basedir\', IF(SUBSTRING(@@global.basedir, -1) = path_separator, path_separator, \'\')));\n    RETURN v_path;\n  END IF;\n  RETURN v_path;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Takes a raw path value, and strips out the datadir or tmpdir\n             replacing with @@datadir and @@tmpdir respectively.\n             Also normalizes the paths across operating systems, so backslashes\n             on Windows are converted to forward slashes\n             Parameters\n             path (VARCHAR(512)):\n               The raw file path value to format.\n             Returns\n             VARCHAR(512) CHARSET UTF8\n             Example\n             mysql> select @@datadir;\n             +-----------------------------------------------+\n             | @@datadir                                     |\n             +-----------------------------------------------+\n             | /Users/mark/sandboxes/SmallTree/AMaster/data/ |\n             +-----------------------------------------------+\n             1 row in set (0.06 sec)\n             mysql> select format_path(\'/Users/mark/sandboxes/SmallTree/AMaster/data/mysql/proc.MYD\') AS path;\n             +--------------------------+\n             | path                     |\n             +--------------------------+\n             | @@datadir/mysql/proc.MYD |\n             +--------------------------+\n             1 row in set (0.03 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n  DECLARE v_dir VARCHAR(1024);\n  DECLARE v_path VARCHAR(512);\n  DECLARE path_separator CHAR(1) DEFAULT \'/\';\n  IF @@global.version_compile_os LIKE \'win%\' THEN\n    SET path_separator = \'\\\';\n  END IF;\n  IF in_path LIKE \'/private/%\' THEN\n    SET v_path = REPLACE(in_path, \'/private\', \'\');\n  ELSE\n    SET v_path = in_path;\n  END IF;\n  SET v_dir= IFNULL((SELECT VARIABLE_VALUE FROM information_schema.global_variables WHERE VARIABLE_NAME = \'innodb_data_home_dir\'), \'\');\n  IF v_path IS NULL THEN\n    RETURN NULL;\n  END IF;\n  IF v_path LIKE CONCAT(@@global.datadir, IF(SUBSTRING(@@global.datadir, -1) = path_separator, \'%\', CONCAT(path_separator, \'%\'))) ESCAPE \'|\' THEN\n    SET v_path = REPLACE(v_path, @@global.datadir, CONCAT(\'@@datadir\', IF(SUBSTRING(@@global.datadir, -1) = path_separator, path_separator, \'\')));\n    RETURN v_path;\n  END IF;\n  IF v_path LIKE CONCAT(@@global.tmpdir, IF(SUBSTRING(@@global.tmpdir, -1) = path_separator, \'%\', CONCAT(path_separator, \'%\'))) ESCAPE \'|\' THEN\n    SET v_path = REPLACE(v_path, @@global.tmpdir, CONCAT(\'@@tmpdir\', IF(SUBSTRING(@@global.tmpdir, -1) = path_separator, path_separator, \'\')));\n    RETURN v_path;\n  END IF;\n  SET v_dir= IFNULL((SELECT VARIABLE_VALUE FROM information_schema.global_variables WHERE VARIABLE_NAME = \'innodb_data_home_dir\'), \'\');\n  IF v_path LIKE CONCAT(v_dir, IF(SUBSTRING(v_dir, -1) = path_separator, \'%\', CONCAT(path_separator, \'%\'))) ESCAPE \'|\' THEN\n    SET v_path = REPLACE(v_path, v_dir, CONCAT(\'@@innodb_data_home_dir\', IF(SUBSTRING(v_dir, -1) = path_separator, path_separator, \'\')));\n    RETURN v_path;\n  END IF;\n  SET v_dir= IFNULL((SELECT VARIABLE_VALUE FROM information_schema.global_variables WHERE VARIABLE_NAME = \'innodb_log_group_home_dir\'), \'\');\n  IF v_path LIKE CONCAT(v_dir, IF(SUBSTRING(v_dir, -1) = path_separator, \'%\', CONCAT(path_separator, \'%\'))) ESCAPE \'|\' THEN\n    SET v_path = REPLACE(v_path, v_dir, CONCAT(\'@@innodb_log_group_home_dir\', IF(SUBSTRING(v_dir, -1) = path_separator, path_separator, \'\')));\n    RETURN v_path;\n  END IF;\n  SET v_dir= IFNULL((SELECT VARIABLE_VALUE FROM information_schema.global_variables WHERE VARIABLE_NAME = \'slave_load_tmpdir\'), \'\');\n  IF v_path LIKE CONCAT(v_dir, IF(SUBSTRING(v_dir, -1) = path_separator, \'%\', CONCAT(path_separator, \'%\'))) ESCAPE \'|\' THEN\n    SET v_path = REPLACE(v_path, v_dir, CONCAT(\'@@slave_load_tmpdir\', IF(SUBSTRING(v_dir, -1) = path_separator, path_separator, \'\')));\n    RETURN v_path;\n  END IF;\n  SET v_dir = IFNULL((SELECT VARIABLE_VALUE FROM information_schema.global_variables WHERE VARIABLE_NAME = \'innodb_undo_directory\'), \'\');\n  IF v_path LIKE CONCAT(v_dir, IF(SUBSTRING(v_dir, -1) = path_separator, \'%\', CONCAT(path_separator, \'%\'))) ESCAPE \'|\' THEN\n    SET v_path = REPLACE(v_path, v_dir, CONCAT(\'@@innodb_undo_directory\', IF(SUBSTRING(v_dir, -1) = path_separator, path_separator, \'\')));\n    RETURN v_path;\n  END IF;\n  IF v_path LIKE CONCAT(@@global.basedir, IF(SUBSTRING(@@global.basedir, -1) = path_separator, \'%\', CONCAT(path_separator, \'%\'))) ESCAPE \'|\' THEN\n    SET v_path = REPLACE(v_path, @@global.basedir, CONCAT(\'@@basedir\', IF(SUBSTRING(@@global.basedir, -1) = path_separator, path_separator, \'\')));\n    RETURN v_path;\n  END IF;\n  RETURN v_path;\nEND','NONE'),('sys','format_statement','FUNCTION','format_statement','SQL','NO_SQL','YES','INVOKER','statement LONGTEXT\n    ','longtext CHARSET utf8mb3 COLLATE utf8mb3_general_ci','BEGIN\n  IF @sys.statement_truncate_len IS NULL THEN\n      SET @sys.statement_truncate_len = sys_get_config(\'statement_truncate_len\', 64);\n  END IF;\n  IF CHAR_LENGTH(statement) > @sys.statement_truncate_len THEN\n      RETURN REPLACE(CONCAT(LEFT(statement, (@sys.statement_truncate_len/2)-2), \' ... \', RIGHT(statement, (@sys.statement_truncate_len/2)-2)), \'\\n\', \' \');\n  ELSE\n      RETURN REPLACE(statement, \'\\n\', \' \');\n  END IF;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Formats a normalized statement, truncating it if it is > 64 characters long by default.\n             To configure the length to truncate the statement to by default, update the `statement_truncate_len`\n             variable with `sys_config` table to a different value. Alternatively, to change it just for just\n             your particular session, use `SET @sys.statement_truncate_len := <some new value>`.\n             Useful for printing statement related data from Performance Schema from\n             the command line.\n             Parameters\n             statement (LONGTEXT):\n               The statement to format.\n             Returns\n             LONGTEXT\n             Example\n             mysql> SELECT sys.format_statement(digest_text)\n                 ->   FROM performance_schema.events_statements_summary_by_digest\n                 ->  ORDER by sum_timer_wait DESC limit 5;\n             +-------------------------------------------------------------------+\n             | sys.format_statement(digest_text)                                 |\n             +-------------------------------------------------------------------+\n             | CREATE SQL SECURITY INVOKER VI ... KE ? AND `variable_value` > ?  |\n             | CREATE SQL SECURITY INVOKER VI ... ait` IS NOT NULL , `esc` . ... |\n             | CREATE SQL SECURITY INVOKER VI ... ait` IS NOT NULL , `sys` . ... |\n             | CREATE SQL SECURITY INVOKER VI ...  , `compressed_size` ) ) DESC  |\n             | CREATE SQL SECURITY INVOKER VI ... LIKE ? ORDER BY `timer_start`  |\n             +-------------------------------------------------------------------+\n             5 rows in set (0.00 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n  IF @sys.statement_truncate_len IS NULL THEN\n      SET @sys.statement_truncate_len = sys_get_config(\'statement_truncate_len\', 64);\n  END IF;\n  IF CHAR_LENGTH(statement) > @sys.statement_truncate_len THEN\n      RETURN REPLACE(CONCAT(LEFT(statement, (@sys.statement_truncate_len/2)-2), \' ... \', RIGHT(statement, (@sys.statement_truncate_len/2)-2)), \'\\n\', \' \');\n  ELSE\n      RETURN REPLACE(statement, \'\\n\', \' \');\n  END IF;\nEND','NONE'),('sys','list_add','FUNCTION','list_add','SQL','CONTAINS_SQL','YES','INVOKER','in_list TEXT,\n        in_add_value TEXT\n    ','text CHARSET utf8mb3 COLLATE utf8mb3_general_ci','BEGIN\n    IF (in_add_value IS NULL) THEN\n        SIGNAL SQLSTATE \'02200\'\n           SET MESSAGE_TEXT = \'Function sys.list_add: in_add_value input variable should not be NULL\',\n               MYSQL_ERRNO = 1138;\n    END IF;\n    IF (in_list IS NULL OR LENGTH(in_list) = 0) THEN\n        RETURN in_add_value;\n    END IF;\n    RETURN (SELECT CONCAT(TRIM(BOTH \',\' FROM TRIM(in_list)), \',\', in_add_value));\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Takes a list, and a value to add to the list, and returns the resulting list.\n             Useful for altering certain session variables, like sql_mode or optimizer_switch for instance.\n             Parameters\n             in_list (TEXT):\n               The comma separated list to add a value to\n             in_add_value (TEXT):\n               The value to add to the input list\n             Returns\n             TEXT\n             Example\n             mysql> select @@sql_mode;\n             +-----------------------------------------------------------------------------------+\n             | @@sql_mode                                                                        |\n             +-----------------------------------------------------------------------------------+\n             | ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |\n             +-----------------------------------------------------------------------------------+\n             1 row in set (0.00 sec)\n             mysql> set sql_mode = sys.list_add(@@sql_mode, \'ANSI_QUOTES\');\n             Query OK, 0 rows affected (0.06 sec)\n             mysql> select @@sql_mode;\n             +-----------------------------------------------------------------------------------------------+\n             | @@sql_mode                                                                                    |\n             +-----------------------------------------------------------------------------------------------+\n             | ANSI_QUOTES,ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |\n             +-----------------------------------------------------------------------------------------------+\n             1 row in set (0.00 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    IF (in_add_value IS NULL) THEN\n        SIGNAL SQLSTATE \'02200\'\n           SET MESSAGE_TEXT = \'Function sys.list_add: in_add_value input variable should not be NULL\',\n               MYSQL_ERRNO = 1138;\n    END IF;\n    IF (in_list IS NULL OR LENGTH(in_list) = 0) THEN\n        RETURN in_add_value;\n    END IF;\n    RETURN (SELECT CONCAT(TRIM(BOTH \',\' FROM TRIM(in_list)), \',\', in_add_value));\nEND','NONE'),('sys','diagnostics','PROCEDURE','diagnostics','SQL','READS_SQL_DATA','NO','INVOKER','\n        IN in_max_runtime int unsigned, IN in_interval int unsigned,\n        IN in_auto_config enum (\'current\', \'medium\', \'full\')\n    ','','BEGIN\n    DECLARE v_start, v_runtime, v_iter_start, v_sleep DECIMAL(20,2) DEFAULT 0.0;\n    DECLARE v_has_innodb, v_has_ndb, v_has_ps, v_has_replication, v_has_ps_replication VARCHAR(8) CHARSET utf8 DEFAULT \'NO\';\n    DECLARE v_this_thread_enabled, v_has_ps_vars, v_has_metrics ENUM(\'YES\', \'NO\');\n    DECLARE v_table_name, v_banner VARCHAR(64) CHARSET utf8;\n    DECLARE v_sql_status_summary_select, v_sql_status_summary_delta, v_sql_status_summary_from, v_no_delta_names TEXT;\n    DECLARE v_output_time, v_output_time_prev DECIMAL(20,3) UNSIGNED;\n    DECLARE v_output_count, v_count, v_old_group_concat_max_len INT UNSIGNED DEFAULT 0;\n    DECLARE v_status_summary_width TINYINT UNSIGNED DEFAULT 50;\n    DECLARE v_done BOOLEAN DEFAULT FALSE;\n    DECLARE c_ndbinfo CURSOR FOR\n        SELECT TABLE_NAME\n          FROM information_schema.TABLES\n         WHERE TABLE_SCHEMA = \'ndbinfo\'\n               AND TABLE_NAME NOT IN (\n                  \'blocks\',\n                  \'config_params\',\n                  \'dict_obj_types\',\n                  \'disk_write_speed_base\',\n                  \'memory_per_fragment\',\n                  \'memoryusage\',\n                  \'operations_per_fragment\',\n                  \'threadblocks\'\n               );\n    DECLARE c_sysviews_w_delta CURSOR FOR\n        SELECT table_name\n          FROM tmp_sys_views_delta\n         ORDER BY table_name;\n    DECLARE CONTINUE HANDLER FOR NOT FOUND SET v_done = TRUE;\n    SELECT INSTRUMENTED INTO v_this_thread_enabled FROM performance_schema.threads WHERE PROCESSLIST_ID = CONNECTION_ID();\n    IF (v_this_thread_enabled = \'YES\') THEN\n        CALL sys.ps_setup_disable_thread(CONNECTION_ID());\n    END IF;\n    IF (in_max_runtime < in_interval) THEN\n        SIGNAL SQLSTATE \'45000\'\n           SET MESSAGE_TEXT = \'in_max_runtime must be greater than or equal to in_interval\';\n    END IF;\n    IF (in_max_runtime = 0) THEN\n        SIGNAL SQLSTATE \'45000\'\n           SET MESSAGE_TEXT = \'in_max_runtime must be greater than 0\';\n    END IF;\n    IF (in_interval = 0) THEN\n        SIGNAL SQLSTATE \'45000\'\n           SET MESSAGE_TEXT = \'in_interval must be greater than 0\';\n    END IF;\n    IF (@sys.diagnostics.allow_i_s_tables IS NULL) THEN\n        SET @sys.diagnostics.allow_i_s_tables = sys.sys_get_config(\'diagnostics.allow_i_s_tables\', \'OFF\');\n    END IF;\n    IF (@sys.diagnostics.include_raw IS NULL) THEN\n        SET @sys.diagnostics.include_raw      = sys.sys_get_config(\'diagnostics.include_raw\'     , \'OFF\');\n    END IF;\n    IF (@sys.debug IS NULL) THEN\n        SET @sys.debug                        = sys.sys_get_config(\'debug\'                       , \'OFF\');\n    END IF;\n    IF (@sys.statement_truncate_len IS NULL) THEN\n        SET @sys.statement_truncate_len       = sys.sys_get_config(\'statement_truncate_len\'      , \'64\' );\n    END IF;\n    SET @log_bin := @@sql_log_bin;\n    IF (@log_bin = 1) THEN\n        SET sql_log_bin = 0;\n    END IF;\n    SET v_no_delta_names = CONCAT(\'s%{COUNT}.Variable_name NOT IN (\',\n        \'\'\'innodb_buffer_pool_pages_total\'\', \',\n        \'\'\'innodb_page_size\'\', \',\n        \'\'\'last_query_cost\'\', \',\n        \'\'\'last_query_partial_plans\'\', \',\n        \'\'\'qcache_total_blocks\'\', \',\n        \'\'\'slave_last_heartbeat\'\', \',\n        \'\'\'ssl_ctx_verify_depth\'\', \',\n        \'\'\'ssl_ctx_verify_mode\'\', \',\n        \'\'\'ssl_session_cache_size\'\', \',\n        \'\'\'ssl_verify_depth\'\', \',\n        \'\'\'ssl_verify_mode\'\', \',\n        \'\'\'ssl_version\'\', \',\n        \'\'\'buffer_flush_lsn_avg_rate\'\', \',\n        \'\'\'buffer_flush_pct_for_dirty\'\', \',\n        \'\'\'buffer_flush_pct_for_lsn\'\', \',\n        \'\'\'buffer_pool_pages_total\'\', \',\n        \'\'\'lock_row_lock_time_avg\'\', \',\n        \'\'\'lock_row_lock_time_max\'\', \',\n        \'\'\'innodb_page_size\'\'\',\n    \')\');\n    IF (in_auto_config <> \'current\') THEN\n        IF (@sys.debug = \'ON\') THEN\n            SELECT CONCAT(\'Updating Performance Schema configuration to \', in_auto_config) AS \'Debug\';\n        END IF;\n        CALL sys.ps_setup_save(0);\n        IF (in_auto_config = \'medium\') THEN\n            UPDATE performance_schema.setup_consumers\n                SET ENABLED = \'YES\'\n            WHERE NAME NOT LIKE \'%\\_history%\';\n            UPDATE performance_schema.setup_instruments\n                SET ENABLED = \'YES\',\n                    TIMED   = \'YES\'\n            WHERE NAME NOT LIKE \'wait/synch/%\';\n        ELSEIF (in_auto_config = \'full\') THEN\n            UPDATE performance_schema.setup_consumers\n                SET ENABLED = \'YES\';\n            UPDATE performance_schema.setup_instruments\n                SET ENABLED = \'YES\',\n                    TIMED   = \'YES\';\n        END IF;\n        UPDATE performance_schema.threads\n           SET INSTRUMENTED = \'YES\'\n         WHERE PROCESSLIST_ID <> CONNECTION_ID();\n    END IF;\n    SET v_start        = UNIX_TIMESTAMP(NOW(2)),\n        in_interval    = IFNULL(in_interval, 30),\n        in_max_runtime = IFNULL(in_max_runtime, 60);\n    SET v_banner = REPEAT(\n                      \'-\',\n                      LEAST(\n                         GREATEST(\n                            36,\n                            CHAR_LENGTH(VERSION()),\n                            CHAR_LENGTH(@@global.version_comment),\n                            CHAR_LENGTH(@@global.version_compile_os),\n                            CHAR_LENGTH(@@global.version_compile_machine),\n                            CHAR_LENGTH(@@global.socket),\n                            CHAR_LENGTH(@@global.datadir)\n                         ),\n                         64\n                      )\n                   );\n    SELECT \'Hostname\' AS \'Name\', @@global.hostname AS \'Value\'\n    UNION ALL\n    SELECT \'Port\' AS \'Name\', @@global.port AS \'Value\'\n    UNION ALL\n    SELECT \'Socket\' AS \'Name\', @@global.socket AS \'Value\'\n    UNION ALL\n    SELECT \'Datadir\' AS \'Name\', @@global.datadir AS \'Value\'\n    UNION ALL\n    SELECT REPEAT(\'-\', 23) AS \'Name\', v_banner AS \'Value\'\n    UNION ALL\n    SELECT \'MySQL Version\' AS \'Name\', VERSION() AS \'Value\'\n    UNION ALL\n    SELECT \'Sys Schema Version\' AS \'Name\', (SELECT sys_version FROM sys.version) AS \'Value\'\n    UNION ALL\n    SELECT \'Version Comment\' AS \'Name\', @@global.version_comment AS \'Value\'\n    UNION ALL\n    SELECT \'Version Compile OS\' AS \'Name\', @@global.version_compile_os AS \'Value\'\n    UNION ALL\n    SELECT \'Version Compile Machine\' AS \'Name\', @@global.version_compile_machine AS \'Value\'\n    UNION ALL\n    SELECT REPEAT(\'-\', 23) AS \'Name\', v_banner AS \'Value\'\n    UNION ALL\n    SELECT \'UTC Time\' AS \'Name\', UTC_TIMESTAMP() AS \'Value\'\n    UNION ALL\n    SELECT \'Local Time\' AS \'Name\', NOW() AS \'Value\'\n    UNION ALL\n    SELECT \'Time Zone\' AS \'Name\', @@global.time_zone AS \'Value\'\n    UNION ALL\n    SELECT \'System Time Zone\' AS \'Name\', @@global.system_time_zone AS \'Value\'\n    UNION ALL\n    SELECT \'Time Zone Offset\' AS \'Name\', TIMEDIFF(NOW(), UTC_TIMESTAMP()) AS \'Value\';\n    SET v_has_innodb         = IFNULL((SELECT SUPPORT FROM information_schema.ENGINES WHERE ENGINE = \'InnoDB\'), \'NO\'),\n        v_has_ndb            = IFNULL((SELECT SUPPORT FROM information_schema.ENGINES WHERE ENGINE = \'NDBCluster\'), \'NO\'),\n        v_has_ps             = IFNULL((SELECT SUPPORT FROM information_schema.ENGINES WHERE ENGINE = \'PERFORMANCE_SCHEMA\'), \'NO\'),\n        v_has_ps_replication = IF(v_has_ps = \'YES\'\n                                   AND EXISTS(SELECT 1 FROM information_schema.TABLES WHERE TABLE_SCHEMA = \'performance_schema\' AND TABLE_NAME = \'replication_applier_status\'),\n                                   \'YES\',\n                                   \'NO\'\n                               ),\n        v_has_replication    = \'MAYBE\',\n        v_has_metrics        = IF(v_has_ps = \'YES\' OR (sys.version_major() = 5 AND sys.version_minor() = 6), \'YES\', \'NO\'),\n        v_has_ps_vars        = \'NO\';\n    \n    \n    IF (@sys.debug = \'ON\') THEN\n       SELECT v_has_innodb AS \'Has_InnoDB\', v_has_ndb AS \'Has_NDBCluster\',\n              v_has_ps AS \'Has_Performance_Schema\', v_has_ps_vars AS \'Has_P_S_SHOW_Variables\',\n              v_has_metrics AS \'Has_metrics\',\n              v_has_ps_replication \'AS Has_P_S_Replication\', v_has_replication AS \'Has_Replication\';\n    END IF;\n    IF (v_has_innodb IN (\'DEFAULT\', \'YES\')) THEN\n        SET @sys.diagnostics.sql = \'SHOW ENGINE InnoDB STATUS\';\n        PREPARE stmt_innodb_status FROM @sys.diagnostics.sql;\n    END IF;\n    IF (v_has_ps = \'YES\') THEN\n        SET @sys.diagnostics.sql = \'SHOW ENGINE PERFORMANCE_SCHEMA STATUS\';\n        PREPARE stmt_ps_status FROM @sys.diagnostics.sql;\n    END IF;\n    IF (v_has_ndb IN (\'DEFAULT\', \'YES\')) THEN\n        SET @sys.diagnostics.sql = \'SHOW ENGINE NDBCLUSTER STATUS\';\n        PREPARE stmt_ndbcluster_status FROM @sys.diagnostics.sql;\n    END IF;\n    SET @sys.diagnostics.sql_gen_query_template = \'SELECT CONCAT(\n           \'\'SELECT \'\',\n           GROUP_CONCAT(\n               CASE WHEN (SUBSTRING(TABLE_NAME, 3), COLUMN_NAME) IN (\n                                (\'\'io_global_by_file_by_bytes\'\', \'\'total\'\'),\n                                (\'\'io_global_by_wait_by_bytes\'\', \'\'total_requested\'\')\n                         )\n                         THEN CONCAT(\'\'sys.format_bytes(\'\', COLUMN_NAME, \'\') AS \'\', COLUMN_NAME)\n                    WHEN SUBSTRING(COLUMN_NAME, -8) = \'\'_latency\'\'\n                         THEN CONCAT(\'\'sys.format_time(\'\', COLUMN_NAME, \'\') AS \'\', COLUMN_NAME)\n                    WHEN SUBSTRING(COLUMN_NAME, -7) = \'\'_memory\'\' OR SUBSTRING(COLUMN_NAME, -17) = \'\'_memory_allocated\'\'\n                         OR ((SUBSTRING(COLUMN_NAME, -5) = \'\'_read\'\' OR SUBSTRING(COLUMN_NAME, -8) = \'\'_written\'\' OR SUBSTRING(COLUMN_NAME, -6) = \'\'_write\'\') AND SUBSTRING(COLUMN_NAME, 1, 6) <> \'\'COUNT_\'\')\n                         THEN CONCAT(\'\'sys.format_bytes(\'\', COLUMN_NAME, \'\') AS \'\', COLUMN_NAME)\n                    ELSE COLUMN_NAME\n               END\n               ORDER BY ORDINAL_POSITION\n               SEPARATOR \'\',\\n       \'\'\n           ),\n           \'\'\\n  FROM tmp_\'\', SUBSTRING(TABLE_NAME FROM 3), \'\'_%{OUTPUT}\'\'\n       ) AS Query INTO @sys.diagnostics.sql_select\n  FROM information_schema.COLUMNS\n WHERE TABLE_SCHEMA = \'\'sys\'\' AND TABLE_NAME = ?\n GROUP BY TABLE_NAME\';\n    SET @sys.diagnostics.sql_gen_query_delta = \'SELECT CONCAT(\n           \'\'SELECT \'\',\n           GROUP_CONCAT(\n               CASE WHEN FIND_IN_SET(COLUMN_NAME, diag.pk)\n                         THEN COLUMN_NAME\n                    WHEN diag.TABLE_NAME = \'\'io_global_by_file_by_bytes\'\' AND COLUMN_NAME = \'\'write_pct\'\'\n                         THEN CONCAT(\'\'IFNULL(ROUND(100-(((e.total_read-IFNULL(s.total_read, 0))\'\',\n                                     \'\'/NULLIF(((e.total_read-IFNULL(s.total_read, 0))+(e.total_written-IFNULL(s.total_written, 0))), 0))*100), 2), 0.00) AS \'\',\n                                     COLUMN_NAME)\n                    WHEN (diag.TABLE_NAME, COLUMN_NAME) IN (\n                                (\'\'io_global_by_file_by_bytes\'\', \'\'total\'\'),\n                                (\'\'io_global_by_wait_by_bytes\'\', \'\'total_requested\'\')\n                         )\n                         THEN CONCAT(\'\'sys.format_bytes(e.\'\', COLUMN_NAME, \'\'-IFNULL(s.\'\', COLUMN_NAME, \'\', 0)) AS \'\', COLUMN_NAME)\n                    WHEN SUBSTRING(COLUMN_NAME, 1, 4) IN (\'\'max_\'\', \'\'min_\'\') AND SUBSTRING(COLUMN_NAME, -8) = \'\'_latency\'\'\n                         THEN CONCAT(\'\'sys.format_time(e.\'\', COLUMN_NAME, \'\') AS \'\', COLUMN_NAME)\n                    WHEN COLUMN_NAME = \'\'avg_latency\'\'\n                         THEN CONCAT(\'\'sys.format_time((e.total_latency - IFNULL(s.total_latency, 0))\'\',\n                                     \'\'/NULLIF(e.total - IFNULL(s.total, 0), 0)) AS \'\', COLUMN_NAME)\n                    WHEN SUBSTRING(COLUMN_NAME, -12) = \'\'_avg_latency\'\'\n                         THEN CONCAT(\'\'sys.format_time((e.\'\', SUBSTRING(COLUMN_NAME FROM 1 FOR CHAR_LENGTH(COLUMN_NAME)-12), \'\'_latency - IFNULL(s.\'\', SUBSTRING(COLUMN_NAME FROM 1 FOR CHAR_LENGTH(COLUMN_NAME)-12), \'\'_latency, 0))\'\',\n                                     \'\'/NULLIF(e.\'\', SUBSTRING(COLUMN_NAME FROM 1 FOR CHAR_LENGTH(COLUMN_NAME)-12), \'\'s - IFNULL(s.\'\', SUBSTRING(COLUMN_NAME FROM 1 FOR CHAR_LENGTH(COLUMN_NAME)-12), \'\'s, 0), 0)) AS \'\', COLUMN_NAME)\n                    WHEN SUBSTRING(COLUMN_NAME, -8) = \'\'_latency\'\'\n                         THEN CONCAT(\'\'sys.format_time(e.\'\', COLUMN_NAME, \'\' - IFNULL(s.\'\', COLUMN_NAME, \'\', 0)) AS \'\', COLUMN_NAME)\n                    WHEN COLUMN_NAME IN (\'\'avg_read\'\', \'\'avg_write\'\', \'\'avg_written\'\')\n                         THEN CONCAT(\'\'sys.format_bytes(IFNULL((e.total_\'\', IF(COLUMN_NAME = \'\'avg_read\'\', \'\'read\'\', \'\'written\'\'), \'\'-IFNULL(s.total_\'\', IF(COLUMN_NAME = \'\'avg_read\'\', \'\'read\'\', \'\'written\'\'), \'\', 0))\'\',\n                                     \'\'/NULLIF(e.count_\'\', IF(COLUMN_NAME = \'\'avg_read\'\', \'\'read\'\', \'\'write\'\'), \'\'-IFNULL(s.count_\'\', IF(COLUMN_NAME = \'\'avg_read\'\', \'\'read\'\', \'\'write\'\'), \'\', 0), 0), 0)) AS \'\',\n                                     COLUMN_NAME)\n                    WHEN SUBSTRING(COLUMN_NAME, -7) = \'\'_memory\'\' OR SUBSTRING(COLUMN_NAME, -17) = \'\'_memory_allocated\'\'\n                         OR ((SUBSTRING(COLUMN_NAME, -5) = \'\'_read\'\' OR SUBSTRING(COLUMN_NAME, -8) = \'\'_written\'\' OR SUBSTRING(COLUMN_NAME, -6) = \'\'_write\'\') AND SUBSTRING(COLUMN_NAME, 1, 6) <> \'\'COUNT_\'\')\n                         THEN CONCAT(\'\'sys.format_bytes(e.\'\', COLUMN_NAME, \'\' - IFNULL(s.\'\', COLUMN_NAME, \'\', 0)) AS \'\', COLUMN_NAME)\n                    ELSE CONCAT(\'\'(e.\'\', COLUMN_NAME, \'\' - IFNULL(s.\'\', COLUMN_NAME, \'\', 0)) AS \'\', COLUMN_NAME)\n               END\n               ORDER BY ORDINAL_POSITION\n               SEPARATOR \'\',\\n       \'\'\n           ),\n           \'\'\\n  FROM tmp_\'\', diag.TABLE_NAME, \'\'_end e\n       LEFT OUTER JOIN tmp_\'\', diag.TABLE_NAME, \'\'_start s USING (\'\', diag.pk, \'\')\'\'\n       ) AS Query INTO @sys.diagnostics.sql_select\n  FROM tmp_sys_views_delta diag\n       INNER JOIN information_schema.COLUMNS c ON c.TABLE_NAME = CONCAT(\'\'x$\'\', diag.TABLE_NAME)\n WHERE c.TABLE_SCHEMA = \'\'sys\'\' AND diag.TABLE_NAME = ?\n GROUP BY diag.TABLE_NAME\';\n    IF (v_has_ps = \'YES\') THEN\n        DROP TEMPORARY TABLE IF EXISTS tmp_sys_views_delta;\n        CREATE TEMPORARY TABLE tmp_sys_views_delta (\n            TABLE_NAME varchar(64) NOT NULL,\n            order_by text COMMENT \'ORDER BY clause for the initial and overall views\',\n            order_by_delta text COMMENT \'ORDER BY clause for the delta views\',\n            where_delta text COMMENT \'WHERE clause to use for delta views to only include rows with a \"count\" > 0\',\n            limit_rows int unsigned COMMENT \'The maximum number of rows to include for the view\',\n            pk varchar(128) COMMENT \'Used with the FIND_IN_SET() function so use comma separated list without whitespace\',\n            PRIMARY KEY (TABLE_NAME)\n        );\n        IF (@sys.debug = \'ON\') THEN\n            SELECT \'Populating tmp_sys_views_delta\' AS \'Debug\';\n        END IF;\n        INSERT INTO tmp_sys_views_delta\n        VALUES (\'host_summary\'                       , \'%{TABLE}.statement_latency DESC\',\n                                                       \'(e.statement_latency-IFNULL(s.statement_latency, 0)) DESC\',\n                                                       \'(e.statements - IFNULL(s.statements, 0)) > 0\', NULL, \'host\'),\n               (\'host_summary_by_file_io\'            , \'%{TABLE}.io_latency DESC\',\n                                                       \'(e.io_latency-IFNULL(s.io_latency, 0)) DESC\',\n                                                       \'(e.ios - IFNULL(s.ios, 0)) > 0\', NULL, \'host\'),\n               (\'host_summary_by_file_io_type\'       , \'%{TABLE}.host, %{TABLE}.total_latency DESC\',\n                                                       \'e.host, (e.total_latency-IFNULL(s.total_latency, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'host,event_name\'),\n               (\'host_summary_by_stages\'             , \'%{TABLE}.host, %{TABLE}.total_latency DESC\',\n                                                       \'e.host, (e.total_latency-IFNULL(s.total_latency, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'host,event_name\'),\n               (\'host_summary_by_statement_latency\'  , \'%{TABLE}.total_latency DESC\',\n                                                       \'(e.total_latency-IFNULL(s.total_latency, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'host\'),\n               (\'host_summary_by_statement_type\'     , \'%{TABLE}.host, %{TABLE}.total_latency DESC\',\n                                                       \'e.host, (e.total_latency-IFNULL(s.total_latency, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'host,statement\'),\n               (\'io_by_thread_by_latency\'            , \'%{TABLE}.total_latency DESC\',\n                                                       \'(e.total_latency-IFNULL(s.total_latency, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'user,thread_id,processlist_id\'),\n               (\'io_global_by_file_by_bytes\'         , \'%{TABLE}.total DESC\',\n                                                       \'(e.total-IFNULL(s.total, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', 100, \'file\'),\n               (\'io_global_by_file_by_latency\'       , \'%{TABLE}.total_latency DESC\',\n                                                       \'(e.total_latency-IFNULL(s.total_latency, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', 100, \'file\'),\n               (\'io_global_by_wait_by_bytes\'         , \'%{TABLE}.total_requested DESC\',\n                                                       \'(e.total_requested-IFNULL(s.total_requested, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'event_name\'),\n               (\'io_global_by_wait_by_latency\'       , \'%{TABLE}.total_latency DESC\',\n                                                       \'(e.total_latency-IFNULL(s.total_latency, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'event_name\'),\n               (\'schema_index_statistics\'            , \'(%{TABLE}.select_latency+%{TABLE}.insert_latency+%{TABLE}.update_latency+%{TABLE}.delete_latency) DESC\',\n                                                       \'((e.select_latency+e.insert_latency+e.update_latency+e.delete_latency)-IFNULL(s.select_latency+s.insert_latency+s.update_latency+s.delete_latency, 0)) DESC\',\n                                                       \'((e.rows_selected+e.insert_latency+e.rows_updated+e.rows_deleted)-IFNULL(s.rows_selected+s.rows_inserted+s.rows_updated+s.rows_deleted, 0)) > 0\',\n                                                       100, \'table_schema,table_name,index_name\'),\n               (\'schema_table_statistics\'            , \'%{TABLE}.total_latency DESC\',\n                                                       \'(e.total_latency-IFNULL(s.total_latency, 0)) DESC\',\n                                                       \'(e.total_latency-IFNULL(s.total_latency, 0)) > 0\', 100, \'table_schema,table_name\'),\n               (\'schema_tables_with_full_table_scans\', \'%{TABLE}.rows_full_scanned DESC\',\n                                                       \'(e.rows_full_scanned-IFNULL(s.rows_full_scanned, 0)) DESC\',\n                                                       \'(e.rows_full_scanned-IFNULL(s.rows_full_scanned, 0)) > 0\', 100, \'object_schema,object_name\'),\n               (\'user_summary\'                       , \'%{TABLE}.statement_latency DESC\',\n                                                       \'(e.statement_latency-IFNULL(s.statement_latency, 0)) DESC\',\n                                                       \'(e.statements - IFNULL(s.statements, 0)) > 0\', NULL, \'user\'),\n               (\'user_summary_by_file_io\'            , \'%{TABLE}.io_latency DESC\',\n                                                       \'(e.io_latency-IFNULL(s.io_latency, 0)) DESC\',\n                                                       \'(e.ios - IFNULL(s.ios, 0)) > 0\', NULL, \'user\'),\n               (\'user_summary_by_file_io_type\'       , \'%{TABLE}.user, %{TABLE}.latency DESC\',\n                                                       \'e.user, (e.latency-IFNULL(s.latency, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'user,event_name\'),\n               (\'user_summary_by_stages\'             , \'%{TABLE}.user, %{TABLE}.total_latency DESC\',\n                                                       \'e.user, (e.total_latency-IFNULL(s.total_latency, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'user,event_name\'),\n               (\'user_summary_by_statement_latency\'  , \'%{TABLE}.total_latency DESC\',\n                                                       \'(e.total_latency-IFNULL(s.total_latency, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'user\'),\n               (\'user_summary_by_statement_type\'     , \'%{TABLE}.user, %{TABLE}.total_latency DESC\',\n                                                       \'e.user, (e.total_latency-IFNULL(s.total_latency, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'user,statement\'),\n               (\'wait_classes_global_by_avg_latency\' , \'IFNULL(%{TABLE}.total_latency / NULLIF(%{TABLE}.total, 0), 0) DESC\',\n                                                       \'IFNULL((e.total_latency-IFNULL(s.total_latency, 0)) / NULLIF((e.total - IFNULL(s.total, 0)), 0), 0) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'event_class\'),\n               (\'wait_classes_global_by_latency\'     , \'%{TABLE}.total_latency DESC\',\n                                                       \'(e.total_latency-IFNULL(s.total_latency, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'event_class\'),\n               (\'waits_by_host_by_latency\'           , \'%{TABLE}.host, %{TABLE}.total_latency DESC\',\n                                                       \'e.host, (e.total_latency-IFNULL(s.total_latency, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'host,event\'),\n               (\'waits_by_user_by_latency\'           , \'%{TABLE}.user, %{TABLE}.total_latency DESC\',\n                                                       \'e.user, (e.total_latency-IFNULL(s.total_latency, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'user,event\'),\n               (\'waits_global_by_latency\'            , \'%{TABLE}.total_latency DESC\',\n                                                       \'(e.total_latency-IFNULL(s.total_latency, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'events\')\n        ;\n    END IF;\n    SELECT \'\n=======================\n     Configuration\n=======================\n\' AS \'\';\n    SELECT \'GLOBAL VARIABLES\' AS \'The following output is:\';\n    IF (v_has_ps_vars = \'YES\') THEN\n        SELECT LOWER(VARIABLE_NAME) AS Variable_name, VARIABLE_VALUE AS Variable_value FROM performance_schema.global_variables ORDER BY VARIABLE_NAME;\n    ELSE\n        SELECT LOWER(VARIABLE_NAME) AS Variable_name, VARIABLE_VALUE AS Variable_value FROM information_schema.GLOBAL_VARIABLES ORDER BY VARIABLE_NAME;\n    END IF;\n    IF (v_has_ps = \'YES\') THEN\n        SELECT \'Performance Schema Setup - Actors\' AS \'The following output is:\';\n        SELECT * FROM performance_schema.setup_actors;\n        SELECT \'Performance Schema Setup - Consumers\' AS \'The following output is:\';\n        SELECT NAME AS Consumer, ENABLED, sys.ps_is_consumer_enabled(NAME) AS COLLECTS\n          FROM performance_schema.setup_consumers;\n        SELECT \'Performance Schema Setup - Instruments\' AS \'The following output is:\';\n        SELECT SUBSTRING_INDEX(NAME, \'/\', 2) AS \'InstrumentClass\',\n               ROUND(100*SUM(IF(ENABLED = \'YES\', 1, 0))/COUNT(*), 2) AS \'EnabledPct\',\n               ROUND(100*SUM(IF(TIMED = \'YES\', 1, 0))/COUNT(*), 2) AS \'TimedPct\'\n          FROM performance_schema.setup_instruments\n         GROUP BY SUBSTRING_INDEX(NAME, \'/\', 2)\n         ORDER BY SUBSTRING_INDEX(NAME, \'/\', 2);\n        SELECT \'Performance Schema Setup - Objects\' AS \'The following output is:\';\n        SELECT * FROM performance_schema.setup_objects;\n        SELECT \'Performance Schema Setup - Threads\' AS \'The following output is:\';\n        SELECT `TYPE` AS ThreadType, COUNT(*) AS \'Total\', ROUND(100*SUM(IF(INSTRUMENTED = \'YES\', 1, 0))/COUNT(*), 2) AS \'InstrumentedPct\'\n          FROM performance_schema.threads\n        GROUP BY TYPE;\n    END IF;\n    IF (v_has_replication = \'NO\') THEN\n        SELECT \'No Replication Configured\' AS \'Replication Status\';\n    ELSE\n        SELECT CONCAT(\'Replication Configured: \', v_has_replication, \' - Performance Schema Replication Tables: \', v_has_ps_replication) AS \'Replication Status\';\n        IF (v_has_ps_replication = \'YES\') THEN\n            SELECT \'Replication - Connection Configuration\' AS \'The following output is:\';\n            SELECT * FROM performance_schema.replication_connection_configuration;\n        END IF;\n        IF (v_has_ps_replication = \'YES\') THEN\n            SELECT \'Replication - Applier Configuration\' AS \'The following output is:\';\n            SELECT * FROM performance_schema.replication_applier_configuration ORDER BY CHANNEL_NAME;\n        END IF;\n    END IF;\n    IF (v_has_ndb IN (\'DEFAULT\', \'YES\')) THEN\n       SELECT \'Cluster Thread Blocks\' AS \'The following output is:\';\n       SELECT * FROM ndbinfo.threadblocks;\n    END IF;\n    IF (v_has_ps = \'YES\') THEN\n        IF (@sys.diagnostics.include_raw = \'ON\') THEN\n            SELECT \'\n========================\n     Initial Status\n========================\n\' AS \'\';\n        END IF;\n        DROP TEMPORARY TABLE IF EXISTS tmp_digests_start;\n        CALL sys.statement_performance_analyzer(\'create_tmp\', \'tmp_digests_start\', NULL);\n        CALL sys.statement_performance_analyzer(\'snapshot\', NULL, NULL);\n        CALL sys.statement_performance_analyzer(\'save\', \'tmp_digests_start\', NULL);\n        IF (@sys.diagnostics.include_raw = \'ON\') THEN\n            SET @sys.diagnostics.sql = REPLACE(@sys.diagnostics.sql_gen_query_template, \'%{OUTPUT}\', \'start\');\n            IF (@sys.debug = \'ON\') THEN\n                SELECT \'The following query will be used to generate the query for each sys view\' AS \'Debug\';\n                SELECT @sys.diagnostics.sql AS \'Debug\';\n            END IF;\n            PREPARE stmt_gen_query FROM @sys.diagnostics.sql;\n        END IF;\n        SET v_done = FALSE;\n        OPEN c_sysviews_w_delta;\n        c_sysviews_w_delta_loop: LOOP\n            FETCH c_sysviews_w_delta INTO v_table_name;\n            IF v_done THEN\n                LEAVE c_sysviews_w_delta_loop;\n            END IF;\n            IF (@sys.debug = \'ON\') THEN\n                SELECT CONCAT(\'The following queries are for storing the initial content of \', v_table_name) AS \'Debug\';\n            END IF;\n            CALL sys.execute_prepared_stmt(CONCAT(\'DROP TEMPORARY TABLE IF EXISTS `tmp_\', v_table_name, \'_start`\'));\n            CALL sys.execute_prepared_stmt(CONCAT(\'CREATE TEMPORARY TABLE `tmp_\', v_table_name, \'_start` SELECT * FROM `sys`.`x$\', v_table_name, \'`\'));\n            IF (@sys.diagnostics.include_raw = \'ON\') THEN\n                SET @sys.diagnostics.table_name = CONCAT(\'x$\', v_table_name);\n                EXECUTE stmt_gen_query USING @sys.diagnostics.table_name;\n                SELECT CONCAT(@sys.diagnostics.sql_select,\n                              IF(order_by IS NOT NULL, CONCAT(\'\\n ORDER BY \', REPLACE(order_by, \'%{TABLE}\', CONCAT(\'tmp_\', v_table_name, \'_start\'))), \'\'),\n                              IF(limit_rows IS NOT NULL, CONCAT(\'\\n LIMIT \', limit_rows), \'\')\n                       )\n                  INTO @sys.diagnostics.sql_select\n                  FROM tmp_sys_views_delta\n                 WHERE TABLE_NAME = v_table_name;\n                SELECT CONCAT(\'Initial \', v_table_name) AS \'The following output is:\';\n                CALL sys.execute_prepared_stmt(@sys.diagnostics.sql_select);\n            END IF;\n        END LOOP;\n        CLOSE c_sysviews_w_delta;\n        IF (@sys.diagnostics.include_raw = \'ON\') THEN\n            DEALLOCATE PREPARE stmt_gen_query;\n        END IF;\n    END IF;\n    SET v_sql_status_summary_select = \'SELECT Variable_name\',\n        v_sql_status_summary_delta  = \'\',\n        v_sql_status_summary_from   = \'\';\n    REPEAT\n        SET v_output_count = v_output_count + 1;\n        IF (v_output_count > 1) THEN\n            SET v_sleep = in_interval-(UNIX_TIMESTAMP(NOW(2))-v_iter_start);\n            SELECT NOW() AS \'Time\', CONCAT(\'Going to sleep for \', v_sleep, \' seconds. Please do not interrupt\') AS \'The following output is:\';\n            DO SLEEP(in_interval);\n        END IF;\n        SET v_iter_start = UNIX_TIMESTAMP(NOW(2));\n        SELECT NOW(), CONCAT(\'Iteration Number \', IFNULL(v_output_count, \'NULL\')) AS \'The following output is:\';\n        IF (@@log_bin = 1) THEN\n            SELECT \'SHOW MASTER STATUS\' AS \'The following output is:\';\n            SHOW MASTER STATUS;\n        END IF;\n        IF (v_has_replication <> \'NO\') THEN\n            SELECT \'SHOW SLAVE STATUS\' AS \'The following output is:\';\n            SHOW SLAVE STATUS;\n        END IF;\n        SET v_table_name = CONCAT(\'tmp_metrics_\', v_output_count);\n        CALL sys.execute_prepared_stmt(CONCAT(\'DROP TEMPORARY TABLE IF EXISTS \', v_table_name));\n        CALL sys.execute_prepared_stmt(CONCAT(\'CREATE TEMPORARY TABLE \', v_table_name, \' (\n  Variable_name VARCHAR(193) NOT NULL,\n  Variable_value VARCHAR(1024),\n  Type VARCHAR(100) NOT NULL,\n  Enabled ENUM(\'\'YES\'\', \'\'NO\'\', \'\'PARTIAL\'\') NOT NULL,\n  PRIMARY KEY (Type, Variable_name)\n) ENGINE = InnoDB DEFAULT CHARSET=utf8\'));\n        IF (v_has_metrics) THEN\n            SET @sys.diagnostics.sql = CONCAT(\n                \'INSERT INTO \', v_table_name,\n                \' SELECT Variable_name, REPLACE(Variable_value, \'\'\\n\'\', \'\'\\\\\\\\n\'\') AS Variable_value, Type, Enabled FROM sys.metrics\'\n            );\n        ELSE\n            SET @sys.diagnostics.sql = CONCAT(\n                \'INSERT INTO \', v_table_name,\n                \'(SELECT LOWER(VARIABLE_NAME) AS Variable_name, REPLACE(VARIABLE_VALUE, \'\'\\n\'\', \'\'\\\\\\\\n\'\') AS Variable_value,\n                         \'\'Global Status\'\' AS Type, \'\'YES\'\' AS Enabled\n  FROM performance_schema.global_status\n) UNION ALL (\nSELECT NAME AS Variable_name, COUNT AS Variable_value,\n       CONCAT(\'\'InnoDB Metrics - \'\', SUBSYSTEM) AS Type,\n       IF(STATUS = \'\'enabled\'\', \'\'YES\'\', \'\'NO\'\') AS Enabled\n  FROM information_schema.INNODB_METRICS\n WHERE NAME NOT IN (\n     \'\'lock_row_lock_time\'\', \'\'lock_row_lock_time_avg\'\', \'\'lock_row_lock_time_max\'\', \'\'lock_row_lock_waits\'\',\n     \'\'buffer_pool_reads\'\', \'\'buffer_pool_read_requests\'\', \'\'buffer_pool_write_requests\'\', \'\'buffer_pool_wait_free\'\',\n     \'\'buffer_pool_read_ahead\'\', \'\'buffer_pool_read_ahead_evicted\'\', \'\'buffer_pool_pages_total\'\', \'\'buffer_pool_pages_misc\'\',\n     \'\'buffer_pool_pages_data\'\', \'\'buffer_pool_bytes_data\'\', \'\'buffer_pool_pages_dirty\'\', \'\'buffer_pool_bytes_dirty\'\',\n     \'\'buffer_pool_pages_free\'\', \'\'buffer_pages_created\'\', \'\'buffer_pages_written\'\', \'\'buffer_pages_read\'\',\n     \'\'buffer_data_reads\'\', \'\'buffer_data_written\'\', \'\'file_num_open_files\'\',\n     \'\'os_log_bytes_written\'\', \'\'os_log_fsyncs\'\', \'\'os_log_pending_fsyncs\'\', \'\'os_log_pending_writes\'\',\n     \'\'log_waits\'\', \'\'log_write_requests\'\', \'\'log_writes\'\', \'\'innodb_dblwr_writes\'\', \'\'innodb_dblwr_pages_written\'\', \'\'innodb_page_size\'\')\n) UNION ALL (\nSELECT \'\'NOW()\'\' AS Variable_name, NOW(3) AS Variable_value, \'\'System Time\'\' AS Type, \'\'YES\'\' AS Enabled\n) UNION ALL (\nSELECT \'\'UNIX_TIMESTAMP()\'\' AS Variable_name, ROUND(UNIX_TIMESTAMP(NOW(3)), 3) AS Variable_value, \'\'System Time\'\' AS Type, \'\'YES\'\' AS Enabled\n)\n ORDER BY Type, Variable_name;\'\n            );\n        END IF;\n        CALL sys.execute_prepared_stmt(@sys.diagnostics.sql);\n        CALL sys.execute_prepared_stmt(\n            CONCAT(\'SELECT Variable_value INTO @sys.diagnostics.output_time FROM \', v_table_name, \' WHERE Type = \'\'System Time\'\' AND Variable_name = \'\'UNIX_TIMESTAMP()\'\'\')\n        );\n        SET v_output_time = @sys.diagnostics.output_time;\n        SET v_sql_status_summary_select = CONCAT(v_sql_status_summary_select, \',\n       CONCAT(\n           LEFT(s\', v_output_count, \'.Variable_value, \', v_status_summary_width, \'),\n           IF(\', REPLACE(v_no_delta_names, \'%{COUNT}\', v_output_count), \' AND s\', v_output_count, \'.Variable_value REGEXP \'\'^[0-9]+(\\\\\\\\.[0-9]+)?$\'\', CONCAT(\'\' (\'\', ROUND(s\', v_output_count, \'.Variable_value/\', v_output_time, \', 2), \'\'/sec)\'\'), \'\'\'\')\n       ) AS \'\'Output \', v_output_count, \'\'\'\'),\n            v_sql_status_summary_from   = CONCAT(v_sql_status_summary_from, \'\n\',\n                                                    IF(v_output_count = 1, \'  FROM \', \'       INNER JOIN \'),\n                                                    v_table_name, \' s\', v_output_count,\n                                                    IF (v_output_count = 1, \'\', \' USING (Type, Variable_name)\'));\n        IF (v_output_count > 1) THEN\n            SET v_sql_status_summary_delta  = CONCAT(v_sql_status_summary_delta, \',\n       IF(\', REPLACE(v_no_delta_names, \'%{COUNT}\', v_output_count), \' AND s\', (v_output_count-1), \'.Variable_value REGEXP \'\'^[0-9]+(\\\\\\\\.[0-9]+)?$\'\' AND s\', v_output_count, \'.Variable_value REGEXP \'\'^[0-9]+(\\\\\\\\.[0-9]+)?$\'\',\n          CONCAT(IF(s\', (v_output_count-1), \'.Variable_value REGEXP \'\'^[0-9]+\\\\\\\\.[0-9]+$\'\' OR s\', v_output_count, \'.Variable_value REGEXP \'\'^[0-9]+\\\\\\\\.[0-9]+$\'\',\n                    ROUND((s\', v_output_count, \'.Variable_value-s\', (v_output_count-1), \'.Variable_value), 2),\n                    (s\', v_output_count, \'.Variable_value-s\', (v_output_count-1), \'.Variable_value)\n                   ),\n                 \'\' (\'\', ROUND((s\', v_output_count, \'.Variable_value-s\', (v_output_count-1), \'.Variable_value)/(\', v_output_time, \'-\', v_output_time_prev, \'), 2), \'\'/sec)\'\'\n          ),\n          \'\'\'\'\n       ) AS \'\'Delta (\', (v_output_count-1), \' -> \', v_output_count, \')\'\'\');\n        END IF;\n        SET v_output_time_prev = v_output_time;\n        IF (@sys.diagnostics.include_raw = \'ON\') THEN\n            IF (v_has_metrics) THEN\n                SELECT \'SELECT * FROM sys.metrics\' AS \'The following output is:\';\n            ELSE\n                SELECT \'sys.metrics equivalent\' AS \'The following output is:\';\n            END IF;\n            CALL sys.execute_prepared_stmt(CONCAT(\'SELECT Type, Variable_name, Enabled, Variable_value FROM \', v_table_name, \' ORDER BY Type, Variable_name\'));\n        END IF;\n        IF (v_has_innodb IN (\'DEFAULT\', \'YES\')) THEN\n            SELECT \'SHOW ENGINE INNODB STATUS\' AS \'The following output is:\';\n            EXECUTE stmt_innodb_status;\n            SELECT \'InnoDB - Transactions\' AS \'The following output is:\';\n            SELECT * FROM information_schema.INNODB_TRX;\n        END IF;\n        IF (v_has_ndb IN (\'DEFAULT\', \'YES\')) THEN\n            SELECT \'SHOW ENGINE NDBCLUSTER STATUS\' AS \'The following output is:\';\n            EXECUTE stmt_ndbcluster_status;\n            SELECT \'ndbinfo.memoryusage\' AS \'The following output is:\';\n            SELECT node_id, memory_type, sys.format_bytes(used) AS used, used_pages, sys.format_bytes(total) AS total, total_pages,\n                   ROUND(100*(used/total), 2) AS \'Used %\'\n            FROM ndbinfo.memoryusage;\n            SET v_done = FALSE;\n            OPEN c_ndbinfo;\n            c_ndbinfo_loop: LOOP\n                FETCH c_ndbinfo INTO v_table_name;\n                IF v_done THEN\n                LEAVE c_ndbinfo_loop;\n                END IF;\n                SELECT CONCAT(\'SELECT * FROM ndbinfo.\', v_table_name) AS \'The following output is:\';\n                CALL sys.execute_prepared_stmt(CONCAT(\'SELECT * FROM `ndbinfo`.`\', v_table_name, \'`\'));\n            END LOOP;\n            CLOSE c_ndbinfo;\n            SELECT * FROM information_schema.FILES;\n        END IF;\n        SELECT \'SELECT * FROM sys.processlist\' AS \'The following output is:\';\n        SELECT processlist.* FROM sys.processlist;\n        IF (v_has_ps = \'YES\') THEN\n            IF (sys.ps_is_consumer_enabled(\'events_waits_history_long\') = \'YES\') THEN\n                SELECT \'SELECT * FROM sys.latest_file_io\' AS \'The following output is:\';\n                SELECT * FROM sys.latest_file_io;\n            END IF;\n            IF (EXISTS(SELECT 1 FROM performance_schema.setup_instruments WHERE NAME LIKE \'memory/%\' AND ENABLED = \'YES\')) THEN\n                SELECT \'SELECT * FROM sys.memory_by_host_by_current_bytes\' AS \'The following output is:\';\n                SELECT * FROM sys.memory_by_host_by_current_bytes;\n                SELECT \'SELECT * FROM sys.memory_by_thread_by_current_bytes\' AS \'The following output is:\';\n                SELECT * FROM sys.memory_by_thread_by_current_bytes;\n                SELECT \'SELECT * FROM sys.memory_by_user_by_current_bytes\' AS \'The following output is:\';\n                SELECT * FROM sys.memory_by_user_by_current_bytes;\n                SELECT \'SELECT * FROM sys.memory_global_by_current_bytes\' AS \'The following output is:\';\n                SELECT * FROM sys.memory_global_by_current_bytes;\n            END IF;\n        END IF;\n        SET v_runtime = (UNIX_TIMESTAMP(NOW(2)) - v_start);\n    UNTIL (v_runtime + in_interval >= in_max_runtime) END REPEAT;\n    IF (v_has_ps = \'YES\') THEN\n        SELECT \'SHOW ENGINE PERFORMANCE_SCHEMA STATUS\' AS \'The following output is:\';\n        EXECUTE stmt_ps_status;\n    END IF;\n    IF (v_has_innodb IN (\'DEFAULT\', \'YES\')) THEN\n        DEALLOCATE PREPARE stmt_innodb_status;\n    END IF;\n    IF (v_has_ps = \'YES\') THEN\n        DEALLOCATE PREPARE stmt_ps_status;\n    END IF;\n    IF (v_has_ndb IN (\'DEFAULT\', \'YES\')) THEN\n        DEALLOCATE PREPARE stmt_ndbcluster_status;\n    END IF;\n    SELECT \'\n============================\n     Schema Information\n============================\n\' AS \'\';\n    SELECT COUNT(*) AS \'Total Number of Tables\' FROM information_schema.TABLES;\n    IF (@sys.diagnostics.allow_i_s_tables = \'ON\') THEN\n        SELECT \'Storage Engine Usage\' AS \'The following output is:\';\n        SELECT ENGINE, COUNT(*) AS NUM_TABLES,\n                sys.format_bytes(SUM(DATA_LENGTH)) AS DATA_LENGTH,\n                sys.format_bytes(SUM(INDEX_LENGTH)) AS INDEX_LENGTH,\n                sys.format_bytes(SUM(DATA_LENGTH+INDEX_LENGTH)) AS TOTAL\n            FROM information_schema.TABLES\n            GROUP BY ENGINE;\n        SELECT \'Schema Object Overview\' AS \'The following output is:\';\n        SELECT * FROM sys.schema_object_overview;\n        SELECT \'Tables without a PRIMARY KEY\' AS \'The following output is:\';\n        SELECT TABLES.TABLE_SCHEMA, ENGINE, COUNT(*) AS NumTables\n          FROM information_schema.TABLES\n               LEFT OUTER JOIN information_schema.STATISTICS ON STATISTICS.TABLE_SCHEMA = TABLES.TABLE_SCHEMA\n                                                                AND STATISTICS.TABLE_NAME = TABLES.TABLE_NAME\n                                                                AND STATISTICS.INDEX_NAME = \'PRIMARY\'\n         WHERE STATISTICS.TABLE_NAME IS NULL\n               AND TABLES.TABLE_SCHEMA NOT IN (\'mysql\', \'information_schema\', \'performance_schema\', \'sys\')\n               AND TABLES.TABLE_TYPE = \'BASE TABLE\'\n         GROUP BY TABLES.TABLE_SCHEMA, ENGINE;\n    END IF;\n    IF (v_has_ps = \'YES\') THEN\n        SELECT \'Unused Indexes\' AS \'The following output is:\';\n        SELECT object_schema, COUNT(*) AS NumUnusedIndexes\n          FROM performance_schema.table_io_waits_summary_by_index_usage\n         WHERE index_name IS NOT NULL\n               AND count_star = 0\n               AND object_schema NOT IN (\'mysql\', \'sys\')\n               AND index_name != \'PRIMARY\'\n         GROUP BY object_schema;\n    END IF;\n    IF (v_has_ps = \'YES\') THEN\n        SELECT \'\n=========================\n     Overall Status\n=========================\n\' AS \'\';\n        SELECT \'CALL sys.ps_statement_avg_latency_histogram()\' AS \'The following output is:\';\n        CALL sys.ps_statement_avg_latency_histogram();\n        CALL sys.statement_performance_analyzer(\'snapshot\', NULL, NULL);\n        CALL sys.statement_performance_analyzer(\'overall\', NULL, \'with_runtimes_in_95th_percentile\');\n        SET @sys.diagnostics.sql = REPLACE(@sys.diagnostics.sql_gen_query_template, \'%{OUTPUT}\', \'end\');\n        IF (@sys.debug = \'ON\') THEN\n            SELECT \'The following query will be used to generate the query for each sys view\' AS \'Debug\';\n            SELECT @sys.diagnostics.sql AS \'Debug\';\n        END IF;\n        PREPARE stmt_gen_query FROM @sys.diagnostics.sql;\n        SET v_done = FALSE;\n        OPEN c_sysviews_w_delta;\n        c_sysviews_w_delta_loop: LOOP\n            FETCH c_sysviews_w_delta INTO v_table_name;\n            IF v_done THEN\n                LEAVE c_sysviews_w_delta_loop;\n            END IF;\n            IF (@sys.debug = \'ON\') THEN\n                SELECT CONCAT(\'The following queries are for storing the final content of \', v_table_name) AS \'Debug\';\n            END IF;\n            CALL sys.execute_prepared_stmt(CONCAT(\'DROP TEMPORARY TABLE IF EXISTS `tmp_\', v_table_name, \'_end`\'));\n            CALL sys.execute_prepared_stmt(CONCAT(\'CREATE TEMPORARY TABLE `tmp_\', v_table_name, \'_end` SELECT * FROM `sys`.`x$\', v_table_name, \'`\'));\n            IF (@sys.diagnostics.include_raw = \'ON\') THEN\n                SET @sys.diagnostics.table_name = CONCAT(\'x$\', v_table_name);\n                EXECUTE stmt_gen_query USING @sys.diagnostics.table_name;\n                SELECT CONCAT(@sys.diagnostics.sql_select,\n                                IF(order_by IS NOT NULL, CONCAT(\'\\n ORDER BY \', REPLACE(order_by, \'%{TABLE}\', CONCAT(\'tmp_\', v_table_name, \'_end\'))), \'\'),\n                                IF(limit_rows IS NOT NULL, CONCAT(\'\\n LIMIT \', limit_rows), \'\')\n                        )\n                    INTO @sys.diagnostics.sql_select\n                    FROM tmp_sys_views_delta\n                    WHERE TABLE_NAME = v_table_name;\n                SELECT CONCAT(\'Overall \', v_table_name) AS \'The following output is:\';\n                CALL sys.execute_prepared_stmt(@sys.diagnostics.sql_select);\n            END IF;\n        END LOOP;\n        CLOSE c_sysviews_w_delta;\n        DEALLOCATE PREPARE stmt_gen_query;\n        SELECT \'\n======================\n     Delta Status\n======================\n\' AS \'\';\n        CALL sys.statement_performance_analyzer(\'delta\', \'tmp_digests_start\', \'with_runtimes_in_95th_percentile\');\n        CALL sys.statement_performance_analyzer(\'cleanup\', NULL, NULL);\n        DROP TEMPORARY TABLE tmp_digests_start;\n        IF (@sys.debug = \'ON\') THEN\n            SELECT \'The following query will be used to generate the query for each sys view delta\' AS \'Debug\';\n            SELECT @sys.diagnostics.sql_gen_query_delta AS \'Debug\';\n        END IF;\n        PREPARE stmt_gen_query_delta FROM @sys.diagnostics.sql_gen_query_delta;\n        SET v_old_group_concat_max_len = @@session.group_concat_max_len;\n        SET @@session.group_concat_max_len = 2048;\n        SET v_done = FALSE;\n        OPEN c_sysviews_w_delta;\n        c_sysviews_w_delta_loop: LOOP\n            FETCH c_sysviews_w_delta INTO v_table_name;\n            IF v_done THEN\n                LEAVE c_sysviews_w_delta_loop;\n            END IF;\n            SET @sys.diagnostics.table_name = v_table_name;\n            EXECUTE stmt_gen_query_delta USING @sys.diagnostics.table_name;\n            SELECT CONCAT(@sys.diagnostics.sql_select,\n                            IF(where_delta IS NOT NULL, CONCAT(\'\\n WHERE \', where_delta), \'\'),\n                            IF(order_by_delta IS NOT NULL, CONCAT(\'\\n ORDER BY \', order_by_delta), \'\'),\n                            IF(limit_rows IS NOT NULL, CONCAT(\'\\n LIMIT \', limit_rows), \'\')\n                    )\n                INTO @sys.diagnostics.sql_select\n                FROM tmp_sys_views_delta\n                WHERE TABLE_NAME = v_table_name;\n            SELECT CONCAT(\'Delta \', v_table_name) AS \'The following output is:\';\n            CALL sys.execute_prepared_stmt(@sys.diagnostics.sql_select);\n            CALL sys.execute_prepared_stmt(CONCAT(\'DROP TEMPORARY TABLE `tmp_\', v_table_name, \'_end`\'));\n            CALL sys.execute_prepared_stmt(CONCAT(\'DROP TEMPORARY TABLE `tmp_\', v_table_name, \'_start`\'));\n        END LOOP;\n        CLOSE c_sysviews_w_delta;\n        SET @@session.group_concat_max_len = v_old_group_concat_max_len;\n        DEALLOCATE PREPARE stmt_gen_query_delta;\n        DROP TEMPORARY TABLE tmp_sys_views_delta;\n    END IF;\n    IF (v_has_metrics) THEN\n        SELECT \'SELECT * FROM sys.metrics\' AS \'The following output is:\';\n    ELSE\n        SELECT \'sys.metrics equivalent\' AS \'The following output is:\';\n    END IF;\n    CALL sys.execute_prepared_stmt(\n        CONCAT(v_sql_status_summary_select, v_sql_status_summary_delta, \', Type, s1.Enabled\', v_sql_status_summary_from,\n               \'\n ORDER BY Type, Variable_name\'\n        )\n    );\n    SET v_count = 0;\n    WHILE (v_count < v_output_count) DO\n        SET v_count = v_count + 1;\n        SET v_table_name = CONCAT(\'tmp_metrics_\', v_count);\n        CALL sys.execute_prepared_stmt(CONCAT(\'DROP TEMPORARY TABLE IF EXISTS \', v_table_name));\n    END WHILE;\n    IF (in_auto_config <> \'current\') THEN\n        CALL sys.ps_setup_reload_saved();\n        SET sql_log_bin = @log_bin;\n    END IF;\n    SET @sys.diagnostics.output_time            = NULL,\n        @sys.diagnostics.sql                    = NULL,\n        @sys.diagnostics.sql_gen_query_delta    = NULL,\n        @sys.diagnostics.sql_gen_query_template = NULL,\n        @sys.diagnostics.sql_select             = NULL,\n        @sys.diagnostics.table_name             = NULL;\n    IF (v_this_thread_enabled = \'YES\') THEN\n        CALL sys.ps_setup_enable_thread(CONNECTION_ID());\n    END IF;\n    IF (@log_bin = 1) THEN\n        SET sql_log_bin = @log_bin;\n    END IF;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Create a report of the current status of the server for diagnostics purposes. Data collected includes (some items depends on versions and settings):\n                * The GLOBAL VARIABLES\n                * Several sys schema views including metrics or equivalent (depending on version and settings)\n                * Queries in the 95th percentile\n                * Several ndbinfo views for MySQL Cluster\n                * Replication (both master and slave) information.\n             Some of the sys schema views are calculated as initial (optional), overall, delta:\n                * The initial view is the content of the view at the start of this procedure.\n                  This output will be the same as the the start values used for the delta view.\n                  The initial view is included if @sys.diagnostics.include_raw = \'ON\'.\n                * The overall view is the content of the view at the end of this procedure.\n                  This output is the same as the end values used for the delta view.\n                  The overall view is always included.\n                * The delta view is the difference from the beginning to the end. Note that for min and max values\n                  they are simply the min or max value from the end view respectively, so does not necessarily reflect\n                  the minimum/maximum value in the monitored period.\n                  Note: except for the metrics views the delta is only calculation between the first and last outputs.\n             Requires the SUPER privilege for \"SET sql_log_bin = 0;\".\n             Versions supported:\n                * MySQL 5.6: 5.6.10 and later\n                * MySQL 5.7: 5.7.9 and later\n             Parameters\n             in_max_runtime (INT UNSIGNED):\n               The maximum time to keep collecting data.\n               Use NULL to get the default which is 60 seconds, otherwise enter a value greater than 0.\n             in_interval (INT UNSIGNED):\n               How long to sleep between data collections.\n               Use NULL to get the default which is 30 seconds, otherwise enter a value greater than 0.\n             in_auto_config (ENUM(\'current\', \'medium\', \'full\'))\n               Automatically enable Performance Schema instruments and consumers.\n               NOTE: The more that are enabled, the more impact on the performance.\n               Supported values are:\n                  * current - use the current settings.\n                  * medium - enable some settings.\n                  * full - enables all settings. This will have a big impact on the\n                           performance - be careful using this option.\n               If another setting the \'current\' is chosen, the current settings\n               are restored at the end of the procedure.\n             Configuration Options\n             sys.diagnostics.allow_i_s_tables\n               Specifies whether it is allowed to do table scan queries on information_schema.TABLES. This can be expensive if there\n               are many tables. Set to \'ON\' to allow, \'OFF\' to not allow.\n               Default is \'OFF\'.\n             sys.diagnostics.include_raw\n               Set to \'ON\' to include the raw data (e.g. the original output of \"SELECT * FROM sys.metrics\").\n               Use this to get the initial values of the various views.\n               Default is \'OFF\'.\n             sys.statement_truncate_len\n               How much of queries in the process list output to include.\n               Default is 64.\n             sys.debug\n               Whether to provide debugging output.\n               Default is \'OFF\'. Set to \'ON\' to include.\n             Example\n             To create a report and append it to the file diag.out:\n             mysql> TEE diag.out;\n             mysql> CALL sys.diagnostics(120, 30, \'current\');\n             ...\n             mysql> NOTEE;\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    DECLARE v_start, v_runtime, v_iter_start, v_sleep DECIMAL(20,2) DEFAULT 0.0;\n    DECLARE v_has_innodb, v_has_ndb, v_has_ps, v_has_replication, v_has_ps_replication VARCHAR(8) CHARSET utf8 DEFAULT \'NO\';\n    DECLARE v_this_thread_enabled, v_has_ps_vars, v_has_metrics ENUM(\'YES\', \'NO\');\n    DECLARE v_table_name, v_banner VARCHAR(64) CHARSET utf8;\n    DECLARE v_sql_status_summary_select, v_sql_status_summary_delta, v_sql_status_summary_from, v_no_delta_names TEXT;\n    DECLARE v_output_time, v_output_time_prev DECIMAL(20,3) UNSIGNED;\n    DECLARE v_output_count, v_count, v_old_group_concat_max_len INT UNSIGNED DEFAULT 0;\n    DECLARE v_status_summary_width TINYINT UNSIGNED DEFAULT 50;\n    DECLARE v_done BOOLEAN DEFAULT FALSE;\n    DECLARE c_ndbinfo CURSOR FOR\n        SELECT TABLE_NAME\n          FROM information_schema.TABLES\n         WHERE TABLE_SCHEMA = \'ndbinfo\'\n               AND TABLE_NAME NOT IN (\n                  \'blocks\',\n                  \'config_params\',\n                  \'dict_obj_types\',\n                  \'disk_write_speed_base\',\n                  \'memory_per_fragment\',\n                  \'memoryusage\',\n                  \'operations_per_fragment\',\n                  \'threadblocks\'\n               );\n    DECLARE c_sysviews_w_delta CURSOR FOR\n        SELECT table_name\n          FROM tmp_sys_views_delta\n         ORDER BY table_name;\n    DECLARE CONTINUE HANDLER FOR NOT FOUND SET v_done = TRUE;\n    SELECT INSTRUMENTED INTO v_this_thread_enabled FROM performance_schema.threads WHERE PROCESSLIST_ID = CONNECTION_ID();\n    IF (v_this_thread_enabled = \'YES\') THEN\n        CALL sys.ps_setup_disable_thread(CONNECTION_ID());\n    END IF;\n    IF (in_max_runtime < in_interval) THEN\n        SIGNAL SQLSTATE \'45000\'\n           SET MESSAGE_TEXT = \'in_max_runtime must be greater than or equal to in_interval\';\n    END IF;\n    IF (in_max_runtime = 0) THEN\n        SIGNAL SQLSTATE \'45000\'\n           SET MESSAGE_TEXT = \'in_max_runtime must be greater than 0\';\n    END IF;\n    IF (in_interval = 0) THEN\n        SIGNAL SQLSTATE \'45000\'\n           SET MESSAGE_TEXT = \'in_interval must be greater than 0\';\n    END IF;\n    IF (@sys.diagnostics.allow_i_s_tables IS NULL) THEN\n        SET @sys.diagnostics.allow_i_s_tables = sys.sys_get_config(\'diagnostics.allow_i_s_tables\', \'OFF\');\n    END IF;\n    IF (@sys.diagnostics.include_raw IS NULL) THEN\n        SET @sys.diagnostics.include_raw      = sys.sys_get_config(\'diagnostics.include_raw\'     , \'OFF\');\n    END IF;\n    IF (@sys.debug IS NULL) THEN\n        SET @sys.debug                        = sys.sys_get_config(\'debug\'                       , \'OFF\');\n    END IF;\n    IF (@sys.statement_truncate_len IS NULL) THEN\n        SET @sys.statement_truncate_len       = sys.sys_get_config(\'statement_truncate_len\'      , \'64\' );\n    END IF;\n    SET @log_bin := @@sql_log_bin;\n    IF (@log_bin = 1) THEN\n        SET sql_log_bin = 0;\n    END IF;\n    SET v_no_delta_names = CONCAT(\'s%{COUNT}.Variable_name NOT IN (\',\n        \'\'\'innodb_buffer_pool_pages_total\'\', \',\n        \'\'\'innodb_page_size\'\', \',\n        \'\'\'last_query_cost\'\', \',\n        \'\'\'last_query_partial_plans\'\', \',\n        \'\'\'qcache_total_blocks\'\', \',\n        \'\'\'slave_last_heartbeat\'\', \',\n        \'\'\'ssl_ctx_verify_depth\'\', \',\n        \'\'\'ssl_ctx_verify_mode\'\', \',\n        \'\'\'ssl_session_cache_size\'\', \',\n        \'\'\'ssl_verify_depth\'\', \',\n        \'\'\'ssl_verify_mode\'\', \',\n        \'\'\'ssl_version\'\', \',\n        \'\'\'buffer_flush_lsn_avg_rate\'\', \',\n        \'\'\'buffer_flush_pct_for_dirty\'\', \',\n        \'\'\'buffer_flush_pct_for_lsn\'\', \',\n        \'\'\'buffer_pool_pages_total\'\', \',\n        \'\'\'lock_row_lock_time_avg\'\', \',\n        \'\'\'lock_row_lock_time_max\'\', \',\n        \'\'\'innodb_page_size\'\'\',\n    \')\');\n    IF (in_auto_config <> \'current\') THEN\n        IF (@sys.debug = \'ON\') THEN\n            SELECT CONCAT(\'Updating Performance Schema configuration to \', in_auto_config) AS \'Debug\';\n        END IF;\n        CALL sys.ps_setup_save(0);\n        IF (in_auto_config = \'medium\') THEN\n            UPDATE performance_schema.setup_consumers\n                SET ENABLED = \'YES\'\n            WHERE NAME NOT LIKE \'%\\_history%\';\n            UPDATE performance_schema.setup_instruments\n                SET ENABLED = \'YES\',\n                    TIMED   = \'YES\'\n            WHERE NAME NOT LIKE \'wait/synch/%\';\n        ELSEIF (in_auto_config = \'full\') THEN\n            UPDATE performance_schema.setup_consumers\n                SET ENABLED = \'YES\';\n            UPDATE performance_schema.setup_instruments\n                SET ENABLED = \'YES\',\n                    TIMED   = \'YES\';\n        END IF;\n        UPDATE performance_schema.threads\n           SET INSTRUMENTED = \'YES\'\n         WHERE PROCESSLIST_ID <> CONNECTION_ID();\n    END IF;\n    SET v_start        = UNIX_TIMESTAMP(NOW(2)),\n        in_interval    = IFNULL(in_interval, 30),\n        in_max_runtime = IFNULL(in_max_runtime, 60);\n    SET v_banner = REPEAT(\n                      \'-\',\n                      LEAST(\n                         GREATEST(\n                            36,\n                            CHAR_LENGTH(VERSION()),\n                            CHAR_LENGTH(@@global.version_comment),\n                            CHAR_LENGTH(@@global.version_compile_os),\n                            CHAR_LENGTH(@@global.version_compile_machine),\n                            CHAR_LENGTH(@@global.socket),\n                            CHAR_LENGTH(@@global.datadir)\n                         ),\n                         64\n                      )\n                   );\n    SELECT \'Hostname\' AS \'Name\', @@global.hostname AS \'Value\'\n    UNION ALL\n    SELECT \'Port\' AS \'Name\', @@global.port AS \'Value\'\n    UNION ALL\n    SELECT \'Socket\' AS \'Name\', @@global.socket AS \'Value\'\n    UNION ALL\n    SELECT \'Datadir\' AS \'Name\', @@global.datadir AS \'Value\'\n    UNION ALL\n    SELECT REPEAT(\'-\', 23) AS \'Name\', v_banner AS \'Value\'\n    UNION ALL\n    SELECT \'MySQL Version\' AS \'Name\', VERSION() AS \'Value\'\n    UNION ALL\n    SELECT \'Sys Schema Version\' AS \'Name\', (SELECT sys_version FROM sys.version) AS \'Value\'\n    UNION ALL\n    SELECT \'Version Comment\' AS \'Name\', @@global.version_comment AS \'Value\'\n    UNION ALL\n    SELECT \'Version Compile OS\' AS \'Name\', @@global.version_compile_os AS \'Value\'\n    UNION ALL\n    SELECT \'Version Compile Machine\' AS \'Name\', @@global.version_compile_machine AS \'Value\'\n    UNION ALL\n    SELECT REPEAT(\'-\', 23) AS \'Name\', v_banner AS \'Value\'\n    UNION ALL\n    SELECT \'UTC Time\' AS \'Name\', UTC_TIMESTAMP() AS \'Value\'\n    UNION ALL\n    SELECT \'Local Time\' AS \'Name\', NOW() AS \'Value\'\n    UNION ALL\n    SELECT \'Time Zone\' AS \'Name\', @@global.time_zone AS \'Value\'\n    UNION ALL\n    SELECT \'System Time Zone\' AS \'Name\', @@global.system_time_zone AS \'Value\'\n    UNION ALL\n    SELECT \'Time Zone Offset\' AS \'Name\', TIMEDIFF(NOW(), UTC_TIMESTAMP()) AS \'Value\';\n    SET v_has_innodb         = IFNULL((SELECT SUPPORT FROM information_schema.ENGINES WHERE ENGINE = \'InnoDB\'), \'NO\'),\n        v_has_ndb            = IFNULL((SELECT SUPPORT FROM information_schema.ENGINES WHERE ENGINE = \'NDBCluster\'), \'NO\'),\n        v_has_ps             = IFNULL((SELECT SUPPORT FROM information_schema.ENGINES WHERE ENGINE = \'PERFORMANCE_SCHEMA\'), \'NO\'),\n        v_has_ps_replication = IF(v_has_ps = \'YES\'\n                                   AND EXISTS(SELECT 1 FROM information_schema.TABLES WHERE TABLE_SCHEMA = \'performance_schema\' AND TABLE_NAME = \'replication_applier_status\'),\n                                   \'YES\',\n                                   \'NO\'\n                               ),\n        v_has_replication    = \'MAYBE\',\n        v_has_metrics        = IF(v_has_ps = \'YES\' OR (sys.version_major() = 5 AND sys.version_minor() = 6), \'YES\', \'NO\'),\n        v_has_ps_vars        = \'NO\';\n    \n    \n    IF (@sys.debug = \'ON\') THEN\n       SELECT v_has_innodb AS \'Has_InnoDB\', v_has_ndb AS \'Has_NDBCluster\',\n              v_has_ps AS \'Has_Performance_Schema\', v_has_ps_vars AS \'Has_P_S_SHOW_Variables\',\n              v_has_metrics AS \'Has_metrics\',\n              v_has_ps_replication \'AS Has_P_S_Replication\', v_has_replication AS \'Has_Replication\';\n    END IF;\n    IF (v_has_innodb IN (\'DEFAULT\', \'YES\')) THEN\n        SET @sys.diagnostics.sql = \'SHOW ENGINE InnoDB STATUS\';\n        PREPARE stmt_innodb_status FROM @sys.diagnostics.sql;\n    END IF;\n    IF (v_has_ps = \'YES\') THEN\n        SET @sys.diagnostics.sql = \'SHOW ENGINE PERFORMANCE_SCHEMA STATUS\';\n        PREPARE stmt_ps_status FROM @sys.diagnostics.sql;\n    END IF;\n    IF (v_has_ndb IN (\'DEFAULT\', \'YES\')) THEN\n        SET @sys.diagnostics.sql = \'SHOW ENGINE NDBCLUSTER STATUS\';\n        PREPARE stmt_ndbcluster_status FROM @sys.diagnostics.sql;\n    END IF;\n    SET @sys.diagnostics.sql_gen_query_template = \'SELECT CONCAT(\\n           \'\'SELECT \'\',\\n           GROUP_CONCAT(\\n               CASE WHEN (SUBSTRING(TABLE_NAME, 3), COLUMN_NAME) IN (\\n                                (\'\'io_global_by_file_by_bytes\'\', \'\'total\'\'),\\n                                (\'\'io_global_by_wait_by_bytes\'\', \'\'total_requested\'\')\\n                         )\\n                         THEN CONCAT(\'\'sys.format_bytes(\'\', COLUMN_NAME, \'\') AS \'\', COLUMN_NAME)\\n                    WHEN SUBSTRING(COLUMN_NAME, -8) = \'\'_latency\'\'\\n                         THEN CONCAT(\'\'sys.format_time(\'\', COLUMN_NAME, \'\') AS \'\', COLUMN_NAME)\\n                    WHEN SUBSTRING(COLUMN_NAME, -7) = \'\'_memory\'\' OR SUBSTRING(COLUMN_NAME, -17) = \'\'_memory_allocated\'\'\\n                         OR ((SUBSTRING(COLUMN_NAME, -5) = \'\'_read\'\' OR SUBSTRING(COLUMN_NAME, -8) = \'\'_written\'\' OR SUBSTRING(COLUMN_NAME, -6) = \'\'_write\'\') AND SUBSTRING(COLUMN_NAME, 1, 6) <> \'\'COUNT_\'\')\\n                         THEN CONCAT(\'\'sys.format_bytes(\'\', COLUMN_NAME, \'\') AS \'\', COLUMN_NAME)\\n                    ELSE COLUMN_NAME\\n               END\\n               ORDER BY ORDINAL_POSITION\\n               SEPARATOR \'\',\\n       \'\'\\n           ),\\n           \'\'\\n  FROM tmp_\'\', SUBSTRING(TABLE_NAME FROM 3), \'\'_%{OUTPUT}\'\'\\n       ) AS Query INTO @sys.diagnostics.sql_select\\n  FROM information_schema.COLUMNS\\n WHERE TABLE_SCHEMA = \'\'sys\'\' AND TABLE_NAME = ?\\n GROUP BY TABLE_NAME\';\n    SET @sys.diagnostics.sql_gen_query_delta = \'SELECT CONCAT(\\n           \'\'SELECT \'\',\\n           GROUP_CONCAT(\\n               CASE WHEN FIND_IN_SET(COLUMN_NAME, diag.pk)\\n                         THEN COLUMN_NAME\\n                    WHEN diag.TABLE_NAME = \'\'io_global_by_file_by_bytes\'\' AND COLUMN_NAME = \'\'write_pct\'\'\\n                         THEN CONCAT(\'\'IFNULL(ROUND(100-(((e.total_read-IFNULL(s.total_read, 0))\'\',\\n                                     \'\'/NULLIF(((e.total_read-IFNULL(s.total_read, 0))+(e.total_written-IFNULL(s.total_written, 0))), 0))*100), 2), 0.00) AS \'\',\\n                                     COLUMN_NAME)\\n                    WHEN (diag.TABLE_NAME, COLUMN_NAME) IN (\\n                                (\'\'io_global_by_file_by_bytes\'\', \'\'total\'\'),\\n                                (\'\'io_global_by_wait_by_bytes\'\', \'\'total_requested\'\')\\n                         )\\n                         THEN CONCAT(\'\'sys.format_bytes(e.\'\', COLUMN_NAME, \'\'-IFNULL(s.\'\', COLUMN_NAME, \'\', 0)) AS \'\', COLUMN_NAME)\\n                    WHEN SUBSTRING(COLUMN_NAME, 1, 4) IN (\'\'max_\'\', \'\'min_\'\') AND SUBSTRING(COLUMN_NAME, -8) = \'\'_latency\'\'\\n                         THEN CONCAT(\'\'sys.format_time(e.\'\', COLUMN_NAME, \'\') AS \'\', COLUMN_NAME)\\n                    WHEN COLUMN_NAME = \'\'avg_latency\'\'\\n                         THEN CONCAT(\'\'sys.format_time((e.total_latency - IFNULL(s.total_latency, 0))\'\',\\n                                     \'\'/NULLIF(e.total - IFNULL(s.total, 0), 0)) AS \'\', COLUMN_NAME)\\n                    WHEN SUBSTRING(COLUMN_NAME, -12) = \'\'_avg_latency\'\'\\n                         THEN CONCAT(\'\'sys.format_time((e.\'\', SUBSTRING(COLUMN_NAME FROM 1 FOR CHAR_LENGTH(COLUMN_NAME)-12), \'\'_latency - IFNULL(s.\'\', SUBSTRING(COLUMN_NAME FROM 1 FOR CHAR_LENGTH(COLUMN_NAME)-12), \'\'_latency, 0))\'\',\\n                                     \'\'/NULLIF(e.\'\', SUBSTRING(COLUMN_NAME FROM 1 FOR CHAR_LENGTH(COLUMN_NAME)-12), \'\'s - IFNULL(s.\'\', SUBSTRING(COLUMN_NAME FROM 1 FOR CHAR_LENGTH(COLUMN_NAME)-12), \'\'s, 0), 0)) AS \'\', COLUMN_NAME)\\n                    WHEN SUBSTRING(COLUMN_NAME, -8) = \'\'_latency\'\'\\n                         THEN CONCAT(\'\'sys.format_time(e.\'\', COLUMN_NAME, \'\' - IFNULL(s.\'\', COLUMN_NAME, \'\', 0)) AS \'\', COLUMN_NAME)\\n                    WHEN COLUMN_NAME IN (\'\'avg_read\'\', \'\'avg_write\'\', \'\'avg_written\'\')\\n                         THEN CONCAT(\'\'sys.format_bytes(IFNULL((e.total_\'\', IF(COLUMN_NAME = \'\'avg_read\'\', \'\'read\'\', \'\'written\'\'), \'\'-IFNULL(s.total_\'\', IF(COLUMN_NAME = \'\'avg_read\'\', \'\'read\'\', \'\'written\'\'), \'\', 0))\'\',\\n                                     \'\'/NULLIF(e.count_\'\', IF(COLUMN_NAME = \'\'avg_read\'\', \'\'read\'\', \'\'write\'\'), \'\'-IFNULL(s.count_\'\', IF(COLUMN_NAME = \'\'avg_read\'\', \'\'read\'\', \'\'write\'\'), \'\', 0), 0), 0)) AS \'\',\\n                                     COLUMN_NAME)\\n                    WHEN SUBSTRING(COLUMN_NAME, -7) = \'\'_memory\'\' OR SUBSTRING(COLUMN_NAME, -17) = \'\'_memory_allocated\'\'\\n                         OR ((SUBSTRING(COLUMN_NAME, -5) = \'\'_read\'\' OR SUBSTRING(COLUMN_NAME, -8) = \'\'_written\'\' OR SUBSTRING(COLUMN_NAME, -6) = \'\'_write\'\') AND SUBSTRING(COLUMN_NAME, 1, 6) <> \'\'COUNT_\'\')\\n                         THEN CONCAT(\'\'sys.format_bytes(e.\'\', COLUMN_NAME, \'\' - IFNULL(s.\'\', COLUMN_NAME, \'\', 0)) AS \'\', COLUMN_NAME)\\n                    ELSE CONCAT(\'\'(e.\'\', COLUMN_NAME, \'\' - IFNULL(s.\'\', COLUMN_NAME, \'\', 0)) AS \'\', COLUMN_NAME)\\n               END\\n               ORDER BY ORDINAL_POSITION\\n               SEPARATOR \'\',\\n       \'\'\\n           ),\\n           \'\'\\n  FROM tmp_\'\', diag.TABLE_NAME, \'\'_end e\\n       LEFT OUTER JOIN tmp_\'\', diag.TABLE_NAME, \'\'_start s USING (\'\', diag.pk, \'\')\'\'\\n       ) AS Query INTO @sys.diagnostics.sql_select\\n  FROM tmp_sys_views_delta diag\\n       INNER JOIN information_schema.COLUMNS c ON c.TABLE_NAME = CONCAT(\'\'x$\'\', diag.TABLE_NAME)\\n WHERE c.TABLE_SCHEMA = \'\'sys\'\' AND diag.TABLE_NAME = ?\\n GROUP BY diag.TABLE_NAME\';\n    IF (v_has_ps = \'YES\') THEN\n        DROP TEMPORARY TABLE IF EXISTS tmp_sys_views_delta;\n        CREATE TEMPORARY TABLE tmp_sys_views_delta (\n            TABLE_NAME varchar(64) NOT NULL,\n            order_by text COMMENT \'ORDER BY clause for the initial and overall views\',\n            order_by_delta text COMMENT \'ORDER BY clause for the delta views\',\n            where_delta text COMMENT \'WHERE clause to use for delta views to only include rows with a \"count\" > 0\',\n            limit_rows int unsigned COMMENT \'The maximum number of rows to include for the view\',\n            pk varchar(128) COMMENT \'Used with the FIND_IN_SET() function so use comma separated list without whitespace\',\n            PRIMARY KEY (TABLE_NAME)\n        );\n        IF (@sys.debug = \'ON\') THEN\n            SELECT \'Populating tmp_sys_views_delta\' AS \'Debug\';\n        END IF;\n        INSERT INTO tmp_sys_views_delta\n        VALUES (\'host_summary\'                       , \'%{TABLE}.statement_latency DESC\',\n                                                       \'(e.statement_latency-IFNULL(s.statement_latency, 0)) DESC\',\n                                                       \'(e.statements - IFNULL(s.statements, 0)) > 0\', NULL, \'host\'),\n               (\'host_summary_by_file_io\'            , \'%{TABLE}.io_latency DESC\',\n                                                       \'(e.io_latency-IFNULL(s.io_latency, 0)) DESC\',\n                                                       \'(e.ios - IFNULL(s.ios, 0)) > 0\', NULL, \'host\'),\n               (\'host_summary_by_file_io_type\'       , \'%{TABLE}.host, %{TABLE}.total_latency DESC\',\n                                                       \'e.host, (e.total_latency-IFNULL(s.total_latency, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'host,event_name\'),\n               (\'host_summary_by_stages\'             , \'%{TABLE}.host, %{TABLE}.total_latency DESC\',\n                                                       \'e.host, (e.total_latency-IFNULL(s.total_latency, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'host,event_name\'),\n               (\'host_summary_by_statement_latency\'  , \'%{TABLE}.total_latency DESC\',\n                                                       \'(e.total_latency-IFNULL(s.total_latency, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'host\'),\n               (\'host_summary_by_statement_type\'     , \'%{TABLE}.host, %{TABLE}.total_latency DESC\',\n                                                       \'e.host, (e.total_latency-IFNULL(s.total_latency, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'host,statement\'),\n               (\'io_by_thread_by_latency\'            , \'%{TABLE}.total_latency DESC\',\n                                                       \'(e.total_latency-IFNULL(s.total_latency, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'user,thread_id,processlist_id\'),\n               (\'io_global_by_file_by_bytes\'         , \'%{TABLE}.total DESC\',\n                                                       \'(e.total-IFNULL(s.total, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', 100, \'file\'),\n               (\'io_global_by_file_by_latency\'       , \'%{TABLE}.total_latency DESC\',\n                                                       \'(e.total_latency-IFNULL(s.total_latency, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', 100, \'file\'),\n               (\'io_global_by_wait_by_bytes\'         , \'%{TABLE}.total_requested DESC\',\n                                                       \'(e.total_requested-IFNULL(s.total_requested, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'event_name\'),\n               (\'io_global_by_wait_by_latency\'       , \'%{TABLE}.total_latency DESC\',\n                                                       \'(e.total_latency-IFNULL(s.total_latency, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'event_name\'),\n               (\'schema_index_statistics\'            , \'(%{TABLE}.select_latency+%{TABLE}.insert_latency+%{TABLE}.update_latency+%{TABLE}.delete_latency) DESC\',\n                                                       \'((e.select_latency+e.insert_latency+e.update_latency+e.delete_latency)-IFNULL(s.select_latency+s.insert_latency+s.update_latency+s.delete_latency, 0)) DESC\',\n                                                       \'((e.rows_selected+e.insert_latency+e.rows_updated+e.rows_deleted)-IFNULL(s.rows_selected+s.rows_inserted+s.rows_updated+s.rows_deleted, 0)) > 0\',\n                                                       100, \'table_schema,table_name,index_name\'),\n               (\'schema_table_statistics\'            , \'%{TABLE}.total_latency DESC\',\n                                                       \'(e.total_latency-IFNULL(s.total_latency, 0)) DESC\',\n                                                       \'(e.total_latency-IFNULL(s.total_latency, 0)) > 0\', 100, \'table_schema,table_name\'),\n               (\'schema_tables_with_full_table_scans\', \'%{TABLE}.rows_full_scanned DESC\',\n                                                       \'(e.rows_full_scanned-IFNULL(s.rows_full_scanned, 0)) DESC\',\n                                                       \'(e.rows_full_scanned-IFNULL(s.rows_full_scanned, 0)) > 0\', 100, \'object_schema,object_name\'),\n               (\'user_summary\'                       , \'%{TABLE}.statement_latency DESC\',\n                                                       \'(e.statement_latency-IFNULL(s.statement_latency, 0)) DESC\',\n                                                       \'(e.statements - IFNULL(s.statements, 0)) > 0\', NULL, \'user\'),\n               (\'user_summary_by_file_io\'            , \'%{TABLE}.io_latency DESC\',\n                                                       \'(e.io_latency-IFNULL(s.io_latency, 0)) DESC\',\n                                                       \'(e.ios - IFNULL(s.ios, 0)) > 0\', NULL, \'user\'),\n               (\'user_summary_by_file_io_type\'       , \'%{TABLE}.user, %{TABLE}.latency DESC\',\n                                                       \'e.user, (e.latency-IFNULL(s.latency, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'user,event_name\'),\n               (\'user_summary_by_stages\'             , \'%{TABLE}.user, %{TABLE}.total_latency DESC\',\n                                                       \'e.user, (e.total_latency-IFNULL(s.total_latency, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'user,event_name\'),\n               (\'user_summary_by_statement_latency\'  , \'%{TABLE}.total_latency DESC\',\n                                                       \'(e.total_latency-IFNULL(s.total_latency, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'user\'),\n               (\'user_summary_by_statement_type\'     , \'%{TABLE}.user, %{TABLE}.total_latency DESC\',\n                                                       \'e.user, (e.total_latency-IFNULL(s.total_latency, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'user,statement\'),\n               (\'wait_classes_global_by_avg_latency\' , \'IFNULL(%{TABLE}.total_latency / NULLIF(%{TABLE}.total, 0), 0) DESC\',\n                                                       \'IFNULL((e.total_latency-IFNULL(s.total_latency, 0)) / NULLIF((e.total - IFNULL(s.total, 0)), 0), 0) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'event_class\'),\n               (\'wait_classes_global_by_latency\'     , \'%{TABLE}.total_latency DESC\',\n                                                       \'(e.total_latency-IFNULL(s.total_latency, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'event_class\'),\n               (\'waits_by_host_by_latency\'           , \'%{TABLE}.host, %{TABLE}.total_latency DESC\',\n                                                       \'e.host, (e.total_latency-IFNULL(s.total_latency, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'host,event\'),\n               (\'waits_by_user_by_latency\'           , \'%{TABLE}.user, %{TABLE}.total_latency DESC\',\n                                                       \'e.user, (e.total_latency-IFNULL(s.total_latency, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'user,event\'),\n               (\'waits_global_by_latency\'            , \'%{TABLE}.total_latency DESC\',\n                                                       \'(e.total_latency-IFNULL(s.total_latency, 0)) DESC\',\n                                                       \'(e.total - IFNULL(s.total, 0)) > 0\', NULL, \'events\')\n        ;\n    END IF;\n    SELECT \'\\n=======================\\n     Configuration\\n=======================\\n\' AS \'\';\n    SELECT \'GLOBAL VARIABLES\' AS \'The following output is:\';\n    IF (v_has_ps_vars = \'YES\') THEN\n        SELECT LOWER(VARIABLE_NAME) AS Variable_name, VARIABLE_VALUE AS Variable_value FROM performance_schema.global_variables ORDER BY VARIABLE_NAME;\n    ELSE\n        SELECT LOWER(VARIABLE_NAME) AS Variable_name, VARIABLE_VALUE AS Variable_value FROM information_schema.GLOBAL_VARIABLES ORDER BY VARIABLE_NAME;\n    END IF;\n    IF (v_has_ps = \'YES\') THEN\n        SELECT \'Performance Schema Setup - Actors\' AS \'The following output is:\';\n        SELECT * FROM performance_schema.setup_actors;\n        SELECT \'Performance Schema Setup - Consumers\' AS \'The following output is:\';\n        SELECT NAME AS Consumer, ENABLED, sys.ps_is_consumer_enabled(NAME) AS COLLECTS\n          FROM performance_schema.setup_consumers;\n        SELECT \'Performance Schema Setup - Instruments\' AS \'The following output is:\';\n        SELECT SUBSTRING_INDEX(NAME, \'/\', 2) AS \'InstrumentClass\',\n               ROUND(100*SUM(IF(ENABLED = \'YES\', 1, 0))/COUNT(*), 2) AS \'EnabledPct\',\n               ROUND(100*SUM(IF(TIMED = \'YES\', 1, 0))/COUNT(*), 2) AS \'TimedPct\'\n          FROM performance_schema.setup_instruments\n         GROUP BY SUBSTRING_INDEX(NAME, \'/\', 2)\n         ORDER BY SUBSTRING_INDEX(NAME, \'/\', 2);\n        SELECT \'Performance Schema Setup - Objects\' AS \'The following output is:\';\n        SELECT * FROM performance_schema.setup_objects;\n        SELECT \'Performance Schema Setup - Threads\' AS \'The following output is:\';\n        SELECT `TYPE` AS ThreadType, COUNT(*) AS \'Total\', ROUND(100*SUM(IF(INSTRUMENTED = \'YES\', 1, 0))/COUNT(*), 2) AS \'InstrumentedPct\'\n          FROM performance_schema.threads\n        GROUP BY TYPE;\n    END IF;\n    IF (v_has_replication = \'NO\') THEN\n        SELECT \'No Replication Configured\' AS \'Replication Status\';\n    ELSE\n        SELECT CONCAT(\'Replication Configured: \', v_has_replication, \' - Performance Schema Replication Tables: \', v_has_ps_replication) AS \'Replication Status\';\n        IF (v_has_ps_replication = \'YES\') THEN\n            SELECT \'Replication - Connection Configuration\' AS \'The following output is:\';\n            SELECT * FROM performance_schema.replication_connection_configuration;\n        END IF;\n        IF (v_has_ps_replication = \'YES\') THEN\n            SELECT \'Replication - Applier Configuration\' AS \'The following output is:\';\n            SELECT * FROM performance_schema.replication_applier_configuration ORDER BY CHANNEL_NAME;\n        END IF;\n    END IF;\n    IF (v_has_ndb IN (\'DEFAULT\', \'YES\')) THEN\n       SELECT \'Cluster Thread Blocks\' AS \'The following output is:\';\n       SELECT * FROM ndbinfo.threadblocks;\n    END IF;\n    IF (v_has_ps = \'YES\') THEN\n        IF (@sys.diagnostics.include_raw = \'ON\') THEN\n            SELECT \'\\n========================\\n     Initial Status\\n========================\\n\' AS \'\';\n        END IF;\n        DROP TEMPORARY TABLE IF EXISTS tmp_digests_start;\n        CALL sys.statement_performance_analyzer(\'create_tmp\', \'tmp_digests_start\', NULL);\n        CALL sys.statement_performance_analyzer(\'snapshot\', NULL, NULL);\n        CALL sys.statement_performance_analyzer(\'save\', \'tmp_digests_start\', NULL);\n        IF (@sys.diagnostics.include_raw = \'ON\') THEN\n            SET @sys.diagnostics.sql = REPLACE(@sys.diagnostics.sql_gen_query_template, \'%{OUTPUT}\', \'start\');\n            IF (@sys.debug = \'ON\') THEN\n                SELECT \'The following query will be used to generate the query for each sys view\' AS \'Debug\';\n                SELECT @sys.diagnostics.sql AS \'Debug\';\n            END IF;\n            PREPARE stmt_gen_query FROM @sys.diagnostics.sql;\n        END IF;\n        SET v_done = FALSE;\n        OPEN c_sysviews_w_delta;\n        c_sysviews_w_delta_loop: LOOP\n            FETCH c_sysviews_w_delta INTO v_table_name;\n            IF v_done THEN\n                LEAVE c_sysviews_w_delta_loop;\n            END IF;\n            IF (@sys.debug = \'ON\') THEN\n                SELECT CONCAT(\'The following queries are for storing the initial content of \', v_table_name) AS \'Debug\';\n            END IF;\n            CALL sys.execute_prepared_stmt(CONCAT(\'DROP TEMPORARY TABLE IF EXISTS `tmp_\', v_table_name, \'_start`\'));\n            CALL sys.execute_prepared_stmt(CONCAT(\'CREATE TEMPORARY TABLE `tmp_\', v_table_name, \'_start` SELECT * FROM `sys`.`x$\', v_table_name, \'`\'));\n            IF (@sys.diagnostics.include_raw = \'ON\') THEN\n                SET @sys.diagnostics.table_name = CONCAT(\'x$\', v_table_name);\n                EXECUTE stmt_gen_query USING @sys.diagnostics.table_name;\n                SELECT CONCAT(@sys.diagnostics.sql_select,\n                              IF(order_by IS NOT NULL, CONCAT(\'\\n ORDER BY \', REPLACE(order_by, \'%{TABLE}\', CONCAT(\'tmp_\', v_table_name, \'_start\'))), \'\'),\n                              IF(limit_rows IS NOT NULL, CONCAT(\'\\n LIMIT \', limit_rows), \'\')\n                       )\n                  INTO @sys.diagnostics.sql_select\n                  FROM tmp_sys_views_delta\n                 WHERE TABLE_NAME = v_table_name;\n                SELECT CONCAT(\'Initial \', v_table_name) AS \'The following output is:\';\n                CALL sys.execute_prepared_stmt(@sys.diagnostics.sql_select);\n            END IF;\n        END LOOP;\n        CLOSE c_sysviews_w_delta;\n        IF (@sys.diagnostics.include_raw = \'ON\') THEN\n            DEALLOCATE PREPARE stmt_gen_query;\n        END IF;\n    END IF;\n    SET v_sql_status_summary_select = \'SELECT Variable_name\',\n        v_sql_status_summary_delta  = \'\',\n        v_sql_status_summary_from   = \'\';\n    REPEAT\n        SET v_output_count = v_output_count + 1;\n        IF (v_output_count > 1) THEN\n            SET v_sleep = in_interval-(UNIX_TIMESTAMP(NOW(2))-v_iter_start);\n            SELECT NOW() AS \'Time\', CONCAT(\'Going to sleep for \', v_sleep, \' seconds. Please do not interrupt\') AS \'The following output is:\';\n            DO SLEEP(in_interval);\n        END IF;\n        SET v_iter_start = UNIX_TIMESTAMP(NOW(2));\n        SELECT NOW(), CONCAT(\'Iteration Number \', IFNULL(v_output_count, \'NULL\')) AS \'The following output is:\';\n        IF (@@log_bin = 1) THEN\n            SELECT \'SHOW MASTER STATUS\' AS \'The following output is:\';\n            SHOW MASTER STATUS;\n        END IF;\n        IF (v_has_replication <> \'NO\') THEN\n            SELECT \'SHOW SLAVE STATUS\' AS \'The following output is:\';\n            SHOW SLAVE STATUS;\n        END IF;\n        SET v_table_name = CONCAT(\'tmp_metrics_\', v_output_count);\n        CALL sys.execute_prepared_stmt(CONCAT(\'DROP TEMPORARY TABLE IF EXISTS \', v_table_name));\n        CALL sys.execute_prepared_stmt(CONCAT(\'CREATE TEMPORARY TABLE \', v_table_name, \' (\\n  Variable_name VARCHAR(193) NOT NULL,\\n  Variable_value VARCHAR(1024),\\n  Type VARCHAR(100) NOT NULL,\\n  Enabled ENUM(\'\'YES\'\', \'\'NO\'\', \'\'PARTIAL\'\') NOT NULL,\\n  PRIMARY KEY (Type, Variable_name)\\n) ENGINE = InnoDB DEFAULT CHARSET=utf8\'));\n        IF (v_has_metrics) THEN\n            SET @sys.diagnostics.sql = CONCAT(\n                \'INSERT INTO \', v_table_name,\n                \' SELECT Variable_name, REPLACE(Variable_value, \'\'\\n\'\', \'\'\\\\n\'\') AS Variable_value, Type, Enabled FROM sys.metrics\'\n            );\n        ELSE\n            SET @sys.diagnostics.sql = CONCAT(\n                \'INSERT INTO \', v_table_name,\n                \'(SELECT LOWER(VARIABLE_NAME) AS Variable_name, REPLACE(VARIABLE_VALUE, \'\'\\n\'\', \'\'\\\\n\'\') AS Variable_value,\\n                         \'\'Global Status\'\' AS Type, \'\'YES\'\' AS Enabled\\n  FROM performance_schema.global_status\\n) UNION ALL (\\nSELECT NAME AS Variable_name, COUNT AS Variable_value,\\n       CONCAT(\'\'InnoDB Metrics - \'\', SUBSYSTEM) AS Type,\\n       IF(STATUS = \'\'enabled\'\', \'\'YES\'\', \'\'NO\'\') AS Enabled\\n  FROM information_schema.INNODB_METRICS\\n WHERE NAME NOT IN (\\n     \'\'lock_row_lock_time\'\', \'\'lock_row_lock_time_avg\'\', \'\'lock_row_lock_time_max\'\', \'\'lock_row_lock_waits\'\',\\n     \'\'buffer_pool_reads\'\', \'\'buffer_pool_read_requests\'\', \'\'buffer_pool_write_requests\'\', \'\'buffer_pool_wait_free\'\',\\n     \'\'buffer_pool_read_ahead\'\', \'\'buffer_pool_read_ahead_evicted\'\', \'\'buffer_pool_pages_total\'\', \'\'buffer_pool_pages_misc\'\',\\n     \'\'buffer_pool_pages_data\'\', \'\'buffer_pool_bytes_data\'\', \'\'buffer_pool_pages_dirty\'\', \'\'buffer_pool_bytes_dirty\'\',\\n     \'\'buffer_pool_pages_free\'\', \'\'buffer_pages_created\'\', \'\'buffer_pages_written\'\', \'\'buffer_pages_read\'\',\\n     \'\'buffer_data_reads\'\', \'\'buffer_data_written\'\', \'\'file_num_open_files\'\',\\n     \'\'os_log_bytes_written\'\', \'\'os_log_fsyncs\'\', \'\'os_log_pending_fsyncs\'\', \'\'os_log_pending_writes\'\',\\n     \'\'log_waits\'\', \'\'log_write_requests\'\', \'\'log_writes\'\', \'\'innodb_dblwr_writes\'\', \'\'innodb_dblwr_pages_written\'\', \'\'innodb_page_size\'\')\\n) UNION ALL (\\nSELECT \'\'NOW()\'\' AS Variable_name, NOW(3) AS Variable_value, \'\'System Time\'\' AS Type, \'\'YES\'\' AS Enabled\\n) UNION ALL (\\nSELECT \'\'UNIX_TIMESTAMP()\'\' AS Variable_name, ROUND(UNIX_TIMESTAMP(NOW(3)), 3) AS Variable_value, \'\'System Time\'\' AS Type, \'\'YES\'\' AS Enabled\\n)\\n ORDER BY Type, Variable_name;\'\n            );\n        END IF;\n        CALL sys.execute_prepared_stmt(@sys.diagnostics.sql);\n        CALL sys.execute_prepared_stmt(\n            CONCAT(\'SELECT Variable_value INTO @sys.diagnostics.output_time FROM \', v_table_name, \' WHERE Type = \'\'System Time\'\' AND Variable_name = \'\'UNIX_TIMESTAMP()\'\'\')\n        );\n        SET v_output_time = @sys.diagnostics.output_time;\n        SET v_sql_status_summary_select = CONCAT(v_sql_status_summary_select, \',\\n       CONCAT(\\n           LEFT(s\', v_output_count, \'.Variable_value, \', v_status_summary_width, \'),\\n           IF(\', REPLACE(v_no_delta_names, \'%{COUNT}\', v_output_count), \' AND s\', v_output_count, \'.Variable_value REGEXP \'\'^[0-9]+(\\\\.[0-9]+)?$\'\', CONCAT(\'\' (\'\', ROUND(s\', v_output_count, \'.Variable_value/\', v_output_time, \', 2), \'\'/sec)\'\'), \'\'\'\')\\n       ) AS \'\'Output \', v_output_count, \'\'\'\'),\n            v_sql_status_summary_from   = CONCAT(v_sql_status_summary_from, \'\\n\',\n                                                    IF(v_output_count = 1, \'  FROM \', \'       INNER JOIN \'),\n                                                    v_table_name, \' s\', v_output_count,\n                                                    IF (v_output_count = 1, \'\', \' USING (Type, Variable_name)\'));\n        IF (v_output_count > 1) THEN\n            SET v_sql_status_summary_delta  = CONCAT(v_sql_status_summary_delta, \',\\n       IF(\', REPLACE(v_no_delta_names, \'%{COUNT}\', v_output_count), \' AND s\', (v_output_count-1), \'.Variable_value REGEXP \'\'^[0-9]+(\\\\.[0-9]+)?$\'\' AND s\', v_output_count, \'.Variable_value REGEXP \'\'^[0-9]+(\\\\.[0-9]+)?$\'\',\\n          CONCAT(IF(s\', (v_output_count-1), \'.Variable_value REGEXP \'\'^[0-9]+\\\\.[0-9]+$\'\' OR s\', v_output_count, \'.Variable_value REGEXP \'\'^[0-9]+\\\\.[0-9]+$\'\',\\n                    ROUND((s\', v_output_count, \'.Variable_value-s\', (v_output_count-1), \'.Variable_value), 2),\\n                    (s\', v_output_count, \'.Variable_value-s\', (v_output_count-1), \'.Variable_value)\\n                   ),\\n                 \'\' (\'\', ROUND((s\', v_output_count, \'.Variable_value-s\', (v_output_count-1), \'.Variable_value)/(\', v_output_time, \'-\', v_output_time_prev, \'), 2), \'\'/sec)\'\'\\n          ),\\n          \'\'\'\'\\n       ) AS \'\'Delta (\', (v_output_count-1), \' -> \', v_output_count, \')\'\'\');\n        END IF;\n        SET v_output_time_prev = v_output_time;\n        IF (@sys.diagnostics.include_raw = \'ON\') THEN\n            IF (v_has_metrics) THEN\n                SELECT \'SELECT * FROM sys.metrics\' AS \'The following output is:\';\n            ELSE\n                SELECT \'sys.metrics equivalent\' AS \'The following output is:\';\n            END IF;\n            CALL sys.execute_prepared_stmt(CONCAT(\'SELECT Type, Variable_name, Enabled, Variable_value FROM \', v_table_name, \' ORDER BY Type, Variable_name\'));\n        END IF;\n        IF (v_has_innodb IN (\'DEFAULT\', \'YES\')) THEN\n            SELECT \'SHOW ENGINE INNODB STATUS\' AS \'The following output is:\';\n            EXECUTE stmt_innodb_status;\n            SELECT \'InnoDB - Transactions\' AS \'The following output is:\';\n            SELECT * FROM information_schema.INNODB_TRX;\n        END IF;\n        IF (v_has_ndb IN (\'DEFAULT\', \'YES\')) THEN\n            SELECT \'SHOW ENGINE NDBCLUSTER STATUS\' AS \'The following output is:\';\n            EXECUTE stmt_ndbcluster_status;\n            SELECT \'ndbinfo.memoryusage\' AS \'The following output is:\';\n            SELECT node_id, memory_type, sys.format_bytes(used) AS used, used_pages, sys.format_bytes(total) AS total, total_pages,\n                   ROUND(100*(used/total), 2) AS \'Used %\'\n            FROM ndbinfo.memoryusage;\n            SET v_done = FALSE;\n            OPEN c_ndbinfo;\n            c_ndbinfo_loop: LOOP\n                FETCH c_ndbinfo INTO v_table_name;\n                IF v_done THEN\n                LEAVE c_ndbinfo_loop;\n                END IF;\n                SELECT CONCAT(\'SELECT * FROM ndbinfo.\', v_table_name) AS \'The following output is:\';\n                CALL sys.execute_prepared_stmt(CONCAT(\'SELECT * FROM `ndbinfo`.`\', v_table_name, \'`\'));\n            END LOOP;\n            CLOSE c_ndbinfo;\n            SELECT * FROM information_schema.FILES;\n        END IF;\n        SELECT \'SELECT * FROM sys.processlist\' AS \'The following output is:\';\n        SELECT processlist.* FROM sys.processlist;\n        IF (v_has_ps = \'YES\') THEN\n            IF (sys.ps_is_consumer_enabled(\'events_waits_history_long\') = \'YES\') THEN\n                SELECT \'SELECT * FROM sys.latest_file_io\' AS \'The following output is:\';\n                SELECT * FROM sys.latest_file_io;\n            END IF;\n            IF (EXISTS(SELECT 1 FROM performance_schema.setup_instruments WHERE NAME LIKE \'memory/%\' AND ENABLED = \'YES\')) THEN\n                SELECT \'SELECT * FROM sys.memory_by_host_by_current_bytes\' AS \'The following output is:\';\n                SELECT * FROM sys.memory_by_host_by_current_bytes;\n                SELECT \'SELECT * FROM sys.memory_by_thread_by_current_bytes\' AS \'The following output is:\';\n                SELECT * FROM sys.memory_by_thread_by_current_bytes;\n                SELECT \'SELECT * FROM sys.memory_by_user_by_current_bytes\' AS \'The following output is:\';\n                SELECT * FROM sys.memory_by_user_by_current_bytes;\n                SELECT \'SELECT * FROM sys.memory_global_by_current_bytes\' AS \'The following output is:\';\n                SELECT * FROM sys.memory_global_by_current_bytes;\n            END IF;\n        END IF;\n        SET v_runtime = (UNIX_TIMESTAMP(NOW(2)) - v_start);\n    UNTIL (v_runtime + in_interval >= in_max_runtime) END REPEAT;\n    IF (v_has_ps = \'YES\') THEN\n        SELECT \'SHOW ENGINE PERFORMANCE_SCHEMA STATUS\' AS \'The following output is:\';\n        EXECUTE stmt_ps_status;\n    END IF;\n    IF (v_has_innodb IN (\'DEFAULT\', \'YES\')) THEN\n        DEALLOCATE PREPARE stmt_innodb_status;\n    END IF;\n    IF (v_has_ps = \'YES\') THEN\n        DEALLOCATE PREPARE stmt_ps_status;\n    END IF;\n    IF (v_has_ndb IN (\'DEFAULT\', \'YES\')) THEN\n        DEALLOCATE PREPARE stmt_ndbcluster_status;\n    END IF;\n    SELECT \'\\n============================\\n     Schema Information\\n============================\\n\' AS \'\';\n    SELECT COUNT(*) AS \'Total Number of Tables\' FROM information_schema.TABLES;\n    IF (@sys.diagnostics.allow_i_s_tables = \'ON\') THEN\n        SELECT \'Storage Engine Usage\' AS \'The following output is:\';\n        SELECT ENGINE, COUNT(*) AS NUM_TABLES,\n                sys.format_bytes(SUM(DATA_LENGTH)) AS DATA_LENGTH,\n                sys.format_bytes(SUM(INDEX_LENGTH)) AS INDEX_LENGTH,\n                sys.format_bytes(SUM(DATA_LENGTH+INDEX_LENGTH)) AS TOTAL\n            FROM information_schema.TABLES\n            GROUP BY ENGINE;\n        SELECT \'Schema Object Overview\' AS \'The following output is:\';\n        SELECT * FROM sys.schema_object_overview;\n        SELECT \'Tables without a PRIMARY KEY\' AS \'The following output is:\';\n        SELECT TABLES.TABLE_SCHEMA, ENGINE, COUNT(*) AS NumTables\n          FROM information_schema.TABLES\n               LEFT OUTER JOIN information_schema.STATISTICS ON STATISTICS.TABLE_SCHEMA = TABLES.TABLE_SCHEMA\n                                                                AND STATISTICS.TABLE_NAME = TABLES.TABLE_NAME\n                                                                AND STATISTICS.INDEX_NAME = \'PRIMARY\'\n         WHERE STATISTICS.TABLE_NAME IS NULL\n               AND TABLES.TABLE_SCHEMA NOT IN (\'mysql\', \'information_schema\', \'performance_schema\', \'sys\')\n               AND TABLES.TABLE_TYPE = \'BASE TABLE\'\n         GROUP BY TABLES.TABLE_SCHEMA, ENGINE;\n    END IF;\n    IF (v_has_ps = \'YES\') THEN\n        SELECT \'Unused Indexes\' AS \'The following output is:\';\n        SELECT object_schema, COUNT(*) AS NumUnusedIndexes\n          FROM performance_schema.table_io_waits_summary_by_index_usage\n         WHERE index_name IS NOT NULL\n               AND count_star = 0\n               AND object_schema NOT IN (\'mysql\', \'sys\')\n               AND index_name != \'PRIMARY\'\n         GROUP BY object_schema;\n    END IF;\n    IF (v_has_ps = \'YES\') THEN\n        SELECT \'\\n=========================\\n     Overall Status\\n=========================\\n\' AS \'\';\n        SELECT \'CALL sys.ps_statement_avg_latency_histogram()\' AS \'The following output is:\';\n        CALL sys.ps_statement_avg_latency_histogram();\n        CALL sys.statement_performance_analyzer(\'snapshot\', NULL, NULL);\n        CALL sys.statement_performance_analyzer(\'overall\', NULL, \'with_runtimes_in_95th_percentile\');\n        SET @sys.diagnostics.sql = REPLACE(@sys.diagnostics.sql_gen_query_template, \'%{OUTPUT}\', \'end\');\n        IF (@sys.debug = \'ON\') THEN\n            SELECT \'The following query will be used to generate the query for each sys view\' AS \'Debug\';\n            SELECT @sys.diagnostics.sql AS \'Debug\';\n        END IF;\n        PREPARE stmt_gen_query FROM @sys.diagnostics.sql;\n        SET v_done = FALSE;\n        OPEN c_sysviews_w_delta;\n        c_sysviews_w_delta_loop: LOOP\n            FETCH c_sysviews_w_delta INTO v_table_name;\n            IF v_done THEN\n                LEAVE c_sysviews_w_delta_loop;\n            END IF;\n            IF (@sys.debug = \'ON\') THEN\n                SELECT CONCAT(\'The following queries are for storing the final content of \', v_table_name) AS \'Debug\';\n            END IF;\n            CALL sys.execute_prepared_stmt(CONCAT(\'DROP TEMPORARY TABLE IF EXISTS `tmp_\', v_table_name, \'_end`\'));\n            CALL sys.execute_prepared_stmt(CONCAT(\'CREATE TEMPORARY TABLE `tmp_\', v_table_name, \'_end` SELECT * FROM `sys`.`x$\', v_table_name, \'`\'));\n            IF (@sys.diagnostics.include_raw = \'ON\') THEN\n                SET @sys.diagnostics.table_name = CONCAT(\'x$\', v_table_name);\n                EXECUTE stmt_gen_query USING @sys.diagnostics.table_name;\n                SELECT CONCAT(@sys.diagnostics.sql_select,\n                                IF(order_by IS NOT NULL, CONCAT(\'\\n ORDER BY \', REPLACE(order_by, \'%{TABLE}\', CONCAT(\'tmp_\', v_table_name, \'_end\'))), \'\'),\n                                IF(limit_rows IS NOT NULL, CONCAT(\'\\n LIMIT \', limit_rows), \'\')\n                        )\n                    INTO @sys.diagnostics.sql_select\n                    FROM tmp_sys_views_delta\n                    WHERE TABLE_NAME = v_table_name;\n                SELECT CONCAT(\'Overall \', v_table_name) AS \'The following output is:\';\n                CALL sys.execute_prepared_stmt(@sys.diagnostics.sql_select);\n            END IF;\n        END LOOP;\n        CLOSE c_sysviews_w_delta;\n        DEALLOCATE PREPARE stmt_gen_query;\n        SELECT \'\\n======================\\n     Delta Status\\n======================\\n\' AS \'\';\n        CALL sys.statement_performance_analyzer(\'delta\', \'tmp_digests_start\', \'with_runtimes_in_95th_percentile\');\n        CALL sys.statement_performance_analyzer(\'cleanup\', NULL, NULL);\n        DROP TEMPORARY TABLE tmp_digests_start;\n        IF (@sys.debug = \'ON\') THEN\n            SELECT \'The following query will be used to generate the query for each sys view delta\' AS \'Debug\';\n            SELECT @sys.diagnostics.sql_gen_query_delta AS \'Debug\';\n        END IF;\n        PREPARE stmt_gen_query_delta FROM @sys.diagnostics.sql_gen_query_delta;\n        SET v_old_group_concat_max_len = @@session.group_concat_max_len;\n        SET @@session.group_concat_max_len = 2048;\n        SET v_done = FALSE;\n        OPEN c_sysviews_w_delta;\n        c_sysviews_w_delta_loop: LOOP\n            FETCH c_sysviews_w_delta INTO v_table_name;\n            IF v_done THEN\n                LEAVE c_sysviews_w_delta_loop;\n            END IF;\n            SET @sys.diagnostics.table_name = v_table_name;\n            EXECUTE stmt_gen_query_delta USING @sys.diagnostics.table_name;\n            SELECT CONCAT(@sys.diagnostics.sql_select,\n                            IF(where_delta IS NOT NULL, CONCAT(\'\\n WHERE \', where_delta), \'\'),\n                            IF(order_by_delta IS NOT NULL, CONCAT(\'\\n ORDER BY \', order_by_delta), \'\'),\n                            IF(limit_rows IS NOT NULL, CONCAT(\'\\n LIMIT \', limit_rows), \'\')\n                    )\n                INTO @sys.diagnostics.sql_select\n                FROM tmp_sys_views_delta\n                WHERE TABLE_NAME = v_table_name;\n            SELECT CONCAT(\'Delta \', v_table_name) AS \'The following output is:\';\n            CALL sys.execute_prepared_stmt(@sys.diagnostics.sql_select);\n            CALL sys.execute_prepared_stmt(CONCAT(\'DROP TEMPORARY TABLE `tmp_\', v_table_name, \'_end`\'));\n            CALL sys.execute_prepared_stmt(CONCAT(\'DROP TEMPORARY TABLE `tmp_\', v_table_name, \'_start`\'));\n        END LOOP;\n        CLOSE c_sysviews_w_delta;\n        SET @@session.group_concat_max_len = v_old_group_concat_max_len;\n        DEALLOCATE PREPARE stmt_gen_query_delta;\n        DROP TEMPORARY TABLE tmp_sys_views_delta;\n    END IF;\n    IF (v_has_metrics) THEN\n        SELECT \'SELECT * FROM sys.metrics\' AS \'The following output is:\';\n    ELSE\n        SELECT \'sys.metrics equivalent\' AS \'The following output is:\';\n    END IF;\n    CALL sys.execute_prepared_stmt(\n        CONCAT(v_sql_status_summary_select, v_sql_status_summary_delta, \', Type, s1.Enabled\', v_sql_status_summary_from,\n               \'\\n ORDER BY Type, Variable_name\'\n        )\n    );\n    SET v_count = 0;\n    WHILE (v_count < v_output_count) DO\n        SET v_count = v_count + 1;\n        SET v_table_name = CONCAT(\'tmp_metrics_\', v_count);\n        CALL sys.execute_prepared_stmt(CONCAT(\'DROP TEMPORARY TABLE IF EXISTS \', v_table_name));\n    END WHILE;\n    IF (in_auto_config <> \'current\') THEN\n        CALL sys.ps_setup_reload_saved();\n        SET sql_log_bin = @log_bin;\n    END IF;\n    SET @sys.diagnostics.output_time            = NULL,\n        @sys.diagnostics.sql                    = NULL,\n        @sys.diagnostics.sql_gen_query_delta    = NULL,\n        @sys.diagnostics.sql_gen_query_template = NULL,\n        @sys.diagnostics.sql_select             = NULL,\n        @sys.diagnostics.table_name             = NULL;\n    IF (v_this_thread_enabled = \'YES\') THEN\n        CALL sys.ps_setup_enable_thread(CONNECTION_ID());\n    END IF;\n    IF (@log_bin = 1) THEN\n        SET sql_log_bin = @log_bin;\n    END IF;\nEND','NONE'),('sys','ps_statement_avg_latency_histogram','PROCEDURE','ps_statement_avg_latency_histogram','SQL','READS_SQL_DATA','NO','INVOKER','','','BEGIN\nSELECT CONCAT(\'\\n\',\n       \'\\n  . = 1 unit\',\n       \'\\n  * = 2 units\',\n       \'\\n  # = 3 units\\n\',\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(0 - \',\n                                               ROUND((@bucket_size := (SELECT ROUND((MAX(avg_us) - MIN(avg_us)) / (@buckets := 16)) AS size\n                                                                         FROM sys.x$ps_digest_avg_latency_distribution)) / (@unit_div := 1000)),\n                                                (@unit := \'ms\'), \')\'),\n                        REPEAT(\' \', (@max_label_size := ((1 + LENGTH(ROUND((@bucket_size * 15) / @unit_div)) + 3 + LENGTH(ROUND(@bucket_size * 16) / @unit_div)) + 1)) - LENGTH(@label_inner)),\n                        @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                      FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                     WHERE b1.avg_us <= @bucket_size), 0)),\n       REPEAT(\' \', (@max_label_len := (@max_label_size + LENGTH((@total_queries := (SELECT SUM(cnt) FROM sys.x$ps_digest_avg_latency_distribution)))) + 1) - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < (@one_unit := 40), \'.\', IF(@count_in_bucket < (@two_unit := 80), \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(\', ROUND(@bucket_size / @unit_div), \' - \', ROUND((@bucket_size * 2) / @unit_div), @unit, \')\'),\n                        REPEAT(\' \', @max_label_size - LENGTH(@label_inner)),\n                        @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                      FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                     WHERE b1.avg_us > @bucket_size AND b1.avg_us <= @bucket_size * 2), 0)),\n       REPEAT(\' \', @max_label_len - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < @one_unit, \'.\', IF(@count_in_bucket < @two_unit, \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(\', ROUND((@bucket_size * 2) / @unit_div), \' - \', ROUND((@bucket_size * 3) / @unit_div), @unit, \')\'),\n                        REPEAT(\' \', @max_label_size - LENGTH(@label_inner)),\n                        @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                      FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                     WHERE b1.avg_us > @bucket_size * 2 AND b1.avg_us <= @bucket_size * 3), 0)),\n       REPEAT(\' \', @max_label_len - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < @one_unit, \'.\', IF(@count_in_bucket < @two_unit, \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(\', ROUND((@bucket_size * 3) / @unit_div), \' - \', ROUND((@bucket_size * 4) / @unit_div), @unit, \')\'),\n                        REPEAT(\' \', @max_label_size - LENGTH(@label_inner)),\n                        @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                      FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                     WHERE b1.avg_us > @bucket_size * 3 AND b1.avg_us <= @bucket_size * 4), 0)),\n       REPEAT(\' \', @max_label_len - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < @one_unit, \'.\', IF(@count_in_bucket < @two_unit, \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(\', ROUND((@bucket_size * 4) / @unit_div), \' - \', ROUND((@bucket_size * 5) / @unit_div), @unit, \')\'),\n                        REPEAT(\' \', @max_label_size - LENGTH(@label_inner)),\n                        @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                      FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                     WHERE b1.avg_us > @bucket_size * 4 AND b1.avg_us <= @bucket_size * 5), 0)),\n       REPEAT(\' \', @max_label_len - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < @one_unit, \'.\', IF(@count_in_bucket < @two_unit, \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(\', ROUND((@bucket_size * 5) / @unit_div), \' - \', ROUND((@bucket_size * 6) / @unit_div), @unit, \')\'),\n                        REPEAT(\' \', @max_label_size - LENGTH(@label_inner)),\n                        @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                      FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                     WHERE b1.avg_us > @bucket_size * 5 AND b1.avg_us <= @bucket_size * 6), 0)),\n       REPEAT(\' \', @max_label_len - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < @one_unit, \'.\', IF(@count_in_bucket < @two_unit, \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(\', ROUND((@bucket_size * 6) / @unit_div), \' - \', ROUND((@bucket_size * 7) / @unit_div), @unit, \')\'),\n                        REPEAT(\' \', @max_label_size - LENGTH(@label_inner)),\n                        @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                      FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                     WHERE b1.avg_us > @bucket_size * 6 AND b1.avg_us <= @bucket_size * 7), 0)),\n       REPEAT(\' \', @max_label_len - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < @one_unit, \'.\', IF(@count_in_bucket < @two_unit, \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(\', ROUND((@bucket_size * 7) / @unit_div), \' - \', ROUND((@bucket_size * 8) / @unit_div), @unit, \')\'),\n                        REPEAT(\' \', @max_label_size - LENGTH(@label_inner)),\n                        @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                      FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                     WHERE b1.avg_us > @bucket_size * 7 AND b1.avg_us <= @bucket_size * 8), 0)),\n       REPEAT(\' \', @max_label_len - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < @one_unit, \'.\', IF(@count_in_bucket < @two_unit, \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(\', ROUND((@bucket_size * 8) / @unit_div), \' - \', ROUND((@bucket_size * 9) / @unit_div), @unit, \')\'),\n                        REPEAT(\' \', @max_label_size - LENGTH(@label_inner)),\n                        @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                      FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                     WHERE b1.avg_us > @bucket_size * 8 AND b1.avg_us <= @bucket_size * 9), 0)),\n       REPEAT(\' \', @max_label_len - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < @one_unit, \'.\', IF(@count_in_bucket < @two_unit, \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(\', ROUND((@bucket_size * 9) / @unit_div), \' - \', ROUND((@bucket_size * 10) / @unit_div), @unit, \')\'),\n                         REPEAT(\' \', @max_label_size - LENGTH(@label_inner)),\n                         @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                       FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                      WHERE b1.avg_us > @bucket_size * 9 AND b1.avg_us <= @bucket_size * 10), 0)),\n       REPEAT(\' \', @max_label_len - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < @one_unit, \'.\', IF(@count_in_bucket < @two_unit, \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(\', ROUND((@bucket_size * 10) / @unit_div), \' - \', ROUND((@bucket_size * 11) / @unit_div), @unit, \')\'),\n                        REPEAT(\' \', @max_label_size - LENGTH(@label_inner)),\n                        @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                      FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                     WHERE b1.avg_us > @bucket_size * 10 AND b1.avg_us <= @bucket_size * 11), 0)),\n       REPEAT(\' \', @max_label_len - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < @one_unit, \'.\', IF(@count_in_bucket < @two_unit, \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(\', ROUND((@bucket_size * 11) / @unit_div), \' - \', ROUND((@bucket_size * 12) / @unit_div), @unit, \')\'),\n                        REPEAT(\' \', @max_label_size - LENGTH(@label_inner)),\n                        @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                      FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                     WHERE b1.avg_us > @bucket_size * 11 AND b1.avg_us <= @bucket_size * 12), 0)),\n       REPEAT(\' \', @max_label_len - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < @one_unit, \'.\', IF(@count_in_bucket < @two_unit, \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(\', ROUND((@bucket_size * 12) / @unit_div), \' - \', ROUND((@bucket_size * 13) / @unit_div), @unit, \')\'),\n                        REPEAT(\' \', @max_label_size - LENGTH(@label_inner)),\n                        @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                      FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                     WHERE b1.avg_us > @bucket_size * 12 AND b1.avg_us <= @bucket_size * 13), 0)),\n       REPEAT(\' \', @max_label_len - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < @one_unit, \'.\', IF(@count_in_bucket < @two_unit, \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(\', ROUND((@bucket_size * 13) / @unit_div), \' - \', ROUND((@bucket_size * 14) / @unit_div), @unit, \')\'),\n                        REPEAT(\' \', @max_label_size - LENGTH(@label_inner)),\n                        @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                      FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                     WHERE b1.avg_us > @bucket_size * 13 AND b1.avg_us <= @bucket_size * 14), 0)),\n       REPEAT(\' \', @max_label_len - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < @one_unit, \'.\', IF(@count_in_bucket < @two_unit, \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(\', ROUND((@bucket_size * 14) / @unit_div), \' - \', ROUND((@bucket_size * 15) / @unit_div), @unit, \')\'),\n                        REPEAT(\' \', @max_label_size - LENGTH(@label_inner)),\n                        @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                      FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                     WHERE b1.avg_us > @bucket_size * 14 AND b1.avg_us <= @bucket_size * 15), 0)),\n       REPEAT(\' \', @max_label_len - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < @one_unit, \'.\', IF(@count_in_bucket < @two_unit, \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(\', ROUND((@bucket_size * 15) / @unit_div), \' - \', ROUND((@bucket_size * 16) / @unit_div), @unit, \')\'),\n                        REPEAT(\' \', @max_label_size - LENGTH(@label_inner)),\n                        @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                      FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                     WHERE b1.avg_us > @bucket_size * 15 AND b1.avg_us <= @bucket_size * 16), 0)),\n       REPEAT(\' \', @max_label_len - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < @one_unit, \'.\', IF(@count_in_bucket < @two_unit, \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       \'\\n\\n  Total Statements: \', @total_queries, \'; Buckets: \', @buckets , \'; Bucket Size: \', ROUND(@bucket_size / @unit_div) , \' \', @unit, \';\\n\'\n      ) AS `Performance Schema Statement Digest Average Latency Histogram`;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Outputs a textual histogram graph of the average latency values\n             across all normalized queries tracked within the Performance Schema\n             events_statements_summary_by_digest table.\n             Can be used to show a very high level picture of what kind of\n             latency distribution statements running within this instance have.\n             Parameters\n             None.\n             Example\n             mysql> CALL sys.ps_statement_avg_latency_histogram()\\G\n             *************************** 1. row ***************************\n             Performance Schema Statement Digest Average Latency Histogram:\n               . = 1 unit\n               * = 2 units\n               # = 3 units\n             (0 - 38ms)     240 | ################################################################################\n             (38 - 77ms)    38  | ......................................\n             (77 - 115ms)   3   | ...\n             (115 - 154ms)  62  | *******************************\n             (154 - 192ms)  3   | ...\n             (192 - 231ms)  0   |\n             (231 - 269ms)  0   |\n             (269 - 307ms)  0   |\n             (307 - 346ms)  0   |\n             (346 - 384ms)  1   | .\n             (384 - 423ms)  1   | .\n             (423 - 461ms)  0   |\n             (461 - 499ms)  0   |\n             (499 - 538ms)  0   |\n             (538 - 576ms)  0   |\n             (576 - 615ms)  1   | .\n               Total Statements: 350; Buckets: 16; Bucket Size: 38 ms;\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\nSELECT CONCAT(\'\\n\',\n       \'\\n  . = 1 unit\',\n       \'\\n  * = 2 units\',\n       \'\\n  # = 3 units\\n\',\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(0 - \',\n                                               ROUND((@bucket_size := (SELECT ROUND((MAX(avg_us) - MIN(avg_us)) / (@buckets := 16)) AS size\n                                                                         FROM sys.x$ps_digest_avg_latency_distribution)) / (@unit_div := 1000)),\n                                                (@unit := \'ms\'), \')\'),\n                        REPEAT(\' \', (@max_label_size := ((1 + LENGTH(ROUND((@bucket_size * 15) / @unit_div)) + 3 + LENGTH(ROUND(@bucket_size * 16) / @unit_div)) + 1)) - LENGTH(@label_inner)),\n                        @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                      FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                     WHERE b1.avg_us <= @bucket_size), 0)),\n       REPEAT(\' \', (@max_label_len := (@max_label_size + LENGTH((@total_queries := (SELECT SUM(cnt) FROM sys.x$ps_digest_avg_latency_distribution)))) + 1) - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < (@one_unit := 40), \'.\', IF(@count_in_bucket < (@two_unit := 80), \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(\', ROUND(@bucket_size / @unit_div), \' - \', ROUND((@bucket_size * 2) / @unit_div), @unit, \')\'),\n                        REPEAT(\' \', @max_label_size - LENGTH(@label_inner)),\n                        @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                      FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                     WHERE b1.avg_us > @bucket_size AND b1.avg_us <= @bucket_size * 2), 0)),\n       REPEAT(\' \', @max_label_len - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < @one_unit, \'.\', IF(@count_in_bucket < @two_unit, \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(\', ROUND((@bucket_size * 2) / @unit_div), \' - \', ROUND((@bucket_size * 3) / @unit_div), @unit, \')\'),\n                        REPEAT(\' \', @max_label_size - LENGTH(@label_inner)),\n                        @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                      FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                     WHERE b1.avg_us > @bucket_size * 2 AND b1.avg_us <= @bucket_size * 3), 0)),\n       REPEAT(\' \', @max_label_len - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < @one_unit, \'.\', IF(@count_in_bucket < @two_unit, \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(\', ROUND((@bucket_size * 3) / @unit_div), \' - \', ROUND((@bucket_size * 4) / @unit_div), @unit, \')\'),\n                        REPEAT(\' \', @max_label_size - LENGTH(@label_inner)),\n                        @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                      FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                     WHERE b1.avg_us > @bucket_size * 3 AND b1.avg_us <= @bucket_size * 4), 0)),\n       REPEAT(\' \', @max_label_len - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < @one_unit, \'.\', IF(@count_in_bucket < @two_unit, \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(\', ROUND((@bucket_size * 4) / @unit_div), \' - \', ROUND((@bucket_size * 5) / @unit_div), @unit, \')\'),\n                        REPEAT(\' \', @max_label_size - LENGTH(@label_inner)),\n                        @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                      FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                     WHERE b1.avg_us > @bucket_size * 4 AND b1.avg_us <= @bucket_size * 5), 0)),\n       REPEAT(\' \', @max_label_len - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < @one_unit, \'.\', IF(@count_in_bucket < @two_unit, \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(\', ROUND((@bucket_size * 5) / @unit_div), \' - \', ROUND((@bucket_size * 6) / @unit_div), @unit, \')\'),\n                        REPEAT(\' \', @max_label_size - LENGTH(@label_inner)),\n                        @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                      FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                     WHERE b1.avg_us > @bucket_size * 5 AND b1.avg_us <= @bucket_size * 6), 0)),\n       REPEAT(\' \', @max_label_len - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < @one_unit, \'.\', IF(@count_in_bucket < @two_unit, \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(\', ROUND((@bucket_size * 6) / @unit_div), \' - \', ROUND((@bucket_size * 7) / @unit_div), @unit, \')\'),\n                        REPEAT(\' \', @max_label_size - LENGTH(@label_inner)),\n                        @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                      FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                     WHERE b1.avg_us > @bucket_size * 6 AND b1.avg_us <= @bucket_size * 7), 0)),\n       REPEAT(\' \', @max_label_len - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < @one_unit, \'.\', IF(@count_in_bucket < @two_unit, \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(\', ROUND((@bucket_size * 7) / @unit_div), \' - \', ROUND((@bucket_size * 8) / @unit_div), @unit, \')\'),\n                        REPEAT(\' \', @max_label_size - LENGTH(@label_inner)),\n                        @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                      FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                     WHERE b1.avg_us > @bucket_size * 7 AND b1.avg_us <= @bucket_size * 8), 0)),\n       REPEAT(\' \', @max_label_len - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < @one_unit, \'.\', IF(@count_in_bucket < @two_unit, \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(\', ROUND((@bucket_size * 8) / @unit_div), \' - \', ROUND((@bucket_size * 9) / @unit_div), @unit, \')\'),\n                        REPEAT(\' \', @max_label_size - LENGTH(@label_inner)),\n                        @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                      FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                     WHERE b1.avg_us > @bucket_size * 8 AND b1.avg_us <= @bucket_size * 9), 0)),\n       REPEAT(\' \', @max_label_len - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < @one_unit, \'.\', IF(@count_in_bucket < @two_unit, \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(\', ROUND((@bucket_size * 9) / @unit_div), \' - \', ROUND((@bucket_size * 10) / @unit_div), @unit, \')\'),\n                         REPEAT(\' \', @max_label_size - LENGTH(@label_inner)),\n                         @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                       FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                      WHERE b1.avg_us > @bucket_size * 9 AND b1.avg_us <= @bucket_size * 10), 0)),\n       REPEAT(\' \', @max_label_len - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < @one_unit, \'.\', IF(@count_in_bucket < @two_unit, \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(\', ROUND((@bucket_size * 10) / @unit_div), \' - \', ROUND((@bucket_size * 11) / @unit_div), @unit, \')\'),\n                        REPEAT(\' \', @max_label_size - LENGTH(@label_inner)),\n                        @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                      FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                     WHERE b1.avg_us > @bucket_size * 10 AND b1.avg_us <= @bucket_size * 11), 0)),\n       REPEAT(\' \', @max_label_len - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < @one_unit, \'.\', IF(@count_in_bucket < @two_unit, \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(\', ROUND((@bucket_size * 11) / @unit_div), \' - \', ROUND((@bucket_size * 12) / @unit_div), @unit, \')\'),\n                        REPEAT(\' \', @max_label_size - LENGTH(@label_inner)),\n                        @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                      FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                     WHERE b1.avg_us > @bucket_size * 11 AND b1.avg_us <= @bucket_size * 12), 0)),\n       REPEAT(\' \', @max_label_len - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < @one_unit, \'.\', IF(@count_in_bucket < @two_unit, \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(\', ROUND((@bucket_size * 12) / @unit_div), \' - \', ROUND((@bucket_size * 13) / @unit_div), @unit, \')\'),\n                        REPEAT(\' \', @max_label_size - LENGTH(@label_inner)),\n                        @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                      FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                     WHERE b1.avg_us > @bucket_size * 12 AND b1.avg_us <= @bucket_size * 13), 0)),\n       REPEAT(\' \', @max_label_len - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < @one_unit, \'.\', IF(@count_in_bucket < @two_unit, \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(\', ROUND((@bucket_size * 13) / @unit_div), \' - \', ROUND((@bucket_size * 14) / @unit_div), @unit, \')\'),\n                        REPEAT(\' \', @max_label_size - LENGTH(@label_inner)),\n                        @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                      FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                     WHERE b1.avg_us > @bucket_size * 13 AND b1.avg_us <= @bucket_size * 14), 0)),\n       REPEAT(\' \', @max_label_len - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < @one_unit, \'.\', IF(@count_in_bucket < @two_unit, \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(\', ROUND((@bucket_size * 14) / @unit_div), \' - \', ROUND((@bucket_size * 15) / @unit_div), @unit, \')\'),\n                        REPEAT(\' \', @max_label_size - LENGTH(@label_inner)),\n                        @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                      FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                     WHERE b1.avg_us > @bucket_size * 14 AND b1.avg_us <= @bucket_size * 15), 0)),\n       REPEAT(\' \', @max_label_len - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < @one_unit, \'.\', IF(@count_in_bucket < @two_unit, \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       @label := CONCAT(@label_inner := CONCAT(\'\\n(\', ROUND((@bucket_size * 15) / @unit_div), \' - \', ROUND((@bucket_size * 16) / @unit_div), @unit, \')\'),\n                        REPEAT(\' \', @max_label_size - LENGTH(@label_inner)),\n                        @count_in_bucket := IFNULL((SELECT SUM(cnt)\n                                                      FROM sys.x$ps_digest_avg_latency_distribution AS b1\n                                                     WHERE b1.avg_us > @bucket_size * 15 AND b1.avg_us <= @bucket_size * 16), 0)),\n       REPEAT(\' \', @max_label_len - LENGTH(@label)), \'| \',\n       IFNULL(REPEAT(IF(@count_in_bucket < @one_unit, \'.\', IF(@count_in_bucket < @two_unit, \'*\', \'#\')),\n       	             IF(@count_in_bucket < @one_unit, @count_in_bucket,\n       	             	IF(@count_in_bucket < @two_unit, @count_in_bucket / 2, @count_in_bucket / 3))), \'\'),\n       \'\\n\\n  Total Statements: \', @total_queries, \'; Buckets: \', @buckets , \'; Bucket Size: \', ROUND(@bucket_size / @unit_div) , \' \', @unit, \';\\n\'\n      ) AS `Performance Schema Statement Digest Average Latency Histogram`;\nEND','NONE'),('sys','ps_trace_statement_digest','PROCEDURE','ps_trace_statement_digest','SQL','MODIFIES_SQL_DATA','NO','INVOKER','\n        IN in_digest VARCHAR(32),\n        IN in_runtime INT,\n        IN in_interval DECIMAL(2,2),\n        IN in_start_fresh BOOLEAN,\n        IN in_auto_enable BOOLEAN\n    ','','BEGIN\n    DECLARE v_start_fresh BOOLEAN DEFAULT false;\n    DECLARE v_auto_enable BOOLEAN DEFAULT false;\n    DECLARE v_explain     BOOLEAN DEFAULT true;\n    DECLARE v_this_thread_enabed ENUM(\'YES\', \'NO\');\n    DECLARE v_runtime INT DEFAULT 0;\n    DECLARE v_start INT DEFAULT 0;\n    DECLARE v_found_stmts INT;\n    SET @log_bin := @@sql_log_bin;\n    SET sql_log_bin = 0;\n    SELECT INSTRUMENTED INTO v_this_thread_enabed FROM performance_schema.threads WHERE PROCESSLIST_ID = CONNECTION_ID();\n    CALL sys.ps_setup_disable_thread(CONNECTION_ID());\n    DROP TEMPORARY TABLE IF EXISTS stmt_trace;\n    CREATE TEMPORARY TABLE stmt_trace (\n        thread_id BIGINT UNSIGNED,\n        timer_start BIGINT UNSIGNED,\n        event_id BIGINT UNSIGNED,\n        sql_text longtext,\n        timer_wait BIGINT UNSIGNED,\n        lock_time BIGINT UNSIGNED,\n        errors BIGINT UNSIGNED,\n        mysql_errno INT,\n        rows_sent BIGINT UNSIGNED,\n        rows_affected BIGINT UNSIGNED,\n        rows_examined BIGINT UNSIGNED,\n        created_tmp_tables BIGINT UNSIGNED,\n        created_tmp_disk_tables BIGINT UNSIGNED,\n        no_index_used BIGINT UNSIGNED,\n        PRIMARY KEY (thread_id, timer_start)\n    );\n    DROP TEMPORARY TABLE IF EXISTS stmt_stages;\n    CREATE TEMPORARY TABLE stmt_stages (\n       event_id BIGINT UNSIGNED,\n       stmt_id BIGINT UNSIGNED,\n       event_name VARCHAR(128),\n       timer_wait BIGINT UNSIGNED,\n       PRIMARY KEY (event_id)\n    );\n    SET v_start_fresh = in_start_fresh;\n    IF v_start_fresh THEN\n        TRUNCATE TABLE performance_schema.events_statements_history_long;\n        TRUNCATE TABLE performance_schema.events_stages_history_long;\n    END IF;\n    SET v_auto_enable = in_auto_enable;\n    IF v_auto_enable THEN\n        CALL sys.ps_setup_save(0);\n        UPDATE performance_schema.threads\n           SET INSTRUMENTED = IF(PROCESSLIST_ID IS NOT NULL, \'YES\', \'NO\');\n        UPDATE performance_schema.setup_consumers\n           SET ENABLED = \'YES\'\n         WHERE NAME NOT LIKE \'%\\_history\'\n               AND NAME NOT LIKE \'events_wait%\'\n               AND NAME NOT LIKE \'events_transactions%\'\n               AND NAME <> \'statements_digest\';\n        UPDATE performance_schema.setup_instruments\n           SET ENABLED = \'YES\',\n               TIMED   = \'YES\'\n         WHERE NAME LIKE \'statement/%\' OR NAME LIKE \'stage/%\';\n    END IF;\n    WHILE v_runtime < in_runtime DO\n        SELECT UNIX_TIMESTAMP() INTO v_start;\n        INSERT IGNORE INTO stmt_trace\n        SELECT thread_id, timer_start, event_id, sql_text, timer_wait, lock_time, errors, mysql_errno,\n               rows_sent, rows_affected, rows_examined, created_tmp_tables, created_tmp_disk_tables, no_index_used\n          FROM performance_schema.events_statements_history_long\n        WHERE digest = in_digest;\n        INSERT IGNORE INTO stmt_stages\n        SELECT stages.event_id, stmt_trace.event_id,\n               stages.event_name, stages.timer_wait\n          FROM performance_schema.events_stages_history_long AS stages\n          JOIN stmt_trace ON stages.nesting_event_id = stmt_trace.event_id;\n        SELECT SLEEP(in_interval) INTO @sleep;\n        SET v_runtime = v_runtime + (UNIX_TIMESTAMP() - v_start);\n    END WHILE;\n    SELECT \"SUMMARY STATISTICS\";\n    SELECT COUNT(*) executions,\n           sys.format_time(SUM(timer_wait)) AS exec_time,\n           sys.format_time(SUM(lock_time)) AS lock_time,\n           SUM(rows_sent) AS rows_sent,\n           SUM(rows_affected) AS rows_affected,\n           SUM(rows_examined) AS rows_examined,\n           SUM(created_tmp_tables) AS tmp_tables,\n           SUM(no_index_used) AS full_scans\n      FROM stmt_trace;\n    SELECT event_name,\n           COUNT(*) as count,\n           sys.format_time(SUM(timer_wait)) as latency\n      FROM stmt_stages\n     GROUP BY event_name\n     ORDER BY SUM(timer_wait) DESC;\n    SELECT \"LONGEST RUNNING STATEMENT\";\n    SELECT thread_id,\n           sys.format_time(timer_wait) AS exec_time,\n           sys.format_time(lock_time) AS lock_time,\n           rows_sent,\n           rows_affected,\n           rows_examined,\n           created_tmp_tables AS tmp_tables,\n           no_index_used AS full_scan\n      FROM stmt_trace\n     ORDER BY timer_wait DESC LIMIT 1;\n    SELECT sql_text\n      FROM stmt_trace\n     ORDER BY timer_wait DESC LIMIT 1;\n    SELECT sql_text, event_id INTO @sql, @sql_id\n      FROM stmt_trace\n    ORDER BY timer_wait DESC LIMIT 1;\n    IF (@sql_id IS NOT NULL) THEN\n        SELECT event_name,\n               sys.format_time(timer_wait) as latency\n          FROM stmt_stages\n         WHERE stmt_id = @sql_id\n         ORDER BY event_id;\n    END IF;\n    DROP TEMPORARY TABLE stmt_trace;\n    DROP TEMPORARY TABLE stmt_stages;\n    IF (@sql IS NOT NULL) THEN\n        SET @stmt := CONCAT(\"EXPLAIN FORMAT=JSON \", @sql);\n        BEGIN\n            DECLARE CONTINUE HANDLER FOR 1064, 1146 SET v_explain = false;\n            PREPARE explain_stmt FROM @stmt;\n        END;\n        IF (v_explain) THEN\n            EXECUTE explain_stmt;\n            DEALLOCATE PREPARE explain_stmt;\n        END IF;\n    END IF;\n    IF v_auto_enable THEN\n        CALL sys.ps_setup_reload_saved();\n    END IF;\n    IF (v_this_thread_enabed = \'YES\') THEN\n        CALL sys.ps_setup_enable_thread(CONNECTION_ID());\n    END IF;\n    SET sql_log_bin = @log_bin;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Traces all instrumentation within Performance Schema for a specific\n             Statement Digest.\n             When finding a statement of interest within the\n             performance_schema.events_statements_summary_by_digest table, feed\n             the DIGEST MD5 value in to this procedure, set how long to poll for,\n             and at what interval to poll, and it will generate a report of all\n             statistics tracked within Performance Schema for that digest for the\n             interval.\n             It will also attempt to generate an EXPLAIN for the longest running\n             example of the digest during the interval. Note this may fail, as:\n                * Performance Schema truncates long SQL_TEXT values (and hence the\n                  EXPLAIN will fail due to parse errors)\n                * the default schema is sys (so tables that are not fully qualified\n                  in the query may not be found)\n                * some queries such as SHOW are not supported in EXPLAIN.\n             When the EXPLAIN fails, the error will be ignored and no EXPLAIN\n             output generated.\n             Requires the SUPER privilege for \"SET sql_log_bin = 0;\".\n             Parameters\n             in_digest (VARCHAR(32)):\n               The statement digest identifier you would like to analyze\n             in_runtime (INT):\n               The number of seconds to run analysis for\n             in_interval (DECIMAL(2,2)):\n               The interval (in seconds, may be fractional) at which to try\n               and take snapshots\n             in_start_fresh (BOOLEAN):\n               Whether to TRUNCATE the events_statements_history_long and\n               events_stages_history_long tables before starting\n             in_auto_enable (BOOLEAN):\n               Whether to automatically turn on required consumers\n             Example\n             mysql> call ps_trace_statement_digest(\'891ec6860f98ba46d89dd20b0c03652c\', 10, 0.1, true, true);\n             +--------------------+\n             | SUMMARY STATISTICS |\n             +--------------------+\n             | SUMMARY STATISTICS |\n             +--------------------+\n             1 row in set (9.11 sec)\n             +------------+-----------+-----------+-----------+---------------+------------+------------+\n             | executions | exec_time | lock_time | rows_sent | rows_examined | tmp_tables | full_scans |\n             +------------+-----------+-----------+-----------+---------------+------------+------------+\n             |         21 | 4.11 ms   | 2.00 ms   |         0 |            21 |          0 |          0 |\n             +------------+-----------+-----------+-----------+---------------+------------+------------+\n             1 row in set (9.11 sec)\n             +------------------------------------------+-------+-----------+\n             | event_name                               | count | latency   |\n             +------------------------------------------+-------+-----------+\n             | stage/sql/checking query cache for query |    16 | 724.37 us |\n             | stage/sql/statistics                     |    16 | 546.92 us |\n             | stage/sql/freeing items                  |    18 | 520.11 us |\n             | stage/sql/init                           |    51 | 466.80 us |\n             ...\n             | stage/sql/cleaning up                    |    18 | 11.92 us  |\n             | stage/sql/executing                      |    16 | 6.95 us   |\n             +------------------------------------------+-------+-----------+\n             17 rows in set (9.12 sec)\n             +---------------------------+\n             | LONGEST RUNNING STATEMENT |\n             +---------------------------+\n             | LONGEST RUNNING STATEMENT |\n             +---------------------------+\n             1 row in set (9.16 sec)\n             +-----------+-----------+-----------+-----------+---------------+------------+-----------+\n             | thread_id | exec_time | lock_time | rows_sent | rows_examined | tmp_tables | full_scan |\n             +-----------+-----------+-----------+-----------+---------------+------------+-----------+\n             |    166646 | 618.43 us | 1.00 ms   |         0 |             1 |          0 |         0 |\n             +-----------+-----------+-----------+-----------+---------------+------------+-----------+\n             1 row in set (9.16 sec)\n             // Truncated for clarity...\n             +-----------------------------------------------------------------+\n             | sql_text                                                        |\n             +-----------------------------------------------------------------+\n             | select hibeventhe0_.id as id1382_, hibeventhe0_.createdTime ... |\n             +-----------------------------------------------------------------+\n             1 row in set (9.17 sec)\n             +------------------------------------------+-----------+\n             | event_name                               | latency   |\n             +------------------------------------------+-----------+\n             | stage/sql/init                           | 8.61 us   |\n             | stage/sql/Waiting for query cache lock   | 453.23 us |\n             | stage/sql/init                           | 331.07 ns |\n             | stage/sql/checking query cache for query | 43.04 us  |\n             ...\n             | stage/sql/freeing items                  | 30.46 us  |\n             | stage/sql/cleaning up                    | 662.13 ns |\n             +------------------------------------------+-----------+\n             18 rows in set (9.23 sec)\n             +----+-------------+--------------+-------+---------------+-----------+---------+-------------+------+-------+\n             | id | select_type | table        | type  | possible_keys | key       | key_len | ref         | rows | Extra |\n             +----+-------------+--------------+-------+---------------+-----------+---------+-------------+------+-------+\n             |  1 | SIMPLE      | hibeventhe0_ | const | fixedTime     | fixedTime | 775     | const,const |    1 | NULL  |\n             +----+-------------+--------------+-------+---------------+-----------+---------+-------------+------+-------+\n             1 row in set (9.27 sec)\n             Query OK, 0 rows affected (9.28 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    DECLARE v_start_fresh BOOLEAN DEFAULT false;\n    DECLARE v_auto_enable BOOLEAN DEFAULT false;\n    DECLARE v_explain     BOOLEAN DEFAULT true;\n    DECLARE v_this_thread_enabed ENUM(\'YES\', \'NO\');\n    DECLARE v_runtime INT DEFAULT 0;\n    DECLARE v_start INT DEFAULT 0;\n    DECLARE v_found_stmts INT;\n    SET @log_bin := @@sql_log_bin;\n    SET sql_log_bin = 0;\n    SELECT INSTRUMENTED INTO v_this_thread_enabed FROM performance_schema.threads WHERE PROCESSLIST_ID = CONNECTION_ID();\n    CALL sys.ps_setup_disable_thread(CONNECTION_ID());\n    DROP TEMPORARY TABLE IF EXISTS stmt_trace;\n    CREATE TEMPORARY TABLE stmt_trace (\n        thread_id BIGINT UNSIGNED,\n        timer_start BIGINT UNSIGNED,\n        event_id BIGINT UNSIGNED,\n        sql_text longtext,\n        timer_wait BIGINT UNSIGNED,\n        lock_time BIGINT UNSIGNED,\n        errors BIGINT UNSIGNED,\n        mysql_errno INT,\n        rows_sent BIGINT UNSIGNED,\n        rows_affected BIGINT UNSIGNED,\n        rows_examined BIGINT UNSIGNED,\n        created_tmp_tables BIGINT UNSIGNED,\n        created_tmp_disk_tables BIGINT UNSIGNED,\n        no_index_used BIGINT UNSIGNED,\n        PRIMARY KEY (thread_id, timer_start)\n    );\n    DROP TEMPORARY TABLE IF EXISTS stmt_stages;\n    CREATE TEMPORARY TABLE stmt_stages (\n       event_id BIGINT UNSIGNED,\n       stmt_id BIGINT UNSIGNED,\n       event_name VARCHAR(128),\n       timer_wait BIGINT UNSIGNED,\n       PRIMARY KEY (event_id)\n    );\n    SET v_start_fresh = in_start_fresh;\n    IF v_start_fresh THEN\n        TRUNCATE TABLE performance_schema.events_statements_history_long;\n        TRUNCATE TABLE performance_schema.events_stages_history_long;\n    END IF;\n    SET v_auto_enable = in_auto_enable;\n    IF v_auto_enable THEN\n        CALL sys.ps_setup_save(0);\n        UPDATE performance_schema.threads\n           SET INSTRUMENTED = IF(PROCESSLIST_ID IS NOT NULL, \'YES\', \'NO\');\n        UPDATE performance_schema.setup_consumers\n           SET ENABLED = \'YES\'\n         WHERE NAME NOT LIKE \'%\\_history\'\n               AND NAME NOT LIKE \'events_wait%\'\n               AND NAME NOT LIKE \'events_transactions%\'\n               AND NAME <> \'statements_digest\';\n        UPDATE performance_schema.setup_instruments\n           SET ENABLED = \'YES\',\n               TIMED   = \'YES\'\n         WHERE NAME LIKE \'statement/%\' OR NAME LIKE \'stage/%\';\n    END IF;\n    WHILE v_runtime < in_runtime DO\n        SELECT UNIX_TIMESTAMP() INTO v_start;\n        INSERT IGNORE INTO stmt_trace\n        SELECT thread_id, timer_start, event_id, sql_text, timer_wait, lock_time, errors, mysql_errno,\n               rows_sent, rows_affected, rows_examined, created_tmp_tables, created_tmp_disk_tables, no_index_used\n          FROM performance_schema.events_statements_history_long\n        WHERE digest = in_digest;\n        INSERT IGNORE INTO stmt_stages\n        SELECT stages.event_id, stmt_trace.event_id,\n               stages.event_name, stages.timer_wait\n          FROM performance_schema.events_stages_history_long AS stages\n          JOIN stmt_trace ON stages.nesting_event_id = stmt_trace.event_id;\n        SELECT SLEEP(in_interval) INTO @sleep;\n        SET v_runtime = v_runtime + (UNIX_TIMESTAMP() - v_start);\n    END WHILE;\n    SELECT \"SUMMARY STATISTICS\";\n    SELECT COUNT(*) executions,\n           sys.format_time(SUM(timer_wait)) AS exec_time,\n           sys.format_time(SUM(lock_time)) AS lock_time,\n           SUM(rows_sent) AS rows_sent,\n           SUM(rows_affected) AS rows_affected,\n           SUM(rows_examined) AS rows_examined,\n           SUM(created_tmp_tables) AS tmp_tables,\n           SUM(no_index_used) AS full_scans\n      FROM stmt_trace;\n    SELECT event_name,\n           COUNT(*) as count,\n           sys.format_time(SUM(timer_wait)) as latency\n      FROM stmt_stages\n     GROUP BY event_name\n     ORDER BY SUM(timer_wait) DESC;\n    SELECT \"LONGEST RUNNING STATEMENT\";\n    SELECT thread_id,\n           sys.format_time(timer_wait) AS exec_time,\n           sys.format_time(lock_time) AS lock_time,\n           rows_sent,\n           rows_affected,\n           rows_examined,\n           created_tmp_tables AS tmp_tables,\n           no_index_used AS full_scan\n      FROM stmt_trace\n     ORDER BY timer_wait DESC LIMIT 1;\n    SELECT sql_text\n      FROM stmt_trace\n     ORDER BY timer_wait DESC LIMIT 1;\n    SELECT sql_text, event_id INTO @sql, @sql_id\n      FROM stmt_trace\n    ORDER BY timer_wait DESC LIMIT 1;\n    IF (@sql_id IS NOT NULL) THEN\n        SELECT event_name,\n               sys.format_time(timer_wait) as latency\n          FROM stmt_stages\n         WHERE stmt_id = @sql_id\n         ORDER BY event_id;\n    END IF;\n    DROP TEMPORARY TABLE stmt_trace;\n    DROP TEMPORARY TABLE stmt_stages;\n    IF (@sql IS NOT NULL) THEN\n        SET @stmt := CONCAT(\"EXPLAIN FORMAT=JSON \", @sql);\n        BEGIN\n            DECLARE CONTINUE HANDLER FOR 1064, 1146 SET v_explain = false;\n            PREPARE explain_stmt FROM @stmt;\n        END;\n        IF (v_explain) THEN\n            EXECUTE explain_stmt;\n            DEALLOCATE PREPARE explain_stmt;\n        END IF;\n    END IF;\n    IF v_auto_enable THEN\n        CALL sys.ps_setup_reload_saved();\n    END IF;\n    IF (v_this_thread_enabed = \'YES\') THEN\n        CALL sys.ps_setup_enable_thread(CONNECTION_ID());\n    END IF;\n    SET sql_log_bin = @log_bin;\nEND','NONE'),('sys','ps_trace_thread','PROCEDURE','ps_trace_thread','SQL','MODIFIES_SQL_DATA','NO','INVOKER','\n        IN in_thread_id BIGINT UNSIGNED,\n        IN in_outfile VARCHAR(255),\n        IN in_max_runtime DECIMAL(20,2),\n        IN in_interval DECIMAL(20,2),\n        IN in_start_fresh BOOLEAN,\n        IN in_auto_setup BOOLEAN,\n        IN in_debug BOOLEAN\n    ','','BEGIN\n    DECLARE v_done bool DEFAULT FALSE;\n    DECLARE v_start, v_runtime DECIMAL(20,2) DEFAULT 0.0;\n    DECLARE v_min_event_id bigint unsigned DEFAULT 0;\n    DECLARE v_this_thread_enabed ENUM(\'YES\', \'NO\');\n    DECLARE v_event longtext;\n    DECLARE c_stack CURSOR FOR\n        SELECT CONCAT(IF(nesting_event_id IS NOT NULL, CONCAT(nesting_event_id, \' -> \'), \'\'),\n                    event_id, \'; \', event_id, \' [label=\"\',\n                    \'(\', sys.format_time(timer_wait), \') \',\n                    IF (event_name NOT LIKE \'wait/io%\',\n                        SUBSTRING_INDEX(event_name, \'/\', -2),\n                        IF (event_name NOT LIKE \'wait/io/file%\' OR event_name NOT LIKE \'wait/io/socket%\',\n                            SUBSTRING_INDEX(event_name, \'/\', -4),\n                            event_name)\n                        ),\n                    IF (event_name LIKE \'statement/%\', IFNULL(CONCAT(\'\\\\n\', wait_info), \'\'), \'\'),\n                    IF (in_debug AND event_name LIKE \'wait%\', wait_info, \'\'),\n                    \'\", \',\n                    CASE WHEN event_name LIKE \'wait/io/file%\' THEN\n                           \'shape=box, style=filled, color=red\'\n                         WHEN event_name LIKE \'wait/io/table%\' THEN\n                           \'shape=box, style=filled, color=green\'\n                         WHEN event_name LIKE \'wait/io/socket%\' THEN\n                           \'shape=box, style=filled, color=yellow\'\n                         WHEN event_name LIKE \'wait/synch/mutex%\' THEN\n                           \'style=filled, color=lightskyblue\'\n                         WHEN event_name LIKE \'wait/synch/cond%\' THEN\n                           \'style=filled, color=darkseagreen3\'\n                         WHEN event_name LIKE \'wait/synch/rwlock%\' THEN\n                           \'style=filled, color=orchid\'\n                         WHEN event_name LIKE \'wait/lock%\' THEN\n                           \'shape=box, style=filled, color=tan\'\n                         WHEN event_name LIKE \'statement/%\' THEN\n                           CONCAT(\'shape=box, style=bold\',\n                                  CASE WHEN event_name LIKE \'statement/com/%\' THEN\n                                         \' style=filled, color=darkseagreen\'\n                                       ELSE\n                                         IF((timer_wait/1000000000000) > @@long_query_time,\n                                            \' style=filled, color=red\',\n                                            \' style=filled, color=lightblue\')\n                                  END\n                           )\n                         WHEN event_name LIKE \'stage/%\' THEN\n                           \'style=filled, color=slategray3\'\n                         WHEN event_name LIKE \'%idle%\' THEN\n                           \'shape=box, style=filled, color=firebrick3\'\n                         ELSE \'\' END,\n                     \'];\\n\'\n                   ) event, event_id\n        FROM (\n             (SELECT thread_id, event_id, event_name, timer_wait, timer_start, nesting_event_id,\n                     CONCAT(sql_text, \'\\\\n\',\n                            \'errors: \', errors, \'\\\\n\',\n                            \'warnings: \', warnings, \'\\\\n\',\n                            \'lock time: \', sys.format_time(lock_time),\'\\\\n\',\n                            \'rows affected: \', rows_affected, \'\\\\n\',\n                            \'rows sent: \', rows_sent, \'\\\\n\',\n                            \'rows examined: \', rows_examined, \'\\\\n\',\n                            \'tmp tables: \', created_tmp_tables, \'\\\\n\',\n                            \'tmp disk tables: \', created_tmp_disk_tables, \'\\\\n\'\n                            \'select scan: \', select_scan, \'\\\\n\',\n                            \'select full join: \', select_full_join, \'\\\\n\',\n                            \'select full range join: \', select_full_range_join, \'\\\\n\',\n                            \'select range: \', select_range, \'\\\\n\',\n                            \'select range check: \', select_range_check, \'\\\\n\',\n                            \'sort merge passes: \', sort_merge_passes, \'\\\\n\',\n                            \'sort rows: \', sort_rows, \'\\\\n\',\n                            \'sort range: \', sort_range, \'\\\\n\',\n                            \'sort scan: \', sort_scan, \'\\\\n\',\n                            \'no index used: \', IF(no_index_used, \'TRUE\', \'FALSE\'), \'\\\\n\',\n                            \'no good index used: \', IF(no_good_index_used, \'TRUE\', \'FALSE\'), \'\\\\n\'\n                     ) AS wait_info\n                FROM performance_schema.events_statements_history_long\n               WHERE thread_id = in_thread_id AND event_id > v_min_event_id)\n             UNION\n             (SELECT thread_id, event_id, event_name, timer_wait, timer_start, nesting_event_id, null AS wait_info\n                FROM performance_schema.events_stages_history_long\n               WHERE thread_id = in_thread_id AND event_id > v_min_event_id)\n             UNION\n             (SELECT thread_id, event_id,\n                     CONCAT(event_name,\n                            IF(event_name NOT LIKE \'wait/synch/mutex%\', IFNULL(CONCAT(\' - \', operation), \'\'), \'\'),\n                            IF(number_of_bytes IS NOT NULL, CONCAT(\' \', number_of_bytes, \' bytes\'), \'\'),\n                            IF(event_name LIKE \'wait/io/file%\', \'\\\\n\', \'\'),\n                            IF(object_schema IS NOT NULL, CONCAT(\'\\\\nObject: \', object_schema, \'.\'), \'\'),\n                            IF(object_name IS NOT NULL,\n                               IF (event_name LIKE \'wait/io/socket%\',\n                                   CONCAT(\'\\\\n\', IF (object_name LIKE \':0%\', @@socket, object_name)),\n                                   object_name),\n                               \'\'\n                            ),\n                            IF(index_name IS NOT NULL, CONCAT(\' Index: \', index_name), \'\'), \'\\\\n\'\n                     ) AS event_name,\n                     timer_wait, timer_start, nesting_event_id, source AS wait_info\n                FROM performance_schema.events_waits_history_long\n               WHERE thread_id = in_thread_id AND event_id > v_min_event_id)\n           ) events\n       ORDER BY event_id;\n    DECLARE CONTINUE HANDLER FOR NOT FOUND SET v_done = TRUE;\n    SET @log_bin := @@sql_log_bin;\n    SET sql_log_bin = 0;\n    SELECT INSTRUMENTED INTO v_this_thread_enabed FROM performance_schema.threads WHERE PROCESSLIST_ID = CONNECTION_ID();\n    CALL sys.ps_setup_disable_thread(CONNECTION_ID());\n    IF (in_auto_setup) THEN\n        CALL sys.ps_setup_save(0);\n        DELETE FROM performance_schema.setup_actors;\n        UPDATE performance_schema.threads\n           SET INSTRUMENTED = IF(THREAD_ID = in_thread_id, \'YES\', \'NO\');\n        UPDATE performance_schema.setup_consumers\n           SET ENABLED = \'YES\'\n         WHERE NAME NOT LIKE \'%\\_history\';\n        UPDATE performance_schema.setup_instruments\n           SET ENABLED = \'YES\',\n               TIMED   = \'YES\';\n    END IF;\n    IF (in_start_fresh) THEN\n        TRUNCATE performance_schema.events_statements_history_long;\n        TRUNCATE performance_schema.events_stages_history_long;\n        TRUNCATE performance_schema.events_waits_history_long;\n    END IF;\n    DROP TEMPORARY TABLE IF EXISTS tmp_events;\n    CREATE TEMPORARY TABLE tmp_events (\n      event_id bigint unsigned NOT NULL,\n      event longblob,\n      PRIMARY KEY (event_id)\n    );\n    INSERT INTO tmp_events VALUES (0, CONCAT(\'digraph events { rankdir=LR; nodesep=0.10;\\n\',\n                                             \'// Stack created .....: \', NOW(), \'\\n\',\n                                             \'// MySQL version .....: \', VERSION(), \'\\n\',\n                                             \'// MySQL hostname ....: \', @@hostname, \'\\n\',\n                                             \'// MySQL port ........: \', @@port, \'\\n\',\n                                             \'// MySQL socket ......: \', @@socket, \'\\n\',\n                                             \'// MySQL user ........: \', CURRENT_USER(), \'\\n\'));\n    SELECT CONCAT(\'Data collection starting for THREAD_ID = \', in_thread_id) AS \'Info\';\n    SET v_min_event_id = 0,\n        v_start        = UNIX_TIMESTAMP(),\n        in_interval    = IFNULL(in_interval, 1.00),\n        in_max_runtime = IFNULL(in_max_runtime, 60.00);\n    WHILE (v_runtime < in_max_runtime\n           AND (SELECT INSTRUMENTED FROM performance_schema.threads WHERE THREAD_ID = in_thread_id) = \'YES\') DO\n        SET v_done = FALSE;\n        OPEN c_stack;\n        c_stack_loop: LOOP\n            FETCH c_stack INTO v_event, v_min_event_id;\n            IF v_done THEN\n                LEAVE c_stack_loop;\n            END IF;\n            IF (LENGTH(v_event) > 0) THEN\n                INSERT INTO tmp_events VALUES (v_min_event_id, v_event);\n            END IF;\n        END LOOP;\n        CLOSE c_stack;\n        SELECT SLEEP(in_interval) INTO @sleep;\n        SET v_runtime = (UNIX_TIMESTAMP() - v_start);\n    END WHILE;\n    INSERT INTO tmp_events VALUES (v_min_event_id+1, \'}\');\n    SET @query = CONCAT(\'SELECT event FROM tmp_events ORDER BY event_id INTO OUTFILE \'\'\', in_outfile, \'\'\' FIELDS ESCAPED BY \'\'\'\' LINES TERMINATED BY \'\'\'\'\');\n    PREPARE stmt_output FROM @query;\n    EXECUTE stmt_output;\n    DEALLOCATE PREPARE stmt_output;\n    SELECT CONCAT(\'Stack trace written to \', in_outfile) AS \'Info\';\n    SELECT CONCAT(\'dot -Tpdf -o /tmp/stack_\', in_thread_id, \'.pdf \', in_outfile) AS \'Convert to PDF\';\n    SELECT CONCAT(\'dot -Tpng -o /tmp/stack_\', in_thread_id, \'.png \', in_outfile) AS \'Convert to PNG\';\n    DROP TEMPORARY TABLE tmp_events;\n    IF (in_auto_setup) THEN\n        CALL sys.ps_setup_reload_saved();\n    END IF;\n    IF (v_this_thread_enabed = \'YES\') THEN\n        CALL sys.ps_setup_enable_thread(CONNECTION_ID());\n    END IF;\n    SET sql_log_bin = @log_bin;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Dumps all data within Performance Schema for an instrumented thread,\n             to create a DOT formatted graph file.\n             Each resultset returned from the procedure should be used for a complete graph\n             Requires the SUPER privilege for \"SET sql_log_bin = 0;\".\n             Parameters\n             in_thread_id (BIGINT UNSIGNED):\n               The thread that you would like a stack trace for\n             in_outfile  (VARCHAR(255)):\n               The filename the dot file will be written to\n             in_max_runtime (DECIMAL(20,2)):\n               The maximum time to keep collecting data.\n               Use NULL to get the default which is 60 seconds.\n             in_interval (DECIMAL(20,2)):\n               How long to sleep between data collections.\n               Use NULL to get the default which is 1 second.\n             in_start_fresh (BOOLEAN):\n               Whether to reset all Performance Schema data before tracing.\n             in_auto_setup (BOOLEAN):\n               Whether to disable all other threads and enable all consumers/instruments.\n               This will also reset the settings at the end of the run.\n             in_debug (BOOLEAN):\n               Whether you would like to include file:lineno in the graph\n             Example\n             mysql> CALL sys.ps_trace_thread(25, CONCAT(\'/tmp/stack-\', REPLACE(NOW(), \' \', \'-\'), \'.dot\'), NULL, NULL, TRUE, TRUE, TRUE);\n             +-------------------+\n             | summary           |\n             +-------------------+\n             | Disabled 1 thread |\n             +-------------------+\n             1 row in set (0.00 sec)\n             +---------------------------------------------+\n             | Info                                        |\n             +---------------------------------------------+\n             | Data collection starting for THREAD_ID = 25 |\n             +---------------------------------------------+\n             1 row in set (0.03 sec)\n             +-----------------------------------------------------------+\n             | Info                                                      |\n             +-----------------------------------------------------------+\n             | Stack trace written to /tmp/stack-2014-02-16-21:18:41.dot |\n             +-----------------------------------------------------------+\n             1 row in set (60.07 sec)\n             +-------------------------------------------------------------------+\n             | Convert to PDF                                                    |\n             +-------------------------------------------------------------------+\n             | dot -Tpdf -o /tmp/stack_25.pdf /tmp/stack-2014-02-16-21:18:41.dot |\n             +-------------------------------------------------------------------+\n             1 row in set (60.07 sec)\n             +-------------------------------------------------------------------+\n             | Convert to PNG                                                    |\n             +-------------------------------------------------------------------+\n             | dot -Tpng -o /tmp/stack_25.png /tmp/stack-2014-02-16-21:18:41.dot |\n             +-------------------------------------------------------------------+\n             1 row in set (60.07 sec)\n             +------------------+\n             | summary          |\n             +------------------+\n             | Enabled 1 thread |\n             +------------------+\n             1 row in set (60.32 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    DECLARE v_done bool DEFAULT FALSE;\n    DECLARE v_start, v_runtime DECIMAL(20,2) DEFAULT 0.0;\n    DECLARE v_min_event_id bigint unsigned DEFAULT 0;\n    DECLARE v_this_thread_enabed ENUM(\'YES\', \'NO\');\n    DECLARE v_event longtext;\n    DECLARE c_stack CURSOR FOR\n        SELECT CONCAT(IF(nesting_event_id IS NOT NULL, CONCAT(nesting_event_id, \' -> \'), \'\'),\n                    event_id, \'; \', event_id, \' [label=\"\',\n                    \'(\', sys.format_time(timer_wait), \') \',\n                    IF (event_name NOT LIKE \'wait/io%\',\n                        SUBSTRING_INDEX(event_name, \'/\', -2),\n                        IF (event_name NOT LIKE \'wait/io/file%\' OR event_name NOT LIKE \'wait/io/socket%\',\n                            SUBSTRING_INDEX(event_name, \'/\', -4),\n                            event_name)\n                        ),\n                    IF (event_name LIKE \'statement/%\', IFNULL(CONCAT(\'\\n\', wait_info), \'\'), \'\'),\n                    IF (in_debug AND event_name LIKE \'wait%\', wait_info, \'\'),\n                    \'\", \',\n                    CASE WHEN event_name LIKE \'wait/io/file%\' THEN\n                           \'shape=box, style=filled, color=red\'\n                         WHEN event_name LIKE \'wait/io/table%\' THEN\n                           \'shape=box, style=filled, color=green\'\n                         WHEN event_name LIKE \'wait/io/socket%\' THEN\n                           \'shape=box, style=filled, color=yellow\'\n                         WHEN event_name LIKE \'wait/synch/mutex%\' THEN\n                           \'style=filled, color=lightskyblue\'\n                         WHEN event_name LIKE \'wait/synch/cond%\' THEN\n                           \'style=filled, color=darkseagreen3\'\n                         WHEN event_name LIKE \'wait/synch/rwlock%\' THEN\n                           \'style=filled, color=orchid\'\n                         WHEN event_name LIKE \'wait/lock%\' THEN\n                           \'shape=box, style=filled, color=tan\'\n                         WHEN event_name LIKE \'statement/%\' THEN\n                           CONCAT(\'shape=box, style=bold\',\n                                  CASE WHEN event_name LIKE \'statement/com/%\' THEN\n                                         \' style=filled, color=darkseagreen\'\n                                       ELSE\n                                         IF((timer_wait/1000000000000) > @@long_query_time,\n                                            \' style=filled, color=red\',\n                                            \' style=filled, color=lightblue\')\n                                  END\n                           )\n                         WHEN event_name LIKE \'stage/%\' THEN\n                           \'style=filled, color=slategray3\'\n                         WHEN event_name LIKE \'%idle%\' THEN\n                           \'shape=box, style=filled, color=firebrick3\'\n                         ELSE \'\' END,\n                     \'];\\n\'\n                   ) event, event_id\n        FROM (\n             (SELECT thread_id, event_id, event_name, timer_wait, timer_start, nesting_event_id,\n                     CONCAT(sql_text, \'\\n\',\n                            \'errors: \', errors, \'\\n\',\n                            \'warnings: \', warnings, \'\\n\',\n                            \'lock time: \', sys.format_time(lock_time),\'\\n\',\n                            \'rows affected: \', rows_affected, \'\\n\',\n                            \'rows sent: \', rows_sent, \'\\n\',\n                            \'rows examined: \', rows_examined, \'\\n\',\n                            \'tmp tables: \', created_tmp_tables, \'\\n\',\n                            \'tmp disk tables: \', created_tmp_disk_tables, \'\\n\'\n                            \'select scan: \', select_scan, \'\\n\',\n                            \'select full join: \', select_full_join, \'\\n\',\n                            \'select full range join: \', select_full_range_join, \'\\n\',\n                            \'select range: \', select_range, \'\\n\',\n                            \'select range check: \', select_range_check, \'\\n\',\n                            \'sort merge passes: \', sort_merge_passes, \'\\n\',\n                            \'sort rows: \', sort_rows, \'\\n\',\n                            \'sort range: \', sort_range, \'\\n\',\n                            \'sort scan: \', sort_scan, \'\\n\',\n                            \'no index used: \', IF(no_index_used, \'TRUE\', \'FALSE\'), \'\\n\',\n                            \'no good index used: \', IF(no_good_index_used, \'TRUE\', \'FALSE\'), \'\\n\'\n                     ) AS wait_info\n                FROM performance_schema.events_statements_history_long\n               WHERE thread_id = in_thread_id AND event_id > v_min_event_id)\n             UNION\n             (SELECT thread_id, event_id, event_name, timer_wait, timer_start, nesting_event_id, null AS wait_info\n                FROM performance_schema.events_stages_history_long\n               WHERE thread_id = in_thread_id AND event_id > v_min_event_id)\n             UNION\n             (SELECT thread_id, event_id,\n                     CONCAT(event_name,\n                            IF(event_name NOT LIKE \'wait/synch/mutex%\', IFNULL(CONCAT(\' - \', operation), \'\'), \'\'),\n                            IF(number_of_bytes IS NOT NULL, CONCAT(\' \', number_of_bytes, \' bytes\'), \'\'),\n                            IF(event_name LIKE \'wait/io/file%\', \'\\n\', \'\'),\n                            IF(object_schema IS NOT NULL, CONCAT(\'\\nObject: \', object_schema, \'.\'), \'\'),\n                            IF(object_name IS NOT NULL,\n                               IF (event_name LIKE \'wait/io/socket%\',\n                                   CONCAT(\'\\n\', IF (object_name LIKE \':0%\', @@socket, object_name)),\n                                   object_name),\n                               \'\'\n                            ),\n                            IF(index_name IS NOT NULL, CONCAT(\' Index: \', index_name), \'\'), \'\\n\'\n                     ) AS event_name,\n                     timer_wait, timer_start, nesting_event_id, source AS wait_info\n                FROM performance_schema.events_waits_history_long\n               WHERE thread_id = in_thread_id AND event_id > v_min_event_id)\n           ) events\n       ORDER BY event_id;\n    DECLARE CONTINUE HANDLER FOR NOT FOUND SET v_done = TRUE;\n    SET @log_bin := @@sql_log_bin;\n    SET sql_log_bin = 0;\n    SELECT INSTRUMENTED INTO v_this_thread_enabed FROM performance_schema.threads WHERE PROCESSLIST_ID = CONNECTION_ID();\n    CALL sys.ps_setup_disable_thread(CONNECTION_ID());\n    IF (in_auto_setup) THEN\n        CALL sys.ps_setup_save(0);\n        DELETE FROM performance_schema.setup_actors;\n        UPDATE performance_schema.threads\n           SET INSTRUMENTED = IF(THREAD_ID = in_thread_id, \'YES\', \'NO\');\n        UPDATE performance_schema.setup_consumers\n           SET ENABLED = \'YES\'\n         WHERE NAME NOT LIKE \'%\\_history\';\n        UPDATE performance_schema.setup_instruments\n           SET ENABLED = \'YES\',\n               TIMED   = \'YES\';\n    END IF;\n    IF (in_start_fresh) THEN\n        TRUNCATE performance_schema.events_statements_history_long;\n        TRUNCATE performance_schema.events_stages_history_long;\n        TRUNCATE performance_schema.events_waits_history_long;\n    END IF;\n    DROP TEMPORARY TABLE IF EXISTS tmp_events;\n    CREATE TEMPORARY TABLE tmp_events (\n      event_id bigint unsigned NOT NULL,\n      event longblob,\n      PRIMARY KEY (event_id)\n    );\n    INSERT INTO tmp_events VALUES (0, CONCAT(\'digraph events { rankdir=LR; nodesep=0.10;\\n\',\n                                             \'// Stack created .....: \', NOW(), \'\\n\',\n                                             \'// MySQL version .....: \', VERSION(), \'\\n\',\n                                             \'// MySQL hostname ....: \', @@hostname, \'\\n\',\n                                             \'// MySQL port ........: \', @@port, \'\\n\',\n                                             \'// MySQL socket ......: \', @@socket, \'\\n\',\n                                             \'// MySQL user ........: \', CURRENT_USER(), \'\\n\'));\n    SELECT CONCAT(\'Data collection starting for THREAD_ID = \', in_thread_id) AS \'Info\';\n    SET v_min_event_id = 0,\n        v_start        = UNIX_TIMESTAMP(),\n        in_interval    = IFNULL(in_interval, 1.00),\n        in_max_runtime = IFNULL(in_max_runtime, 60.00);\n    WHILE (v_runtime < in_max_runtime\n           AND (SELECT INSTRUMENTED FROM performance_schema.threads WHERE THREAD_ID = in_thread_id) = \'YES\') DO\n        SET v_done = FALSE;\n        OPEN c_stack;\n        c_stack_loop: LOOP\n            FETCH c_stack INTO v_event, v_min_event_id;\n            IF v_done THEN\n                LEAVE c_stack_loop;\n            END IF;\n            IF (LENGTH(v_event) > 0) THEN\n                INSERT INTO tmp_events VALUES (v_min_event_id, v_event);\n            END IF;\n        END LOOP;\n        CLOSE c_stack;\n        SELECT SLEEP(in_interval) INTO @sleep;\n        SET v_runtime = (UNIX_TIMESTAMP() - v_start);\n    END WHILE;\n    INSERT INTO tmp_events VALUES (v_min_event_id+1, \'}\');\n    SET @query = CONCAT(\'SELECT event FROM tmp_events ORDER BY event_id INTO OUTFILE \'\'\', in_outfile, \'\'\' FIELDS ESCAPED BY \'\'\'\' LINES TERMINATED BY \'\'\'\'\');\n    PREPARE stmt_output FROM @query;\n    EXECUTE stmt_output;\n    DEALLOCATE PREPARE stmt_output;\n    SELECT CONCAT(\'Stack trace written to \', in_outfile) AS \'Info\';\n    SELECT CONCAT(\'dot -Tpdf -o /tmp/stack_\', in_thread_id, \'.pdf \', in_outfile) AS \'Convert to PDF\';\n    SELECT CONCAT(\'dot -Tpng -o /tmp/stack_\', in_thread_id, \'.png \', in_outfile) AS \'Convert to PNG\';\n    DROP TEMPORARY TABLE tmp_events;\n    IF (in_auto_setup) THEN\n        CALL sys.ps_setup_reload_saved();\n    END IF;\n    IF (v_this_thread_enabed = \'YES\') THEN\n        CALL sys.ps_setup_enable_thread(CONNECTION_ID());\n    END IF;\n    SET sql_log_bin = @log_bin;\nEND','NONE'),('sys','ps_setup_reset_to_default','PROCEDURE','ps_setup_reset_to_default','SQL','MODIFIES_SQL_DATA','NO','INVOKER','\n       IN in_verbose BOOLEAN\n    ','','BEGIN\n    SET @query = \'DELETE\n                    FROM performance_schema.setup_actors\n                   WHERE NOT (HOST = \'\'%\'\' AND USER = \'\'%\'\' AND ROLE = \'\'%\'\')\';\n    IF (in_verbose) THEN\n        SELECT CONCAT(\'Resetting: setup_actors\\n\', REPLACE(@query, \'  \', \'\')) AS status;\n    END IF;\n    PREPARE reset_stmt FROM @query;\n    EXECUTE reset_stmt;\n    DEALLOCATE PREPARE reset_stmt;\n    SET @query = \'INSERT IGNORE INTO performance_schema.setup_actors\n                  VALUES (\'\'%\'\', \'\'%\'\', \'\'%\'\', \'\'YES\'\', \'\'YES\'\')\';\n    IF (in_verbose) THEN\n        SELECT CONCAT(\'Resetting: setup_actors\\n\', REPLACE(@query, \'  \', \'\')) AS status;\n    END IF;\n    PREPARE reset_stmt FROM @query;\n    EXECUTE reset_stmt;\n    DEALLOCATE PREPARE reset_stmt;\n    SET @query = \'UPDATE performance_schema.setup_instruments\n                     SET ENABLED = sys.ps_is_instrument_default_enabled(NAME),\n                         TIMED   = sys.ps_is_instrument_default_timed(NAME)\';\n    IF (in_verbose) THEN\n        SELECT CONCAT(\'Resetting: setup_instruments\\n\', REPLACE(@query, \'  \', \'\')) AS status;\n    END IF;\n    PREPARE reset_stmt FROM @query;\n    EXECUTE reset_stmt;\n    DEALLOCATE PREPARE reset_stmt;\n    SET @query = \'UPDATE performance_schema.setup_consumers\n                     SET ENABLED = IF(NAME IN (\'\'events_statements_current\'\', \'\'events_transactions_current\'\', \'\'global_instrumentation\'\', \'\'thread_instrumentation\'\', \'\'statements_digest\'\'), \'\'YES\'\', \'\'NO\'\')\';\n    IF (in_verbose) THEN\n        SELECT CONCAT(\'Resetting: setup_consumers\\n\', REPLACE(@query, \'  \', \'\')) AS status;\n    END IF;\n    PREPARE reset_stmt FROM @query;\n    EXECUTE reset_stmt;\n    DEALLOCATE PREPARE reset_stmt;\n    SET @query = \'DELETE\n                    FROM performance_schema.setup_objects\n                   WHERE NOT (OBJECT_TYPE IN (\'\'EVENT\'\', \'\'FUNCTION\'\', \'\'PROCEDURE\'\', \'\'TABLE\'\', \'\'TRIGGER\'\') AND OBJECT_NAME = \'\'%\'\'\n                     AND (OBJECT_SCHEMA = \'\'mysql\'\'              AND ENABLED = \'\'NO\'\'  AND TIMED = \'\'NO\'\' )\n                      OR (OBJECT_SCHEMA = \'\'performance_schema\'\' AND ENABLED = \'\'NO\'\'  AND TIMED = \'\'NO\'\' )\n                      OR (OBJECT_SCHEMA = \'\'information_schema\'\' AND ENABLED = \'\'NO\'\'  AND TIMED = \'\'NO\'\' )\n                      OR (OBJECT_SCHEMA = \'\'%\'\'                  AND ENABLED = \'\'YES\'\' AND TIMED = \'\'YES\'\'))\';\n    IF (in_verbose) THEN\n        SELECT CONCAT(\'Resetting: setup_objects\\n\', REPLACE(@query, \'  \', \'\')) AS status;\n    END IF;\n    PREPARE reset_stmt FROM @query;\n    EXECUTE reset_stmt;\n    DEALLOCATE PREPARE reset_stmt;\n    SET @query = \'INSERT IGNORE INTO performance_schema.setup_objects\n                  VALUES (\'\'EVENT\'\'    , \'\'mysql\'\'             , \'\'%\'\', \'\'NO\'\' , \'\'NO\'\' ),\n                         (\'\'EVENT\'\'    , \'\'performance_schema\'\', \'\'%\'\', \'\'NO\'\' , \'\'NO\'\' ),\n                         (\'\'EVENT\'\'    , \'\'information_schema\'\', \'\'%\'\', \'\'NO\'\' , \'\'NO\'\' ),\n                         (\'\'EVENT\'\'    , \'\'%\'\'                 , \'\'%\'\', \'\'YES\'\', \'\'YES\'\'),\n                         (\'\'FUNCTION\'\' , \'\'mysql\'\'             , \'\'%\'\', \'\'NO\'\' , \'\'NO\'\' ),\n                         (\'\'FUNCTION\'\' , \'\'performance_schema\'\', \'\'%\'\', \'\'NO\'\' , \'\'NO\'\' ),\n                         (\'\'FUNCTION\'\' , \'\'information_schema\'\', \'\'%\'\', \'\'NO\'\' , \'\'NO\'\' ),\n                         (\'\'FUNCTION\'\' , \'\'%\'\'                 , \'\'%\'\', \'\'YES\'\', \'\'YES\'\'),\n                         (\'\'PROCEDURE\'\', \'\'mysql\'\'             , \'\'%\'\', \'\'NO\'\' , \'\'NO\'\' ),\n                         (\'\'PROCEDURE\'\', \'\'performance_schema\'\', \'\'%\'\', \'\'NO\'\' , \'\'NO\'\' ),\n                         (\'\'PROCEDURE\'\', \'\'information_schema\'\', \'\'%\'\', \'\'NO\'\' , \'\'NO\'\' ),\n                         (\'\'PROCEDURE\'\', \'\'%\'\'                 , \'\'%\'\', \'\'YES\'\', \'\'YES\'\'),\n                         (\'\'TABLE\'\'    , \'\'mysql\'\'             , \'\'%\'\', \'\'NO\'\' , \'\'NO\'\' ),\n                         (\'\'TABLE\'\'    , \'\'performance_schema\'\', \'\'%\'\', \'\'NO\'\' , \'\'NO\'\' ),\n                         (\'\'TABLE\'\'    , \'\'information_schema\'\', \'\'%\'\', \'\'NO\'\' , \'\'NO\'\' ),\n                         (\'\'TABLE\'\'    , \'\'%\'\'                 , \'\'%\'\', \'\'YES\'\', \'\'YES\'\'),\n                         (\'\'TRIGGER\'\'  , \'\'mysql\'\'             , \'\'%\'\', \'\'NO\'\' , \'\'NO\'\' ),\n                         (\'\'TRIGGER\'\'  , \'\'performance_schema\'\', \'\'%\'\', \'\'NO\'\' , \'\'NO\'\' ),\n                         (\'\'TRIGGER\'\'  , \'\'information_schema\'\', \'\'%\'\', \'\'NO\'\' , \'\'NO\'\' ),\n                         (\'\'TRIGGER\'\'  , \'\'%\'\'                 , \'\'%\'\', \'\'YES\'\', \'\'YES\'\')\';\n    IF (in_verbose) THEN\n        SELECT CONCAT(\'Resetting: setup_objects\\n\', REPLACE(@query, \'  \', \'\')) AS status;\n    END IF;\n    PREPARE reset_stmt FROM @query;\n    EXECUTE reset_stmt;\n    DEALLOCATE PREPARE reset_stmt;\n    SET @query = \'UPDATE performance_schema.threads\n                     SET INSTRUMENTED = \'\'YES\'\'\';\n    IF (in_verbose) THEN\n        SELECT CONCAT(\'Resetting: threads\\n\', REPLACE(@query, \'  \', \'\')) AS status;\n    END IF;\n    PREPARE reset_stmt FROM @query;\n    EXECUTE reset_stmt;\n    DEALLOCATE PREPARE reset_stmt;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Resets the Performance Schema setup to the default settings.\n             Parameters\n             in_verbose (BOOLEAN):\n               Whether to print each setup stage (including the SQL) whilst running.\n             Example\n             mysql> CALL sys.ps_setup_reset_to_default(true)\\G\n             *************************** 1. row ***************************\n             status: Resetting: setup_actors\n             DELETE\n             FROM performance_schema.setup_actors\n              WHERE NOT (HOST = \'%\' AND USER = \'%\' AND ROLE = \'%\')\n             1 row in set (0.00 sec)\n             *************************** 1. row ***************************\n             status: Resetting: setup_actors\n             INSERT IGNORE INTO performance_schema.setup_actors\n             VALUES (\'%\', \'%\', \'%\')\n             1 row in set (0.00 sec)\n             ...\n             mysql> CALL sys.ps_setup_reset_to_default(false)\\G\n             Query OK, 0 rows affected (0.00 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    SET @query = \'DELETE\\n                    FROM performance_schema.setup_actors\\n                   WHERE NOT (HOST = \'\'%\'\' AND USER = \'\'%\'\' AND ROLE = \'\'%\'\')\';\n    IF (in_verbose) THEN\n        SELECT CONCAT(\'Resetting: setup_actors\\n\', REPLACE(@query, \'  \', \'\')) AS status;\n    END IF;\n    PREPARE reset_stmt FROM @query;\n    EXECUTE reset_stmt;\n    DEALLOCATE PREPARE reset_stmt;\n    SET @query = \'INSERT IGNORE INTO performance_schema.setup_actors\\n                  VALUES (\'\'%\'\', \'\'%\'\', \'\'%\'\', \'\'YES\'\', \'\'YES\'\')\';\n    IF (in_verbose) THEN\n        SELECT CONCAT(\'Resetting: setup_actors\\n\', REPLACE(@query, \'  \', \'\')) AS status;\n    END IF;\n    PREPARE reset_stmt FROM @query;\n    EXECUTE reset_stmt;\n    DEALLOCATE PREPARE reset_stmt;\n    SET @query = \'UPDATE performance_schema.setup_instruments\\n                     SET ENABLED = sys.ps_is_instrument_default_enabled(NAME),\\n                         TIMED   = sys.ps_is_instrument_default_timed(NAME)\';\n    IF (in_verbose) THEN\n        SELECT CONCAT(\'Resetting: setup_instruments\\n\', REPLACE(@query, \'  \', \'\')) AS status;\n    END IF;\n    PREPARE reset_stmt FROM @query;\n    EXECUTE reset_stmt;\n    DEALLOCATE PREPARE reset_stmt;\n    SET @query = \'UPDATE performance_schema.setup_consumers\\n                     SET ENABLED = IF(NAME IN (\'\'events_statements_current\'\', \'\'events_transactions_current\'\', \'\'global_instrumentation\'\', \'\'thread_instrumentation\'\', \'\'statements_digest\'\'), \'\'YES\'\', \'\'NO\'\')\';\n    IF (in_verbose) THEN\n        SELECT CONCAT(\'Resetting: setup_consumers\\n\', REPLACE(@query, \'  \', \'\')) AS status;\n    END IF;\n    PREPARE reset_stmt FROM @query;\n    EXECUTE reset_stmt;\n    DEALLOCATE PREPARE reset_stmt;\n    SET @query = \'DELETE\\n                    FROM performance_schema.setup_objects\\n                   WHERE NOT (OBJECT_TYPE IN (\'\'EVENT\'\', \'\'FUNCTION\'\', \'\'PROCEDURE\'\', \'\'TABLE\'\', \'\'TRIGGER\'\') AND OBJECT_NAME = \'\'%\'\'\\n                     AND (OBJECT_SCHEMA = \'\'mysql\'\'              AND ENABLED = \'\'NO\'\'  AND TIMED = \'\'NO\'\' )\\n                      OR (OBJECT_SCHEMA = \'\'performance_schema\'\' AND ENABLED = \'\'NO\'\'  AND TIMED = \'\'NO\'\' )\\n                      OR (OBJECT_SCHEMA = \'\'information_schema\'\' AND ENABLED = \'\'NO\'\'  AND TIMED = \'\'NO\'\' )\\n                      OR (OBJECT_SCHEMA = \'\'%\'\'                  AND ENABLED = \'\'YES\'\' AND TIMED = \'\'YES\'\'))\';\n    IF (in_verbose) THEN\n        SELECT CONCAT(\'Resetting: setup_objects\\n\', REPLACE(@query, \'  \', \'\')) AS status;\n    END IF;\n    PREPARE reset_stmt FROM @query;\n    EXECUTE reset_stmt;\n    DEALLOCATE PREPARE reset_stmt;\n    SET @query = \'INSERT IGNORE INTO performance_schema.setup_objects\\n                  VALUES (\'\'EVENT\'\'    , \'\'mysql\'\'             , \'\'%\'\', \'\'NO\'\' , \'\'NO\'\' ),\\n                         (\'\'EVENT\'\'    , \'\'performance_schema\'\', \'\'%\'\', \'\'NO\'\' , \'\'NO\'\' ),\\n                         (\'\'EVENT\'\'    , \'\'information_schema\'\', \'\'%\'\', \'\'NO\'\' , \'\'NO\'\' ),\\n                         (\'\'EVENT\'\'    , \'\'%\'\'                 , \'\'%\'\', \'\'YES\'\', \'\'YES\'\'),\\n                         (\'\'FUNCTION\'\' , \'\'mysql\'\'             , \'\'%\'\', \'\'NO\'\' , \'\'NO\'\' ),\\n                         (\'\'FUNCTION\'\' , \'\'performance_schema\'\', \'\'%\'\', \'\'NO\'\' , \'\'NO\'\' ),\\n                         (\'\'FUNCTION\'\' , \'\'information_schema\'\', \'\'%\'\', \'\'NO\'\' , \'\'NO\'\' ),\\n                         (\'\'FUNCTION\'\' , \'\'%\'\'                 , \'\'%\'\', \'\'YES\'\', \'\'YES\'\'),\\n                         (\'\'PROCEDURE\'\', \'\'mysql\'\'             , \'\'%\'\', \'\'NO\'\' , \'\'NO\'\' ),\\n                         (\'\'PROCEDURE\'\', \'\'performance_schema\'\', \'\'%\'\', \'\'NO\'\' , \'\'NO\'\' ),\\n                         (\'\'PROCEDURE\'\', \'\'information_schema\'\', \'\'%\'\', \'\'NO\'\' , \'\'NO\'\' ),\\n                         (\'\'PROCEDURE\'\', \'\'%\'\'                 , \'\'%\'\', \'\'YES\'\', \'\'YES\'\'),\\n                         (\'\'TABLE\'\'    , \'\'mysql\'\'             , \'\'%\'\', \'\'NO\'\' , \'\'NO\'\' ),\\n                         (\'\'TABLE\'\'    , \'\'performance_schema\'\', \'\'%\'\', \'\'NO\'\' , \'\'NO\'\' ),\\n                         (\'\'TABLE\'\'    , \'\'information_schema\'\', \'\'%\'\', \'\'NO\'\' , \'\'NO\'\' ),\\n                         (\'\'TABLE\'\'    , \'\'%\'\'                 , \'\'%\'\', \'\'YES\'\', \'\'YES\'\'),\\n                         (\'\'TRIGGER\'\'  , \'\'mysql\'\'             , \'\'%\'\', \'\'NO\'\' , \'\'NO\'\' ),\\n                         (\'\'TRIGGER\'\'  , \'\'performance_schema\'\', \'\'%\'\', \'\'NO\'\' , \'\'NO\'\' ),\\n                         (\'\'TRIGGER\'\'  , \'\'information_schema\'\', \'\'%\'\', \'\'NO\'\' , \'\'NO\'\' ),\\n                         (\'\'TRIGGER\'\'  , \'\'%\'\'                 , \'\'%\'\', \'\'YES\'\', \'\'YES\'\')\';\n    IF (in_verbose) THEN\n        SELECT CONCAT(\'Resetting: setup_objects\\n\', REPLACE(@query, \'  \', \'\')) AS status;\n    END IF;\n    PREPARE reset_stmt FROM @query;\n    EXECUTE reset_stmt;\n    DEALLOCATE PREPARE reset_stmt;\n    SET @query = \'UPDATE performance_schema.threads\\n                     SET INSTRUMENTED = \'\'YES\'\'\';\n    IF (in_verbose) THEN\n        SELECT CONCAT(\'Resetting: threads\\n\', REPLACE(@query, \'  \', \'\')) AS status;\n    END IF;\n    PREPARE reset_stmt FROM @query;\n    EXECUTE reset_stmt;\n    DEALLOCATE PREPARE reset_stmt;\nEND','NONE'),('sys','ps_setup_show_disabled_instruments','PROCEDURE','ps_setup_show_disabled_instruments','SQL','READS_SQL_DATA','YES','INVOKER','','','BEGIN\n    SELECT name AS disabled_instruments, timed\n      FROM performance_schema.setup_instruments\n     WHERE enabled = \'NO\'\n     ORDER BY disabled_instruments;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Shows all currently disabled instruments.\n             Parameters\n             None\n             Example\n             mysql> CALL sys.ps_setup_show_disabled_instruments();\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    SELECT name AS disabled_instruments, timed\n      FROM performance_schema.setup_instruments\n     WHERE enabled = \'NO\'\n     ORDER BY disabled_instruments;\nEND','NONE'),('sys','format_time','FUNCTION','format_time','SQL','NO_SQL','YES','INVOKER','picoseconds TEXT\n    ','text CHARSET utf8mb3 COLLATE utf8mb3_general_ci','BEGIN\n  IF picoseconds IS NULL THEN RETURN NULL;\n  ELSEIF picoseconds >= 604800000000000000 THEN RETURN CONCAT(ROUND(picoseconds / 604800000000000000, 2), \' w\');\n  ELSEIF picoseconds >= 86400000000000000 THEN RETURN CONCAT(ROUND(picoseconds / 86400000000000000, 2), \' d\');\n  ELSEIF picoseconds >= 3600000000000000 THEN RETURN CONCAT(ROUND(picoseconds / 3600000000000000, 2), \' h\');\n  ELSEIF picoseconds >= 60000000000000 THEN RETURN CONCAT(ROUND(picoseconds / 60000000000000, 2), \' m\');\n  ELSEIF picoseconds >= 1000000000000 THEN RETURN CONCAT(ROUND(picoseconds / 1000000000000, 2), \' s\');\n  ELSEIF picoseconds >= 1000000000 THEN RETURN CONCAT(ROUND(picoseconds / 1000000000, 2), \' ms\');\n  ELSEIF picoseconds >= 1000000 THEN RETURN CONCAT(ROUND(picoseconds / 1000000, 2), \' us\');\n  ELSEIF picoseconds >= 1000 THEN RETURN CONCAT(ROUND(picoseconds / 1000, 2), \' ns\');\n  ELSE RETURN CONCAT(picoseconds, \' ps\');\n  END IF;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Takes a raw picoseconds value, and converts it to a human readable form.\n             Picoseconds are the precision that all latency values are printed in\n             within Performance Schema, however are not user friendly when wanting\n             to scan output from the command line.\n             Parameters\n             picoseconds (TEXT):\n               The raw picoseconds value to convert.\n             Returns\n             TEXT\n             Example\n             mysql> select format_time(342342342342345);\n             +------------------------------+\n             | format_time(342342342342345) |\n             +------------------------------+\n             | 00:05:42                     |\n             +------------------------------+\n             1 row in set (0.00 sec)\n             mysql> select format_time(342342342);\n             +------------------------+\n             | format_time(342342342) |\n             +------------------------+\n             | 342.34 us              |\n             +------------------------+\n             1 row in set (0.00 sec)\n             mysql> select format_time(34234);\n              +--------------------+\n             | format_time(34234) |\n             +--------------------+\n             | 34.23 ns           |\n             +--------------------+\n             1 row in set (0.00 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n  IF picoseconds IS NULL THEN RETURN NULL;\n  ELSEIF picoseconds >= 604800000000000000 THEN RETURN CONCAT(ROUND(picoseconds / 604800000000000000, 2), \' w\');\n  ELSEIF picoseconds >= 86400000000000000 THEN RETURN CONCAT(ROUND(picoseconds / 86400000000000000, 2), \' d\');\n  ELSEIF picoseconds >= 3600000000000000 THEN RETURN CONCAT(ROUND(picoseconds / 3600000000000000, 2), \' h\');\n  ELSEIF picoseconds >= 60000000000000 THEN RETURN CONCAT(ROUND(picoseconds / 60000000000000, 2), \' m\');\n  ELSEIF picoseconds >= 1000000000000 THEN RETURN CONCAT(ROUND(picoseconds / 1000000000000, 2), \' s\');\n  ELSEIF picoseconds >= 1000000000 THEN RETURN CONCAT(ROUND(picoseconds / 1000000000, 2), \' ms\');\n  ELSEIF picoseconds >= 1000000 THEN RETURN CONCAT(ROUND(picoseconds / 1000000, 2), \' us\');\n  ELSEIF picoseconds >= 1000 THEN RETURN CONCAT(ROUND(picoseconds / 1000, 2), \' ns\');\n  ELSE RETURN CONCAT(picoseconds, \' ps\');\n  END IF;\nEND','NONE'),('sys','list_drop','FUNCTION','list_drop','SQL','CONTAINS_SQL','YES','INVOKER','in_list TEXT,\n        in_drop_value TEXT\n    ','text CHARSET utf8mb3 COLLATE utf8mb3_general_ci','BEGIN\n    IF (in_drop_value IS NULL) THEN\n        SIGNAL SQLSTATE \'02200\'\n           SET MESSAGE_TEXT = \'Function sys.list_drop: in_drop_value input variable should not be NULL\',\n               MYSQL_ERRNO = 1138;\n    END IF;\n    IF (in_list IS NULL OR LENGTH(in_list) = 0) THEN\n        RETURN in_list;\n    END IF;\n    RETURN (SELECT TRIM(BOTH \',\' FROM REPLACE(REPLACE(CONCAT(\',\', in_list), CONCAT(\',\', in_drop_value), \'\'), CONCAT(\', \', in_drop_value), \'\')));\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Takes a list, and a value to attempt to remove from the list, and returns the resulting list.\n             Useful for altering certain session variables, like sql_mode or optimizer_switch for instance.\n             Parameters\n             in_list (TEXT):\n               The comma separated list to drop a value from\n             in_drop_value (TEXT):\n               The value to drop from the input list\n             Returns\n             TEXT\n             Example\n             mysql> select @@sql_mode;\n             +-----------------------------------------------------------------------------------------------+\n             | @@sql_mode                                                                                    |\n             +-----------------------------------------------------------------------------------------------+\n             | ANSI_QUOTES,ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |\n             +-----------------------------------------------------------------------------------------------+\n             1 row in set (0.00 sec)\n             mysql> set sql_mode = sys.list_drop(@@sql_mode, \'ONLY_FULL_GROUP_BY\');\n             Query OK, 0 rows affected (0.03 sec)\n             mysql> select @@sql_mode;\n             +----------------------------------------------------------------------------+\n             | @@sql_mode                                                                 |\n             +----------------------------------------------------------------------------+\n             | ANSI_QUOTES,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |\n             +----------------------------------------------------------------------------+\n             1 row in set (0.00 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    IF (in_drop_value IS NULL) THEN\n        SIGNAL SQLSTATE \'02200\'\n           SET MESSAGE_TEXT = \'Function sys.list_drop: in_drop_value input variable should not be NULL\',\n               MYSQL_ERRNO = 1138;\n    END IF;\n    IF (in_list IS NULL OR LENGTH(in_list) = 0) THEN\n        RETURN in_list;\n    END IF;\n    RETURN (SELECT TRIM(BOTH \',\' FROM REPLACE(REPLACE(CONCAT(\',\', in_list), CONCAT(\',\', in_drop_value), \'\'), CONCAT(\', \', in_drop_value), \'\')));\nEND','NONE'),('sys','ps_setup_show_enabled_instruments','PROCEDURE','ps_setup_show_enabled_instruments','SQL','READS_SQL_DATA','YES','INVOKER','','','BEGIN\n    SELECT name AS enabled_instruments, timed\n      FROM performance_schema.setup_instruments\n     WHERE enabled = \'YES\'\n     ORDER BY enabled_instruments;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Shows all currently enabled instruments.\n             Parameters\n             None\n             Example\n             mysql> CALL sys.ps_setup_show_enabled_instruments();\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    SELECT name AS enabled_instruments, timed\n      FROM performance_schema.setup_instruments\n     WHERE enabled = \'YES\'\n     ORDER BY enabled_instruments;\nEND','NONE'),('sys','statement_performance_analyzer','PROCEDURE','statement_performance_analyzer','SQL','CONTAINS_SQL','NO','INVOKER','\n        IN in_action ENUM(\'snapshot\', \'overall\', \'delta\', \'create_table\', \'create_tmp\', \'save\', \'cleanup\'),\n        IN in_table VARCHAR(129),\n        IN in_views SET (\'with_runtimes_in_95th_percentile\', \'analysis\', \'with_errors_or_warnings\', \'with_full_table_scans\', \'with_sorting\', \'with_temp_tables\', \'custom\')\n    ','','BEGIN\n    DECLARE v_table_exists, v_tmp_digests_table_exists, v_custom_view_exists ENUM(\'\', \'BASE TABLE\', \'VIEW\', \'TEMPORARY\') DEFAULT \'\';\n    DECLARE v_this_thread_enabled ENUM(\'YES\', \'NO\');\n    DECLARE v_force_new_snapshot BOOLEAN DEFAULT FALSE;\n    DECLARE v_digests_table VARCHAR(133);\n    DECLARE v_quoted_table, v_quoted_custom_view VARCHAR(133) DEFAULT \'\';\n    DECLARE v_table_db, v_table_name, v_custom_db, v_custom_name VARCHAR(64);\n    DECLARE v_digest_table_template, v_checksum_ref, v_checksum_table text;\n    DECLARE v_sql longtext;\n    DECLARE v_error_msg VARCHAR(128);\n    SELECT INSTRUMENTED INTO v_this_thread_enabled FROM performance_schema.threads WHERE PROCESSLIST_ID = CONNECTION_ID();\n    IF (v_this_thread_enabled = \'YES\') THEN\n        CALL sys.ps_setup_disable_thread(CONNECTION_ID());\n    END IF;\n    SET @log_bin := @@sql_log_bin;\n    IF (@log_bin = 1) THEN\n        SET sql_log_bin = 0;\n    END IF;\n    IF (@sys.statement_performance_analyzer.limit IS NULL) THEN\n        SET @sys.statement_performance_analyzer.limit = sys.sys_get_config(\'statement_performance_analyzer.limit\', \'100\');\n    END IF;\n    IF (@sys.debug IS NULL) THEN\n        SET @sys.debug                                = sys.sys_get_config(\'debug\'                               , \'OFF\');\n    END IF;\n    IF (in_table = \'NOW()\') THEN\n        SET v_force_new_snapshot = TRUE,\n            in_table             = NULL;\n    ELSEIF (in_table IS NOT NULL) THEN\n        IF (NOT INSTR(in_table, \'.\')) THEN\n            SET v_table_db   = DATABASE(),\n                v_table_name = in_table;\n        ELSE\n            SET v_table_db   = SUBSTRING_INDEX(in_table, \'.\', 1);\n            SET v_table_name = SUBSTRING(in_table, CHAR_LENGTH(v_table_db)+2);\n        END IF;\n        SET v_quoted_table = CONCAT(\'`\', v_table_db, \'`.`\', v_table_name, \'`\');\n        IF (@sys.debug = \'ON\') THEN\n            SELECT CONCAT(\'in_table is: db = \'\'\', v_table_db, \'\'\', table = \'\'\', v_table_name, \'\'\'\') AS \'Debug\';\n        END IF;\n        IF (v_table_db = DATABASE() AND (v_table_name = \'tmp_digests\' OR v_table_name = \'tmp_digests_delta\')) THEN\n            SET v_error_msg = CONCAT(\'Invalid value for in_table: \', v_quoted_table, \' is reserved table name.\');\n            SIGNAL SQLSTATE \'45000\'\n               SET MESSAGE_TEXT = v_error_msg;\n        END IF;\n        CALL sys.table_exists(v_table_db, v_table_name, v_table_exists);\n        IF (@sys.debug = \'ON\') THEN\n            SELECT CONCAT(\'v_table_exists = \', v_table_exists) AS \'Debug\';\n        END IF;\n        IF (v_table_exists = \'BASE TABLE\') THEN\n            SET v_checksum_ref = (\n                 SELECT GROUP_CONCAT(CONCAT(COLUMN_NAME, COLUMN_TYPE) ORDER BY ORDINAL_POSITION) AS Checksum\n                   FROM information_schema.COLUMNS\n                  WHERE TABLE_SCHEMA = \'performance_schema\' AND TABLE_NAME = \'events_statements_summary_by_digest\'\n                ),\n                v_checksum_table = (\n                 SELECT GROUP_CONCAT(CONCAT(COLUMN_NAME, COLUMN_TYPE) ORDER BY ORDINAL_POSITION) AS Checksum\n                   FROM information_schema.COLUMNS\n                  WHERE TABLE_SCHEMA = v_table_db AND TABLE_NAME = v_table_name\n                );\n            IF (v_checksum_ref <> v_checksum_table) THEN\n                SET v_error_msg = CONCAT(\'The table \',\n                                         IF(CHAR_LENGTH(v_quoted_table) > 93, CONCAT(\'...\', SUBSTRING(v_quoted_table, -90)), v_quoted_table),\n                                         \' has the wrong definition.\');\n                SIGNAL SQLSTATE \'45000\'\n                   SET MESSAGE_TEXT = v_error_msg;\n            END IF;\n        END IF;\n    END IF;\n    IF (in_views IS NULL OR in_views = \'\') THEN\n        SET in_views = \'with_runtimes_in_95th_percentile,analysis,with_errors_or_warnings,with_full_table_scans,with_sorting,with_temp_tables\';\n    END IF;\n    CALL sys.table_exists(DATABASE(), \'tmp_digests\', v_tmp_digests_table_exists);\n    IF (@sys.debug = \'ON\') THEN\n        SELECT CONCAT(\'v_tmp_digests_table_exists = \', v_tmp_digests_table_exists) AS \'Debug\';\n    END IF;\n    CASE\n        WHEN in_action IN (\'snapshot\', \'overall\') THEN\n            IF (in_table IS NOT NULL) THEN\n                IF (NOT v_table_exists IN (\'TEMPORARY\', \'BASE TABLE\')) THEN\n                    SET v_error_msg = CONCAT(\'The \', in_action, \' action requires in_table to be NULL, NOW() or specify an existing table.\',\n                                             \' The table \',\n                                             IF(CHAR_LENGTH(v_quoted_table) > 16, CONCAT(\'...\', SUBSTRING(v_quoted_table, -13)), v_quoted_table),\n                                             \' does not exist.\');\n                    SIGNAL SQLSTATE \'45000\'\n                       SET MESSAGE_TEXT = v_error_msg;\n                END IF;\n            END IF;\n        WHEN in_action IN (\'delta\', \'save\') THEN\n            IF (v_table_exists NOT IN (\'TEMPORARY\', \'BASE TABLE\')) THEN\n                SET v_error_msg = CONCAT(\'The \', in_action, \' action requires in_table to be an existing table.\',\n                                         IF(in_table IS NOT NULL, CONCAT(\' The table \',\n                                             IF(CHAR_LENGTH(v_quoted_table) > 39, CONCAT(\'...\', SUBSTRING(v_quoted_table, -36)), v_quoted_table),\n                                             \' does not exist.\'), \'\'));\n                SIGNAL SQLSTATE \'45000\'\n                   SET MESSAGE_TEXT = v_error_msg;\n            END IF;\n            IF (in_action = \'delta\' AND v_tmp_digests_table_exists <> \'TEMPORARY\') THEN\n                SIGNAL SQLSTATE \'45000\'\n                   SET MESSAGE_TEXT = \'An existing snapshot generated with the statement_performance_analyzer() must exist.\';\n            END IF;\n        WHEN in_action = \'create_tmp\' THEN\n            IF (v_table_exists = \'TEMPORARY\') THEN\n                SET v_error_msg = CONCAT(\'Cannot create the table \',\n                                         IF(CHAR_LENGTH(v_quoted_table) > 72, CONCAT(\'...\', SUBSTRING(v_quoted_table, -69)), v_quoted_table),\n                                         \' as it already exists.\');\n                SIGNAL SQLSTATE \'45000\'\n                   SET MESSAGE_TEXT = v_error_msg;\n            END IF;\n        WHEN in_action = \'create_table\' THEN\n            IF (v_table_exists <> \'\') THEN\n                SET v_error_msg = CONCAT(\'Cannot create the table \',\n                                         IF(CHAR_LENGTH(v_quoted_table) > 52, CONCAT(\'...\', SUBSTRING(v_quoted_table, -49)), v_quoted_table),\n                                         \' as it already exists\',\n                                         IF(v_table_exists = \'TEMPORARY\', \' as a temporary table.\', \'.\'));\n                SIGNAL SQLSTATE \'45000\'\n                   SET MESSAGE_TEXT = v_error_msg;\n            END IF;\n        WHEN in_action = \'cleanup\' THEN\n            DO (SELECT 1);\n        ELSE\n            SIGNAL SQLSTATE \'45000\'\n               SET MESSAGE_TEXT = \'Unknown action. Supported actions are: cleanup, create_table, create_tmp, delta, overall, save, snapshot\';\n    END CASE;\n    SET v_digest_table_template = \'CREATE %{TEMPORARY}TABLE %{TABLE_NAME} (\n  `SCHEMA_NAME` varchar(64) DEFAULT NULL,\n  `DIGEST` varchar(32) DEFAULT NULL,\n  `DIGEST_TEXT` longtext,\n  `COUNT_STAR` bigint(20) unsigned NOT NULL,\n  `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL,\n  `MIN_TIMER_WAIT` bigint(20) unsigned NOT NULL,\n  `AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL,\n  `MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL,\n  `SUM_LOCK_TIME` bigint(20) unsigned NOT NULL,\n  `SUM_ERRORS` bigint(20) unsigned NOT NULL,\n  `SUM_WARNINGS` bigint(20) unsigned NOT NULL,\n  `SUM_ROWS_AFFECTED` bigint(20) unsigned NOT NULL,\n  `SUM_ROWS_SENT` bigint(20) unsigned NOT NULL,\n  `SUM_ROWS_EXAMINED` bigint(20) unsigned NOT NULL,\n  `SUM_CREATED_TMP_DISK_TABLES` bigint(20) unsigned NOT NULL,\n  `SUM_CREATED_TMP_TABLES` bigint(20) unsigned NOT NULL,\n  `SUM_SELECT_FULL_JOIN` bigint(20) unsigned NOT NULL,\n  `SUM_SELECT_FULL_RANGE_JOIN` bigint(20) unsigned NOT NULL,\n  `SUM_SELECT_RANGE` bigint(20) unsigned NOT NULL,\n  `SUM_SELECT_RANGE_CHECK` bigint(20) unsigned NOT NULL,\n  `SUM_SELECT_SCAN` bigint(20) unsigned NOT NULL,\n  `SUM_SORT_MERGE_PASSES` bigint(20) unsigned NOT NULL,\n  `SUM_SORT_RANGE` bigint(20) unsigned NOT NULL,\n  `SUM_SORT_ROWS` bigint(20) unsigned NOT NULL,\n  `SUM_SORT_SCAN` bigint(20) unsigned NOT NULL,\n  `SUM_NO_INDEX_USED` bigint(20) unsigned NOT NULL,\n  `SUM_NO_GOOD_INDEX_USED` bigint(20) unsigned NOT NULL,\n  `FIRST_SEEN` timestamp NULL DEFAULT NULL,\n  `LAST_SEEN` timestamp NULL DEFAULT NULL,\n  INDEX (SCHEMA_NAME, DIGEST)\n) DEFAULT CHARSET=utf8\';\n    IF (v_force_new_snapshot\n           OR in_action = \'snapshot\'\n           OR (in_action = \'overall\' AND in_table IS NULL)\n           OR (in_action = \'save\' AND v_tmp_digests_table_exists <> \'TEMPORARY\')\n       ) THEN\n        IF (v_tmp_digests_table_exists = \'TEMPORARY\') THEN\n            IF (@sys.debug = \'ON\') THEN\n                SELECT \'DROP TEMPORARY TABLE IF EXISTS tmp_digests\' AS \'Debug\';\n            END IF;\n            DROP TEMPORARY TABLE IF EXISTS tmp_digests;\n        END IF;\n        CALL sys.execute_prepared_stmt(REPLACE(REPLACE(v_digest_table_template, \'%{TEMPORARY}\', \'TEMPORARY \'), \'%{TABLE_NAME}\', \'tmp_digests\'));\n        SET v_sql = CONCAT(\'INSERT INTO tmp_digests SELECT * FROM \',\n                           IF(in_table IS NULL OR in_action = \'save\', \'performance_schema.events_statements_summary_by_digest\', v_quoted_table));\n        CALL sys.execute_prepared_stmt(v_sql);\n    END IF;\n    IF (in_action IN (\'create_table\', \'create_tmp\')) THEN\n        IF (in_action = \'create_table\') THEN\n            CALL sys.execute_prepared_stmt(REPLACE(REPLACE(v_digest_table_template, \'%{TEMPORARY}\', \'\'), \'%{TABLE_NAME}\', v_quoted_table));\n        ELSE\n            CALL sys.execute_prepared_stmt(REPLACE(REPLACE(v_digest_table_template, \'%{TEMPORARY}\', \'TEMPORARY \'), \'%{TABLE_NAME}\', v_quoted_table));\n        END IF;\n    ELSEIF (in_action = \'save\') THEN\n        CALL sys.execute_prepared_stmt(CONCAT(\'DELETE FROM \', v_quoted_table));\n        CALL sys.execute_prepared_stmt(CONCAT(\'INSERT INTO \', v_quoted_table, \' SELECT * FROM tmp_digests\'));\n    ELSEIF (in_action = \'cleanup\') THEN\n        DROP TEMPORARY TABLE IF EXISTS sys.tmp_digests;\n        DROP TEMPORARY TABLE IF EXISTS sys.tmp_digests_delta;\n    ELSEIF (in_action IN (\'overall\', \'delta\')) THEN\n        IF (in_action = \'overall\') THEN\n            IF (in_table IS NULL) THEN\n                SET v_digests_table = \'tmp_digests\';\n            ELSE\n                SET v_digests_table = v_quoted_table;\n            END IF;\n        ELSE\n            SET v_digests_table = \'tmp_digests_delta\';\n            DROP TEMPORARY TABLE IF EXISTS tmp_digests_delta;\n            CREATE TEMPORARY TABLE tmp_digests_delta LIKE tmp_digests;\n            SET v_sql = CONCAT(\'INSERT INTO tmp_digests_delta\nSELECT `d_end`.`SCHEMA_NAME`,\n       `d_end`.`DIGEST`,\n       `d_end`.`DIGEST_TEXT`,\n       `d_end`.`COUNT_STAR`-IFNULL(`d_start`.`COUNT_STAR`, 0) AS \'\'COUNT_STAR\'\',\n       `d_end`.`SUM_TIMER_WAIT`-IFNULL(`d_start`.`SUM_TIMER_WAIT`, 0) AS \'\'SUM_TIMER_WAIT\'\',\n       `d_end`.`MIN_TIMER_WAIT` AS \'\'MIN_TIMER_WAIT\'\',\n       IFNULL((`d_end`.`SUM_TIMER_WAIT`-IFNULL(`d_start`.`SUM_TIMER_WAIT`, 0))/NULLIF(`d_end`.`COUNT_STAR`-IFNULL(`d_start`.`COUNT_STAR`, 0), 0), 0) AS \'\'AVG_TIMER_WAIT\'\',\n       `d_end`.`MAX_TIMER_WAIT` AS \'\'MAX_TIMER_WAIT\'\',\n       `d_end`.`SUM_LOCK_TIME`-IFNULL(`d_start`.`SUM_LOCK_TIME`, 0) AS \'\'SUM_LOCK_TIME\'\',\n       `d_end`.`SUM_ERRORS`-IFNULL(`d_start`.`SUM_ERRORS`, 0) AS \'\'SUM_ERRORS\'\',\n       `d_end`.`SUM_WARNINGS`-IFNULL(`d_start`.`SUM_WARNINGS`, 0) AS \'\'SUM_WARNINGS\'\',\n       `d_end`.`SUM_ROWS_AFFECTED`-IFNULL(`d_start`.`SUM_ROWS_AFFECTED`, 0) AS \'\'SUM_ROWS_AFFECTED\'\',\n       `d_end`.`SUM_ROWS_SENT`-IFNULL(`d_start`.`SUM_ROWS_SENT`, 0) AS \'\'SUM_ROWS_SENT\'\',\n       `d_end`.`SUM_ROWS_EXAMINED`-IFNULL(`d_start`.`SUM_ROWS_EXAMINED`, 0) AS \'\'SUM_ROWS_EXAMINED\'\',\n       `d_end`.`SUM_CREATED_TMP_DISK_TABLES`-IFNULL(`d_start`.`SUM_CREATED_TMP_DISK_TABLES`, 0) AS \'\'SUM_CREATED_TMP_DISK_TABLES\'\',\n       `d_end`.`SUM_CREATED_TMP_TABLES`-IFNULL(`d_start`.`SUM_CREATED_TMP_TABLES`, 0) AS \'\'SUM_CREATED_TMP_TABLES\'\',\n       `d_end`.`SUM_SELECT_FULL_JOIN`-IFNULL(`d_start`.`SUM_SELECT_FULL_JOIN`, 0) AS \'\'SUM_SELECT_FULL_JOIN\'\',\n       `d_end`.`SUM_SELECT_FULL_RANGE_JOIN`-IFNULL(`d_start`.`SUM_SELECT_FULL_RANGE_JOIN`, 0) AS \'\'SUM_SELECT_FULL_RANGE_JOIN\'\',\n       `d_end`.`SUM_SELECT_RANGE`-IFNULL(`d_start`.`SUM_SELECT_RANGE`, 0) AS \'\'SUM_SELECT_RANGE\'\',\n       `d_end`.`SUM_SELECT_RANGE_CHECK`-IFNULL(`d_start`.`SUM_SELECT_RANGE_CHECK`, 0) AS \'\'SUM_SELECT_RANGE_CHECK\'\',\n       `d_end`.`SUM_SELECT_SCAN`-IFNULL(`d_start`.`SUM_SELECT_SCAN`, 0) AS \'\'SUM_SELECT_SCAN\'\',\n       `d_end`.`SUM_SORT_MERGE_PASSES`-IFNULL(`d_start`.`SUM_SORT_MERGE_PASSES`, 0) AS \'\'SUM_SORT_MERGE_PASSES\'\',\n       `d_end`.`SUM_SORT_RANGE`-IFNULL(`d_start`.`SUM_SORT_RANGE`, 0) AS \'\'SUM_SORT_RANGE\'\',\n       `d_end`.`SUM_SORT_ROWS`-IFNULL(`d_start`.`SUM_SORT_ROWS`, 0) AS \'\'SUM_SORT_ROWS\'\',\n       `d_end`.`SUM_SORT_SCAN`-IFNULL(`d_start`.`SUM_SORT_SCAN`, 0) AS \'\'SUM_SORT_SCAN\'\',\n       `d_end`.`SUM_NO_INDEX_USED`-IFNULL(`d_start`.`SUM_NO_INDEX_USED`, 0) AS \'\'SUM_NO_INDEX_USED\'\',\n       `d_end`.`SUM_NO_GOOD_INDEX_USED`-IFNULL(`d_start`.`SUM_NO_GOOD_INDEX_USED`, 0) AS \'\'SUM_NO_GOOD_INDEX_USED\'\',\n       `d_end`.`FIRST_SEEN`,\n       `d_end`.`LAST_SEEN`\n  FROM tmp_digests d_end\n       LEFT OUTER JOIN \', v_quoted_table, \' d_start ON `d_start`.`DIGEST` = `d_end`.`DIGEST`\n                                                    AND (`d_start`.`SCHEMA_NAME` = `d_end`.`SCHEMA_NAME`\n                                                          OR (`d_start`.`SCHEMA_NAME` IS NULL AND `d_end`.`SCHEMA_NAME` IS NULL)\n                                                        )\n WHERE `d_end`.`COUNT_STAR`-IFNULL(`d_start`.`COUNT_STAR`, 0) > 0\');\n            CALL sys.execute_prepared_stmt(v_sql);\n        END IF;\n        IF (FIND_IN_SET(\'with_runtimes_in_95th_percentile\', in_views)) THEN\n            SELECT \'Queries with Runtime in 95th Percentile\' AS \'Next Output\';\n            DROP TEMPORARY TABLE IF EXISTS tmp_digest_avg_latency_distribution1;\n            DROP TEMPORARY TABLE IF EXISTS tmp_digest_avg_latency_distribution2;\n            DROP TEMPORARY TABLE IF EXISTS tmp_digest_95th_percentile_by_avg_us;\n            CREATE TEMPORARY TABLE tmp_digest_avg_latency_distribution1 (\n              cnt bigint unsigned NOT NULL,\n              avg_us decimal(21,0) NOT NULL,\n              PRIMARY KEY (avg_us)\n            ) ENGINE=InnoDB;\n            SET v_sql = CONCAT(\'INSERT INTO tmp_digest_avg_latency_distribution1\nSELECT COUNT(*) cnt,\n       ROUND(avg_timer_wait/1000000) AS avg_us\n  FROM \', v_digests_table, \'\n GROUP BY avg_us\');\n            CALL sys.execute_prepared_stmt(v_sql);\n            CREATE TEMPORARY TABLE tmp_digest_avg_latency_distribution2 LIKE tmp_digest_avg_latency_distribution1;\n            INSERT INTO tmp_digest_avg_latency_distribution2 SELECT * FROM tmp_digest_avg_latency_distribution1;\n            CREATE TEMPORARY TABLE tmp_digest_95th_percentile_by_avg_us (\n              avg_us decimal(21,0) NOT NULL,\n              percentile decimal(46,4) NOT NULL,\n              PRIMARY KEY (avg_us)\n            ) ENGINE=InnoDB;\n            SET v_sql = CONCAT(\'INSERT INTO tmp_digest_95th_percentile_by_avg_us\nSELECT s2.avg_us avg_us,\n       IFNULL(SUM(s1.cnt)/NULLIF((SELECT COUNT(*) FROM \', v_digests_table, \'), 0), 0) percentile\n  FROM tmp_digest_avg_latency_distribution1 AS s1\n       JOIN tmp_digest_avg_latency_distribution2 AS s2 ON s1.avg_us <= s2.avg_us\n GROUP BY s2.avg_us\nHAVING percentile > 0.95\n ORDER BY percentile\n LIMIT 1\');\n            CALL sys.execute_prepared_stmt(v_sql);\n            SET v_sql =\n                REPLACE(\n                    REPLACE(\n                        (SELECT VIEW_DEFINITION\n                           FROM information_schema.VIEWS\n                          WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = \'statements_with_runtimes_in_95th_percentile\'\n                        ),\n                        \'`performance_schema`.`events_statements_summary_by_digest`\',\n                        v_digests_table\n                    ),\n                    \'sys.x$ps_digest_95th_percentile_by_avg_us\',\n                    \'`sys`.`x$ps_digest_95th_percentile_by_avg_us`\'\n              );\n            CALL sys.execute_prepared_stmt(v_sql);\n            DROP TEMPORARY TABLE tmp_digest_avg_latency_distribution1;\n            DROP TEMPORARY TABLE tmp_digest_avg_latency_distribution2;\n            DROP TEMPORARY TABLE tmp_digest_95th_percentile_by_avg_us;\n        END IF;\n        IF (FIND_IN_SET(\'analysis\', in_views)) THEN\n            SELECT CONCAT(\'Top \', @sys.statement_performance_analyzer.limit, \' Queries Ordered by Total Latency\') AS \'Next Output\';\n            SET v_sql =\n                REPLACE(\n                    (SELECT VIEW_DEFINITION\n                       FROM information_schema.VIEWS\n                      WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = \'statement_analysis\'\n                    ),\n                    \'`performance_schema`.`events_statements_summary_by_digest`\',\n                    v_digests_table\n                );\n            IF (@sys.statement_performance_analyzer.limit > 0) THEN\n                SET v_sql = CONCAT(v_sql, \' LIMIT \', @sys.statement_performance_analyzer.limit);\n            END IF;\n            CALL sys.execute_prepared_stmt(v_sql);\n        END IF;\n        IF (FIND_IN_SET(\'with_errors_or_warnings\', in_views)) THEN\n            SELECT CONCAT(\'Top \', @sys.statement_performance_analyzer.limit, \' Queries with Errors\') AS \'Next Output\';\n            SET v_sql =\n                REPLACE(\n                    (SELECT VIEW_DEFINITION\n                       FROM information_schema.VIEWS\n                      WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = \'statements_with_errors_or_warnings\'\n                    ),\n                    \'`performance_schema`.`events_statements_summary_by_digest`\',\n                    v_digests_table\n                );\n            IF (@sys.statement_performance_analyzer.limit > 0) THEN\n                SET v_sql = CONCAT(v_sql, \' LIMIT \', @sys.statement_performance_analyzer.limit);\n            END IF;\n            CALL sys.execute_prepared_stmt(v_sql);\n        END IF;\n        IF (FIND_IN_SET(\'with_full_table_scans\', in_views)) THEN\n            SELECT CONCAT(\'Top \', @sys.statement_performance_analyzer.limit, \' Queries with Full Table Scan\') AS \'Next Output\';\n            SET v_sql =\n                REPLACE(\n                    (SELECT VIEW_DEFINITION\n                       FROM information_schema.VIEWS\n                      WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = \'statements_with_full_table_scans\'\n                    ),\n                    \'`performance_schema`.`events_statements_summary_by_digest`\',\n                    v_digests_table\n                );\n            IF (@sys.statement_performance_analyzer.limit > 0) THEN\n                SET v_sql = CONCAT(v_sql, \' LIMIT \', @sys.statement_performance_analyzer.limit);\n            END IF;\n            CALL sys.execute_prepared_stmt(v_sql);\n        END IF;\n        IF (FIND_IN_SET(\'with_sorting\', in_views)) THEN\n            SELECT CONCAT(\'Top \', @sys.statement_performance_analyzer.limit, \' Queries with Sorting\') AS \'Next Output\';\n            SET v_sql =\n                REPLACE(\n                    (SELECT VIEW_DEFINITION\n                       FROM information_schema.VIEWS\n                      WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = \'statements_with_sorting\'\n                    ),\n                    \'`performance_schema`.`events_statements_summary_by_digest`\',\n                    v_digests_table\n                );\n            IF (@sys.statement_performance_analyzer.limit > 0) THEN\n                SET v_sql = CONCAT(v_sql, \' LIMIT \', @sys.statement_performance_analyzer.limit);\n            END IF;\n            CALL sys.execute_prepared_stmt(v_sql);\n        END IF;\n        IF (FIND_IN_SET(\'with_temp_tables\', in_views)) THEN\n            SELECT CONCAT(\'Top \', @sys.statement_performance_analyzer.limit, \' Queries with Internal Temporary Tables\') AS \'Next Output\';\n            SET v_sql =\n                REPLACE(\n                    (SELECT VIEW_DEFINITION\n                       FROM information_schema.VIEWS\n                      WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = \'statements_with_temp_tables\'\n                    ),\n                    \'`performance_schema`.`events_statements_summary_by_digest`\',\n                    v_digests_table\n                );\n            IF (@sys.statement_performance_analyzer.limit > 0) THEN\n                SET v_sql = CONCAT(v_sql, \' LIMIT \', @sys.statement_performance_analyzer.limit);\n            END IF;\n            CALL sys.execute_prepared_stmt(v_sql);\n        END IF;\n        IF (FIND_IN_SET(\'custom\', in_views)) THEN\n            SELECT CONCAT(\'Top \', @sys.statement_performance_analyzer.limit, \' Queries Using Custom View\') AS \'Next Output\';\n            IF (@sys.statement_performance_analyzer.view IS NULL) THEN\n                SET @sys.statement_performance_analyzer.view = sys.sys_get_config(\'statement_performance_analyzer.view\', NULL);\n            END IF;\n            IF (@sys.statement_performance_analyzer.view IS NULL) THEN\n                SIGNAL SQLSTATE \'45000\'\n                   SET MESSAGE_TEXT = \'The @sys.statement_performance_analyzer.view user variable must be set with the view or query to use.\';\n            END IF;\n            IF (NOT INSTR(@sys.statement_performance_analyzer.view, \' \')) THEN\n                IF (NOT INSTR(@sys.statement_performance_analyzer.view, \'.\')) THEN\n                    SET v_custom_db   = DATABASE(),\n                        v_custom_name = @sys.statement_performance_analyzer.view;\n                ELSE\n                    SET v_custom_db   = SUBSTRING_INDEX(@sys.statement_performance_analyzer.view, \'.\', 1);\n                    SET v_custom_name = SUBSTRING(@sys.statement_performance_analyzer.view, CHAR_LENGTH(v_custom_db)+2);\n                END IF;\n                CALL sys.table_exists(v_custom_db, v_custom_name, v_custom_view_exists);\n                IF (v_custom_view_exists <> \'VIEW\') THEN\n                    SIGNAL SQLSTATE \'45000\'\n                       SET MESSAGE_TEXT = \'The @sys.statement_performance_analyzer.view user variable is set but specified neither an existing view nor a query.\';\n                END IF;\n                SET v_sql =\n                    REPLACE(\n                        (SELECT VIEW_DEFINITION\n                           FROM information_schema.VIEWS\n                          WHERE TABLE_SCHEMA = v_custom_db AND TABLE_NAME = v_custom_name\n                        ),\n                        \'`performance_schema`.`events_statements_summary_by_digest`\',\n                        v_digests_table\n                    );\n            ELSE\n                SET v_sql = REPLACE(@sys.statement_performance_analyzer.view, \'`performance_schema`.`events_statements_summary_by_digest`\', v_digests_table);\n            END IF;\n            IF (@sys.statement_performance_analyzer.limit > 0) THEN\n                SET v_sql = CONCAT(v_sql, \' LIMIT \', @sys.statement_performance_analyzer.limit);\n            END IF;\n            CALL sys.execute_prepared_stmt(v_sql);\n        END IF;\n    END IF;\n    IF (v_this_thread_enabled = \'YES\') THEN\n        CALL sys.ps_setup_enable_thread(CONNECTION_ID());\n    END IF;\n    IF (@log_bin = 1) THEN\n        SET sql_log_bin = @log_bin;\n    END IF;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Create a report of the statements running on the server.\n             The views are calculated based on the overall and/or delta activity.\n             Requires the SUPER privilege for \"SET sql_log_bin = 0;\".\n             Parameters\n             in_action (ENUM(\'snapshot\', \'overall\', \'delta\', \'create_tmp\', \'create_table\', \'save\', \'cleanup\')):\n               The action to take. Supported actions are:\n                 * snapshot      Store a snapshot. The default is to make a snapshot of the current content of\n                                 performance_schema.events_statements_summary_by_digest, but by setting in_table\n                                 this can be overwritten to copy the content of the specified table.\n                                 The snapshot is stored in the sys.tmp_digests temporary table.\n                 * overall       Generate analyzis based on the content specified by in_table. For the overall analyzis,\n                                 in_table can be NOW() to use a fresh snapshot. This will overwrite an existing snapshot.\n                                 Use NULL for in_table to use the existing snapshot. If in_table IS NULL and no snapshot\n                                 exists, a new will be created.\n                                 See also in_views and @sys.statement_performance_analyzer.limit.\n                 * delta         Generate a delta analysis. The delta will be calculated between the reference table in\n                                 in_table and the snapshot. An existing snapshot must exist.\n                                 The action uses the sys.tmp_digests_delta temporary table.\n                                 See also in_views and @sys.statement_performance_analyzer.limit.\n                 * create_table  Create a regular table suitable for storing the snapshot for later use, e.g. for\n                                 calculating deltas.\n                 * create_tmp    Create a temporary table suitable for storing the snapshot for later use, e.g. for\n                                 calculating deltas.\n                 * save          Save the snapshot in the table specified by in_table. The table must exists and have\n                                 the correct structure.\n                                 If no snapshot exists, a new is created.\n                 * cleanup       Remove the temporary tables used for the snapshot and delta.\n             in_table (VARCHAR(129)):\n               The table argument used for some actions. Use the format \'db1.t1\' or \'t1\' without using any backticks (`)\n               for quoting. Periods (.) are not supported in the database and table names.\n               The meaning of the table for each action supporting the argument is:\n                 * snapshot      The snapshot is created based on the specified table. Set to NULL or NOW() to use\n                                 the current content of performance_schema.events_statements_summary_by_digest.\n                 * overall       The table with the content to create the overall analyzis for. The following values\n                                 can be used:\n                                   - A table name - use the content of that table.\n                                   - NOW()        - create a fresh snapshot and overwrite the existing snapshot.\n                                   - NULL         - use the last stored snapshot.\n                 * delta         The table name is mandatory and specified the reference view to compare the currently\n                                 stored snapshot against. If no snapshot exists, a new will be created.\n                 * create_table  The name of the regular table to create.\n                 * create_tmp    The name of the temporary table to create.\n                 * save          The name of the table to save the currently stored snapshot into.\n             in_views (SET (\'with_runtimes_in_95th_percentile\', \'analysis\', \'with_errors_or_warnings\',\n                            \'with_full_table_scans\', \'with_sorting\', \'with_temp_tables\', \'custom\'))\n               Which views to include:\n                 * with_runtimes_in_95th_percentile  Based on the sys.statements_with_runtimes_in_95th_percentile view\n                 * analysis                          Based on the sys.statement_analysis view\n                 * with_errors_or_warnings           Based on the sys.statements_with_errors_or_warnings view\n                 * with_full_table_scans             Based on the sys.statements_with_full_table_scans view\n                 * with_sorting                      Based on the sys.statements_with_sorting view\n                 * with_temp_tables                  Based on the sys.statements_with_temp_tables view\n                 * custom                            Use a custom view. This view must be specified in @sys.statement_performance_analyzer.view to an existing view or a query\n             Default is to include all except \'custom\'.\n             Configuration Options\n             sys.statement_performance_analyzer.limit\n               The maximum number of rows to include for the views that does not have a built-in limit (e.g. the 95th percentile view).\n               If not set the limit is 100.\n             sys.statement_performance_analyzer.view\n               Used together with the \'custom\' view. If the value contains a space, it is considered a query, otherwise it must be\n               an existing view querying the performance_schema.events_statements_summary_by_digest table. There cannot be any limit\n               clause including in the query or view definition if @sys.statement_performance_analyzer.limit > 0.\n               If specifying a view, use the same format as for in_table.\n             sys.debug\n               Whether to provide debugging output.\n               Default is \'OFF\'. Set to \'ON\' to include.\n             Example\n             To create a report with the queries in the 95th percentile since last truncate of performance_schema.events_statements_summary_by_digest\n             and the delta for a 1 minute period:\n                1. Create a temporary table to store the initial snapshot.\n                2. Create the initial snapshot.\n                3. Save the initial snapshot in the temporary table.\n                4. Wait one minute.\n                5. Create a new snapshot.\n                6. Perform analyzis based on the new snapshot.\n                7. Perform analyzis based on the delta between the initial and new snapshots.\n             mysql> CALL sys.statement_performance_analyzer(\'create_tmp\', \'mydb.tmp_digests_ini\', NULL);\n             Query OK, 0 rows affected (0.08 sec)\n             mysql> CALL sys.statement_performance_analyzer(\'snapshot\', NULL, NULL);\n             Query OK, 0 rows affected (0.02 sec)\n             mysql> CALL sys.statement_performance_analyzer(\'save\', \'mydb.tmp_digests_ini\', NULL);\n             Query OK, 0 rows affected (0.00 sec)\n             mysql> DO SLEEP(60);\n             Query OK, 0 rows affected (1 min 0.00 sec)\n             mysql> CALL sys.statement_performance_analyzer(\'snapshot\', NULL, NULL);\n             Query OK, 0 rows affected (0.02 sec)\n             mysql> CALL sys.statement_performance_analyzer(\'overall\', NULL, \'with_runtimes_in_95th_percentile\');\n             +-----------------------------------------+\n             | Next Output                             |\n             +-----------------------------------------+\n             | Queries with Runtime in 95th Percentile |\n             +-----------------------------------------+\n             1 row in set (0.05 sec)\n             ...\n             mysql> CALL sys.statement_performance_analyzer(\'delta\', \'mydb.tmp_digests_ini\', \'with_runtimes_in_95th_percentile\');\n             +-----------------------------------------+\n             | Next Output                             |\n             +-----------------------------------------+\n             | Queries with Runtime in 95th Percentile |\n             +-----------------------------------------+\n             1 row in set (0.03 sec)\n             ...\n             To create an overall report of the 95th percentile queries and the top 10 queries with full table scans:\n             mysql> CALL sys.statement_performance_analyzer(\'snapshot\', NULL, NULL);\n             Query OK, 0 rows affected (0.01 sec)\n             mysql> SET @sys.statement_performance_analyzer.limit = 10;\n             Query OK, 0 rows affected (0.00 sec)\n             mysql> CALL sys.statement_performance_analyzer(\'overall\', NULL, \'with_runtimes_in_95th_percentile,with_full_table_scans\');\n             +-----------------------------------------+\n             | Next Output                             |\n             +-----------------------------------------+\n             | Queries with Runtime in 95th Percentile |\n             +-----------------------------------------+\n             1 row in set (0.01 sec)\n             ...\n             +-------------------------------------+\n             | Next Output                         |\n             +-------------------------------------+\n             | Top 10 Queries with Full Table Scan |\n             +-------------------------------------+\n             1 row in set (0.09 sec)\n             ...\n             Use a custom view showing the top 10 query sorted by total execution time refreshing the view every minute using\n             the watch command in Linux.\n             mysql> CREATE OR REPLACE VIEW mydb.my_statements AS\n                 -> SELECT sys.format_statement(DIGEST_TEXT) AS query,\n                 ->        SCHEMA_NAME AS db,\n                 ->        COUNT_STAR AS exec_count,\n                 ->        sys.format_time(SUM_TIMER_WAIT) AS total_latency,\n                 ->        sys.format_time(AVG_TIMER_WAIT) AS avg_latency,\n                 ->        ROUND(IFNULL(SUM_ROWS_SENT / NULLIF(COUNT_STAR, 0), 0)) AS rows_sent_avg,\n                 ->        ROUND(IFNULL(SUM_ROWS_EXAMINED / NULLIF(COUNT_STAR, 0), 0)) AS rows_examined_avg,\n                 ->        ROUND(IFNULL(SUM_ROWS_AFFECTED / NULLIF(COUNT_STAR, 0), 0)) AS rows_affected_avg,\n                 ->        DIGEST AS digest\n                 ->   FROM performance_schema.events_statements_summary_by_digest\n                 -> ORDER BY SUM_TIMER_WAIT DESC;\n             Query OK, 0 rows affected (0.01 sec)\n             mysql> CALL sys.statement_performance_analyzer(\'create_table\', \'mydb.digests_prev\', NULL);\n             Query OK, 0 rows affected (0.10 sec)\n             shell$ watch -n 60 \"mysql sys --table -e \"\n             > SET @sys.statement_performance_analyzer.view = \'mydb.my_statements\';\n             > SET @sys.statement_performance_analyzer.limit = 10;\n             > CALL statement_performance_analyzer(\'snapshot\', NULL, NULL);\n             > CALL statement_performance_analyzer(\'delta\', \'mydb.digests_prev\', \'custom\');\n             > CALL statement_performance_analyzer(\'save\', \'mydb.digests_prev\', NULL);\n             > \"\"\n             Every 60.0s: mysql sys --table -e \"                                                                                                   ...  Mon Dec 22 10:58:51 2014\n             +----------------------------------+\n             | Next Output                      |\n             +----------------------------------+\n             | Top 10 Queries Using Custom View |\n             +----------------------------------+\n             +-------------------+-------+------------+---------------+-------------+---------------+-------------------+-------------------+----------------------------------+\n             | query             | db    | exec_count | total_latency | avg_latency | rows_sent_avg | rows_examined_avg | rows_affected_avg | digest                           |\n             +-------------------+-------+------------+---------------+-------------+---------------+-------------------+-------------------+----------------------------------+\n             ...\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    DECLARE v_table_exists, v_tmp_digests_table_exists, v_custom_view_exists ENUM(\'\', \'BASE TABLE\', \'VIEW\', \'TEMPORARY\') DEFAULT \'\';\n    DECLARE v_this_thread_enabled ENUM(\'YES\', \'NO\');\n    DECLARE v_force_new_snapshot BOOLEAN DEFAULT FALSE;\n    DECLARE v_digests_table VARCHAR(133);\n    DECLARE v_quoted_table, v_quoted_custom_view VARCHAR(133) DEFAULT \'\';\n    DECLARE v_table_db, v_table_name, v_custom_db, v_custom_name VARCHAR(64);\n    DECLARE v_digest_table_template, v_checksum_ref, v_checksum_table text;\n    DECLARE v_sql longtext;\n    DECLARE v_error_msg VARCHAR(128);\n    SELECT INSTRUMENTED INTO v_this_thread_enabled FROM performance_schema.threads WHERE PROCESSLIST_ID = CONNECTION_ID();\n    IF (v_this_thread_enabled = \'YES\') THEN\n        CALL sys.ps_setup_disable_thread(CONNECTION_ID());\n    END IF;\n    SET @log_bin := @@sql_log_bin;\n    IF (@log_bin = 1) THEN\n        SET sql_log_bin = 0;\n    END IF;\n    IF (@sys.statement_performance_analyzer.limit IS NULL) THEN\n        SET @sys.statement_performance_analyzer.limit = sys.sys_get_config(\'statement_performance_analyzer.limit\', \'100\');\n    END IF;\n    IF (@sys.debug IS NULL) THEN\n        SET @sys.debug                                = sys.sys_get_config(\'debug\'                               , \'OFF\');\n    END IF;\n    IF (in_table = \'NOW()\') THEN\n        SET v_force_new_snapshot = TRUE,\n            in_table             = NULL;\n    ELSEIF (in_table IS NOT NULL) THEN\n        IF (NOT INSTR(in_table, \'.\')) THEN\n            SET v_table_db   = DATABASE(),\n                v_table_name = in_table;\n        ELSE\n            SET v_table_db   = SUBSTRING_INDEX(in_table, \'.\', 1);\n            SET v_table_name = SUBSTRING(in_table, CHAR_LENGTH(v_table_db)+2);\n        END IF;\n        SET v_quoted_table = CONCAT(\'`\', v_table_db, \'`.`\', v_table_name, \'`\');\n        IF (@sys.debug = \'ON\') THEN\n            SELECT CONCAT(\'in_table is: db = \'\'\', v_table_db, \'\'\', table = \'\'\', v_table_name, \'\'\'\') AS \'Debug\';\n        END IF;\n        IF (v_table_db = DATABASE() AND (v_table_name = \'tmp_digests\' OR v_table_name = \'tmp_digests_delta\')) THEN\n            SET v_error_msg = CONCAT(\'Invalid value for in_table: \', v_quoted_table, \' is reserved table name.\');\n            SIGNAL SQLSTATE \'45000\'\n               SET MESSAGE_TEXT = v_error_msg;\n        END IF;\n        CALL sys.table_exists(v_table_db, v_table_name, v_table_exists);\n        IF (@sys.debug = \'ON\') THEN\n            SELECT CONCAT(\'v_table_exists = \', v_table_exists) AS \'Debug\';\n        END IF;\n        IF (v_table_exists = \'BASE TABLE\') THEN\n            SET v_checksum_ref = (\n                 SELECT GROUP_CONCAT(CONCAT(COLUMN_NAME, COLUMN_TYPE) ORDER BY ORDINAL_POSITION) AS Checksum\n                   FROM information_schema.COLUMNS\n                  WHERE TABLE_SCHEMA = \'performance_schema\' AND TABLE_NAME = \'events_statements_summary_by_digest\'\n                ),\n                v_checksum_table = (\n                 SELECT GROUP_CONCAT(CONCAT(COLUMN_NAME, COLUMN_TYPE) ORDER BY ORDINAL_POSITION) AS Checksum\n                   FROM information_schema.COLUMNS\n                  WHERE TABLE_SCHEMA = v_table_db AND TABLE_NAME = v_table_name\n                );\n            IF (v_checksum_ref <> v_checksum_table) THEN\n                SET v_error_msg = CONCAT(\'The table \',\n                                         IF(CHAR_LENGTH(v_quoted_table) > 93, CONCAT(\'...\', SUBSTRING(v_quoted_table, -90)), v_quoted_table),\n                                         \' has the wrong definition.\');\n                SIGNAL SQLSTATE \'45000\'\n                   SET MESSAGE_TEXT = v_error_msg;\n            END IF;\n        END IF;\n    END IF;\n    IF (in_views IS NULL OR in_views = \'\') THEN\n        SET in_views = \'with_runtimes_in_95th_percentile,analysis,with_errors_or_warnings,with_full_table_scans,with_sorting,with_temp_tables\';\n    END IF;\n    CALL sys.table_exists(DATABASE(), \'tmp_digests\', v_tmp_digests_table_exists);\n    IF (@sys.debug = \'ON\') THEN\n        SELECT CONCAT(\'v_tmp_digests_table_exists = \', v_tmp_digests_table_exists) AS \'Debug\';\n    END IF;\n    CASE\n        WHEN in_action IN (\'snapshot\', \'overall\') THEN\n            IF (in_table IS NOT NULL) THEN\n                IF (NOT v_table_exists IN (\'TEMPORARY\', \'BASE TABLE\')) THEN\n                    SET v_error_msg = CONCAT(\'The \', in_action, \' action requires in_table to be NULL, NOW() or specify an existing table.\',\n                                             \' The table \',\n                                             IF(CHAR_LENGTH(v_quoted_table) > 16, CONCAT(\'...\', SUBSTRING(v_quoted_table, -13)), v_quoted_table),\n                                             \' does not exist.\');\n                    SIGNAL SQLSTATE \'45000\'\n                       SET MESSAGE_TEXT = v_error_msg;\n                END IF;\n            END IF;\n        WHEN in_action IN (\'delta\', \'save\') THEN\n            IF (v_table_exists NOT IN (\'TEMPORARY\', \'BASE TABLE\')) THEN\n                SET v_error_msg = CONCAT(\'The \', in_action, \' action requires in_table to be an existing table.\',\n                                         IF(in_table IS NOT NULL, CONCAT(\' The table \',\n                                             IF(CHAR_LENGTH(v_quoted_table) > 39, CONCAT(\'...\', SUBSTRING(v_quoted_table, -36)), v_quoted_table),\n                                             \' does not exist.\'), \'\'));\n                SIGNAL SQLSTATE \'45000\'\n                   SET MESSAGE_TEXT = v_error_msg;\n            END IF;\n            IF (in_action = \'delta\' AND v_tmp_digests_table_exists <> \'TEMPORARY\') THEN\n                SIGNAL SQLSTATE \'45000\'\n                   SET MESSAGE_TEXT = \'An existing snapshot generated with the statement_performance_analyzer() must exist.\';\n            END IF;\n        WHEN in_action = \'create_tmp\' THEN\n            IF (v_table_exists = \'TEMPORARY\') THEN\n                SET v_error_msg = CONCAT(\'Cannot create the table \',\n                                         IF(CHAR_LENGTH(v_quoted_table) > 72, CONCAT(\'...\', SUBSTRING(v_quoted_table, -69)), v_quoted_table),\n                                         \' as it already exists.\');\n                SIGNAL SQLSTATE \'45000\'\n                   SET MESSAGE_TEXT = v_error_msg;\n            END IF;\n        WHEN in_action = \'create_table\' THEN\n            IF (v_table_exists <> \'\') THEN\n                SET v_error_msg = CONCAT(\'Cannot create the table \',\n                                         IF(CHAR_LENGTH(v_quoted_table) > 52, CONCAT(\'...\', SUBSTRING(v_quoted_table, -49)), v_quoted_table),\n                                         \' as it already exists\',\n                                         IF(v_table_exists = \'TEMPORARY\', \' as a temporary table.\', \'.\'));\n                SIGNAL SQLSTATE \'45000\'\n                   SET MESSAGE_TEXT = v_error_msg;\n            END IF;\n        WHEN in_action = \'cleanup\' THEN\n            DO (SELECT 1);\n        ELSE\n            SIGNAL SQLSTATE \'45000\'\n               SET MESSAGE_TEXT = \'Unknown action. Supported actions are: cleanup, create_table, create_tmp, delta, overall, save, snapshot\';\n    END CASE;\n    SET v_digest_table_template = \'CREATE %{TEMPORARY}TABLE %{TABLE_NAME} (\\n  `SCHEMA_NAME` varchar(64) DEFAULT NULL,\\n  `DIGEST` varchar(32) DEFAULT NULL,\\n  `DIGEST_TEXT` longtext,\\n  `COUNT_STAR` bigint(20) unsigned NOT NULL,\\n  `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL,\\n  `MIN_TIMER_WAIT` bigint(20) unsigned NOT NULL,\\n  `AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL,\\n  `MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL,\\n  `SUM_LOCK_TIME` bigint(20) unsigned NOT NULL,\\n  `SUM_ERRORS` bigint(20) unsigned NOT NULL,\\n  `SUM_WARNINGS` bigint(20) unsigned NOT NULL,\\n  `SUM_ROWS_AFFECTED` bigint(20) unsigned NOT NULL,\\n  `SUM_ROWS_SENT` bigint(20) unsigned NOT NULL,\\n  `SUM_ROWS_EXAMINED` bigint(20) unsigned NOT NULL,\\n  `SUM_CREATED_TMP_DISK_TABLES` bigint(20) unsigned NOT NULL,\\n  `SUM_CREATED_TMP_TABLES` bigint(20) unsigned NOT NULL,\\n  `SUM_SELECT_FULL_JOIN` bigint(20) unsigned NOT NULL,\\n  `SUM_SELECT_FULL_RANGE_JOIN` bigint(20) unsigned NOT NULL,\\n  `SUM_SELECT_RANGE` bigint(20) unsigned NOT NULL,\\n  `SUM_SELECT_RANGE_CHECK` bigint(20) unsigned NOT NULL,\\n  `SUM_SELECT_SCAN` bigint(20) unsigned NOT NULL,\\n  `SUM_SORT_MERGE_PASSES` bigint(20) unsigned NOT NULL,\\n  `SUM_SORT_RANGE` bigint(20) unsigned NOT NULL,\\n  `SUM_SORT_ROWS` bigint(20) unsigned NOT NULL,\\n  `SUM_SORT_SCAN` bigint(20) unsigned NOT NULL,\\n  `SUM_NO_INDEX_USED` bigint(20) unsigned NOT NULL,\\n  `SUM_NO_GOOD_INDEX_USED` bigint(20) unsigned NOT NULL,\\n  `FIRST_SEEN` timestamp NULL DEFAULT NULL,\\n  `LAST_SEEN` timestamp NULL DEFAULT NULL,\\n  INDEX (SCHEMA_NAME, DIGEST)\\n) DEFAULT CHARSET=utf8\';\n    IF (v_force_new_snapshot\n           OR in_action = \'snapshot\'\n           OR (in_action = \'overall\' AND in_table IS NULL)\n           OR (in_action = \'save\' AND v_tmp_digests_table_exists <> \'TEMPORARY\')\n       ) THEN\n        IF (v_tmp_digests_table_exists = \'TEMPORARY\') THEN\n            IF (@sys.debug = \'ON\') THEN\n                SELECT \'DROP TEMPORARY TABLE IF EXISTS tmp_digests\' AS \'Debug\';\n            END IF;\n            DROP TEMPORARY TABLE IF EXISTS tmp_digests;\n        END IF;\n        CALL sys.execute_prepared_stmt(REPLACE(REPLACE(v_digest_table_template, \'%{TEMPORARY}\', \'TEMPORARY \'), \'%{TABLE_NAME}\', \'tmp_digests\'));\n        SET v_sql = CONCAT(\'INSERT INTO tmp_digests SELECT * FROM \',\n                           IF(in_table IS NULL OR in_action = \'save\', \'performance_schema.events_statements_summary_by_digest\', v_quoted_table));\n        CALL sys.execute_prepared_stmt(v_sql);\n    END IF;\n    IF (in_action IN (\'create_table\', \'create_tmp\')) THEN\n        IF (in_action = \'create_table\') THEN\n            CALL sys.execute_prepared_stmt(REPLACE(REPLACE(v_digest_table_template, \'%{TEMPORARY}\', \'\'), \'%{TABLE_NAME}\', v_quoted_table));\n        ELSE\n            CALL sys.execute_prepared_stmt(REPLACE(REPLACE(v_digest_table_template, \'%{TEMPORARY}\', \'TEMPORARY \'), \'%{TABLE_NAME}\', v_quoted_table));\n        END IF;\n    ELSEIF (in_action = \'save\') THEN\n        CALL sys.execute_prepared_stmt(CONCAT(\'DELETE FROM \', v_quoted_table));\n        CALL sys.execute_prepared_stmt(CONCAT(\'INSERT INTO \', v_quoted_table, \' SELECT * FROM tmp_digests\'));\n    ELSEIF (in_action = \'cleanup\') THEN\n        DROP TEMPORARY TABLE IF EXISTS sys.tmp_digests;\n        DROP TEMPORARY TABLE IF EXISTS sys.tmp_digests_delta;\n    ELSEIF (in_action IN (\'overall\', \'delta\')) THEN\n        IF (in_action = \'overall\') THEN\n            IF (in_table IS NULL) THEN\n                SET v_digests_table = \'tmp_digests\';\n            ELSE\n                SET v_digests_table = v_quoted_table;\n            END IF;\n        ELSE\n            SET v_digests_table = \'tmp_digests_delta\';\n            DROP TEMPORARY TABLE IF EXISTS tmp_digests_delta;\n            CREATE TEMPORARY TABLE tmp_digests_delta LIKE tmp_digests;\n            SET v_sql = CONCAT(\'INSERT INTO tmp_digests_delta\\nSELECT `d_end`.`SCHEMA_NAME`,\\n       `d_end`.`DIGEST`,\\n       `d_end`.`DIGEST_TEXT`,\\n       `d_end`.`COUNT_STAR`-IFNULL(`d_start`.`COUNT_STAR`, 0) AS \'\'COUNT_STAR\'\',\\n       `d_end`.`SUM_TIMER_WAIT`-IFNULL(`d_start`.`SUM_TIMER_WAIT`, 0) AS \'\'SUM_TIMER_WAIT\'\',\\n       `d_end`.`MIN_TIMER_WAIT` AS \'\'MIN_TIMER_WAIT\'\',\\n       IFNULL((`d_end`.`SUM_TIMER_WAIT`-IFNULL(`d_start`.`SUM_TIMER_WAIT`, 0))/NULLIF(`d_end`.`COUNT_STAR`-IFNULL(`d_start`.`COUNT_STAR`, 0), 0), 0) AS \'\'AVG_TIMER_WAIT\'\',\\n       `d_end`.`MAX_TIMER_WAIT` AS \'\'MAX_TIMER_WAIT\'\',\\n       `d_end`.`SUM_LOCK_TIME`-IFNULL(`d_start`.`SUM_LOCK_TIME`, 0) AS \'\'SUM_LOCK_TIME\'\',\\n       `d_end`.`SUM_ERRORS`-IFNULL(`d_start`.`SUM_ERRORS`, 0) AS \'\'SUM_ERRORS\'\',\\n       `d_end`.`SUM_WARNINGS`-IFNULL(`d_start`.`SUM_WARNINGS`, 0) AS \'\'SUM_WARNINGS\'\',\\n       `d_end`.`SUM_ROWS_AFFECTED`-IFNULL(`d_start`.`SUM_ROWS_AFFECTED`, 0) AS \'\'SUM_ROWS_AFFECTED\'\',\\n       `d_end`.`SUM_ROWS_SENT`-IFNULL(`d_start`.`SUM_ROWS_SENT`, 0) AS \'\'SUM_ROWS_SENT\'\',\\n       `d_end`.`SUM_ROWS_EXAMINED`-IFNULL(`d_start`.`SUM_ROWS_EXAMINED`, 0) AS \'\'SUM_ROWS_EXAMINED\'\',\\n       `d_end`.`SUM_CREATED_TMP_DISK_TABLES`-IFNULL(`d_start`.`SUM_CREATED_TMP_DISK_TABLES`, 0) AS \'\'SUM_CREATED_TMP_DISK_TABLES\'\',\\n       `d_end`.`SUM_CREATED_TMP_TABLES`-IFNULL(`d_start`.`SUM_CREATED_TMP_TABLES`, 0) AS \'\'SUM_CREATED_TMP_TABLES\'\',\\n       `d_end`.`SUM_SELECT_FULL_JOIN`-IFNULL(`d_start`.`SUM_SELECT_FULL_JOIN`, 0) AS \'\'SUM_SELECT_FULL_JOIN\'\',\\n       `d_end`.`SUM_SELECT_FULL_RANGE_JOIN`-IFNULL(`d_start`.`SUM_SELECT_FULL_RANGE_JOIN`, 0) AS \'\'SUM_SELECT_FULL_RANGE_JOIN\'\',\\n       `d_end`.`SUM_SELECT_RANGE`-IFNULL(`d_start`.`SUM_SELECT_RANGE`, 0) AS \'\'SUM_SELECT_RANGE\'\',\\n       `d_end`.`SUM_SELECT_RANGE_CHECK`-IFNULL(`d_start`.`SUM_SELECT_RANGE_CHECK`, 0) AS \'\'SUM_SELECT_RANGE_CHECK\'\',\\n       `d_end`.`SUM_SELECT_SCAN`-IFNULL(`d_start`.`SUM_SELECT_SCAN`, 0) AS \'\'SUM_SELECT_SCAN\'\',\\n       `d_end`.`SUM_SORT_MERGE_PASSES`-IFNULL(`d_start`.`SUM_SORT_MERGE_PASSES`, 0) AS \'\'SUM_SORT_MERGE_PASSES\'\',\\n       `d_end`.`SUM_SORT_RANGE`-IFNULL(`d_start`.`SUM_SORT_RANGE`, 0) AS \'\'SUM_SORT_RANGE\'\',\\n       `d_end`.`SUM_SORT_ROWS`-IFNULL(`d_start`.`SUM_SORT_ROWS`, 0) AS \'\'SUM_SORT_ROWS\'\',\\n       `d_end`.`SUM_SORT_SCAN`-IFNULL(`d_start`.`SUM_SORT_SCAN`, 0) AS \'\'SUM_SORT_SCAN\'\',\\n       `d_end`.`SUM_NO_INDEX_USED`-IFNULL(`d_start`.`SUM_NO_INDEX_USED`, 0) AS \'\'SUM_NO_INDEX_USED\'\',\\n       `d_end`.`SUM_NO_GOOD_INDEX_USED`-IFNULL(`d_start`.`SUM_NO_GOOD_INDEX_USED`, 0) AS \'\'SUM_NO_GOOD_INDEX_USED\'\',\\n       `d_end`.`FIRST_SEEN`,\\n       `d_end`.`LAST_SEEN`\\n  FROM tmp_digests d_end\\n       LEFT OUTER JOIN \', v_quoted_table, \' d_start ON `d_start`.`DIGEST` = `d_end`.`DIGEST`\\n                                                    AND (`d_start`.`SCHEMA_NAME` = `d_end`.`SCHEMA_NAME`\\n                                                          OR (`d_start`.`SCHEMA_NAME` IS NULL AND `d_end`.`SCHEMA_NAME` IS NULL)\\n                                                        )\\n WHERE `d_end`.`COUNT_STAR`-IFNULL(`d_start`.`COUNT_STAR`, 0) > 0\');\n            CALL sys.execute_prepared_stmt(v_sql);\n        END IF;\n        IF (FIND_IN_SET(\'with_runtimes_in_95th_percentile\', in_views)) THEN\n            SELECT \'Queries with Runtime in 95th Percentile\' AS \'Next Output\';\n            DROP TEMPORARY TABLE IF EXISTS tmp_digest_avg_latency_distribution1;\n            DROP TEMPORARY TABLE IF EXISTS tmp_digest_avg_latency_distribution2;\n            DROP TEMPORARY TABLE IF EXISTS tmp_digest_95th_percentile_by_avg_us;\n            CREATE TEMPORARY TABLE tmp_digest_avg_latency_distribution1 (\n              cnt bigint unsigned NOT NULL,\n              avg_us decimal(21,0) NOT NULL,\n              PRIMARY KEY (avg_us)\n            ) ENGINE=InnoDB;\n            SET v_sql = CONCAT(\'INSERT INTO tmp_digest_avg_latency_distribution1\\nSELECT COUNT(*) cnt,\\n       ROUND(avg_timer_wait/1000000) AS avg_us\\n  FROM \', v_digests_table, \'\\n GROUP BY avg_us\');\n            CALL sys.execute_prepared_stmt(v_sql);\n            CREATE TEMPORARY TABLE tmp_digest_avg_latency_distribution2 LIKE tmp_digest_avg_latency_distribution1;\n            INSERT INTO tmp_digest_avg_latency_distribution2 SELECT * FROM tmp_digest_avg_latency_distribution1;\n            CREATE TEMPORARY TABLE tmp_digest_95th_percentile_by_avg_us (\n              avg_us decimal(21,0) NOT NULL,\n              percentile decimal(46,4) NOT NULL,\n              PRIMARY KEY (avg_us)\n            ) ENGINE=InnoDB;\n            SET v_sql = CONCAT(\'INSERT INTO tmp_digest_95th_percentile_by_avg_us\\nSELECT s2.avg_us avg_us,\\n       IFNULL(SUM(s1.cnt)/NULLIF((SELECT COUNT(*) FROM \', v_digests_table, \'), 0), 0) percentile\\n  FROM tmp_digest_avg_latency_distribution1 AS s1\\n       JOIN tmp_digest_avg_latency_distribution2 AS s2 ON s1.avg_us <= s2.avg_us\\n GROUP BY s2.avg_us\\nHAVING percentile > 0.95\\n ORDER BY percentile\\n LIMIT 1\');\n            CALL sys.execute_prepared_stmt(v_sql);\n            SET v_sql =\n                REPLACE(\n                    REPLACE(\n                        (SELECT VIEW_DEFINITION\n                           FROM information_schema.VIEWS\n                          WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = \'statements_with_runtimes_in_95th_percentile\'\n                        ),\n                        \'`performance_schema`.`events_statements_summary_by_digest`\',\n                        v_digests_table\n                    ),\n                    \'sys.x$ps_digest_95th_percentile_by_avg_us\',\n                    \'`sys`.`x$ps_digest_95th_percentile_by_avg_us`\'\n              );\n            CALL sys.execute_prepared_stmt(v_sql);\n            DROP TEMPORARY TABLE tmp_digest_avg_latency_distribution1;\n            DROP TEMPORARY TABLE tmp_digest_avg_latency_distribution2;\n            DROP TEMPORARY TABLE tmp_digest_95th_percentile_by_avg_us;\n        END IF;\n        IF (FIND_IN_SET(\'analysis\', in_views)) THEN\n            SELECT CONCAT(\'Top \', @sys.statement_performance_analyzer.limit, \' Queries Ordered by Total Latency\') AS \'Next Output\';\n            SET v_sql =\n                REPLACE(\n                    (SELECT VIEW_DEFINITION\n                       FROM information_schema.VIEWS\n                      WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = \'statement_analysis\'\n                    ),\n                    \'`performance_schema`.`events_statements_summary_by_digest`\',\n                    v_digests_table\n                );\n            IF (@sys.statement_performance_analyzer.limit > 0) THEN\n                SET v_sql = CONCAT(v_sql, \' LIMIT \', @sys.statement_performance_analyzer.limit);\n            END IF;\n            CALL sys.execute_prepared_stmt(v_sql);\n        END IF;\n        IF (FIND_IN_SET(\'with_errors_or_warnings\', in_views)) THEN\n            SELECT CONCAT(\'Top \', @sys.statement_performance_analyzer.limit, \' Queries with Errors\') AS \'Next Output\';\n            SET v_sql =\n                REPLACE(\n                    (SELECT VIEW_DEFINITION\n                       FROM information_schema.VIEWS\n                      WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = \'statements_with_errors_or_warnings\'\n                    ),\n                    \'`performance_schema`.`events_statements_summary_by_digest`\',\n                    v_digests_table\n                );\n            IF (@sys.statement_performance_analyzer.limit > 0) THEN\n                SET v_sql = CONCAT(v_sql, \' LIMIT \', @sys.statement_performance_analyzer.limit);\n            END IF;\n            CALL sys.execute_prepared_stmt(v_sql);\n        END IF;\n        IF (FIND_IN_SET(\'with_full_table_scans\', in_views)) THEN\n            SELECT CONCAT(\'Top \', @sys.statement_performance_analyzer.limit, \' Queries with Full Table Scan\') AS \'Next Output\';\n            SET v_sql =\n                REPLACE(\n                    (SELECT VIEW_DEFINITION\n                       FROM information_schema.VIEWS\n                      WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = \'statements_with_full_table_scans\'\n                    ),\n                    \'`performance_schema`.`events_statements_summary_by_digest`\',\n                    v_digests_table\n                );\n            IF (@sys.statement_performance_analyzer.limit > 0) THEN\n                SET v_sql = CONCAT(v_sql, \' LIMIT \', @sys.statement_performance_analyzer.limit);\n            END IF;\n            CALL sys.execute_prepared_stmt(v_sql);\n        END IF;\n        IF (FIND_IN_SET(\'with_sorting\', in_views)) THEN\n            SELECT CONCAT(\'Top \', @sys.statement_performance_analyzer.limit, \' Queries with Sorting\') AS \'Next Output\';\n            SET v_sql =\n                REPLACE(\n                    (SELECT VIEW_DEFINITION\n                       FROM information_schema.VIEWS\n                      WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = \'statements_with_sorting\'\n                    ),\n                    \'`performance_schema`.`events_statements_summary_by_digest`\',\n                    v_digests_table\n                );\n            IF (@sys.statement_performance_analyzer.limit > 0) THEN\n                SET v_sql = CONCAT(v_sql, \' LIMIT \', @sys.statement_performance_analyzer.limit);\n            END IF;\n            CALL sys.execute_prepared_stmt(v_sql);\n        END IF;\n        IF (FIND_IN_SET(\'with_temp_tables\', in_views)) THEN\n            SELECT CONCAT(\'Top \', @sys.statement_performance_analyzer.limit, \' Queries with Internal Temporary Tables\') AS \'Next Output\';\n            SET v_sql =\n                REPLACE(\n                    (SELECT VIEW_DEFINITION\n                       FROM information_schema.VIEWS\n                      WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = \'statements_with_temp_tables\'\n                    ),\n                    \'`performance_schema`.`events_statements_summary_by_digest`\',\n                    v_digests_table\n                );\n            IF (@sys.statement_performance_analyzer.limit > 0) THEN\n                SET v_sql = CONCAT(v_sql, \' LIMIT \', @sys.statement_performance_analyzer.limit);\n            END IF;\n            CALL sys.execute_prepared_stmt(v_sql);\n        END IF;\n        IF (FIND_IN_SET(\'custom\', in_views)) THEN\n            SELECT CONCAT(\'Top \', @sys.statement_performance_analyzer.limit, \' Queries Using Custom View\') AS \'Next Output\';\n            IF (@sys.statement_performance_analyzer.view IS NULL) THEN\n                SET @sys.statement_performance_analyzer.view = sys.sys_get_config(\'statement_performance_analyzer.view\', NULL);\n            END IF;\n            IF (@sys.statement_performance_analyzer.view IS NULL) THEN\n                SIGNAL SQLSTATE \'45000\'\n                   SET MESSAGE_TEXT = \'The @sys.statement_performance_analyzer.view user variable must be set with the view or query to use.\';\n            END IF;\n            IF (NOT INSTR(@sys.statement_performance_analyzer.view, \' \')) THEN\n                IF (NOT INSTR(@sys.statement_performance_analyzer.view, \'.\')) THEN\n                    SET v_custom_db   = DATABASE(),\n                        v_custom_name = @sys.statement_performance_analyzer.view;\n                ELSE\n                    SET v_custom_db   = SUBSTRING_INDEX(@sys.statement_performance_analyzer.view, \'.\', 1);\n                    SET v_custom_name = SUBSTRING(@sys.statement_performance_analyzer.view, CHAR_LENGTH(v_custom_db)+2);\n                END IF;\n                CALL sys.table_exists(v_custom_db, v_custom_name, v_custom_view_exists);\n                IF (v_custom_view_exists <> \'VIEW\') THEN\n                    SIGNAL SQLSTATE \'45000\'\n                       SET MESSAGE_TEXT = \'The @sys.statement_performance_analyzer.view user variable is set but specified neither an existing view nor a query.\';\n                END IF;\n                SET v_sql =\n                    REPLACE(\n                        (SELECT VIEW_DEFINITION\n                           FROM information_schema.VIEWS\n                          WHERE TABLE_SCHEMA = v_custom_db AND TABLE_NAME = v_custom_name\n                        ),\n                        \'`performance_schema`.`events_statements_summary_by_digest`\',\n                        v_digests_table\n                    );\n            ELSE\n                SET v_sql = REPLACE(@sys.statement_performance_analyzer.view, \'`performance_schema`.`events_statements_summary_by_digest`\', v_digests_table);\n            END IF;\n            IF (@sys.statement_performance_analyzer.limit > 0) THEN\n                SET v_sql = CONCAT(v_sql, \' LIMIT \', @sys.statement_performance_analyzer.limit);\n            END IF;\n            CALL sys.execute_prepared_stmt(v_sql);\n        END IF;\n    END IF;\n    IF (v_this_thread_enabled = \'YES\') THEN\n        CALL sys.ps_setup_enable_thread(CONNECTION_ID());\n    END IF;\n    IF (@log_bin = 1) THEN\n        SET sql_log_bin = @log_bin;\n    END IF;\nEND','NONE'),('sys','ps_is_account_enabled','FUNCTION','ps_is_account_enabled','SQL','READS_SQL_DATA','YES','INVOKER','in_host VARCHAR(60),\n        in_user VARCHAR(16)\n    ','enum(\'YES\',\'NO\') CHARSET utf8mb3 COLLATE utf8mb3_general_ci','BEGIN\n    RETURN IF(EXISTS(SELECT 1\n                       FROM performance_schema.setup_actors\n                      WHERE (`HOST` = \'%\' OR in_host LIKE `HOST`)\n                        AND (`USER` = \'%\' OR `USER` = in_user)\n                    ),\n              \'YES\', \'NO\'\n           );\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Determines whether instrumentation of an account is enabled\n             within Performance Schema.\n             Parameters\n             in_host VARCHAR(60):\n               The hostname of the account to check.\n             in_user (VARCHAR(16)):\n               The username of the account to check.\n             Returns\n             ENUM(\'YES\', \'NO\', \'PARTIAL\')\n             Example\n             mysql> SELECT sys.ps_is_account_enabled(\'localhost\', \'root\');\n             +------------------------------------------------+\n             | sys.ps_is_account_enabled(\'localhost\', \'root\') |\n             +------------------------------------------------+\n             | YES                                            |\n             +------------------------------------------------+\n             1 row in set (0.01 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    RETURN IF(EXISTS(SELECT 1\n                       FROM performance_schema.setup_actors\n                      WHERE (`HOST` = \'%\' OR in_host LIKE `HOST`)\n                        AND (`USER` = \'%\' OR `USER` = in_user)\n                    ),\n              \'YES\', \'NO\'\n           );\nEND','NONE'),('sys','ps_is_consumer_enabled','FUNCTION','ps_is_consumer_enabled','SQL','READS_SQL_DATA','YES','INVOKER','in_consumer varchar(64)\n   ','enum(\'YES\',\'NO\') CHARSET utf8mb3 COLLATE utf8mb3_general_ci','BEGIN\n    RETURN (\n        SELECT (CASE\n                   WHEN c.NAME = \'global_instrumentation\' THEN c.ENABLED\n                   WHEN c.NAME = \'thread_instrumentation\' THEN IF(cg.ENABLED = \'YES\' AND c.ENABLED = \'YES\', \'YES\', \'NO\')\n                   WHEN c.NAME LIKE \'%\\_digest\'           THEN IF(cg.ENABLED = \'YES\' AND c.ENABLED = \'YES\', \'YES\', \'NO\')\n                   WHEN c.NAME LIKE \'%\\_current\'          THEN IF(cg.ENABLED = \'YES\' AND ct.ENABLED = \'YES\' AND c.ENABLED = \'YES\', \'YES\', \'NO\')\n                   ELSE IF(cg.ENABLED = \'YES\' AND ct.ENABLED = \'YES\' AND c.ENABLED = \'YES\'\n                           AND ( SELECT cc.ENABLED FROM performance_schema.setup_consumers cc WHERE NAME = CONCAT(SUBSTRING_INDEX(c.NAME, \'_\', 2), \'_current\')\n                               ) = \'YES\', \'YES\', \'NO\')\n                END) AS IsEnabled\n          FROM performance_schema.setup_consumers c\n               INNER JOIN performance_schema.setup_consumers cg\n               INNER JOIN performance_schema.setup_consumers ct\n         WHERE cg.NAME       = \'global_instrumentation\'\n               AND ct.NAME   = \'thread_instrumentation\'\n               AND c.NAME    = in_consumer\n       );\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Determines whether a consumer is enabled (taking the consumer hierarchy into consideration)\n             within the Performance Schema.\n             Parameters\n             in_consumer VARCHAR(64):\n               The name of the consumer to check.\n             Returns\n             ENUM(\'YES\', \'NO\')\n             Example\n             mysql> SELECT sys.ps_is_consumer_enabled(\'events_stages_history\');\n             +-----------------------------------------------------+\n             | sys.ps_is_consumer_enabled(\'events_stages_history\') |\n             +-----------------------------------------------------+\n             | NO                                                  |\n             +-----------------------------------------------------+\n             1 row in set (0.00 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    RETURN (\n        SELECT (CASE\n                   WHEN c.NAME = \'global_instrumentation\' THEN c.ENABLED\n                   WHEN c.NAME = \'thread_instrumentation\' THEN IF(cg.ENABLED = \'YES\' AND c.ENABLED = \'YES\', \'YES\', \'NO\')\n                   WHEN c.NAME LIKE \'%\\_digest\'           THEN IF(cg.ENABLED = \'YES\' AND c.ENABLED = \'YES\', \'YES\', \'NO\')\n                   WHEN c.NAME LIKE \'%\\_current\'          THEN IF(cg.ENABLED = \'YES\' AND ct.ENABLED = \'YES\' AND c.ENABLED = \'YES\', \'YES\', \'NO\')\n                   ELSE IF(cg.ENABLED = \'YES\' AND ct.ENABLED = \'YES\' AND c.ENABLED = \'YES\'\n                           AND ( SELECT cc.ENABLED FROM performance_schema.setup_consumers cc WHERE NAME = CONCAT(SUBSTRING_INDEX(c.NAME, \'_\', 2), \'_current\')\n                               ) = \'YES\', \'YES\', \'NO\')\n                END) AS IsEnabled\n          FROM performance_schema.setup_consumers c\n               INNER JOIN performance_schema.setup_consumers cg\n               INNER JOIN performance_schema.setup_consumers ct\n         WHERE cg.NAME       = \'global_instrumentation\'\n               AND ct.NAME   = \'thread_instrumentation\'\n               AND c.NAME    = in_consumer\n       );\nEND','NONE'),('sys','table_exists','PROCEDURE','table_exists','SQL','CONTAINS_SQL','NO','INVOKER','\n        IN in_db VARCHAR(64), IN in_table VARCHAR(64),\n        OUT out_exists ENUM(\'\', \'BASE TABLE\', \'VIEW\', \'TEMPORARY\', \'SEQUENCE\', \'SYSTEM VIEW\')\n    ','','BEGIN\n    DECLARE v_error BOOLEAN DEFAULT FALSE;\n    DECLARE db_quoted VARCHAR(64);\n    DECLARE table_quoted VARCHAR(64);\n    DECLARE v_table_type VARCHAR(16) DEFAULT \'\';\n    DECLARE v_system_db BOOLEAN\n        DEFAULT LOWER(in_db) IN (\'information_schema\', \'performance_schema\');\n    DECLARE CONTINUE HANDLER FOR 1050 SET v_error = TRUE;\n    DECLARE CONTINUE HANDLER FOR 1146 SET v_error = TRUE;\n    SET out_exists = \'\';\n    SET db_quoted = sys.quote_identifier(in_db);\n    SET table_quoted = sys.quote_identifier(in_table);\n    IF (EXISTS(SELECT 1 FROM information_schema.TABLES WHERE TABLE_SCHEMA = in_db AND TABLE_NAME = in_table)) THEN\n        IF v_system_db = FALSE THEN\n            SET @sys.tmp.table_exists.SQL = CONCAT(\'CREATE TEMPORARY TABLE \',\n                                                    db_quoted,\n                                                    \'.\',\n                                                    table_quoted,\n                                                    \'(id INT PRIMARY KEY)\');\n            PREPARE stmt_create_table FROM @sys.tmp.table_exists.SQL;\n            EXECUTE stmt_create_table;\n            DEALLOCATE PREPARE stmt_create_table;\n            SET @sys.tmp.table_exists.SQL = CONCAT(\'DROP TEMPORARY TABLE \',\n                                                                db_quoted,\n                                                                \'.\',\n                                                                table_quoted);\n            PREPARE stmt_drop_table FROM @sys.tmp.table_exists.SQL;\n            EXECUTE stmt_drop_table;\n            DEALLOCATE PREPARE stmt_drop_table;\n        END IF;\n        IF (v_error) THEN\n            SET out_exists = \'TEMPORARY\';\n        ELSE\n            SET v_table_type = (SELECT TABLE_TYPE FROM information_schema.TABLES WHERE TABLE_SCHEMA = in_db AND TABLE_NAME = in_table);\n            IF v_table_type = \'SYSTEM VERSIONED\' THEN\n                SET out_exists = \'BASE TABLE\';\n            ELSE\n                SET out_exists = v_table_type;\n            END IF;\n        END IF;\n    ELSE\n        IF v_system_db = FALSE THEN\n            SET @sys.tmp.table_exists.SQL = CONCAT(\'SELECT COUNT(*) FROM \',\n                                                            db_quoted,\n                                                            \'.\',\n                                                            table_quoted);\n            PREPARE stmt_select FROM @sys.tmp.table_exists.SQL;\n            IF (NOT v_error) THEN\n                DEALLOCATE PREPARE stmt_select;\n                SET out_exists = \'TEMPORARY\';\n            END IF;\n        END IF;\n    END IF;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Tests whether the table specified in in_db and in_table exists either as a regular\n             table, or as a temporary table. The returned value corresponds to the table that\n             will be used, so if there\'s both a temporary and a permanent table with the given\n             name, then \'TEMPORARY\' will be returned.\n             Parameters\n             in_db (VARCHAR(64)):\n               The database name to check for the existence of the table in.\n             in_table (VARCHAR(64)):\n               The name of the table to check the existence of.\n             out_exists ENUM(\'\', \'BASE TABLE\', \'VIEW\', \'TEMPORARY\'):\n               The return value: whether the table exists. The value is one of:\n                 * \'\'             - the table does not exist neither as a base table, view, sequence nor temporary table.\n                 * \'BASE TABLE\'   - the table name exists as a permanent base table table.\n                 * \'VIEW\'         - the table name exists as a view.\n                 * \'TEMPORARY\'    - the table name exists as a temporary table.\n                 * \'SEQUENCE\'     - the table name exists as a sequence.\n                 * \'SYSTEM VIEW\'  - the table name exists as a system view.\n             Example\n             mysql> CREATE DATABASE db1;\n             Query OK, 1 row affected (0.07 sec)\n             mysql> use db1;\n             Database changed\n             mysql> CREATE TABLE t1 (id INT PRIMARY KEY);\n             Query OK, 0 rows affected (0.08 sec)\n             mysql> CREATE TABLE t2 (id INT PRIMARY KEY);\n             Query OK, 0 rows affected (0.08 sec)\n             mysql> CREATE view v_t1 AS SELECT * FROM t1;\n             Query OK, 0 rows affected (0.00 sec)\n             mysql> CREATE TEMPORARY TABLE t1 (id INT PRIMARY KEY);\n             Query OK, 0 rows affected (0.00 sec)\n             mysql> CALL sys.table_exists(\'db1\', \'t1\', @exists); SELECT @exists;\n             Query OK, 0 rows affected (0.00 sec)\n             +------------+\n             | @exists    |\n             +------------+\n             | TEMPORARY  |\n             +------------+\n             1 row in set (0.00 sec)\n             mysql> CALL sys.table_exists(\'db1\', \'t2\', @exists); SELECT @exists;\n             Query OK, 0 rows affected (0.00 sec)\n             +------------+\n             | @exists    |\n             +------------+\n             | BASE TABLE |\n             +------------+\n             1 row in set (0.01 sec)\n             mysql> CALL sys.table_exists(\'db1\', \'v_t1\', @exists); SELECT @exists;\n             Query OK, 0 rows affected (0.00 sec)\n             +---------+\n             | @exists |\n             +---------+\n             | VIEW    |\n             +---------+\n             1 row in set (0.00 sec)\n             MariaDB [sys]> CALL sys.table_exists(\'db1\', \'s\', @exists); SELECT @exists;\n             Query OK, 0 rows affected (0.006 sec)\n             +----------+\n             | @exists  |\n             +----------+\n             | SEQUENCE |\n             +----------+\n             1 row in set (0.000 sec)\n             MariaDB [sys]> CALL table_exists(\'information_schema\', \'user_variables\', @exists); SELECT @exists;\n             Query OK, 0 rows affected (0.003 sec)\n             +-------------+\n             | @exists     |\n             +-------------+\n             | SYSTEM VIEW |\n             +-------------+\n             1 row in set (0.001 sec)\n             mysql> CALL sys.table_exists(\'db1\', \'t3\', @exists); SELECT @exists;\n             Query OK, 0 rows affected (0.01 sec)\n             +---------+\n             | @exists |\n             +---------+\n             |         |\n             +---------+\n             1 row in set (0.00 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    DECLARE v_error BOOLEAN DEFAULT FALSE;\n    DECLARE db_quoted VARCHAR(64);\n    DECLARE table_quoted VARCHAR(64);\n    DECLARE v_table_type VARCHAR(16) DEFAULT \'\';\n    DECLARE v_system_db BOOLEAN\n        DEFAULT LOWER(in_db) IN (\'information_schema\', \'performance_schema\');\n    DECLARE CONTINUE HANDLER FOR 1050 SET v_error = TRUE;\n    DECLARE CONTINUE HANDLER FOR 1146 SET v_error = TRUE;\n    SET out_exists = \'\';\n    SET db_quoted = sys.quote_identifier(in_db);\n    SET table_quoted = sys.quote_identifier(in_table);\n    IF (EXISTS(SELECT 1 FROM information_schema.TABLES WHERE TABLE_SCHEMA = in_db AND TABLE_NAME = in_table)) THEN\n        IF v_system_db = FALSE THEN\n            SET @sys.tmp.table_exists.SQL = CONCAT(\'CREATE TEMPORARY TABLE \',\n                                                    db_quoted,\n                                                    \'.\',\n                                                    table_quoted,\n                                                    \'(id INT PRIMARY KEY)\');\n            PREPARE stmt_create_table FROM @sys.tmp.table_exists.SQL;\n            EXECUTE stmt_create_table;\n            DEALLOCATE PREPARE stmt_create_table;\n            SET @sys.tmp.table_exists.SQL = CONCAT(\'DROP TEMPORARY TABLE \',\n                                                                db_quoted,\n                                                                \'.\',\n                                                                table_quoted);\n            PREPARE stmt_drop_table FROM @sys.tmp.table_exists.SQL;\n            EXECUTE stmt_drop_table;\n            DEALLOCATE PREPARE stmt_drop_table;\n        END IF;\n        IF (v_error) THEN\n            SET out_exists = \'TEMPORARY\';\n        ELSE\n            SET v_table_type = (SELECT TABLE_TYPE FROM information_schema.TABLES WHERE TABLE_SCHEMA = in_db AND TABLE_NAME = in_table);\n            IF v_table_type = \'SYSTEM VERSIONED\' THEN\n                SET out_exists = \'BASE TABLE\';\n            ELSE\n                SET out_exists = v_table_type;\n            END IF;\n        END IF;\n    ELSE\n        IF v_system_db = FALSE THEN\n            SET @sys.tmp.table_exists.SQL = CONCAT(\'SELECT COUNT(*) FROM \',\n                                                            db_quoted,\n                                                            \'.\',\n                                                            table_quoted);\n            PREPARE stmt_select FROM @sys.tmp.table_exists.SQL;\n            IF (NOT v_error) THEN\n                DEALLOCATE PREPARE stmt_select;\n                SET out_exists = \'TEMPORARY\';\n            END IF;\n        END IF;\n    END IF;\nEND','NONE'),('sys','ps_is_instrument_default_enabled','FUNCTION','ps_is_instrument_default_enabled','SQL','READS_SQL_DATA','YES','INVOKER','in_instrument VARCHAR(128)\n    ','enum(\'YES\',\'NO\') CHARSET utf8mb3 COLLATE utf8mb3_general_ci','BEGIN\n    DECLARE v_enabled ENUM(\'YES\', \'NO\');\n    SET v_enabled = IF(in_instrument LIKE \'wait/io/file/%\'\n                        OR in_instrument LIKE \'wait/io/table/%\'\n                        OR in_instrument LIKE \'statement/%\'\n                        OR in_instrument LIKE \'memory/performance_schema/%\'\n                        OR in_instrument IN (\'wait/lock/table/sql/handler\', \'idle\')\n               \n                      ,\n                       \'YES\',\n                       \'NO\'\n                    );\n    RETURN v_enabled;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Returns whether an instrument is enabled by default in this version of MySQL.\n             Parameters\n             in_instrument VARCHAR(128):\n               The instrument to check.\n             Returns\n             ENUM(\'YES\', \'NO\')\n             Example\n             mysql> SELECT sys.ps_is_instrument_default_enabled(\'statement/sql/select\');\n             +--------------------------------------------------------------+\n             | sys.ps_is_instrument_default_enabled(\'statement/sql/select\') |\n             +--------------------------------------------------------------+\n             | YES                                                          |\n             +--------------------------------------------------------------+\n             1 row in set (0.00 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    DECLARE v_enabled ENUM(\'YES\', \'NO\');\n    SET v_enabled = IF(in_instrument LIKE \'wait/io/file/%\'\n                        OR in_instrument LIKE \'wait/io/table/%\'\n                        OR in_instrument LIKE \'statement/%\'\n                        OR in_instrument LIKE \'memory/performance_schema/%\'\n                        OR in_instrument IN (\'wait/lock/table/sql/handler\', \'idle\')\n               \n                      ,\n                       \'YES\',\n                       \'NO\'\n                    );\n    RETURN v_enabled;\nEND','NONE'),('sys','ps_is_instrument_default_timed','FUNCTION','ps_is_instrument_default_timed','SQL','READS_SQL_DATA','YES','INVOKER','in_instrument VARCHAR(128)\n    ','enum(\'YES\',\'NO\') CHARSET utf8mb3 COLLATE utf8mb3_general_ci','BEGIN\n    DECLARE v_timed ENUM(\'YES\', \'NO\');\n    SET v_timed = IF(in_instrument LIKE \'wait/io/file/%\'\n                        OR in_instrument LIKE \'wait/io/table/%\'\n                        OR in_instrument LIKE \'statement/%\'\n                        OR in_instrument IN (\'wait/lock/table/sql/handler\', \'idle\')\n               \n                      ,\n                       \'YES\',\n                       \'NO\'\n                    );\n    RETURN v_timed;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Returns whether an instrument is timed by default in this version of MySQL.\n             Parameters\n             in_instrument VARCHAR(128):\n               The instrument to check.\n             Returns\n             ENUM(\'YES\', \'NO\')\n             Example\n             mysql> SELECT sys.ps_is_instrument_default_timed(\'statement/sql/select\');\n             +------------------------------------------------------------+\n             | sys.ps_is_instrument_default_timed(\'statement/sql/select\') |\n             +------------------------------------------------------------+\n             | YES                                                        |\n             +------------------------------------------------------------+\n             1 row in set (0.00 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    DECLARE v_timed ENUM(\'YES\', \'NO\');\n    SET v_timed = IF(in_instrument LIKE \'wait/io/file/%\'\n                        OR in_instrument LIKE \'wait/io/table/%\'\n                        OR in_instrument LIKE \'statement/%\'\n                        OR in_instrument IN (\'wait/lock/table/sql/handler\', \'idle\')\n               \n                      ,\n                       \'YES\',\n                       \'NO\'\n                    );\n    RETURN v_timed;\nEND','NONE'),('sys','ps_is_thread_instrumented','FUNCTION','ps_is_thread_instrumented','SQL','READS_SQL_DATA','NO','INVOKER','in_connection_id BIGINT UNSIGNED\n    ','enum(\'YES\',\'NO\',\'UNKNOWN\') CHARSET utf8mb3 COLLATE utf8mb3_general_ci','BEGIN\n    DECLARE v_enabled ENUM(\'YES\', \'NO\', \'UNKNOWN\');\n    IF (in_connection_id IS NULL) THEN\n        RETURN NULL;\n    END IF;\n    SELECT INSTRUMENTED INTO v_enabled\n      FROM performance_schema.threads\n     WHERE PROCESSLIST_ID = in_connection_id;\n    IF (v_enabled IS NULL) THEN\n        RETURN \'UNKNOWN\';\n    ELSE\n        RETURN v_enabled;\n    END IF;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Checks whether the provided connection id is instrumented within Performance Schema.\n             Parameters\n             in_connection_id (BIGINT UNSIGNED):\n               The id of the connection to check.\n             Returns\n             ENUM(\'YES\', \'NO\', \'UNKNOWN\')\n             Example\n             mysql> SELECT sys.ps_is_thread_instrumented(CONNECTION_ID());\n             +------------------------------------------------+\n             | sys.ps_is_thread_instrumented(CONNECTION_ID()) |\n             +------------------------------------------------+\n             | YES                                            |\n             +------------------------------------------------+\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    DECLARE v_enabled ENUM(\'YES\', \'NO\', \'UNKNOWN\');\n    IF (in_connection_id IS NULL) THEN\n        RETURN NULL;\n    END IF;\n    SELECT INSTRUMENTED INTO v_enabled\n      FROM performance_schema.threads\n     WHERE PROCESSLIST_ID = in_connection_id;\n    IF (v_enabled IS NULL) THEN\n        RETURN \'UNKNOWN\';\n    ELSE\n        RETURN v_enabled;\n    END IF;\nEND','NONE'),('sys','ps_thread_id','FUNCTION','ps_thread_id','SQL','READS_SQL_DATA','NO','INVOKER','in_connection_id BIGINT UNSIGNED\n    ','bigint(20) unsigned','BEGIN\n    RETURN (SELECT THREAD_ID\n              FROM `performance_schema`.`threads`\n             WHERE PROCESSLIST_ID = IFNULL(in_connection_id, CONNECTION_ID())\n           );\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Return the Performance Schema THREAD_ID for the specified connection ID.\n             Parameters\n             in_connection_id (BIGINT UNSIGNED):\n               The id of the connection to return the thread id for. If NULL, the current\n               connection thread id is returned.\n             Example\n             mysql> SELECT sys.ps_thread_id(79);\n             +----------------------+\n             | sys.ps_thread_id(79) |\n             +----------------------+\n             |                   98 |\n             +----------------------+\n             1 row in set (0.00 sec)\n             mysql> SELECT sys.ps_thread_id(CONNECTION_ID());\n             +-----------------------------------+\n             | sys.ps_thread_id(CONNECTION_ID()) |\n             +-----------------------------------+\n             |                                98 |\n             +-----------------------------------+\n             1 row in set (0.00 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    RETURN (SELECT THREAD_ID\n              FROM `performance_schema`.`threads`\n             WHERE PROCESSLIST_ID = IFNULL(in_connection_id, CONNECTION_ID())\n           );\nEND','NONE'),('sys','ps_thread_account','FUNCTION','ps_thread_account','SQL','READS_SQL_DATA','NO','INVOKER','in_thread_id BIGINT UNSIGNED\n    ','text CHARSET utf8mb3 COLLATE utf8mb3_general_ci','BEGIN\n    RETURN (SELECT IF(\n                      type = \'FOREGROUND\',\n                      CONCAT(processlist_user, \'@\', processlist_host),\n                      type\n                     ) AS account\n              FROM `performance_schema`.`threads`\n             WHERE thread_id = in_thread_id);\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Return the user@host account for the given Performance Schema thread id.\n             Parameters\n             in_thread_id (BIGINT UNSIGNED):\n               The id of the thread to return the account for.\n             Example\n             mysql> select thread_id, processlist_user, processlist_host from performance_schema.threads where type = \'foreground\';\n              +-----------+------------------+------------------+\n              | thread_id | processlist_user | processlist_host |\n              +-----------+------------------+------------------+\n              |        23 | NULL             | NULL             |\n              |        30 | root             | localhost        |\n              |        31 | msandbox         | localhost        |\n              |        32 | msandbox         | localhost        |\n              +-----------+------------------+------------------+\n              4 rows in set (0.00 sec)\n              mysql> select sys.ps_thread_account(31);\n              +---------------------------+\n              | sys.ps_thread_account(31) |\n              +---------------------------+\n              | msandbox@localhost        |\n              +---------------------------+\n              1 row in set (0.00 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    RETURN (SELECT IF(\n                      type = \'FOREGROUND\',\n                      CONCAT(processlist_user, \'@\', processlist_host),\n                      type\n                     ) AS account\n              FROM `performance_schema`.`threads`\n             WHERE thread_id = in_thread_id);\nEND','NONE'),('sys','quote_identifier','FUNCTION','quote_identifier','SQL','NO_SQL','YES','INVOKER','in_identifier TEXT','text CHARSET utf8mb3 COLLATE utf8mb3_general_ci','BEGIN\n    RETURN CONCAT(\'`\', REPLACE(in_identifier, \'`\', \'``\'), \'`\');\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Takes an unquoted identifier (schema name, table name, etc.) and\n             returns the identifier quoted with backticks.\n             Parameters\n             in_identifier (TEXT):\n               The identifier to quote.\n             Returns\n             TEXT\n             Example\n             mysql> SELECT sys.quote_identifier(\'my_identifier\') AS Identifier;\n             +-----------------+\n             | Identifier      |\n             +-----------------+\n             | `my_identifier` |\n             +-----------------+\n             1 row in set (0.00 sec)\n             mysql> SELECT sys.quote_identifier(\'my`idenfier\') AS Identifier;\n             +----------------+\n             | Identifier     |\n             +----------------+\n             | `my``idenfier` |\n             +----------------+\n             1 row in set (0.00 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    RETURN CONCAT(\'`\', REPLACE(in_identifier, \'`\', \'``\'), \'`\');\nEND','NONE'),('sys','sys_get_config','FUNCTION','sys_get_config','SQL','READS_SQL_DATA','YES','INVOKER','in_variable_name VARCHAR(128),\n        in_default_value VARCHAR(128)\n    ','varchar(128) CHARSET utf8mb3 COLLATE utf8mb3_general_ci','BEGIN\n    DECLARE v_value VARCHAR(128) DEFAULT NULL;\n    DECLARE old_val INTEGER DEFAULT NULL;\n    SET v_value = (SELECT value FROM sys.sys_config WHERE variable = in_variable_name);\n    IF (v_value IS NULL) THEN\n        SET v_value = in_default_value;\n    END IF;\n    RETURN v_value;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Returns the value for the requested variable using the following logic:\n                1. If the option exists in sys.sys_config return the value from there.\n                2. Else fall back on the provided default value.\n             Notes for using sys_get_config():\n                * If the default value argument to sys_get_config() is NULL and case 2. is reached, NULL is returned.\n                  It is then expected that the caller is able to handle NULL for the given configuration option.\n                * The convention is to name the user variables @sys.<name of variable>. It is <name of variable> that\n                  is stored in the sys_config table and is what is expected as the argument to sys_get_config().\n                * If you want to check whether the configuration option has already been set and if not assign with\n                  the return value of sys_get_config() you can use IFNULL(...) (see example below). However this should\n                  not be done inside a loop (e.g. for each row in a result set) as for repeated calls where assignment\n                  is only needed in the first iteration using IFNULL(...) is expected to be significantly slower than\n                  using an IF (...) THEN ... END IF; block (see example below).\n             Parameters\n             in_variable_name (VARCHAR(128)):\n               The name of the config option to return the value for.\n             in_default_value (VARCHAR(128)):\n               The default value to return if the variable does not exist in sys.sys_config.\n             Returns\n             VARCHAR(128)\n             Example\n             mysql> SELECT sys.sys_get_config(\'statement_truncate_len\', 128) AS Value;\n             +-------+\n             | Value |\n             +-------+\n             | 64    |\n             +-------+\n             1 row in set (0.00 sec)\n             mysql> SET @sys.statement_truncate_len = IFNULL(@sys.statement_truncate_len, sys.sys_get_config(\'statement_truncate_len\', 64));\n             Query OK, 0 rows affected (0.00 sec)\n             IF (@sys.statement_truncate_len IS NULL) THEN\n                 SET @sys.statement_truncate_len = sys.sys_get_config(\'statement_truncate_len\', 64);\n             END IF;\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    DECLARE v_value VARCHAR(128) DEFAULT NULL;\n    DECLARE old_val INTEGER DEFAULT NULL;\n    SET v_value = (SELECT value FROM sys.sys_config WHERE variable = in_variable_name);\n    IF (v_value IS NULL) THEN\n        SET v_value = in_default_value;\n    END IF;\n    RETURN v_value;\nEND','NONE'),('sys','version_major','FUNCTION','version_major','SQL','NO_SQL','NO','INVOKER','','tinyint(3) unsigned','BEGIN\n    RETURN SUBSTRING_INDEX(SUBSTRING_INDEX(VERSION(), \'-\', 1), \'.\', 1);\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Returns the major version of MySQL Server.\n             Returns\n             TINYINT UNSIGNED\n             Example\n             mysql> SELECT VERSION(), sys.version_major();\n             +--------------------------------------+---------------------+\n             | VERSION()                            | sys.version_major() |\n             +--------------------------------------+---------------------+\n             | 5.7.9-enterprise-commercial-advanced | 5                   |\n             +--------------------------------------+---------------------+\n             1 row in set (0.00 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    RETURN SUBSTRING_INDEX(SUBSTRING_INDEX(VERSION(), \'-\', 1), \'.\', 1);\nEND','NONE'),('sys','version_minor','FUNCTION','version_minor','SQL','NO_SQL','NO','INVOKER','','tinyint(3) unsigned','BEGIN\n    RETURN SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(VERSION(), \'-\', 1), \'.\', 2), \'.\', -1);\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Returns the minor (release series) version of MySQL Server.\n             Returns\n             TINYINT UNSIGNED\n             Example\n             mysql> SELECT VERSION(), sys.server_minor();\n             +--------------------------------------+---------------------+\n             | VERSION()                            | sys.version_minor() |\n             +--------------------------------------+---------------------+\n             | 5.7.9-enterprise-commercial-advanced | 7                   |\n             +--------------------------------------+---------------------+\n             1 row in set (0.00 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    RETURN SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(VERSION(), \'-\', 1), \'.\', 2), \'.\', -1);\nEND','NONE'),('sys','version_patch','FUNCTION','version_patch','SQL','NO_SQL','NO','INVOKER','','tinyint(3) unsigned','BEGIN\n    RETURN SUBSTRING_INDEX(SUBSTRING_INDEX(VERSION(), \'-\', 1), \'.\', -1);\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Returns the patch release version of MySQL Server.\n             Returns\n             TINYINT UNSIGNED\n             Example\n             mysql> SELECT VERSION(), sys.version_patch();\n             +--------------------------------------+---------------------+\n             | VERSION()                            | sys.version_patch() |\n             +--------------------------------------+---------------------+\n             | 5.7.9-enterprise-commercial-advanced | 9                   |\n             +--------------------------------------+---------------------+\n             1 row in set (0.00 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    RETURN SUBSTRING_INDEX(SUBSTRING_INDEX(VERSION(), \'-\', 1), \'.\', -1);\nEND','NONE'),('sys','execute_prepared_stmt','PROCEDURE','execute_prepared_stmt','SQL','READS_SQL_DATA','NO','INVOKER','\n        IN in_query longtext CHARACTER SET UTF8\n    ','','BEGIN\n    IF (@sys.debug IS NULL) THEN\n        SET @sys.debug = sys.sys_get_config(\'debug\', \'OFF\');\n    END IF;\n    IF (in_query IS NULL OR LENGTH(in_query) < 4) THEN\n       SIGNAL SQLSTATE \'45000\'\n          SET MESSAGE_TEXT = \"The @sys.execute_prepared_stmt.sql must contain a query\";\n    END IF;\n    SET @sys.execute_prepared_stmt.sql = in_query;\n    IF (@sys.debug = \'ON\') THEN\n        SELECT @sys.execute_prepared_stmt.sql AS \'Debug\';\n    END IF;\n    PREPARE sys_execute_prepared_stmt FROM @sys.execute_prepared_stmt.sql;\n    EXECUTE sys_execute_prepared_stmt;\n    DEALLOCATE PREPARE sys_execute_prepared_stmt;\n    SET @sys.execute_prepared_stmt.sql = NULL;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Takes the query in the argument and executes it using a prepared statement. The prepared statement is deallocated,\n             so the procedure is mainly useful for executing one off dynamically created queries.\n             The sys_execute_prepared_stmt prepared statement name is used for the query and is required not to exist.\n             Parameters\n             in_query (longtext CHARACTER SET UTF8):\n               The query to execute.\n             Configuration Options\n             sys.debug\n               Whether to provide debugging output.\n               Default is \'OFF\'. Set to \'ON\' to include.\n             Example\n             mysql> CALL sys.execute_prepared_stmt(\'SELECT * FROM sys.sys_config\');\n             +------------------------+-------+---------------------+--------+\n             | variable               | value | set_time            | set_by |\n             +------------------------+-------+---------------------+--------+\n             | statement_truncate_len | 64    | 2015-06-30 13:06:00 | NULL   |\n             +------------------------+-------+---------------------+--------+\n             1 row in set (0.00 sec)\n             Query OK, 0 rows affected (0.00 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    IF (@sys.debug IS NULL) THEN\n        SET @sys.debug = sys.sys_get_config(\'debug\', \'OFF\');\n    END IF;\n    IF (in_query IS NULL OR LENGTH(in_query) < 4) THEN\n       SIGNAL SQLSTATE \'45000\'\n          SET MESSAGE_TEXT = \"The @sys.execute_prepared_stmt.sql must contain a query\";\n    END IF;\n    SET @sys.execute_prepared_stmt.sql = in_query;\n    IF (@sys.debug = \'ON\') THEN\n        SELECT @sys.execute_prepared_stmt.sql AS \'Debug\';\n    END IF;\n    PREPARE sys_execute_prepared_stmt FROM @sys.execute_prepared_stmt.sql;\n    EXECUTE sys_execute_prepared_stmt;\n    DEALLOCATE PREPARE sys_execute_prepared_stmt;\n    SET @sys.execute_prepared_stmt.sql = NULL;\nEND','NONE'),('sys','ps_setup_disable_background_threads','PROCEDURE','ps_setup_disable_background_threads','SQL','MODIFIES_SQL_DATA','NO','INVOKER','','','BEGIN\n    UPDATE performance_schema.threads\n       SET instrumented = \'NO\'\n     WHERE type = \'BACKGROUND\';\n    SELECT CONCAT(\'Disabled \', @rows := ROW_COUNT(), \' background thread\', IF(@rows != 1, \'s\', \'\')) AS summary;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Disable all background thread instrumentation within Performance Schema.\n             Parameters\n             None.\n             Example\n             mysql> CALL sys.ps_setup_disable_background_threads();\n             +--------------------------------+\n             | summary                        |\n             +--------------------------------+\n             | Disabled 18 background threads |\n             +--------------------------------+\n             1 row in set (0.00 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    UPDATE performance_schema.threads\n       SET instrumented = \'NO\'\n     WHERE type = \'BACKGROUND\';\n    SELECT CONCAT(\'Disabled \', @rows := ROW_COUNT(), \' background thread\', IF(@rows != 1, \'s\', \'\')) AS summary;\nEND','NONE'),('sys','ps_setup_disable_consumer','PROCEDURE','ps_setup_disable_consumer','SQL','MODIFIES_SQL_DATA','NO','INVOKER','\n        IN consumer VARCHAR(128)\n    ','','BEGIN\n    UPDATE performance_schema.setup_consumers\n       SET enabled = \'NO\'\n     WHERE name LIKE CONCAT(\'%\', consumer, \'%\');\n    SELECT CONCAT(\'Disabled \', @rows := ROW_COUNT(), \' consumer\', IF(@rows != 1, \'s\', \'\')) AS summary;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Disables consumers within Performance Schema\n             matching the input pattern.\n             Parameters\n             consumer (VARCHAR(128)):\n               A LIKE pattern match (using \"%consumer%\") of consumers to disable\n             Example\n             To disable all consumers:\n             mysql> CALL sys.ps_setup_disable_consumer(\'\');\n             +--------------------------+\n             | summary                  |\n             +--------------------------+\n             | Disabled 15 consumers    |\n             +--------------------------+\n             1 row in set (0.02 sec)\n             To disable just the event_stage consumers:\n             mysql> CALL sys.ps_setup_disable_comsumers(\'stage\');\n             +------------------------+\n             | summary                |\n             +------------------------+\n             | Disabled 3 consumers   |\n             +------------------------+\n             1 row in set (0.00 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    UPDATE performance_schema.setup_consumers\n       SET enabled = \'NO\'\n     WHERE name LIKE CONCAT(\'%\', consumer, \'%\');\n    SELECT CONCAT(\'Disabled \', @rows := ROW_COUNT(), \' consumer\', IF(@rows != 1, \'s\', \'\')) AS summary;\nEND','NONE'),('sys','ps_setup_disable_instrument','PROCEDURE','ps_setup_disable_instrument','SQL','MODIFIES_SQL_DATA','NO','INVOKER','\n        IN in_pattern VARCHAR(128)\n    ','','BEGIN\n    UPDATE performance_schema.setup_instruments\n       SET enabled = \'NO\', timed = \'NO\'\n     WHERE name LIKE CONCAT(\'%\', in_pattern, \'%\');\n    SELECT CONCAT(\'Disabled \', @rows := ROW_COUNT(), \' instrument\', IF(@rows != 1, \'s\', \'\')) AS summary;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Disables instruments within Performance Schema\n             matching the input pattern.\n             Parameters\n             in_pattern (VARCHAR(128)):\n               A LIKE pattern match (using \"%in_pattern%\") of events to disable\n             Example\n             To disable all mutex instruments:\n             mysql> CALL sys.ps_setup_disable_instrument(\'wait/synch/mutex\');\n             +--------------------------+\n             | summary                  |\n             +--------------------------+\n             | Disabled 155 instruments |\n             +--------------------------+\n             1 row in set (0.02 sec)\n             To disable just a specific TCP/IP based network IO instrument:\n             mysql> CALL sys.ps_setup_disable_instrument(\'wait/io/socket/sql/server_tcpip_socket\');\n             +------------------------+\n             | summary                |\n             +------------------------+\n             | Disabled 1 instruments |\n             +------------------------+\n             1 row in set (0.00 sec)\n             To disable all instruments:\n             mysql> CALL sys.ps_setup_disable_instrument(\'\');\n             +--------------------------+\n             | summary                  |\n             +--------------------------+\n             | Disabled 547 instruments |\n             +--------------------------+\n             1 row in set (0.01 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    UPDATE performance_schema.setup_instruments\n       SET enabled = \'NO\', timed = \'NO\'\n     WHERE name LIKE CONCAT(\'%\', in_pattern, \'%\');\n    SELECT CONCAT(\'Disabled \', @rows := ROW_COUNT(), \' instrument\', IF(@rows != 1, \'s\', \'\')) AS summary;\nEND','NONE'),('sys','ps_setup_disable_thread','PROCEDURE','ps_setup_disable_thread','SQL','MODIFIES_SQL_DATA','NO','INVOKER','\n        IN in_connection_id BIGINT\n    ','','BEGIN\n    UPDATE performance_schema.threads\n       SET instrumented = \'NO\'\n     WHERE processlist_id = in_connection_id;\n    SELECT CONCAT(\'Disabled \', @rows := ROW_COUNT(), \' thread\', IF(@rows != 1, \'s\', \'\')) AS summary;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Disable the given connection/thread in Performance Schema.\n             Parameters\n             in_connection_id (BIGINT):\n               The connection ID (PROCESSLIST_ID from performance_schema.threads\n               or the ID shown within SHOW PROCESSLIST)\n             Example\n             mysql> CALL sys.ps_setup_disable_thread(3);\n             +-------------------+\n             | summary           |\n             +-------------------+\n             | Disabled 1 thread |\n             +-------------------+\n             1 row in set (0.01 sec)\n             To disable the current connection:\n             mysql> CALL sys.ps_setup_disable_thread(CONNECTION_ID());\n             +-------------------+\n             | summary           |\n             +-------------------+\n             | Disabled 1 thread |\n             +-------------------+\n             1 row in set (0.00 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    UPDATE performance_schema.threads\n       SET instrumented = \'NO\'\n     WHERE processlist_id = in_connection_id;\n    SELECT CONCAT(\'Disabled \', @rows := ROW_COUNT(), \' thread\', IF(@rows != 1, \'s\', \'\')) AS summary;\nEND','NONE'),('sys','ps_setup_enable_background_threads','PROCEDURE','ps_setup_enable_background_threads','SQL','MODIFIES_SQL_DATA','NO','INVOKER','','','BEGIN\n    UPDATE performance_schema.threads\n       SET instrumented = \'YES\'\n     WHERE type = \'BACKGROUND\';\n    SELECT CONCAT(\'Enabled \', @rows := ROW_COUNT(), \' background thread\', IF(@rows != 1, \'s\', \'\')) AS summary;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Enable all background thread instrumentation within Performance Schema.\n             Parameters\n             None.\n             Example\n             mysql> CALL sys.ps_setup_enable_background_threads();\n             +-------------------------------+\n             | summary                       |\n             +-------------------------------+\n             | Enabled 18 background threads |\n             +-------------------------------+\n             1 row in set (0.00 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    UPDATE performance_schema.threads\n       SET instrumented = \'YES\'\n     WHERE type = \'BACKGROUND\';\n    SELECT CONCAT(\'Enabled \', @rows := ROW_COUNT(), \' background thread\', IF(@rows != 1, \'s\', \'\')) AS summary;\nEND','NONE'),('sys','ps_setup_enable_consumer','PROCEDURE','ps_setup_enable_consumer','SQL','MODIFIES_SQL_DATA','NO','INVOKER','\n        IN consumer VARCHAR(128)\n    ','','BEGIN\n    UPDATE performance_schema.setup_consumers\n       SET enabled = \'YES\'\n     WHERE name LIKE CONCAT(\'%\', consumer, \'%\');\n    SELECT CONCAT(\'Enabled \', @rows := ROW_COUNT(), \' consumer\', IF(@rows != 1, \'s\', \'\')) AS summary;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Enables consumers within Performance Schema\n             matching the input pattern.\n             Parameters\n             consumer (VARCHAR(128)):\n               A LIKE pattern match (using \"%consumer%\") of consumers to enable\n             Example\n             To enable all consumers:\n             mysql> CALL sys.ps_setup_enable_consumer(\'\');\n             +-------------------------+\n             | summary                 |\n             +-------------------------+\n             | Enabled 10 consumers    |\n             +-------------------------+\n             1 row in set (0.02 sec)\n             Query OK, 0 rows affected (0.02 sec)\n             To enable just \"waits\" consumers:\n             mysql> CALL sys.ps_setup_enable_consumer(\'waits\');\n             +-----------------------+\n             | summary               |\n             +-----------------------+\n             | Enabled 3 consumers   |\n             +-----------------------+\n             1 row in set (0.00 sec)\n             Query OK, 0 rows affected (0.00 sec)\n             ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    UPDATE performance_schema.setup_consumers\n       SET enabled = \'YES\'\n     WHERE name LIKE CONCAT(\'%\', consumer, \'%\');\n    SELECT CONCAT(\'Enabled \', @rows := ROW_COUNT(), \' consumer\', IF(@rows != 1, \'s\', \'\')) AS summary;\nEND','NONE'),('sys','ps_setup_enable_instrument','PROCEDURE','ps_setup_enable_instrument','SQL','MODIFIES_SQL_DATA','NO','INVOKER','\n        IN in_pattern VARCHAR(128)\n    ','','BEGIN\n    UPDATE performance_schema.setup_instruments\n       SET enabled = \'YES\', timed = \'YES\'\n     WHERE name LIKE CONCAT(\'%\', in_pattern, \'%\');\n    SELECT CONCAT(\'Enabled \', @rows := ROW_COUNT(), \' instrument\', IF(@rows != 1, \'s\', \'\')) AS summary;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Enables instruments within Performance Schema\n             matching the input pattern.\n             Parameters\n             in_pattern (VARCHAR(128)):\n               A LIKE pattern match (using \"%in_pattern%\") of events to enable\n             Example\n             To enable all mutex instruments:\n             mysql> CALL sys.ps_setup_enable_instrument(\'wait/synch/mutex\');\n             +-------------------------+\n             | summary                 |\n             +-------------------------+\n             | Enabled 155 instruments |\n             +-------------------------+\n             1 row in set (0.02 sec)\n             Query OK, 0 rows affected (0.02 sec)\n             To enable just a specific TCP/IP based network IO instrument:\n             mysql> CALL sys.ps_setup_enable_instrument(\'wait/io/socket/sql/server_tcpip_socket\');\n             +-----------------------+\n             | summary               |\n             +-----------------------+\n             | Enabled 1 instruments |\n             +-----------------------+\n             1 row in set (0.00 sec)\n             Query OK, 0 rows affected (0.00 sec)\n             To enable all instruments:\n             mysql> CALL sys.ps_setup_enable_instrument(\'\');\n             +-------------------------+\n             | summary                 |\n             +-------------------------+\n             | Enabled 547 instruments |\n             +-------------------------+\n             1 row in set (0.01 sec)\n             Query OK, 0 rows affected (0.01 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    UPDATE performance_schema.setup_instruments\n       SET enabled = \'YES\', timed = \'YES\'\n     WHERE name LIKE CONCAT(\'%\', in_pattern, \'%\');\n    SELECT CONCAT(\'Enabled \', @rows := ROW_COUNT(), \' instrument\', IF(@rows != 1, \'s\', \'\')) AS summary;\nEND','NONE'),('sys','ps_setup_enable_thread','PROCEDURE','ps_setup_enable_thread','SQL','MODIFIES_SQL_DATA','NO','INVOKER','\n        IN in_connection_id BIGINT\n    ','','BEGIN\n    UPDATE performance_schema.threads\n       SET instrumented = \'YES\'\n     WHERE processlist_id = in_connection_id;\n    SELECT CONCAT(\'Enabled \', @rows := ROW_COUNT(), \' thread\', IF(@rows != 1, \'s\', \'\')) AS summary;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Enable the given connection/thread in Performance Schema.\n             Parameters\n             in_connection_id (BIGINT):\n               The connection ID (PROCESSLIST_ID from performance_schema.threads\n               or the ID shown within SHOW PROCESSLIST)\n             Example\n             mysql> CALL sys.ps_setup_enable_thread(3);\n             +------------------+\n             | summary          |\n             +------------------+\n             | Enabled 1 thread |\n             +------------------+\n             1 row in set (0.01 sec)\n             To enable the current connection:\n             mysql> CALL sys.ps_setup_enable_thread(CONNECTION_ID());\n             +------------------+\n             | summary          |\n             +------------------+\n             | Enabled 1 thread |\n             +------------------+\n             1 row in set (0.00 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    UPDATE performance_schema.threads\n       SET instrumented = \'YES\'\n     WHERE processlist_id = in_connection_id;\n    SELECT CONCAT(\'Enabled \', @rows := ROW_COUNT(), \' thread\', IF(@rows != 1, \'s\', \'\')) AS summary;\nEND','NONE'),('sys','ps_setup_save','PROCEDURE','ps_setup_save','SQL','MODIFIES_SQL_DATA','NO','INVOKER','\n        IN in_timeout INT\n    ','','BEGIN\n    DECLARE v_lock_result INT;\n    SET @log_bin := @@sql_log_bin;\n    SET sql_log_bin = 0;\n    SELECT GET_LOCK(\'sys.ps_setup_save\', in_timeout) INTO v_lock_result;\n    IF v_lock_result THEN\n        DROP TEMPORARY TABLE IF EXISTS tmp_setup_actors;\n        DROP TEMPORARY TABLE IF EXISTS tmp_setup_consumers;\n        DROP TEMPORARY TABLE IF EXISTS tmp_setup_instruments;\n        DROP TEMPORARY TABLE IF EXISTS tmp_threads;\n        CREATE TEMPORARY TABLE tmp_setup_actors LIKE performance_schema.setup_actors;\n        CREATE TEMPORARY TABLE tmp_setup_consumers LIKE performance_schema.setup_consumers;\n        CREATE TEMPORARY TABLE tmp_setup_instruments LIKE performance_schema.setup_instruments;\n        CREATE TEMPORARY TABLE tmp_threads (THREAD_ID bigint unsigned NOT NULL PRIMARY KEY, INSTRUMENTED enum(\'YES\',\'NO\') NOT NULL);\n        INSERT INTO tmp_setup_actors SELECT * FROM performance_schema.setup_actors;\n        INSERT INTO tmp_setup_consumers SELECT * FROM performance_schema.setup_consumers;\n        INSERT INTO tmp_setup_instruments SELECT * FROM performance_schema.setup_instruments;\n        INSERT INTO tmp_threads SELECT THREAD_ID, INSTRUMENTED FROM performance_schema.threads;\n    ELSE\n        SIGNAL SQLSTATE VALUE \'90000\'\n           SET MESSAGE_TEXT = \'Could not lock the sys.ps_setup_save user lock, another thread has a saved configuration\';\n    END IF;\n    SET sql_log_bin = @log_bin;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Saves the current configuration of Performance Schema,\n             so that you can alter the setup for debugging purposes,\n             but restore it to a previous state.\n             Use the companion procedure - ps_setup_reload_saved(), to\n             restore the saved config.\n             The named lock \"sys.ps_setup_save\" is taken before the\n             current configuration is saved. If the attempt to get the named\n             lock times out, an error occurs.\n             The lock is released after the settings have been restored by\n             calling ps_setup_reload_saved().\n             Requires the SUPER privilege for \"SET sql_log_bin = 0;\".\n             Parameters\n             in_timeout INT\n               The timeout in seconds used when trying to obtain the lock.\n               A negative timeout means infinite timeout.\n             Example\n             mysql> CALL sys.ps_setup_save(-1);\n             Query OK, 0 rows affected (0.08 sec)\n             mysql> UPDATE performance_schema.setup_instruments\n                 ->    SET enabled = \'YES\', timed = \'YES\';\n             Query OK, 547 rows affected (0.40 sec)\n             Rows matched: 784  Changed: 547  Warnings: 0\n             /* Run some tests that need more detailed instrumentation here */\n             mysql> CALL sys.ps_setup_reload_saved();\n             Query OK, 0 rows affected (0.32 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    DECLARE v_lock_result INT;\n    SET @log_bin := @@sql_log_bin;\n    SET sql_log_bin = 0;\n    SELECT GET_LOCK(\'sys.ps_setup_save\', in_timeout) INTO v_lock_result;\n    IF v_lock_result THEN\n        DROP TEMPORARY TABLE IF EXISTS tmp_setup_actors;\n        DROP TEMPORARY TABLE IF EXISTS tmp_setup_consumers;\n        DROP TEMPORARY TABLE IF EXISTS tmp_setup_instruments;\n        DROP TEMPORARY TABLE IF EXISTS tmp_threads;\n        CREATE TEMPORARY TABLE tmp_setup_actors LIKE performance_schema.setup_actors;\n        CREATE TEMPORARY TABLE tmp_setup_consumers LIKE performance_schema.setup_consumers;\n        CREATE TEMPORARY TABLE tmp_setup_instruments LIKE performance_schema.setup_instruments;\n        CREATE TEMPORARY TABLE tmp_threads (THREAD_ID bigint unsigned NOT NULL PRIMARY KEY, INSTRUMENTED enum(\'YES\',\'NO\') NOT NULL);\n        INSERT INTO tmp_setup_actors SELECT * FROM performance_schema.setup_actors;\n        INSERT INTO tmp_setup_consumers SELECT * FROM performance_schema.setup_consumers;\n        INSERT INTO tmp_setup_instruments SELECT * FROM performance_schema.setup_instruments;\n        INSERT INTO tmp_threads SELECT THREAD_ID, INSTRUMENTED FROM performance_schema.threads;\n    ELSE\n        SIGNAL SQLSTATE VALUE \'90000\'\n           SET MESSAGE_TEXT = \'Could not lock the sys.ps_setup_save user lock, another thread has a saved configuration\';\n    END IF;\n    SET sql_log_bin = @log_bin;\nEND','NONE'),('sys','ps_setup_reload_saved','PROCEDURE','ps_setup_reload_saved','SQL','MODIFIES_SQL_DATA','NO','INVOKER','','','BEGIN\n    DECLARE v_done bool DEFAULT FALSE;\n    DECLARE v_lock_result INT;\n    DECLARE v_lock_used_by BIGINT;\n    DECLARE v_signal_message TEXT;\n    DECLARE EXIT HANDLER FOR SQLEXCEPTION\n    BEGIN\n        SIGNAL SQLSTATE VALUE \'90001\'\n           SET MESSAGE_TEXT = \'An error occurred, was sys.ps_setup_save() run before this procedure?\';\n    END;\n    SET @log_bin := @@sql_log_bin;\n    SET sql_log_bin = 0;\n    SELECT IS_USED_LOCK(\'sys.ps_setup_save\') INTO v_lock_used_by;\n    IF (v_lock_used_by != CONNECTION_ID()) THEN\n        SET v_signal_message = CONCAT(\'The sys.ps_setup_save lock is currently owned by \', v_lock_used_by);\n        SIGNAL SQLSTATE VALUE \'90002\'\n           SET MESSAGE_TEXT = v_signal_message;\n    END IF;\n    DELETE FROM performance_schema.setup_actors;\n    INSERT INTO performance_schema.setup_actors SELECT * FROM tmp_setup_actors;\n    BEGIN\n        DECLARE v_name varchar(64);\n        DECLARE v_enabled enum(\'YES\', \'NO\');\n        DECLARE c_consumers CURSOR FOR SELECT NAME, ENABLED FROM tmp_setup_consumers;\n        DECLARE CONTINUE HANDLER FOR NOT FOUND SET v_done = TRUE;\n        SET v_done = FALSE;\n        OPEN c_consumers;\n        c_consumers_loop: LOOP\n            FETCH c_consumers INTO v_name, v_enabled;\n            IF v_done THEN\n               LEAVE c_consumers_loop;\n            END IF;\n            UPDATE performance_schema.setup_consumers\n               SET ENABLED = v_enabled\n             WHERE NAME = v_name;\n         END LOOP;\n         CLOSE c_consumers;\n    END;\n    UPDATE performance_schema.setup_instruments\n     INNER JOIN tmp_setup_instruments USING (NAME)\n       SET performance_schema.setup_instruments.ENABLED = tmp_setup_instruments.ENABLED,\n           performance_schema.setup_instruments.TIMED   = tmp_setup_instruments.TIMED;\n    BEGIN\n        DECLARE v_thread_id bigint unsigned;\n        DECLARE v_instrumented enum(\'YES\', \'NO\');\n        DECLARE c_threads CURSOR FOR SELECT THREAD_ID, INSTRUMENTED FROM tmp_threads;\n        DECLARE CONTINUE HANDLER FOR NOT FOUND SET v_done = TRUE;\n        SET v_done = FALSE;\n        OPEN c_threads;\n        c_threads_loop: LOOP\n            FETCH c_threads INTO v_thread_id, v_instrumented;\n            IF v_done THEN\n               LEAVE c_threads_loop;\n            END IF;\n            UPDATE performance_schema.threads\n               SET INSTRUMENTED = v_instrumented\n             WHERE THREAD_ID = v_thread_id;\n        END LOOP;\n        CLOSE c_threads;\n    END;\n    UPDATE performance_schema.threads\n       SET INSTRUMENTED = IF(PROCESSLIST_USER IS NOT NULL,\n                             sys.ps_is_account_enabled(PROCESSLIST_HOST, PROCESSLIST_USER),\n                             \'YES\')\n     WHERE THREAD_ID NOT IN (SELECT THREAD_ID FROM tmp_threads);\n    DROP TEMPORARY TABLE tmp_setup_actors;\n    DROP TEMPORARY TABLE tmp_setup_consumers;\n    DROP TEMPORARY TABLE tmp_setup_instruments;\n    DROP TEMPORARY TABLE tmp_threads;\n    SELECT RELEASE_LOCK(\'sys.ps_setup_save\') INTO v_lock_result;\n    SET sql_log_bin = @log_bin;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Reloads a saved Performance Schema configuration,\n             so that you can alter the setup for debugging purposes,\n             but restore it to a previous state.\n             Use the companion procedure - ps_setup_save(), to\n             save a configuration.\n             Requires the SUPER privilege for \"SET sql_log_bin = 0;\".\n             Parameters\n             None.\n             Example\n             mysql> CALL sys.ps_setup_save();\n             Query OK, 0 rows affected (0.08 sec)\n             mysql> UPDATE performance_schema.setup_instruments SET enabled = \'YES\', timed = \'YES\';\n             Query OK, 547 rows affected (0.40 sec)\n             Rows matched: 784  Changed: 547  Warnings: 0\n             /* Run some tests that need more detailed instrumentation here */\n             mysql> CALL sys.ps_setup_reload_saved();\n             Query OK, 0 rows affected (0.32 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    DECLARE v_done bool DEFAULT FALSE;\n    DECLARE v_lock_result INT;\n    DECLARE v_lock_used_by BIGINT;\n    DECLARE v_signal_message TEXT;\n    DECLARE EXIT HANDLER FOR SQLEXCEPTION\n    BEGIN\n        SIGNAL SQLSTATE VALUE \'90001\'\n           SET MESSAGE_TEXT = \'An error occurred, was sys.ps_setup_save() run before this procedure?\';\n    END;\n    SET @log_bin := @@sql_log_bin;\n    SET sql_log_bin = 0;\n    SELECT IS_USED_LOCK(\'sys.ps_setup_save\') INTO v_lock_used_by;\n    IF (v_lock_used_by != CONNECTION_ID()) THEN\n        SET v_signal_message = CONCAT(\'The sys.ps_setup_save lock is currently owned by \', v_lock_used_by);\n        SIGNAL SQLSTATE VALUE \'90002\'\n           SET MESSAGE_TEXT = v_signal_message;\n    END IF;\n    DELETE FROM performance_schema.setup_actors;\n    INSERT INTO performance_schema.setup_actors SELECT * FROM tmp_setup_actors;\n    BEGIN\n        DECLARE v_name varchar(64);\n        DECLARE v_enabled enum(\'YES\', \'NO\');\n        DECLARE c_consumers CURSOR FOR SELECT NAME, ENABLED FROM tmp_setup_consumers;\n        DECLARE CONTINUE HANDLER FOR NOT FOUND SET v_done = TRUE;\n        SET v_done = FALSE;\n        OPEN c_consumers;\n        c_consumers_loop: LOOP\n            FETCH c_consumers INTO v_name, v_enabled;\n            IF v_done THEN\n               LEAVE c_consumers_loop;\n            END IF;\n            UPDATE performance_schema.setup_consumers\n               SET ENABLED = v_enabled\n             WHERE NAME = v_name;\n         END LOOP;\n         CLOSE c_consumers;\n    END;\n    UPDATE performance_schema.setup_instruments\n     INNER JOIN tmp_setup_instruments USING (NAME)\n       SET performance_schema.setup_instruments.ENABLED = tmp_setup_instruments.ENABLED,\n           performance_schema.setup_instruments.TIMED   = tmp_setup_instruments.TIMED;\n    BEGIN\n        DECLARE v_thread_id bigint unsigned;\n        DECLARE v_instrumented enum(\'YES\', \'NO\');\n        DECLARE c_threads CURSOR FOR SELECT THREAD_ID, INSTRUMENTED FROM tmp_threads;\n        DECLARE CONTINUE HANDLER FOR NOT FOUND SET v_done = TRUE;\n        SET v_done = FALSE;\n        OPEN c_threads;\n        c_threads_loop: LOOP\n            FETCH c_threads INTO v_thread_id, v_instrumented;\n            IF v_done THEN\n               LEAVE c_threads_loop;\n            END IF;\n            UPDATE performance_schema.threads\n               SET INSTRUMENTED = v_instrumented\n             WHERE THREAD_ID = v_thread_id;\n        END LOOP;\n        CLOSE c_threads;\n    END;\n    UPDATE performance_schema.threads\n       SET INSTRUMENTED = IF(PROCESSLIST_USER IS NOT NULL,\n                             sys.ps_is_account_enabled(PROCESSLIST_HOST, PROCESSLIST_USER),\n                             \'YES\')\n     WHERE THREAD_ID NOT IN (SELECT THREAD_ID FROM tmp_threads);\n    DROP TEMPORARY TABLE tmp_setup_actors;\n    DROP TEMPORARY TABLE tmp_setup_consumers;\n    DROP TEMPORARY TABLE tmp_setup_instruments;\n    DROP TEMPORARY TABLE tmp_threads;\n    SELECT RELEASE_LOCK(\'sys.ps_setup_save\') INTO v_lock_result;\n    SET sql_log_bin = @log_bin;\nEND','NONE'),('sys','ps_setup_show_disabled','PROCEDURE','ps_setup_show_disabled','SQL','READS_SQL_DATA','NO','INVOKER','\n        IN in_show_instruments BOOLEAN,\n        IN in_show_threads BOOLEAN\n    ','','BEGIN\n    SELECT @@performance_schema AS performance_schema_enabled;\n    \n    SELECT object_type,\n           CONCAT(object_schema, \'.\', object_name) AS objects,\n           enabled,\n           timed\n      FROM performance_schema.setup_objects\n     WHERE enabled = \'NO\'\n     ORDER BY object_type, objects;\n    SELECT name AS disabled_consumers\n      FROM performance_schema.setup_consumers\n     WHERE enabled = \'NO\'\n     ORDER BY disabled_consumers;\n    IF (in_show_threads) THEN\n        SELECT IF(name = \'thread/sql/one_connection\',\n                  CONCAT(processlist_user, \'@\', processlist_host),\n                  REPLACE(name, \'thread/\', \'\')) AS disabled_threads,\n        TYPE AS thread_type\n          FROM performance_schema.threads\n         WHERE INSTRUMENTED = \'NO\'\n         ORDER BY disabled_threads;\n    END IF;\n    IF (in_show_instruments) THEN\n        SELECT name AS disabled_instruments,\n               timed\n          FROM performance_schema.setup_instruments\n         WHERE enabled = \'NO\'\n         ORDER BY disabled_instruments;\n    END IF;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Shows all currently disable Performance Schema configuration.\n             Disabled users is only available for MySQL 5.7.6 and later.\n             In earlier versions it was only possible to enable users.\n             Parameters\n             in_show_instruments (BOOLEAN):\n               Whether to print disabled instruments (can print many items)\n             in_show_threads (BOOLEAN):\n               Whether to print disabled threads\n             Example\n             mysql> CALL sys.ps_setup_show_disabled(TRUE, TRUE);\n             +----------------------------+\n             | performance_schema_enabled |\n             +----------------------------+\n             |                          1 |\n             +----------------------------+\n             1 row in set (0.00 sec)\n             +--------------------+\n             | disabled_users     |\n             +--------------------+\n             | \'mark\'@\'localhost\' |\n             +--------------------+\n             1 row in set (0.00 sec)\n             +-------------+----------------------+---------+-------+\n             | object_type | objects              | enabled | timed |\n             +-------------+----------------------+---------+-------+\n             | EVENT       | mysql.%              | NO      | NO    |\n             | EVENT       | performance_schema.% | NO      | NO    |\n             | EVENT       | information_schema.% | NO      | NO    |\n             | FUNCTION    | mysql.%              | NO      | NO    |\n             | FUNCTION    | performance_schema.% | NO      | NO    |\n             | FUNCTION    | information_schema.% | NO      | NO    |\n             | PROCEDURE   | mysql.%              | NO      | NO    |\n             | PROCEDURE   | performance_schema.% | NO      | NO    |\n             | PROCEDURE   | information_schema.% | NO      | NO    |\n             | TABLE       | mysql.%              | NO      | NO    |\n             | TABLE       | performance_schema.% | NO      | NO    |\n             | TABLE       | information_schema.% | NO      | NO    |\n             | TRIGGER     | mysql.%              | NO      | NO    |\n             | TRIGGER     | performance_schema.% | NO      | NO    |\n             | TRIGGER     | information_schema.% | NO      | NO    |\n             +-------------+----------------------+---------+-------+\n             15 rows in set (0.00 sec)\n             +----------------------------------+\n             | disabled_consumers               |\n             +----------------------------------+\n             | events_stages_current            |\n             | events_stages_history            |\n             | events_stages_history_long       |\n             | events_statements_history        |\n             | events_statements_history_long   |\n             | events_transactions_history      |\n             | events_transactions_history_long |\n             | events_waits_current             |\n             | events_waits_history             |\n             | events_waits_history_long        |\n             +----------------------------------+\n             10 rows in set (0.00 sec)\n             Empty set (0.00 sec)\n             +---------------------------------------------------------------------------------------+-------+\n             | disabled_instruments                                                                  | timed |\n             +---------------------------------------------------------------------------------------+-------+\n             | wait/synch/mutex/sql/TC_LOG_MMAP::LOCK_tc                                             | NO    |\n             | wait/synch/mutex/sql/LOCK_des_key_file                                                | NO    |\n             | wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_commit                                       | NO    |\n             ...\n             | memory/sql/servers_cache                                                              | NO    |\n             | memory/sql/udf_mem                                                                    | NO    |\n             | wait/lock/metadata/sql/mdl                                                            | NO    |\n             +---------------------------------------------------------------------------------------+-------+\n             547 rows in set (0.00 sec)\n             Query OK, 0 rows affected (0.01 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    SELECT @@performance_schema AS performance_schema_enabled;\n    \n    SELECT object_type,\n           CONCAT(object_schema, \'.\', object_name) AS objects,\n           enabled,\n           timed\n      FROM performance_schema.setup_objects\n     WHERE enabled = \'NO\'\n     ORDER BY object_type, objects;\n    SELECT name AS disabled_consumers\n      FROM performance_schema.setup_consumers\n     WHERE enabled = \'NO\'\n     ORDER BY disabled_consumers;\n    IF (in_show_threads) THEN\n        SELECT IF(name = \'thread/sql/one_connection\',\n                  CONCAT(processlist_user, \'@\', processlist_host),\n                  REPLACE(name, \'thread/\', \'\')) AS disabled_threads,\n        TYPE AS thread_type\n          FROM performance_schema.threads\n         WHERE INSTRUMENTED = \'NO\'\n         ORDER BY disabled_threads;\n    END IF;\n    IF (in_show_instruments) THEN\n        SELECT name AS disabled_instruments,\n               timed\n          FROM performance_schema.setup_instruments\n         WHERE enabled = \'NO\'\n         ORDER BY disabled_instruments;\n    END IF;\nEND','NONE'),('sys','ps_setup_show_disabled_consumers','PROCEDURE','ps_setup_show_disabled_consumers','SQL','READS_SQL_DATA','YES','INVOKER','','','BEGIN\n    SELECT name AS disabled_consumers\n      FROM performance_schema.setup_consumers\n     WHERE enabled = \'NO\'\n     ORDER BY disabled_consumers;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Shows all currently disabled consumers.\n             Parameters\n             None\n             Example\n             mysql> CALL sys.ps_setup_show_disabled_consumers();\n             +---------------------------+\n             | disabled_consumers        |\n             +---------------------------+\n             | events_statements_current |\n             | global_instrumentation    |\n             | thread_instrumentation    |\n             | statements_digest         |\n             +---------------------------+\n             4 rows in set (0.05 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    SELECT name AS disabled_consumers\n      FROM performance_schema.setup_consumers\n     WHERE enabled = \'NO\'\n     ORDER BY disabled_consumers;\nEND','NONE'),('sys','ps_setup_show_enabled_consumers','PROCEDURE','ps_setup_show_enabled_consumers','SQL','READS_SQL_DATA','YES','INVOKER','','','BEGIN\n    SELECT name AS enabled_consumers\n      FROM performance_schema.setup_consumers\n     WHERE enabled = \'YES\'\n     ORDER BY enabled_consumers;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Shows all currently enabled consumers.\n             Parameters\n             None\n             Example\n             mysql> CALL sys.ps_setup_show_enabled_consumers();\n             +---------------------------+\n             | enabled_consumers         |\n             +---------------------------+\n             | events_statements_current |\n             | global_instrumentation    |\n             | thread_instrumentation    |\n             | statements_digest         |\n             +---------------------------+\n             4 rows in set (0.05 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    SELECT name AS enabled_consumers\n      FROM performance_schema.setup_consumers\n     WHERE enabled = \'YES\'\n     ORDER BY enabled_consumers;\nEND','NONE'),('sys','ps_truncate_all_tables','PROCEDURE','ps_truncate_all_tables','SQL','MODIFIES_SQL_DATA','YES','INVOKER','\n        IN in_verbose BOOLEAN\n    ','','BEGIN\n    DECLARE v_done INT DEFAULT FALSE;\n    DECLARE v_total_tables INT DEFAULT 0;\n    DECLARE v_ps_table VARCHAR(64);\n    DECLARE ps_tables CURSOR FOR\n        SELECT table_name\n          FROM INFORMATION_SCHEMA.TABLES\n         WHERE table_schema = \'performance_schema\'\n           AND (table_name LIKE \'%summary%\'\n            OR table_name LIKE \'%history%\');\n    DECLARE CONTINUE HANDLER FOR NOT FOUND SET v_done = TRUE;\n    OPEN ps_tables;\n    ps_tables_loop: LOOP\n        FETCH ps_tables INTO v_ps_table;\n        IF v_done THEN\n          LEAVE ps_tables_loop;\n        END IF;\n        SET @truncate_stmt := CONCAT(\'TRUNCATE TABLE performance_schema.\', v_ps_table);\n        IF in_verbose THEN\n            SELECT CONCAT(\'Running: \', @truncate_stmt) AS status;\n        END IF;\n        PREPARE truncate_stmt FROM @truncate_stmt;\n        EXECUTE truncate_stmt;\n        DEALLOCATE PREPARE truncate_stmt;\n        SET v_total_tables = v_total_tables + 1;\n    END LOOP;\n    CLOSE ps_tables;\n    SELECT CONCAT(\'Truncated \', v_total_tables, \' tables\') AS summary;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Truncates all summary tables within Performance Schema,\n             resetting all aggregated instrumentation as a snapshot.\n             Parameters\n             in_verbose (BOOLEAN):\n               Whether to print each TRUNCATE statement before running\n             Example\n             mysql> CALL sys.ps_truncate_all_tables(false);\n             +---------------------+\n             | summary             |\n             +---------------------+\n             | Truncated 44 tables |\n             +---------------------+\n             1 row in set (0.10 sec)\n             Query OK, 0 rows affected (0.10 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    DECLARE v_done INT DEFAULT FALSE;\n    DECLARE v_total_tables INT DEFAULT 0;\n    DECLARE v_ps_table VARCHAR(64);\n    DECLARE ps_tables CURSOR FOR\n        SELECT table_name\n          FROM INFORMATION_SCHEMA.TABLES\n         WHERE table_schema = \'performance_schema\'\n           AND (table_name LIKE \'%summary%\'\n            OR table_name LIKE \'%history%\');\n    DECLARE CONTINUE HANDLER FOR NOT FOUND SET v_done = TRUE;\n    OPEN ps_tables;\n    ps_tables_loop: LOOP\n        FETCH ps_tables INTO v_ps_table;\n        IF v_done THEN\n          LEAVE ps_tables_loop;\n        END IF;\n        SET @truncate_stmt := CONCAT(\'TRUNCATE TABLE performance_schema.\', v_ps_table);\n        IF in_verbose THEN\n            SELECT CONCAT(\'Running: \', @truncate_stmt) AS status;\n        END IF;\n        PREPARE truncate_stmt FROM @truncate_stmt;\n        EXECUTE truncate_stmt;\n        DEALLOCATE PREPARE truncate_stmt;\n        SET v_total_tables = v_total_tables + 1;\n    END LOOP;\n    CLOSE ps_tables;\n    SELECT CONCAT(\'Truncated \', v_total_tables, \' tables\') AS summary;\nEND','NONE'),('sys','ps_setup_show_enabled','PROCEDURE','ps_setup_show_enabled','SQL','READS_SQL_DATA','YES','INVOKER','\n        IN in_show_instruments BOOLEAN,\n        IN in_show_threads BOOLEAN\n    ','','BEGIN\n    SELECT @@performance_schema AS performance_schema_enabled;\n    SELECT CONCAT(\'\\\'\', user, \'\\\'@\\\'\', host, \'\\\'\') AS enabled_users\n      FROM performance_schema.setup_actors\n      WHERE enabled = \'YES\'\n     ORDER BY enabled_users;\n    SELECT object_type,\n           CONCAT(object_schema, \'.\', object_name) AS objects,\n           enabled,\n           timed\n      FROM performance_schema.setup_objects\n     WHERE enabled = \'YES\'\n     ORDER BY object_type, objects;\n    SELECT name AS enabled_consumers\n      FROM performance_schema.setup_consumers\n     WHERE enabled = \'YES\'\n     ORDER BY enabled_consumers;\n    IF (in_show_threads) THEN\n        SELECT IF(name = \'thread/sql/one_connection\',\n                  CONCAT(processlist_user, \'@\', processlist_host),\n                  REPLACE(name, \'thread/\', \'\')) AS enabled_threads,\n        TYPE AS thread_type\n          FROM performance_schema.threads\n         WHERE INSTRUMENTED = \'YES\' AND name <> \'thread/innodb/thread_pool_thread\'\n         ORDER BY enabled_threads;\n    END IF;\n    IF (in_show_instruments) THEN\n        SELECT name AS enabled_instruments,\n               timed\n          FROM performance_schema.setup_instruments\n         WHERE enabled = \'YES\'\n         ORDER BY enabled_instruments;\n    END IF;\nEND','mariadb.sys@localhost','2023-10-29 23:32:37','2023-10-29 23:32:37','','\n             Description\n             Shows all currently enabled Performance Schema configuration.\n             Parameters\n             in_show_instruments (BOOLEAN):\n               Whether to print enabled instruments (can print many items)\n             in_show_threads (BOOLEAN):\n               Whether to print enabled threads\n             Example\n             mysql> CALL sys.ps_setup_show_enabled(TRUE, TRUE);\n             +----------------------------+\n             | performance_schema_enabled |\n             +----------------------------+\n             |                          1 |\n             +----------------------------+\n             1 row in set (0.00 sec)\n             +---------------+\n             | enabled_users |\n             +---------------+\n             | \'%\'@\'%\'       |\n             +---------------+\n             1 row in set (0.01 sec)\n             +-------------+---------+---------+-------+\n             | object_type | objects | enabled | timed |\n             +-------------+---------+---------+-------+\n             | EVENT       | %.%     | YES     | YES   |\n             | FUNCTION    | %.%     | YES     | YES   |\n             | PROCEDURE   | %.%     | YES     | YES   |\n             | TABLE       | %.%     | YES     | YES   |\n             | TRIGGER     | %.%     | YES     | YES   |\n             +-------------+---------+---------+-------+\n             5 rows in set (0.01 sec)\n             +---------------------------+\n             | enabled_consumers         |\n             +---------------------------+\n             | events_statements_current |\n             | global_instrumentation    |\n             | thread_instrumentation    |\n             | statements_digest         |\n             +---------------------------+\n             4 rows in set (0.05 sec)\n             +---------------------------------+-------------+\n             | enabled_threads                 | thread_type |\n             +---------------------------------+-------------+\n             | sql/main                        | BACKGROUND  |\n             | sql/thread_timer_notifier       | BACKGROUND  |\n             | innodb/io_ibuf_thread           | BACKGROUND  |\n             | innodb/io_log_thread            | BACKGROUND  |\n             | innodb/io_read_thread           | BACKGROUND  |\n             | innodb/io_read_thread           | BACKGROUND  |\n             | innodb/io_write_thread          | BACKGROUND  |\n             | innodb/io_write_thread          | BACKGROUND  |\n             | innodb/page_cleaner_thread      | BACKGROUND  |\n             | innodb/srv_lock_timeout_thread  | BACKGROUND  |\n             | innodb/srv_error_monitor_thread | BACKGROUND  |\n             | innodb/srv_monitor_thread       | BACKGROUND  |\n             | innodb/srv_master_thread        | BACKGROUND  |\n             | innodb/srv_purge_thread         | BACKGROUND  |\n             | innodb/srv_worker_thread        | BACKGROUND  |\n             | innodb/srv_worker_thread        | BACKGROUND  |\n             | innodb/srv_worker_thread        | BACKGROUND  |\n             | innodb/buf_dump_thread          | BACKGROUND  |\n             | innodb/dict_stats_thread        | BACKGROUND  |\n             | sql/signal_handler              | BACKGROUND  |\n             | sql/compress_gtid_table         | FOREGROUND  |\n             | root@localhost                  | FOREGROUND  |\n             +---------------------------------+-------------+\n             22 rows in set (0.01 sec)\n             +-------------------------------------+-------+\n             | enabled_instruments                 | timed |\n             +-------------------------------------+-------+\n             | wait/io/file/sql/map                | YES   |\n             | wait/io/file/sql/binlog             | YES   |\n             ...\n             | statement/com/Error                 | YES   |\n             | statement/com/                      | YES   |\n             | idle                                | YES   |\n             +-------------------------------------+-------+\n             210 rows in set (0.08 sec)\n             Query OK, 0 rows affected (0.89 sec)\n            ','utf8mb3','utf8mb3_general_ci','utf8mb3_general_ci','BEGIN\n    SELECT @@performance_schema AS performance_schema_enabled;\n    SELECT CONCAT(\'\'\'\', user, \'\'\'@\'\'\', host, \'\'\'\') AS enabled_users\n      FROM performance_schema.setup_actors\n      WHERE enabled = \'YES\'\n     ORDER BY enabled_users;\n    SELECT object_type,\n           CONCAT(object_schema, \'.\', object_name) AS objects,\n           enabled,\n           timed\n      FROM performance_schema.setup_objects\n     WHERE enabled = \'YES\'\n     ORDER BY object_type, objects;\n    SELECT name AS enabled_consumers\n      FROM performance_schema.setup_consumers\n     WHERE enabled = \'YES\'\n     ORDER BY enabled_consumers;\n    IF (in_show_threads) THEN\n        SELECT IF(name = \'thread/sql/one_connection\',\n                  CONCAT(processlist_user, \'@\', processlist_host),\n                  REPLACE(name, \'thread/\', \'\')) AS enabled_threads,\n        TYPE AS thread_type\n          FROM performance_schema.threads\n         WHERE INSTRUMENTED = \'YES\' AND name <> \'thread/innodb/thread_pool_thread\'\n         ORDER BY enabled_threads;\n    END IF;\n    IF (in_show_instruments) THEN\n        SELECT name AS enabled_instruments,\n               timed\n          FROM performance_schema.setup_instruments\n         WHERE enabled = \'YES\'\n         ORDER BY enabled_instruments;\n    END IF;\nEND','NONE');

--
-- Table structure for table `procs_priv`
--

CREATE TABLE `procs_priv` (
  `Host` char(255) NOT NULL DEFAULT '',
  `Db` char(64) NOT NULL DEFAULT '',
  `User` char(128) NOT NULL DEFAULT '',
  `Routine_name` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '',
  `Routine_type` enum('FUNCTION','PROCEDURE','PACKAGE','PACKAGE BODY') NOT NULL,
  `Grantor` varchar(384) NOT NULL DEFAULT '',
  `Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '',
  `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`),
  KEY `Grantor` (`Grantor`)
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Procedure privileges';

--
-- Dumping data for table `procs_priv`
--


--
-- Table structure for table `proxies_priv`
--

CREATE TABLE `proxies_priv` (
  `Host` char(255) NOT NULL DEFAULT '',
  `User` char(128) NOT NULL DEFAULT '',
  `Proxied_host` char(255) NOT NULL DEFAULT '',
  `Proxied_user` char(128) NOT NULL DEFAULT '',
  `With_grant` tinyint(1) NOT NULL DEFAULT 0,
  `Grantor` varchar(384) NOT NULL DEFAULT '',
  `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`Host`,`User`,`Proxied_host`,`Proxied_user`),
  KEY `Grantor` (`Grantor`)
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='User proxy privileges';

--
-- Dumping data for table `proxies_priv`
--

INSERT INTO `proxies_priv` VALUES ('localhost','root','','',1,'','2023-10-29 23:32:37');

--
-- Table structure for table `roles_mapping`
--

CREATE TABLE `roles_mapping` (
  `Host` char(255) NOT NULL DEFAULT '',
  `User` char(128) NOT NULL DEFAULT '',
  `Role` char(128) NOT NULL DEFAULT '',
  `Admin_option` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
  UNIQUE KEY `Host` (`Host`,`User`,`Role`)
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Granted roles';

--
-- Dumping data for table `roles_mapping`
--


--
-- Table structure for table `servers`
--

CREATE TABLE `servers` (
  `Server_name` char(64) NOT NULL DEFAULT '',
  `Host` varchar(2048) NOT NULL DEFAULT '',
  `Db` char(64) NOT NULL DEFAULT '',
  `Username` char(128) NOT NULL DEFAULT '',
  `Password` char(64) NOT NULL DEFAULT '',
  `Port` int(4) NOT NULL DEFAULT 0,
  `Socket` char(64) NOT NULL DEFAULT '',
  `Wrapper` char(64) NOT NULL DEFAULT '',
  `Owner` varchar(512) NOT NULL DEFAULT '',
  PRIMARY KEY (`Server_name`)
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='MySQL Foreign Servers table';

--
-- Dumping data for table `servers`
--


--
-- Table structure for table `table_stats`
--

CREATE TABLE `table_stats` (
  `db_name` varchar(64) NOT NULL,
  `table_name` varchar(64) NOT NULL,
  `cardinality` bigint(21) unsigned DEFAULT NULL,
  PRIMARY KEY (`db_name`,`table_name`)
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='Statistics on Tables';

--
-- Dumping data for table `table_stats`
--


--
-- Table structure for table `tables_priv`
--

CREATE TABLE `tables_priv` (
  `Host` char(255) NOT NULL DEFAULT '',
  `Db` char(64) NOT NULL DEFAULT '',
  `User` char(128) NOT NULL DEFAULT '',
  `Table_name` char(64) NOT NULL DEFAULT '',
  `Grantor` varchar(384) NOT NULL DEFAULT '',
  `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger','Delete versioning rows') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '',
  `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '',
  PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`),
  KEY `Grantor` (`Grantor`)
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Table privileges';

--
-- Dumping data for table `tables_priv`
--

INSERT INTO `tables_priv` VALUES ('localhost','mysql','mariadb.sys','global_priv','root@localhost','0000-00-00 00:00:00','Select,Delete','');

--
-- Table structure for table `time_zone`
--

CREATE TABLE `time_zone` (
  `Time_zone_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `Use_leap_seconds` enum('Y','N') NOT NULL DEFAULT 'N',
  PRIMARY KEY (`Time_zone_id`)
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Time zones';

--
-- Dumping data for table `time_zone`
--


--
-- Table structure for table `time_zone_leap_second`
--

CREATE TABLE `time_zone_leap_second` (
  `Transition_time` bigint(20) NOT NULL,
  `Correction` int(11) NOT NULL,
  PRIMARY KEY (`Transition_time`)
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Leap seconds information for time zones';

--
-- Dumping data for table `time_zone_leap_second`
--


--
-- Table structure for table `time_zone_name`
--

CREATE TABLE `time_zone_name` (
  `Name` char(64) NOT NULL,
  `Time_zone_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`Name`)
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Time zone names';

--
-- Dumping data for table `time_zone_name`
--


--
-- Table structure for table `time_zone_transition`
--

CREATE TABLE `time_zone_transition` (
  `Time_zone_id` int(10) unsigned NOT NULL,
  `Transition_time` bigint(20) NOT NULL,
  `Transition_type_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`Time_zone_id`,`Transition_time`)
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Time zone transitions';

--
-- Dumping data for table `time_zone_transition`
--


--
-- Table structure for table `time_zone_transition_type`
--

CREATE TABLE `time_zone_transition_type` (
  `Time_zone_id` int(10) unsigned NOT NULL,
  `Transition_type_id` int(10) unsigned NOT NULL,
  `Offset` int(11) NOT NULL DEFAULT 0,
  `Is_DST` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `Abbreviation` char(8) NOT NULL DEFAULT '',
  PRIMARY KEY (`Time_zone_id`,`Transition_type_id`)
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Time zone transition types';

--
-- Dumping data for table `time_zone_transition_type`
--


--
-- Temporary table structure for view `user`
--

/*!50001 DROP VIEW IF EXISTS `user`*/;
/*!50001 CREATE VIEW `user` AS SELECT
 1 AS `Host`,
  1 AS `User`,
  1 AS `Password`,
  1 AS `Select_priv`,
  1 AS `Insert_priv`,
  1 AS `Update_priv`,
  1 AS `Delete_priv`,
  1 AS `Create_priv`,
  1 AS `Drop_priv`,
  1 AS `Reload_priv`,
  1 AS `Shutdown_priv`,
  1 AS `Process_priv`,
  1 AS `File_priv`,
  1 AS `Grant_priv`,
  1 AS `References_priv`,
  1 AS `Index_priv`,
  1 AS `Alter_priv`,
  1 AS `Show_db_priv`,
  1 AS `Super_priv`,
  1 AS `Create_tmp_table_priv`,
  1 AS `Lock_tables_priv`,
  1 AS `Execute_priv`,
  1 AS `Repl_slave_priv`,
  1 AS `Repl_client_priv`,
  1 AS `Create_view_priv`,
  1 AS `Show_view_priv`,
  1 AS `Create_routine_priv`,
  1 AS `Alter_routine_priv`,
  1 AS `Create_user_priv`,
  1 AS `Event_priv`,
  1 AS `Trigger_priv`,
  1 AS `Create_tablespace_priv`,
  1 AS `Delete_history_priv`,
  1 AS `ssl_type`,
  1 AS `ssl_cipher`,
  1 AS `x509_issuer`,
  1 AS `x509_subject`,
  1 AS `max_questions`,
  1 AS `max_updates`,
  1 AS `max_connections`,
  1 AS `max_user_connections`,
  1 AS `plugin`,
  1 AS `authentication_string`,
  1 AS `password_expired`,
  1 AS `is_role`,
  1 AS `default_role`,
  1 AS `max_statement_time` */;

--
-- Table structure for table `transaction_registry`
--

CREATE TABLE IF NOT EXISTS `transaction_registry` (
  `transaction_id` bigint(20) unsigned NOT NULL,
  `commit_id` bigint(20) unsigned NOT NULL,
  `begin_timestamp` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000',
  `commit_timestamp` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000',
  `isolation_level` enum('READ-UNCOMMITTED','READ-COMMITTED','REPEATABLE-READ','SERIALIZABLE') NOT NULL,
  PRIMARY KEY (`transaction_id`),
  UNIQUE KEY `commit_id` (`commit_id`),
  KEY `begin_timestamp` (`begin_timestamp`),
  KEY `commit_timestamp` (`commit_timestamp`,`transaction_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin STATS_PERSISTENT=0;

--
-- Current Database: `phpmyadmin`
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `phpmyadmin` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci */;

USE `phpmyadmin`;

--
-- Table structure for table `pma__bookmark`
--

CREATE TABLE `pma__bookmark` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `dbase` varchar(255) NOT NULL DEFAULT '',
  `user` varchar(255) NOT NULL DEFAULT '',
  `label` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '',
  `query` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Bookmarks';

--
-- Dumping data for table `pma__bookmark`
--


--
-- Table structure for table `pma__central_columns`
--

CREATE TABLE `pma__central_columns` (
  `db_name` varchar(64) NOT NULL,
  `col_name` varchar(64) NOT NULL,
  `col_type` varchar(64) NOT NULL,
  `col_length` text DEFAULT NULL,
  `col_collation` varchar(64) NOT NULL,
  `col_isNull` tinyint(1) NOT NULL,
  `col_extra` varchar(255) DEFAULT '',
  `col_default` text DEFAULT NULL,
  PRIMARY KEY (`db_name`,`col_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Central list of columns';

--
-- Dumping data for table `pma__central_columns`
--


--
-- Table structure for table `pma__column_info`
--

CREATE TABLE `pma__column_info` (
  `id` int(5) unsigned NOT NULL AUTO_INCREMENT,
  `db_name` varchar(64) NOT NULL DEFAULT '',
  `table_name` varchar(64) NOT NULL DEFAULT '',
  `column_name` varchar(64) NOT NULL DEFAULT '',
  `comment` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '',
  `mimetype` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '',
  `transformation` varchar(255) NOT NULL DEFAULT '',
  `transformation_options` varchar(255) NOT NULL DEFAULT '',
  `input_transformation` varchar(255) NOT NULL DEFAULT '',
  `input_transformation_options` varchar(255) NOT NULL DEFAULT '',
  PRIMARY KEY (`id`),
  UNIQUE KEY `db_name` (`db_name`,`table_name`,`column_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Column information for phpMyAdmin';

--
-- Dumping data for table `pma__column_info`
--


--
-- Table structure for table `pma__designer_settings`
--

CREATE TABLE `pma__designer_settings` (
  `username` varchar(64) NOT NULL,
  `settings_data` text NOT NULL,
  PRIMARY KEY (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Settings related to Designer';

--
-- Dumping data for table `pma__designer_settings`
--


--
-- Table structure for table `pma__export_templates`
--

CREATE TABLE `pma__export_templates` (
  `id` int(5) unsigned NOT NULL AUTO_INCREMENT,
  `username` varchar(64) NOT NULL,
  `export_type` varchar(10) NOT NULL,
  `template_name` varchar(64) NOT NULL,
  `template_data` text NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `u_user_type_template` (`username`,`export_type`,`template_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Saved export templates';

--
-- Dumping data for table `pma__export_templates`
--


--
-- Table structure for table `pma__favorite`
--

CREATE TABLE `pma__favorite` (
  `username` varchar(64) NOT NULL,
  `tables` text NOT NULL,
  PRIMARY KEY (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Favorite tables';

--
-- Dumping data for table `pma__favorite`
--


--
-- Table structure for table `pma__history`
--

CREATE TABLE `pma__history` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `username` varchar(64) NOT NULL DEFAULT '',
  `db` varchar(64) NOT NULL DEFAULT '',
  `table` varchar(64) NOT NULL DEFAULT '',
  `timevalue` timestamp NOT NULL DEFAULT current_timestamp(),
  `sqlquery` text NOT NULL,
  PRIMARY KEY (`id`),
  KEY `username` (`username`,`db`,`table`,`timevalue`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='SQL history for phpMyAdmin';

--
-- Dumping data for table `pma__history`
--


--
-- Table structure for table `pma__navigationhiding`
--

CREATE TABLE `pma__navigationhiding` (
  `username` varchar(64) NOT NULL,
  `item_name` varchar(64) NOT NULL,
  `item_type` varchar(64) NOT NULL,
  `db_name` varchar(64) NOT NULL,
  `table_name` varchar(64) NOT NULL,
  PRIMARY KEY (`username`,`item_name`,`item_type`,`db_name`,`table_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Hidden items of navigation tree';

--
-- Dumping data for table `pma__navigationhiding`
--


--
-- Table structure for table `pma__pdf_pages`
--

CREATE TABLE `pma__pdf_pages` (
  `db_name` varchar(64) NOT NULL DEFAULT '',
  `page_nr` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `page_descr` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '',
  PRIMARY KEY (`page_nr`),
  KEY `db_name` (`db_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='PDF relation pages for phpMyAdmin';

--
-- Dumping data for table `pma__pdf_pages`
--


--
-- Table structure for table `pma__recent`
--

CREATE TABLE `pma__recent` (
  `username` varchar(64) NOT NULL,
  `tables` text NOT NULL,
  PRIMARY KEY (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Recently accessed tables';

--
-- Dumping data for table `pma__recent`
--

INSERT INTO `pma__recent` VALUES ('root','[{\"db\":\"b2b\",\"table\":\"logs\"},{\"db\":\"b2b\",\"table\":\"hotels_booking_list\"},{\"db\":\"b2b\",\"table\":\"flights_booking_list\"},{\"db\":\"b2b\",\"table\":\"users\"},{\"db\":\"b2b\",\"table\":\"settings\"},{\"db\":\"b2b\",\"table\":\"currencies\"},{\"db\":\"b2b\",\"table\":\"user_settings\"},{\"db\":\"b2b\",\"table\":\"admins\"},{\"db\":\"b2b\",\"table\":\"sessions\"},{\"db\":\"b2b\",\"table\":\"markups\"}]');

--
-- Table structure for table `pma__relation`
--

CREATE TABLE `pma__relation` (
  `master_db` varchar(64) NOT NULL DEFAULT '',
  `master_table` varchar(64) NOT NULL DEFAULT '',
  `master_field` varchar(64) NOT NULL DEFAULT '',
  `foreign_db` varchar(64) NOT NULL DEFAULT '',
  `foreign_table` varchar(64) NOT NULL DEFAULT '',
  `foreign_field` varchar(64) NOT NULL DEFAULT '',
  PRIMARY KEY (`master_db`,`master_table`,`master_field`),
  KEY `foreign_field` (`foreign_db`,`foreign_table`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Relation table';

--
-- Dumping data for table `pma__relation`
--


--
-- Table structure for table `pma__savedsearches`
--

CREATE TABLE `pma__savedsearches` (
  `id` int(5) unsigned NOT NULL AUTO_INCREMENT,
  `username` varchar(64) NOT NULL DEFAULT '',
  `db_name` varchar(64) NOT NULL DEFAULT '',
  `search_name` varchar(64) NOT NULL DEFAULT '',
  `search_data` text NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `u_savedsearches_username_dbname` (`username`,`db_name`,`search_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Saved searches';

--
-- Dumping data for table `pma__savedsearches`
--


--
-- Table structure for table `pma__table_coords`
--

CREATE TABLE `pma__table_coords` (
  `db_name` varchar(64) NOT NULL DEFAULT '',
  `table_name` varchar(64) NOT NULL DEFAULT '',
  `pdf_page_number` int(11) NOT NULL DEFAULT 0,
  `x` float unsigned NOT NULL DEFAULT 0,
  `y` float unsigned NOT NULL DEFAULT 0,
  PRIMARY KEY (`db_name`,`table_name`,`pdf_page_number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Table coordinates for phpMyAdmin PDF output';

--
-- Dumping data for table `pma__table_coords`
--


--
-- Table structure for table `pma__table_info`
--

CREATE TABLE `pma__table_info` (
  `db_name` varchar(64) NOT NULL DEFAULT '',
  `table_name` varchar(64) NOT NULL DEFAULT '',
  `display_field` varchar(64) NOT NULL DEFAULT '',
  PRIMARY KEY (`db_name`,`table_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Table information for phpMyAdmin';

--
-- Dumping data for table `pma__table_info`
--


--
-- Table structure for table `pma__table_uiprefs`
--

CREATE TABLE `pma__table_uiprefs` (
  `username` varchar(64) NOT NULL,
  `db_name` varchar(64) NOT NULL,
  `table_name` varchar(64) NOT NULL,
  `prefs` text NOT NULL,
  `last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`username`,`db_name`,`table_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Tables'' UI preferences';

--
-- Dumping data for table `pma__table_uiprefs`
--


--
-- Table structure for table `pma__tracking`
--

CREATE TABLE `pma__tracking` (
  `db_name` varchar(64) NOT NULL,
  `table_name` varchar(64) NOT NULL,
  `version` int(10) unsigned NOT NULL,
  `date_created` datetime NOT NULL,
  `date_updated` datetime NOT NULL,
  `schema_snapshot` text NOT NULL,
  `schema_sql` text DEFAULT NULL,
  `data_sql` longtext DEFAULT NULL,
  `tracking` set('UPDATE','REPLACE','INSERT','DELETE','TRUNCATE','CREATE DATABASE','ALTER DATABASE','DROP DATABASE','CREATE TABLE','ALTER TABLE','RENAME TABLE','DROP TABLE','CREATE INDEX','DROP INDEX','CREATE VIEW','ALTER VIEW','DROP VIEW') DEFAULT NULL,
  `tracking_active` int(1) unsigned NOT NULL DEFAULT 1,
  PRIMARY KEY (`db_name`,`table_name`,`version`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Database changes tracking for phpMyAdmin';

--
-- Dumping data for table `pma__tracking`
--


--
-- Table structure for table `pma__userconfig`
--

CREATE TABLE `pma__userconfig` (
  `username` varchar(64) NOT NULL,
  `timevalue` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `config_data` text NOT NULL,
  PRIMARY KEY (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='User preferences storage for phpMyAdmin';

--
-- Dumping data for table `pma__userconfig`
--

INSERT INTO `pma__userconfig` VALUES ('root','2023-11-19 01:32:52','{\"Console\\/Mode\":\"collapse\"}');

--
-- Table structure for table `pma__usergroups`
--

CREATE TABLE `pma__usergroups` (
  `usergroup` varchar(64) NOT NULL,
  `tab` varchar(64) NOT NULL,
  `allowed` enum('Y','N') NOT NULL DEFAULT 'N',
  PRIMARY KEY (`usergroup`,`tab`,`allowed`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='User groups with configured menu items';

--
-- Dumping data for table `pma__usergroups`
--


--
-- Table structure for table `pma__users`
--

CREATE TABLE `pma__users` (
  `username` varchar(64) NOT NULL,
  `usergroup` varchar(64) NOT NULL,
  PRIMARY KEY (`username`,`usergroup`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Users and their assignments to user groups';

--
-- Dumping data for table `pma__users`
--


--
-- Current Database: `b2b`
--

USE `b2b`;

--
-- Current Database: `mysql`
--

USE `mysql`;

--
-- Final view structure for view `user`
--

/*!50001 DROP VIEW IF EXISTS `user`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`mariadb.sys`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `user` AS select `global_priv`.`Host` AS `Host`,`global_priv`.`User` AS `User`,if(json_value(`global_priv`.`Priv`,'$.plugin') in ('mysql_native_password','mysql_old_password'),ifnull(json_value(`global_priv`.`Priv`,'$.authentication_string'),''),'') AS `Password`,if(json_value(`global_priv`.`Priv`,'$.access') & 1,'Y','N') AS `Select_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 2,'Y','N') AS `Insert_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 4,'Y','N') AS `Update_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 8,'Y','N') AS `Delete_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 16,'Y','N') AS `Create_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 32,'Y','N') AS `Drop_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 64,'Y','N') AS `Reload_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 128,'Y','N') AS `Shutdown_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 256,'Y','N') AS `Process_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 512,'Y','N') AS `File_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 1024,'Y','N') AS `Grant_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 2048,'Y','N') AS `References_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 4096,'Y','N') AS `Index_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 8192,'Y','N') AS `Alter_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 16384,'Y','N') AS `Show_db_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 32768,'Y','N') AS `Super_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 65536,'Y','N') AS `Create_tmp_table_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 131072,'Y','N') AS `Lock_tables_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 262144,'Y','N') AS `Execute_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 524288,'Y','N') AS `Repl_slave_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 1048576,'Y','N') AS `Repl_client_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 2097152,'Y','N') AS `Create_view_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 4194304,'Y','N') AS `Show_view_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 8388608,'Y','N') AS `Create_routine_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 16777216,'Y','N') AS `Alter_routine_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 33554432,'Y','N') AS `Create_user_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 67108864,'Y','N') AS `Event_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 134217728,'Y','N') AS `Trigger_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 268435456,'Y','N') AS `Create_tablespace_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 536870912,'Y','N') AS `Delete_history_priv`,elt(ifnull(json_value(`global_priv`.`Priv`,'$.ssl_type'),0) + 1,'','ANY','X509','SPECIFIED') AS `ssl_type`,ifnull(json_value(`global_priv`.`Priv`,'$.ssl_cipher'),'') AS `ssl_cipher`,ifnull(json_value(`global_priv`.`Priv`,'$.x509_issuer'),'') AS `x509_issuer`,ifnull(json_value(`global_priv`.`Priv`,'$.x509_subject'),'') AS `x509_subject`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_questions'),0) as unsigned) AS `max_questions`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_updates'),0) as unsigned) AS `max_updates`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_connections'),0) as unsigned) AS `max_connections`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_user_connections'),0) as signed) AS `max_user_connections`,ifnull(json_value(`global_priv`.`Priv`,'$.plugin'),'') AS `plugin`,ifnull(json_value(`global_priv`.`Priv`,'$.authentication_string'),'') AS `authentication_string`,if(ifnull(json_value(`global_priv`.`Priv`,'$.password_last_changed'),1) = 0,'Y','N') AS `password_expired`,elt(ifnull(json_value(`global_priv`.`Priv`,'$.is_role'),0) + 1,'N','Y') AS `is_role`,ifnull(json_value(`global_priv`.`Priv`,'$.default_role'),'') AS `default_role`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_statement_time'),0.0) as decimal(12,6)) AS `max_statement_time` from `global_priv` */;

--
-- Current Database: `phpmyadmin`
--

USE `phpmyadmin`;


