diff --git a/views/i_s/innodb_buffer_stats_by_schema.sql b/views/i_s/innodb_buffer_stats_by_schema.sql index d0d2e22..0618433 100644 --- a/views/i_s/innodb_buffer_stats_by_schema.sql +++ b/views/i_s/innodb_buffer_stats_by_schema.sql @@ -47,8 +47,8 @@ SELECT IF(LOCATE('.', ibp.table_name) = 0, 'InnoDB System', REPLACE(SUBSTRING_IN sys.format_bytes(SUM(IF(ibp.compressed_size = 0, 16384, compressed_size))) AS allocated, sys.format_bytes(SUM(ibp.data_size)) AS data, COUNT(ibp.page_number) AS pages, - COUNT(IF(ibp.is_hashed = 'YES', 1, 0)) AS pages_hashed, - COUNT(IF(ibp.is_old = 'YES', 1, 0)) AS pages_old, + SUM(IF(ibp.is_hashed = 'YES', 1, 0)) AS pages_hashed, + SUM(IF(ibp.is_old = 'YES', 1, 0)) AS pages_old, ROUND(SUM(ibp.number_records)/COUNT(DISTINCT ibp.index_name)) AS rows_cached FROM information_schema.innodb_buffer_page ibp WHERE table_name IS NOT NULL diff --git a/views/i_s/innodb_buffer_stats_by_table.sql b/views/i_s/innodb_buffer_stats_by_table.sql index 1f63e66..31aceab 100644 --- a/views/i_s/innodb_buffer_stats_by_table.sql +++ b/views/i_s/innodb_buffer_stats_by_table.sql @@ -53,8 +53,8 @@ SELECT IF(LOCATE('.', ibp.table_name) = 0, 'InnoDB System', REPLACE(SUBSTRING_IN sys.format_bytes(SUM(IF(ibp.compressed_size = 0, 16384, compressed_size))) AS allocated, sys.format_bytes(SUM(ibp.data_size)) AS data, COUNT(ibp.page_number) AS pages, - COUNT(IF(ibp.is_hashed = 'YES', 1, 0)) AS pages_hashed, - COUNT(IF(ibp.is_old = 'YES', 1, 0)) AS pages_old, + SUM(IF(ibp.is_hashed = 'YES', 1, 0)) AS pages_hashed, + SUM(IF(ibp.is_old = 'YES', 1, 0)) AS pages_old, ROUND(SUM(ibp.number_records)/COUNT(DISTINCT ibp.index_name)) AS rows_cached FROM information_schema.innodb_buffer_page ibp WHERE table_name IS NOT NULL diff --git a/views/i_s/x_innodb_buffer_stats_by_schema.sql b/views/i_s/x_innodb_buffer_stats_by_schema.sql index ecc6deb..311207e 100644 --- a/views/i_s/x_innodb_buffer_stats_by_schema.sql +++ b/views/i_s/x_innodb_buffer_stats_by_schema.sql @@ -46,8 +46,8 @@ SELECT IF(LOCATE('.', ibp.table_name) = 0, 'InnoDB System', REPLACE(SUBSTRING_IN SUM(IF(ibp.compressed_size = 0, 16384, compressed_size)) AS allocated, SUM(ibp.data_size) AS data, COUNT(ibp.page_number) AS pages, - COUNT(IF(ibp.is_hashed = 'YES', 1, 0)) AS pages_hashed, - COUNT(IF(ibp.is_old = 'YES', 1, 0)) AS pages_old, + SUM(IF(ibp.is_hashed = 'YES', 1, 0)) AS pages_hashed, + SUM(IF(ibp.is_old = 'YES', 1, 0)) AS pages_old, ROUND(IFNULL(SUM(ibp.number_records)/NULLIF(COUNT(DISTINCT ibp.index_name), 0), 0)) AS rows_cached FROM information_schema.innodb_buffer_page ibp WHERE table_name IS NOT NULL diff --git a/views/i_s/x_innodb_buffer_stats_by_table.sql b/views/i_s/x_innodb_buffer_stats_by_table.sql index d9021d5..51a3398 100644 --- a/views/i_s/x_innodb_buffer_stats_by_table.sql +++ b/views/i_s/x_innodb_buffer_stats_by_table.sql @@ -53,8 +53,8 @@ SELECT IF(LOCATE('.', ibp.table_name) = 0, 'InnoDB System', REPLACE(SUBSTRING_IN SUM(IF(ibp.compressed_size = 0, 16384, compressed_size)) AS allocated, SUM(ibp.data_size) AS data, COUNT(ibp.page_number) AS pages, - COUNT(IF(ibp.is_hashed = 'YES', 1, 0)) AS pages_hashed, - COUNT(IF(ibp.is_old = 'YES', 1, 0)) AS pages_old, + SUM(IF(ibp.is_hashed = 'YES', 1, 0)) AS pages_hashed, + SUM(IF(ibp.is_old = 'YES', 1, 0)) AS pages_old, ROUND(IFNULL(SUM(ibp.number_records)/NULLIF(COUNT(DISTINCT ibp.index_name), 0), 0)) AS rows_cached FROM information_schema.innodb_buffer_page ibp WHERE table_name IS NOT NULL