From f0eb8890f66f51dfc7d8414d242fae33c96c1c3f Mon Sep 17 00:00:00 2001 From: Federico Razzoli Date: Thu, 5 May 2016 12:58:50 +0200 Subject: [PATCH 1/9] view: engines_usage --- sys_56.sql | 1 + sys_57.sql | 1 + views/i_s/engines_usage.sql | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 views/i_s/engines_usage.sql diff --git a/sys_56.sql b/sys_56.sql index afa34bc..9c85fb3 100644 --- a/sys_56.sql +++ b/sys_56.sql @@ -54,6 +54,7 @@ SOURCE ./views/i_s/schema_object_overview.sql SOURCE ./views/i_s/schema_auto_increment_columns.sql SOURCE ./views/i_s/x_schema_flattened_keys.sql SOURCE ./views/i_s/schema_redundant_indexes.sql +SOURCE ./views/i_s/engines_usage.sql SOURCE ./views/p_s/ps_check_lost_instrumentation.sql SOURCE ./views/p_s/processlist.sql diff --git a/sys_57.sql b/sys_57.sql index 8e25b9c..9e01800 100644 --- a/sys_57.sql +++ b/sys_57.sql @@ -55,6 +55,7 @@ SOURCE ./views/i_s/schema_object_overview.sql SOURCE ./views/i_s/schema_auto_increment_columns.sql SOURCE ./views/i_s/x_schema_flattened_keys.sql SOURCE ./views/i_s/schema_redundant_indexes.sql +SOURCE ./views/i_s/engines_usage.sql SOURCE ./views/p_s/ps_check_lost_instrumentation_57.sql diff --git a/views/i_s/engines_usage.sql b/views/i_s/engines_usage.sql new file mode 100644 index 0000000..d4529d4 --- /dev/null +++ b/views/i_s/engines_usage.sql @@ -0,0 +1,32 @@ +-- +-- View: engines_usage +-- +-- Storage engines usage statistics. +-- +-- mysql> SELECT * FROM sys.engines_usage; +-- +--------+--------------+ +-- | engine | tables_count | +-- +--------+--------------+ +-- | InnoDB | 5 | +-- | MEMORY | 3 | +-- | MyISAM | 5 | +-- +--------+--------------+ +-- 3 rows in set (0.01 sec) +-- + +CREATE OR REPLACE + ALGORITHM = TEMPTABLE + DEFINER = 'root'@'localhost' + SQL SECURITY INVOKER +VIEW engines_usage ( + engine, + tables_count +) AS + SELECT e.ENGINE, COUNT(t.ENGINE) AS tables_count + FROM INFORMATION_SCHEMA.ENGINES e + LEFT JOIN INFORMATION_SCHEMA.TABLES t + ON e.ENGINE = t.ENGINE + WHERE t.TABLE_SCHEMA NOT IN ('performance_schema', 'information_schema', 'mysql') + AND e.SUPPORT IN ('YES', 'DEFAULT') + GROUP BY e.ENGINE + ORDER BY e.ENGINE; From 50f050771869434b583e85ae3bc0b70a1530d65a Mon Sep 17 00:00:00 2001 From: Federico Razzoli Date: Thu, 5 May 2016 13:11:50 +0200 Subject: [PATCH 2/9] view: engines_unused --- sys_56.sql | 1 + sys_57.sql | 1 + views/i_s/engines_unused.sql | 30 ++++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 views/i_s/engines_unused.sql diff --git a/sys_56.sql b/sys_56.sql index 9c85fb3..2950957 100644 --- a/sys_56.sql +++ b/sys_56.sql @@ -55,6 +55,7 @@ SOURCE ./views/i_s/schema_auto_increment_columns.sql SOURCE ./views/i_s/x_schema_flattened_keys.sql SOURCE ./views/i_s/schema_redundant_indexes.sql SOURCE ./views/i_s/engines_usage.sql +SOURCE ./views/i_s/engines_unused.sql SOURCE ./views/p_s/ps_check_lost_instrumentation.sql SOURCE ./views/p_s/processlist.sql diff --git a/sys_57.sql b/sys_57.sql index 9e01800..be2c43f 100644 --- a/sys_57.sql +++ b/sys_57.sql @@ -56,6 +56,7 @@ SOURCE ./views/i_s/schema_auto_increment_columns.sql SOURCE ./views/i_s/x_schema_flattened_keys.sql SOURCE ./views/i_s/schema_redundant_indexes.sql SOURCE ./views/i_s/engines_usage.sql +SOURCE ./views/i_s/engines_unused.sql SOURCE ./views/p_s/ps_check_lost_instrumentation_57.sql diff --git a/views/i_s/engines_unused.sql b/views/i_s/engines_unused.sql new file mode 100644 index 0000000..9364a21 --- /dev/null +++ b/views/i_s/engines_unused.sql @@ -0,0 +1,30 @@ +-- +-- View: engines_unused +-- +-- Storage engines that are installed, but currently not used for any table. +-- +-- mysql> SELECT * FROM sys.engines_unused; +-- +------------+ +-- | engine | +-- +------------+ +-- | ARCHIVE | +-- | BLACKHOLE | +-- | MRG_MYISAM | +-- +------------+ +-- 3 rows in set (0.01 sec) +-- + +CREATE OR REPLACE + ALGORITHM = TEMPTABLE + DEFINER = 'root'@'localhost' + SQL SECURITY INVOKER +VIEW engines_unused ( + engine +) AS + SELECT e.ENGINE + FROM INFORMATION_SCHEMA.ENGINES e + LEFT JOIN INFORMATION_SCHEMA.TABLES t + ON e.ENGINE = t.ENGINE + WHERE e.SUPPORT IN ('YES', 'DEFAULT') + AND t.ENGINE IS NULL + ORDER BY e.ENGINE; From 04f0c2186ba52706b54d62389c31aa380e4ea88a Mon Sep 17 00:00:00 2001 From: Federico Razzoli Date: Thu, 5 May 2016 13:23:26 +0200 Subject: [PATCH 3/9] view: engines_usage_by_schema --- sys_56.sql | 1 + sys_57.sql | 1 + views/i_s/engines_usage_by_schema.sql | 30 ++++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 views/i_s/engines_usage_by_schema.sql diff --git a/sys_56.sql b/sys_56.sql index 2950957..c5e3709 100644 --- a/sys_56.sql +++ b/sys_56.sql @@ -55,6 +55,7 @@ SOURCE ./views/i_s/schema_auto_increment_columns.sql SOURCE ./views/i_s/x_schema_flattened_keys.sql SOURCE ./views/i_s/schema_redundant_indexes.sql SOURCE ./views/i_s/engines_usage.sql +SOURCE ./views/i_s/engines_usage_by_schema.sql SOURCE ./views/i_s/engines_unused.sql SOURCE ./views/p_s/ps_check_lost_instrumentation.sql diff --git a/sys_57.sql b/sys_57.sql index be2c43f..6d66cdf 100644 --- a/sys_57.sql +++ b/sys_57.sql @@ -56,6 +56,7 @@ SOURCE ./views/i_s/schema_auto_increment_columns.sql SOURCE ./views/i_s/x_schema_flattened_keys.sql SOURCE ./views/i_s/schema_redundant_indexes.sql SOURCE ./views/i_s/engines_usage.sql +SOURCE ./views/i_s/engines_usage_by_schema.sql SOURCE ./views/i_s/engines_unused.sql SOURCE ./views/p_s/ps_check_lost_instrumentation_57.sql diff --git a/views/i_s/engines_usage_by_schema.sql b/views/i_s/engines_usage_by_schema.sql new file mode 100644 index 0000000..f5b65aa --- /dev/null +++ b/views/i_s/engines_usage_by_schema.sql @@ -0,0 +1,30 @@ +-- +-- View: engines_usage_by_schema +-- +-- Storage engines (and views) usage statistics, grouped by database. +-- +-- mysql> SELECT * FROM sys.engines_usage_by_schema; +-- +---------------+--------+--------------+ +-- | engine_schema | engine | tables_count | +-- +---------------+--------+--------------+ +-- | sys | VIEW | 103 | +-- | sys | InnoDB | 1 | +-- ... +-- +---------------+--------+--------------+ +-- 5 rows in set (0.00 sec) +-- + +CREATE OR REPLACE + ALGORITHM = TEMPTABLE + DEFINER = 'root'@'localhost' + SQL SECURITY INVOKER +VIEW engines_usage_by_schema ( + engine_schema, + engine, + tables_count +) AS + SELECT TABLE_SCHEMA AS engine_schema, IFNULL(ENGINE, 'VIEW'), COUNT(*) AS tables_count + FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_SCHEMA NOT IN ('performance_schema', 'information_schema', 'mysql') + GROUP BY TABLE_SCHEMA, ENGINE + ORDER BY TABLE_SCHEMA, ENGINE; From f2440480bcf2e41d18a73e0f7ff5892963bdcaf6 Mon Sep 17 00:00:00 2001 From: Federico Razzoli Date: Thu, 5 May 2016 14:33:08 +0200 Subject: [PATCH 4/9] renamed engines_* views to engine_* --- views/i_s/engine_unused.sql | 30 ++++++++++++++++++++++++++++++ views/i_s/engine_usage.sql | 32 ++++++++++++++++++++++++++++++++ views/i_s/engine_usage_by_schema.sql | 30 ++++++++++++++++++++++++++++++ views/i_s/engines_unused.sql | 30 ------------------------------ views/i_s/engines_usage.sql | 32 -------------------------------- views/i_s/engines_usage_by_schema.sql | 30 ------------------------------ 6 files changed, 92 insertions(+), 92 deletions(-) create mode 100644 views/i_s/engine_unused.sql create mode 100644 views/i_s/engine_usage.sql create mode 100644 views/i_s/engine_usage_by_schema.sql delete mode 100644 views/i_s/engines_unused.sql delete mode 100644 views/i_s/engines_usage.sql delete mode 100644 views/i_s/engines_usage_by_schema.sql diff --git a/views/i_s/engine_unused.sql b/views/i_s/engine_unused.sql new file mode 100644 index 0000000..b3697a1 --- /dev/null +++ b/views/i_s/engine_unused.sql @@ -0,0 +1,30 @@ +-- +-- View: engines_unused +-- +-- Storage engines that are installed, but currently not used for any table. +-- +-- mysql> SELECT * FROM sys.engines_unused; +-- +------------+ +-- | engine | +-- +------------+ +-- | ARCHIVE | +-- | BLACKHOLE | +-- | MRG_MYISAM | +-- +------------+ +-- 3 rows in set (0.01 sec) +-- + +CREATE OR REPLACE + ALGORITHM = TEMPTABLE + DEFINER = 'root'@'localhost' + SQL SECURITY INVOKER +VIEW engine_unused ( + engine +) AS + SELECT e.ENGINE + FROM INFORMATION_SCHEMA.ENGINES e + LEFT JOIN INFORMATION_SCHEMA.TABLES t + ON e.ENGINE = t.ENGINE + WHERE e.SUPPORT IN ('YES', 'DEFAULT') + AND t.ENGINE IS NULL + ORDER BY e.ENGINE; diff --git a/views/i_s/engine_usage.sql b/views/i_s/engine_usage.sql new file mode 100644 index 0000000..40cfb73 --- /dev/null +++ b/views/i_s/engine_usage.sql @@ -0,0 +1,32 @@ +-- +-- View: engines_usage +-- +-- Storage engines usage statistics. +-- +-- mysql> SELECT * FROM sys.engines_usage; +-- +--------+--------------+ +-- | engine | tables_count | +-- +--------+--------------+ +-- | InnoDB | 5 | +-- | MEMORY | 3 | +-- | MyISAM | 5 | +-- +--------+--------------+ +-- 3 rows in set (0.01 sec) +-- + +CREATE OR REPLACE + ALGORITHM = TEMPTABLE + DEFINER = 'root'@'localhost' + SQL SECURITY INVOKER +VIEW engine_usage ( + engine, + tables_count +) AS + SELECT e.ENGINE, COUNT(t.ENGINE) AS tables_count + FROM INFORMATION_SCHEMA.ENGINES e + LEFT JOIN INFORMATION_SCHEMA.TABLES t + ON e.ENGINE = t.ENGINE + WHERE t.TABLE_SCHEMA NOT IN ('performance_schema', 'information_schema', 'mysql') + AND e.SUPPORT IN ('YES', 'DEFAULT') + GROUP BY e.ENGINE + ORDER BY e.ENGINE; diff --git a/views/i_s/engine_usage_by_schema.sql b/views/i_s/engine_usage_by_schema.sql new file mode 100644 index 0000000..a066219 --- /dev/null +++ b/views/i_s/engine_usage_by_schema.sql @@ -0,0 +1,30 @@ +-- +-- View: engines_usage_by_schema +-- +-- Storage engines (and views) usage statistics, grouped by database. +-- +-- mysql> SELECT * FROM sys.engines_usage_by_schema; +-- +---------------+--------+--------------+ +-- | engine_schema | engine | tables_count | +-- +---------------+--------+--------------+ +-- | sys | VIEW | 103 | +-- | sys | InnoDB | 1 | +-- ... +-- +---------------+--------+--------------+ +-- 5 rows in set (0.00 sec) +-- + +CREATE OR REPLACE + ALGORITHM = TEMPTABLE + DEFINER = 'root'@'localhost' + SQL SECURITY INVOKER +VIEW engine_usage_by_schema ( + engine_schema, + engine, + tables_count +) AS + SELECT TABLE_SCHEMA AS engine_schema, IFNULL(ENGINE, 'VIEW'), COUNT(*) AS tables_count + FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_SCHEMA NOT IN ('performance_schema', 'information_schema', 'mysql') + GROUP BY TABLE_SCHEMA, ENGINE + ORDER BY TABLE_SCHEMA, ENGINE; diff --git a/views/i_s/engines_unused.sql b/views/i_s/engines_unused.sql deleted file mode 100644 index 9364a21..0000000 --- a/views/i_s/engines_unused.sql +++ /dev/null @@ -1,30 +0,0 @@ --- --- View: engines_unused --- --- Storage engines that are installed, but currently not used for any table. --- --- mysql> SELECT * FROM sys.engines_unused; --- +------------+ --- | engine | --- +------------+ --- | ARCHIVE | --- | BLACKHOLE | --- | MRG_MYISAM | --- +------------+ --- 3 rows in set (0.01 sec) --- - -CREATE OR REPLACE - ALGORITHM = TEMPTABLE - DEFINER = 'root'@'localhost' - SQL SECURITY INVOKER -VIEW engines_unused ( - engine -) AS - SELECT e.ENGINE - FROM INFORMATION_SCHEMA.ENGINES e - LEFT JOIN INFORMATION_SCHEMA.TABLES t - ON e.ENGINE = t.ENGINE - WHERE e.SUPPORT IN ('YES', 'DEFAULT') - AND t.ENGINE IS NULL - ORDER BY e.ENGINE; diff --git a/views/i_s/engines_usage.sql b/views/i_s/engines_usage.sql deleted file mode 100644 index d4529d4..0000000 --- a/views/i_s/engines_usage.sql +++ /dev/null @@ -1,32 +0,0 @@ --- --- View: engines_usage --- --- Storage engines usage statistics. --- --- mysql> SELECT * FROM sys.engines_usage; --- +--------+--------------+ --- | engine | tables_count | --- +--------+--------------+ --- | InnoDB | 5 | --- | MEMORY | 3 | --- | MyISAM | 5 | --- +--------+--------------+ --- 3 rows in set (0.01 sec) --- - -CREATE OR REPLACE - ALGORITHM = TEMPTABLE - DEFINER = 'root'@'localhost' - SQL SECURITY INVOKER -VIEW engines_usage ( - engine, - tables_count -) AS - SELECT e.ENGINE, COUNT(t.ENGINE) AS tables_count - FROM INFORMATION_SCHEMA.ENGINES e - LEFT JOIN INFORMATION_SCHEMA.TABLES t - ON e.ENGINE = t.ENGINE - WHERE t.TABLE_SCHEMA NOT IN ('performance_schema', 'information_schema', 'mysql') - AND e.SUPPORT IN ('YES', 'DEFAULT') - GROUP BY e.ENGINE - ORDER BY e.ENGINE; diff --git a/views/i_s/engines_usage_by_schema.sql b/views/i_s/engines_usage_by_schema.sql deleted file mode 100644 index f5b65aa..0000000 --- a/views/i_s/engines_usage_by_schema.sql +++ /dev/null @@ -1,30 +0,0 @@ --- --- View: engines_usage_by_schema --- --- Storage engines (and views) usage statistics, grouped by database. --- --- mysql> SELECT * FROM sys.engines_usage_by_schema; --- +---------------+--------+--------------+ --- | engine_schema | engine | tables_count | --- +---------------+--------+--------------+ --- | sys | VIEW | 103 | --- | sys | InnoDB | 1 | --- ... --- +---------------+--------+--------------+ --- 5 rows in set (0.00 sec) --- - -CREATE OR REPLACE - ALGORITHM = TEMPTABLE - DEFINER = 'root'@'localhost' - SQL SECURITY INVOKER -VIEW engines_usage_by_schema ( - engine_schema, - engine, - tables_count -) AS - SELECT TABLE_SCHEMA AS engine_schema, IFNULL(ENGINE, 'VIEW'), COUNT(*) AS tables_count - FROM INFORMATION_SCHEMA.TABLES - WHERE TABLE_SCHEMA NOT IN ('performance_schema', 'information_schema', 'mysql') - GROUP BY TABLE_SCHEMA, ENGINE - ORDER BY TABLE_SCHEMA, ENGINE; From ad508dd3b02bab6c0125513726006a77f36eebd0 Mon Sep 17 00:00:00 2001 From: Federico Razzoli Date: Thu, 5 May 2016 14:34:31 +0200 Subject: [PATCH 5/9] removed engine_unused as requested by mark --- views/i_s/engine_unused.sql | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 views/i_s/engine_unused.sql diff --git a/views/i_s/engine_unused.sql b/views/i_s/engine_unused.sql deleted file mode 100644 index b3697a1..0000000 --- a/views/i_s/engine_unused.sql +++ /dev/null @@ -1,30 +0,0 @@ --- --- View: engines_unused --- --- Storage engines that are installed, but currently not used for any table. --- --- mysql> SELECT * FROM sys.engines_unused; --- +------------+ --- | engine | --- +------------+ --- | ARCHIVE | --- | BLACKHOLE | --- | MRG_MYISAM | --- +------------+ --- 3 rows in set (0.01 sec) --- - -CREATE OR REPLACE - ALGORITHM = TEMPTABLE - DEFINER = 'root'@'localhost' - SQL SECURITY INVOKER -VIEW engine_unused ( - engine -) AS - SELECT e.ENGINE - FROM INFORMATION_SCHEMA.ENGINES e - LEFT JOIN INFORMATION_SCHEMA.TABLES t - ON e.ENGINE = t.ENGINE - WHERE e.SUPPORT IN ('YES', 'DEFAULT') - AND t.ENGINE IS NULL - ORDER BY e.ENGINE; From 95f8e02e9d5d3eff55ac789ad88d2249663f8753 Mon Sep 17 00:00:00 2001 From: Federico Razzoli Date: Thu, 5 May 2016 14:59:46 +0200 Subject: [PATCH 6/9] updated install files --- sys_56.sql | 5 ++--- sys_57.sql | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/sys_56.sql b/sys_56.sql index c5e3709..72a025a 100644 --- a/sys_56.sql +++ b/sys_56.sql @@ -54,9 +54,8 @@ SOURCE ./views/i_s/schema_object_overview.sql SOURCE ./views/i_s/schema_auto_increment_columns.sql SOURCE ./views/i_s/x_schema_flattened_keys.sql SOURCE ./views/i_s/schema_redundant_indexes.sql -SOURCE ./views/i_s/engines_usage.sql -SOURCE ./views/i_s/engines_usage_by_schema.sql -SOURCE ./views/i_s/engines_unused.sql +SOURCE ./views/i_s/engine_usage.sql +SOURCE ./views/i_s/engine_usage_by_schema.sql SOURCE ./views/p_s/ps_check_lost_instrumentation.sql SOURCE ./views/p_s/processlist.sql diff --git a/sys_57.sql b/sys_57.sql index 6d66cdf..c02bb21 100644 --- a/sys_57.sql +++ b/sys_57.sql @@ -55,9 +55,8 @@ SOURCE ./views/i_s/schema_object_overview.sql SOURCE ./views/i_s/schema_auto_increment_columns.sql SOURCE ./views/i_s/x_schema_flattened_keys.sql SOURCE ./views/i_s/schema_redundant_indexes.sql -SOURCE ./views/i_s/engines_usage.sql -SOURCE ./views/i_s/engines_usage_by_schema.sql -SOURCE ./views/i_s/engines_unused.sql +SOURCE ./views/i_s/engine_usage.sql +SOURCE ./views/i_s/engine_usage_by_schema.sql SOURCE ./views/p_s/ps_check_lost_instrumentation_57.sql From 2b28d8ed9807c7c4fba0f8473a2cc0744eb5a70c Mon Sep 17 00:00:00 2001 From: Federico Razzoli Date: Thu, 5 May 2016 15:13:38 +0200 Subject: [PATCH 7/9] include system databases in engine_* views results --- views/i_s/engine_usage.sql | 7 +++---- views/i_s/engine_usage_by_schema.sql | 5 ++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/views/i_s/engine_usage.sql b/views/i_s/engine_usage.sql index 40cfb73..2e9862c 100644 --- a/views/i_s/engine_usage.sql +++ b/views/i_s/engine_usage.sql @@ -1,9 +1,9 @@ -- --- View: engines_usage +-- View: engine_usage -- -- Storage engines usage statistics. -- --- mysql> SELECT * FROM sys.engines_usage; +-- mysql> SELECT * FROM sys.engine_usage; -- +--------+--------------+ -- | engine | tables_count | -- +--------+--------------+ @@ -26,7 +26,6 @@ VIEW engine_usage ( FROM INFORMATION_SCHEMA.ENGINES e LEFT JOIN INFORMATION_SCHEMA.TABLES t ON e.ENGINE = t.ENGINE - WHERE t.TABLE_SCHEMA NOT IN ('performance_schema', 'information_schema', 'mysql') - AND e.SUPPORT IN ('YES', 'DEFAULT') + WHERE e.SUPPORT IN ('YES', 'DEFAULT') GROUP BY e.ENGINE ORDER BY e.ENGINE; diff --git a/views/i_s/engine_usage_by_schema.sql b/views/i_s/engine_usage_by_schema.sql index a066219..5359302 100644 --- a/views/i_s/engine_usage_by_schema.sql +++ b/views/i_s/engine_usage_by_schema.sql @@ -1,9 +1,9 @@ -- --- View: engines_usage_by_schema +-- View: engine_usage_by_schema -- -- Storage engines (and views) usage statistics, grouped by database. -- --- mysql> SELECT * FROM sys.engines_usage_by_schema; +-- mysql> SELECT * FROM sys.engine_usage_by_schema; -- +---------------+--------+--------------+ -- | engine_schema | engine | tables_count | -- +---------------+--------+--------------+ @@ -25,6 +25,5 @@ VIEW engine_usage_by_schema ( ) AS SELECT TABLE_SCHEMA AS engine_schema, IFNULL(ENGINE, 'VIEW'), COUNT(*) AS tables_count FROM INFORMATION_SCHEMA.TABLES - WHERE TABLE_SCHEMA NOT IN ('performance_schema', 'information_schema', 'mysql') GROUP BY TABLE_SCHEMA, ENGINE ORDER BY TABLE_SCHEMA, ENGINE; From 05c053c3db04510f1d6bfd61caabc860731e2ca0 Mon Sep 17 00:00:00 2001 From: Federico Razzoli Date: Thu, 5 May 2016 15:16:02 +0200 Subject: [PATCH 8/9] exclude views from engine_usage_by_schema results --- views/i_s/engine_usage_by_schema.sql | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/views/i_s/engine_usage_by_schema.sql b/views/i_s/engine_usage_by_schema.sql index 5359302..d8c2618 100644 --- a/views/i_s/engine_usage_by_schema.sql +++ b/views/i_s/engine_usage_by_schema.sql @@ -1,7 +1,7 @@ -- -- View: engine_usage_by_schema -- --- Storage engines (and views) usage statistics, grouped by database. +-- Storage engines usage statistics, grouped by database. -- -- mysql> SELECT * FROM sys.engine_usage_by_schema; -- +---------------+--------+--------------+ @@ -23,7 +23,8 @@ VIEW engine_usage_by_schema ( engine, tables_count ) AS - SELECT TABLE_SCHEMA AS engine_schema, IFNULL(ENGINE, 'VIEW'), COUNT(*) AS tables_count + SELECT TABLE_SCHEMA AS engine_schema, ENGINE, COUNT(*) AS tables_count FROM INFORMATION_SCHEMA.TABLES + WHERE ENGINE IS NOT NULL GROUP BY TABLE_SCHEMA, ENGINE ORDER BY TABLE_SCHEMA, ENGINE; From 035d8f1d499fb20038cd94d638d19bd312e523a5 Mon Sep 17 00:00:00 2001 From: Federico Razzoli Date: Thu, 5 May 2016 15:20:08 +0200 Subject: [PATCH 9/9] updated examples --- views/i_s/engine_usage.sql | 18 ++++++++++-------- views/i_s/engine_usage_by_schema.sql | 15 ++++++++------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/views/i_s/engine_usage.sql b/views/i_s/engine_usage.sql index 2e9862c..50e72ef 100644 --- a/views/i_s/engine_usage.sql +++ b/views/i_s/engine_usage.sql @@ -4,14 +4,16 @@ -- Storage engines usage statistics. -- -- mysql> SELECT * FROM sys.engine_usage; --- +--------+--------------+ --- | engine | tables_count | --- +--------+--------------+ --- | InnoDB | 5 | --- | MEMORY | 3 | --- | MyISAM | 5 | --- +--------+--------------+ --- 3 rows in set (0.01 sec) +-- +--------------------+--------------+ +-- | engine | tables_count | +-- +--------------------+--------------+ +-- | ARCHIVE | 0 | +-- | BLACKHOLE | 0 | +-- | CSV | 2 | +-- | InnoDB | 306 | +-- ... +-- +--------------------+--------------+ +-- 8 rows in set (0.01 sec) -- CREATE OR REPLACE diff --git a/views/i_s/engine_usage_by_schema.sql b/views/i_s/engine_usage_by_schema.sql index d8c2618..bae70e2 100644 --- a/views/i_s/engine_usage_by_schema.sql +++ b/views/i_s/engine_usage_by_schema.sql @@ -4,14 +4,15 @@ -- Storage engines usage statistics, grouped by database. -- -- mysql> SELECT * FROM sys.engine_usage_by_schema; --- +---------------+--------+--------------+ --- | engine_schema | engine | tables_count | --- +---------------+--------+--------------+ --- | sys | VIEW | 103 | --- | sys | InnoDB | 1 | +-- +--------------------+--------------------+--------------+ +-- | engine_schema | engine | tables_count | +-- +--------------------+--------------------+--------------+ +-- | information_schema | InnoDB | 10 | +-- | information_schema | MEMORY | 51 | +-- | mysql | CSV | 2 | -- ... --- +---------------+--------+--------------+ --- 5 rows in set (0.00 sec) +-- +--------------------+--------------------+--------------+ +-- 10 rows in set (0.01 sec) -- CREATE OR REPLACE