('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','2024-08-15 04:59:53','2024-08-15 04:59:53','','\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','2024-08-15 04:59:51','2024-08-15 04:59:51','','\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','2024-08-15 04:59:51','2024-08-15 04:59:51','','\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','2024-08-15 04:59:53','2024-08-15 04:59:53','','\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','2024-08-15 04:59:53','2024-08-15 04:59:53','','\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','2024-08-15 04:59:51','2024-08-15 04:59:51','','\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','2024-08-15 04:59:51','2024-08-15 04:59:51','','\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','2024-08-15 04:59:53','2024-08-15 04:59:53','','\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','2024-08-15 04:59:51','2024-08-15 04:59:51','','\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','2024-08-15 04:59:51','2024-08-15 04:59:51','','\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','2024-08-15 04:59:51','2024-08-15 04:59:51','','\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','2024-08-15 04:59:51','2024-08-15 04:59:51','','\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','2024-08-15 04:59:51','2024-08-15 04:59:51','','\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','2024-08-15 04:59:51','2024-08-15 04:59:51','','\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','2024-08-15 04:59:51','2024-08-15 04:59:51','','\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','2024-08-15 04:59:52','2024-08-15 04:59:52','','\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','2024-08-15 04:59:52','2024-08-15 04:59:52','','\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','2024-08-15 04:59:52','2024-08-15 04:59:52','','\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','2024-08-15 04:59:53','2024-08-15 04:59:53','','\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','2024-08-15 04:59:53','2024-08-15 04:59:53','','\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','2024-08-15 04:59:53','2024-08-15 04:59:53','','\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','2024-08-15 04:59:53','2024-08-15 04:59:53','','\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','2024-08-15 04:59:53','2024-08-15 04:59:53','','\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','2024-08-15 04:59:53','2024-08-15 04:59:53','','\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','2024-08-15 04:59:53','2024-08-15 04:59:53','','\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','2024-08-15 04:59:53','2024-08-15 04:59:53','','\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','2024-08-15 04:59:53','2024-08-15 04:59:53','','\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 AS SELECT * FROM performance_schema.setup_actors;\n        CREATE TEMPORARY TABLE tmp_setup_consumers AS SELECT * FROM  performance_schema.setup_consumers;\n        CREATE TEMPORARY TABLE tmp_setup_instruments AS SELECT * FROM  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_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','2024-08-15 04:59:53','2024-08-15 04:59:53','','\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 AS SELECT * FROM performance_schema.setup_actors;\n        CREATE TEMPORARY TABLE tmp_setup_consumers AS SELECT * FROM  performance_schema.setup_consumers;\n        CREATE TEMPORARY TABLE tmp_setup_instruments AS SELECT * FROM  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_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','2024-08-15 04:59:53','2024-08-15 04:59:53','','\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','2024-08-15 04:59:53','2024-08-15 04:59:53','','\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','2024-08-15 04:59:53','2024-08-15 04:59:53','','\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','2024-08-15 04:59:53','2024-08-15 04:59:53','','\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','2024-08-15 04:59:53','2024-08-15 04:59:53','','\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','2024-08-15 04:59:53','2024-08-15 04:59:53','','\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,'','2024-08-15 04:59:51'),
('localhost','mysql','','',1,'','2024-08-15 04:59:51');

--
-- 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;

--
-- Dump for 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` */;

--
