From eac8d74b632de0743dec7a82faeb0dc7fd46fca7 Mon Sep 17 00:00:00 2001 From: yoku0825 Date: Wed, 23 Mar 2016 17:50:06 +0900 Subject: [PATCH] Fix Bug#80833 [MySQL Bugs: #80833: Incorrect calculation for pages_hashed, pages_old](http://bugs.mysql.com/bug.php?id=80833) --- views/i_s/innodb_buffer_stats_by_schema.sql | 4 ++-- views/i_s/innodb_buffer_stats_by_table.sql | 4 ++-- views/i_s/x_innodb_buffer_stats_by_schema.sql | 4 ++-- views/i_s/x_innodb_buffer_stats_by_table.sql | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) 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