From 94033fcf83733d773d806103b138f94f3deb93e0 Mon Sep 17 00:00:00 2001 From: Monty Date: Sun, 31 Dec 2023 16:32:16 +0200 Subject: [PATCH] MDEV-33151 Add more columns to TABLE_STATISTICS and USER STATS Columns added to TABLE_STATISTICS - ROWS_INSERTED, ROWS_DELETED, ROWS_UPDATED, KEY_READ_HITS and KEY_READ_MISSES. Columns added to CLIENT_STATISTICS and USER_STATISTICS: - KEY_READ_HITS and KEY_READ_MISSES. User visible changes (except new columns): - CLIENT_STATISTICS and USER_STATISTICS has columns KEY_READ_HITS and KEY_READ_MISSES added after column ROWS_UPDATED before SELECT_COMMANDS. Other changes: - Do not collect table statistics for system tables like index_stats table_stats, performance_schema, information_schema etc as the user has no control of these and the generate noice in the statistics. - All row variables that are part of user_stats are moved to 'struct rows_stats' to make it easy to clear all of them at once. - ha_read_key_misses added to STATUS_VAR Notes: - userstat.result has a change of numbers of rows for handler_read_key. This is because use-stat-tables is now disabled for the test. --- .../main/information_schema_stats.result | 29 ++++++--- mysql-test/main/information_schema_stats.test | 5 ++ mysql-test/main/lowercase_table5.result | 6 +- mysql-test/main/sp.result | 2 +- mysql-test/main/subselect.result | 7 ++- .../main/subselect_no_exists_to_in.result | 7 ++- mysql-test/main/subselect_no_mat.result | 7 ++- mysql-test/main/subselect_no_opts.result | 7 ++- mysql-test/main/subselect_no_scache.result | 7 ++- mysql-test/main/subselect_no_semijoin.result | 7 ++- mysql-test/main/userstat.opt | 2 +- mysql-test/main/userstat.result | 19 ++++-- .../suite/funcs_1/r/is_columns_is.result | 62 ++++++++++++------- .../funcs_1/r/is_columns_is_embedded.result | 62 ++++++++++++------- .../innodb/r/table_index_statistics.result | 4 +- plugin/userstat/client_stats.cc | 12 ++-- plugin/userstat/table_stats.cc | 19 +++++- plugin/userstat/user_stats.cc | 2 + sql/ha_sequence.cc | 2 +- sql/handler.cc | 53 +++++++++++----- sql/handler.h | 10 ++- sql/sql_class.h | 1 + sql/sql_connect.cc | 42 +++++++------ sql/structs.h | 23 ++++++- .../mysql-test/rocksdb/r/table_stats.result | 5 ++ 25 files changed, 265 insertions(+), 137 deletions(-) diff --git a/mysql-test/main/information_schema_stats.result b/mysql-test/main/information_schema_stats.result index dae6b8c8972..5688b059538 100644 --- a/mysql-test/main/information_schema_stats.result +++ b/mysql-test/main/information_schema_stats.result @@ -20,26 +20,35 @@ TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ QUERIES test just_a_test IND_just_a_test_first_name_last_name 1 1 test just_a_test IND_just_a_test_state 2 1 select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test'; -TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES -test just_a_test 18 5 5 +TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES ROWS_INSERTED ROWS_UPDATED ROWS_DELETED KEY_READ_HITS KEY_READ_MISSES +test just_a_test 18 5 5 5 0 0 2 0 alter table just_a_test drop key IND_just_a_test_first_name_last_name; select * from information_schema.index_statistics where table_schema='test' and table_name='just_a_test'; TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ QUERIES test just_a_test IND_just_a_test_state 2 1 select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test'; -TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES -test just_a_test 23 5 5 +TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES ROWS_INSERTED ROWS_UPDATED ROWS_DELETED KEY_READ_HITS KEY_READ_MISSES +test just_a_test 23 5 5 5 0 0 2 0 alter table just_a_test drop column state; select * from information_schema.index_statistics where table_schema='test' and table_name='just_a_test'; TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ QUERIES +select * from just_a_test force index(primary) where id between 1 and 2; +id first_name last_name address phone email +1 fa la china_a 11111111 fa_la@163.com +2 fb lb china_b 22222222 fb_lb@163.com +select * from just_a_test force index(primary) where id=8; +id first_name last_name address phone email +update just_a_test set first_name="unlucky" where id=5; +delete from just_a_test where id=5; select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test'; -TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES -test just_a_test 28 5 5 +TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES ROWS_INSERTED ROWS_UPDATED ROWS_DELETED KEY_READ_HITS KEY_READ_MISSES +test just_a_test 32 7 7 5 1 1 5 1 select * from information_schema.index_statistics where table_schema='test' and table_name='just_a_test'; TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ QUERIES +test just_a_test PRIMARY 4 3 drop table just_a_test; select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test'; -TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES +TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES ROWS_INSERTED ROWS_UPDATED ROWS_DELETED KEY_READ_HITS KEY_READ_MISSES select * from information_schema.index_statistics where table_schema='test' and table_name='just_a_test'; TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ QUERIES create table just_a_test(id int not null primary key,first_name varchar(10),last_name varchar(10),address varchar(100),phone bigint,email varchar(30), state varchar(30),key(first_name,last_name),key(state)); @@ -63,11 +72,11 @@ test just_a_test PRIMARY 4 1 test just_a_test first_name 1 1 test just_a_test state 2 1 select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test'; -TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES -test just_a_test 7 5 15 +TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES ROWS_INSERTED ROWS_UPDATED ROWS_DELETED KEY_READ_HITS KEY_READ_MISSES +test just_a_test 7 5 15 5 0 0 3 0 drop table just_a_test; select * from information_schema.index_statistics where table_schema='test' and table_name='just_a_test'; TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ QUERIES select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test'; -TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES +TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES ROWS_INSERTED ROWS_UPDATED ROWS_DELETED KEY_READ_HITS KEY_READ_MISSES set global userstat=@save_userstat; diff --git a/mysql-test/main/information_schema_stats.test b/mysql-test/main/information_schema_stats.test index 5e6a949d98d..5c08717d753 100644 --- a/mysql-test/main/information_schema_stats.test +++ b/mysql-test/main/information_schema_stats.test @@ -10,6 +10,7 @@ insert into just_a_test values(1,'fa','la','china_a',11111111,'fa_la@163.com','C (3,'fc','lc','china_c',33333333,'fc_lc@163.com','California'), (4,'fd','ld','china_d',44444444,'fd_ld@163.com','Utah'), (5,'fe','le','china_e',55555555,'fe_le@163.com','Arizona'); + alter table just_a_test add primary key (id); alter table just_a_test add key IND_just_a_test_first_name_last_name(first_name,last_name); alter table just_a_test add key IND_just_a_test_state(state); @@ -23,6 +24,10 @@ select * from information_schema.index_statistics where table_schema='test' and select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test'; alter table just_a_test drop column state; select * from information_schema.index_statistics where table_schema='test' and table_name='just_a_test'; +select * from just_a_test force index(primary) where id between 1 and 2; +select * from just_a_test force index(primary) where id=8; +update just_a_test set first_name="unlucky" where id=5; +delete from just_a_test where id=5; select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test'; select * from information_schema.index_statistics where table_schema='test' and table_name='just_a_test'; drop table just_a_test; diff --git a/mysql-test/main/lowercase_table5.result b/mysql-test/main/lowercase_table5.result index c4193a8d822..6eb80e21800 100644 --- a/mysql-test/main/lowercase_table5.result +++ b/mysql-test/main/lowercase_table5.result @@ -126,9 +126,9 @@ a 3 4 SELECT * FROM INFORMATION_SCHEMA.TABLE_STATISTICS ORDER BY BINARY TABLE_NAME; -TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES -test T1 4 4 4 -test t1 4 4 4 +TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES ROWS_INSERTED ROWS_UPDATED ROWS_DELETED KEY_READ_HITS KEY_READ_MISSES +test T1 4 4 4 4 0 0 0 0 +test t1 4 4 4 4 0 0 0 0 SELECT * FROM INFORMATION_SCHEMA.INDEX_STATISTICS ORDER BY BINARY TABLE_NAME; TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ QUERIES test T1 a 4 1 diff --git a/mysql-test/main/sp.result b/mysql-test/main/sp.result index 60bd5d9135f..40d3743a054 100644 --- a/mysql-test/main/sp.result +++ b/mysql-test/main/sp.result @@ -7629,7 +7629,7 @@ SELECT 1; DROP PROCEDURE sp; CREATE PROCEDURE sp() SET STATEMENT SQL_SELECT_LIMIT=0 FOR SHOW USER_STATISTICS; CALL sp; -User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_read Rows_sent Rows_deleted Rows_inserted Rows_updated Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries Total_ssl_connections Max_statement_time_exceeded +User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_read Rows_sent Rows_deleted Rows_inserted Rows_updated Key_read_hits Key_read_misses Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries Total_ssl_connections Max_statement_time_exceeded SELECT 1; 1 1 diff --git a/mysql-test/main/subselect.result b/mysql-test/main/subselect.result index 5e1a2563f29..7cfdcc850db 100644 --- a/mysql-test/main/subselect.result +++ b/mysql-test/main/subselect.result @@ -7126,9 +7126,10 @@ MIN(b) NULL # The following shows that t2 was indeed scanned with a full scan. show table_statistics; -Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes -test t1 2 0 0 -test t2 3 0 0 +Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes Rows_inserted Rows_updated Rows_deleted Key_read_hits Key_read_misses +test t1 2 0 0 0 0 0 0 0 +test t2 3 0 0 0 0 0 1 0 +test t3 0 0 0 0 0 0 0 1 show index_statistics; Table_schema Table_name Index_name Rows_read Queries test t2 b 1 1 diff --git a/mysql-test/main/subselect_no_exists_to_in.result b/mysql-test/main/subselect_no_exists_to_in.result index ea44b162cd8..1c800789b58 100644 --- a/mysql-test/main/subselect_no_exists_to_in.result +++ b/mysql-test/main/subselect_no_exists_to_in.result @@ -7128,9 +7128,10 @@ MIN(b) NULL # The following shows that t2 was indeed scanned with a full scan. show table_statistics; -Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes -test t1 2 0 0 -test t2 3 0 0 +Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes Rows_inserted Rows_updated Rows_deleted Key_read_hits Key_read_misses +test t1 2 0 0 0 0 0 0 0 +test t2 3 0 0 0 0 0 1 0 +test t3 0 0 0 0 0 0 0 1 show index_statistics; Table_schema Table_name Index_name Rows_read Queries test t2 b 1 1 diff --git a/mysql-test/main/subselect_no_mat.result b/mysql-test/main/subselect_no_mat.result index 5f58069a75c..c9315f92e53 100644 --- a/mysql-test/main/subselect_no_mat.result +++ b/mysql-test/main/subselect_no_mat.result @@ -7124,9 +7124,10 @@ MIN(b) NULL # The following shows that t2 was indeed scanned with a full scan. show table_statistics; -Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes -test t1 2 0 0 -test t2 3 0 0 +Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes Rows_inserted Rows_updated Rows_deleted Key_read_hits Key_read_misses +test t1 2 0 0 0 0 0 0 0 +test t2 3 0 0 0 0 0 1 0 +test t3 0 0 0 0 0 0 0 1 show index_statistics; Table_schema Table_name Index_name Rows_read Queries test t2 b 1 1 diff --git a/mysql-test/main/subselect_no_opts.result b/mysql-test/main/subselect_no_opts.result index 887432b1292..10233eef292 100644 --- a/mysql-test/main/subselect_no_opts.result +++ b/mysql-test/main/subselect_no_opts.result @@ -7121,9 +7121,10 @@ MIN(b) NULL # The following shows that t2 was indeed scanned with a full scan. show table_statistics; -Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes -test t1 2 0 0 -test t2 3 0 0 +Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes Rows_inserted Rows_updated Rows_deleted Key_read_hits Key_read_misses +test t1 2 0 0 0 0 0 0 0 +test t2 3 0 0 0 0 0 1 0 +test t3 0 0 0 0 0 0 0 1 show index_statistics; Table_schema Table_name Index_name Rows_read Queries test t2 b 1 1 diff --git a/mysql-test/main/subselect_no_scache.result b/mysql-test/main/subselect_no_scache.result index d4b3917aeb5..0fd4c374282 100644 --- a/mysql-test/main/subselect_no_scache.result +++ b/mysql-test/main/subselect_no_scache.result @@ -7132,9 +7132,10 @@ MIN(b) NULL # The following shows that t2 was indeed scanned with a full scan. show table_statistics; -Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes -test t1 2 0 0 -test t2 3 0 0 +Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes Rows_inserted Rows_updated Rows_deleted Key_read_hits Key_read_misses +test t1 2 0 0 0 0 0 0 0 +test t2 3 0 0 0 0 0 1 0 +test t3 0 0 0 0 0 0 0 1 show index_statistics; Table_schema Table_name Index_name Rows_read Queries test t2 b 1 1 diff --git a/mysql-test/main/subselect_no_semijoin.result b/mysql-test/main/subselect_no_semijoin.result index ba8c94afa67..36fb3d43c8c 100644 --- a/mysql-test/main/subselect_no_semijoin.result +++ b/mysql-test/main/subselect_no_semijoin.result @@ -7121,9 +7121,10 @@ MIN(b) NULL # The following shows that t2 was indeed scanned with a full scan. show table_statistics; -Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes -test t1 2 0 0 -test t2 3 0 0 +Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes Rows_inserted Rows_updated Rows_deleted Key_read_hits Key_read_misses +test t1 2 0 0 0 0 0 0 0 +test t2 3 0 0 0 0 0 1 0 +test t3 0 0 0 0 0 0 0 1 show index_statistics; Table_schema Table_name Index_name Rows_read Queries test t2 b 1 1 diff --git a/mysql-test/main/userstat.opt b/mysql-test/main/userstat.opt index 45c618ea22e..09cb4742c95 100644 --- a/mysql-test/main/userstat.opt +++ b/mysql-test/main/userstat.opt @@ -1 +1 @@ ---disable-userstat +--disable-userstat --use-stat-tables=never diff --git a/mysql-test/main/userstat.result b/mysql-test/main/userstat.result index 3563863aafe..318eb9fb5a3 100644 --- a/mysql-test/main/userstat.result +++ b/mysql-test/main/userstat.result @@ -15,6 +15,8 @@ ROWS_SENT bigint(21) NO NULL ROWS_DELETED bigint(21) NO NULL ROWS_INSERTED bigint(21) NO NULL ROWS_UPDATED bigint(21) NO NULL +KEY_READ_HITS bigint(21) NO NULL +KEY_READ_MISSES bigint(21) NO NULL SELECT_COMMANDS bigint(21) NO NULL UPDATE_COMMANDS bigint(21) NO NULL OTHER_COMMANDS bigint(21) NO NULL @@ -42,6 +44,8 @@ ROWS_SENT bigint(21) NO NULL ROWS_DELETED bigint(21) NO NULL ROWS_INSERTED bigint(21) NO NULL ROWS_UPDATED bigint(21) NO NULL +KEY_READ_HITS bigint(21) NO NULL +KEY_READ_MISSES bigint(21) NO NULL SELECT_COMMANDS bigint(21) NO NULL UPDATE_COMMANDS bigint(21) NO NULL OTHER_COMMANDS bigint(21) NO NULL @@ -67,6 +71,11 @@ TABLE_NAME varchar(192) NO NULL ROWS_READ bigint(21) NO NULL ROWS_CHANGED bigint(21) NO NULL ROWS_CHANGED_X_INDEXES bigint(21) NO NULL +ROWS_INSERTED bigint(21) NO NULL +ROWS_UPDATED bigint(21) NO NULL +ROWS_DELETED bigint(21) NO NULL +KEY_READ_HITS bigint(21) NO NULL +KEY_READ_MISSES bigint(21) NO NULL set @save_general_log=@@global.general_log; set @@global.general_log=0; set @@global.userstat=1; @@ -117,7 +126,7 @@ Handler_mrr_key_refills 0 Handler_mrr_rowid_refills 0 Handler_prepare 18 Handler_read_first 0 -Handler_read_key 17 +Handler_read_key 9 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 @@ -135,15 +144,15 @@ Handler_update 5 Handler_write 7 select variable_value - @global_read_key as "handler_read_key" from information_schema.global_status where variable_name="handler_read_key"; handler_read_key -17 +9 disconnect ssl_con; set @@global.userstat=0; select * from information_schema.index_statistics; TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ QUERIES select * from information_schema.table_statistics; -TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES +TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES ROWS_INSERTED ROWS_UPDATED ROWS_DELETED KEY_READ_HITS KEY_READ_MISSES show table_statistics; -Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes +Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes Rows_inserted Rows_updated Rows_deleted Key_read_hits Key_read_misses show index_statistics; Table_schema Table_name Index_name Rows_read Queries select TOTAL_CONNECTIONS, TOTAL_SSL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.client_statistics;; @@ -191,7 +200,7 @@ flush index_statistics; select * from information_schema.index_statistics; TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ QUERIES select * from information_schema.table_statistics; -TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES +TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES ROWS_INSERTED ROWS_UPDATED ROWS_DELETED KEY_READ_HITS KEY_READ_MISSES show status like "%generic%"; Variable_name Value Com_show_generic 2 diff --git a/mysql-test/suite/funcs_1/r/is_columns_is.result b/mysql-test/suite/funcs_1/r/is_columns_is.result index 508df6a839a..bd1f73e06cc 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_is.result +++ b/mysql-test/suite/funcs_1/r/is_columns_is.result @@ -30,31 +30,33 @@ def information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME 4 NULL NO varchar 64 19 def information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL NO NO def information_schema CHECK_CONSTRAINTS LEVEL 5 NULL NO varchar 6 18 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(6) select NEVER NULL NO NO def information_schema CHECK_CONSTRAINTS TABLE_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL NO NO -def information_schema CLIENT_STATISTICS ACCESS_DENIED 22 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO +def information_schema CLIENT_STATISTICS ACCESS_DENIED 24 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO def information_schema CLIENT_STATISTICS BINLOG_BYTES_WRITTEN 9 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO def information_schema CLIENT_STATISTICS BUSY_TIME 5 NULL NO double NULL NULL 21 NULL NULL NULL NULL double select NEVER NULL NO NO def information_schema CLIENT_STATISTICS BYTES_RECEIVED 7 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO def information_schema CLIENT_STATISTICS BYTES_SENT 8 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO def information_schema CLIENT_STATISTICS CLIENT 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL NO NO -def information_schema CLIENT_STATISTICS COMMIT_TRANSACTIONS 18 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO +def information_schema CLIENT_STATISTICS COMMIT_TRANSACTIONS 20 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO def information_schema CLIENT_STATISTICS CONCURRENT_CONNECTIONS 3 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO def information_schema CLIENT_STATISTICS CONNECTED_TIME 4 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO def information_schema CLIENT_STATISTICS CPU_TIME 6 NULL NO double NULL NULL 21 NULL NULL NULL NULL double select NEVER NULL NO NO -def information_schema CLIENT_STATISTICS DENIED_CONNECTIONS 20 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO -def information_schema CLIENT_STATISTICS EMPTY_QUERIES 23 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO -def information_schema CLIENT_STATISTICS LOST_CONNECTIONS 21 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO -def information_schema CLIENT_STATISTICS MAX_STATEMENT_TIME_EXCEEDED 25 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO -def information_schema CLIENT_STATISTICS OTHER_COMMANDS 17 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO -def information_schema CLIENT_STATISTICS ROLLBACK_TRANSACTIONS 19 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO +def information_schema CLIENT_STATISTICS DENIED_CONNECTIONS 22 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO +def information_schema CLIENT_STATISTICS EMPTY_QUERIES 25 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO +def information_schema CLIENT_STATISTICS KEY_READ_HITS 15 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO +def information_schema CLIENT_STATISTICS KEY_READ_MISSES 16 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO +def information_schema CLIENT_STATISTICS LOST_CONNECTIONS 23 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO +def information_schema CLIENT_STATISTICS MAX_STATEMENT_TIME_EXCEEDED 27 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO +def information_schema CLIENT_STATISTICS OTHER_COMMANDS 19 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO +def information_schema CLIENT_STATISTICS ROLLBACK_TRANSACTIONS 21 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO def information_schema CLIENT_STATISTICS ROWS_DELETED 12 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO def information_schema CLIENT_STATISTICS ROWS_INSERTED 13 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO def information_schema CLIENT_STATISTICS ROWS_READ 10 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO def information_schema CLIENT_STATISTICS ROWS_SENT 11 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO def information_schema CLIENT_STATISTICS ROWS_UPDATED 14 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO -def information_schema CLIENT_STATISTICS SELECT_COMMANDS 15 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO +def information_schema CLIENT_STATISTICS SELECT_COMMANDS 17 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO def information_schema CLIENT_STATISTICS TOTAL_CONNECTIONS 2 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO -def information_schema CLIENT_STATISTICS TOTAL_SSL_CONNECTIONS 24 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL NO NO -def information_schema CLIENT_STATISTICS UPDATE_COMMANDS 16 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO +def information_schema CLIENT_STATISTICS TOTAL_SSL_CONNECTIONS 26 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL NO NO +def information_schema CLIENT_STATISTICS UPDATE_COMMANDS 18 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO def information_schema COLLATIONS CHARACTER_SET_NAME 2 NULL YES varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL NO NO def information_schema COLLATIONS COLLATION_NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL NO NO def information_schema COLLATIONS ID 3 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(11) select NEVER NULL NO NO @@ -467,9 +469,14 @@ def information_schema TABLE_PRIVILEGES PRIVILEGE_TYPE 5 NULL NO varchar 64 192 def information_schema TABLE_PRIVILEGES TABLE_CATALOG 2 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL NO NO def information_schema TABLE_PRIVILEGES TABLE_NAME 4 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL NO NO def information_schema TABLE_PRIVILEGES TABLE_SCHEMA 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL NO NO +def information_schema TABLE_STATISTICS KEY_READ_HITS 9 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO +def information_schema TABLE_STATISTICS KEY_READ_MISSES 10 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO def information_schema TABLE_STATISTICS ROWS_CHANGED 4 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO def information_schema TABLE_STATISTICS ROWS_CHANGED_X_INDEXES 5 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO +def information_schema TABLE_STATISTICS ROWS_DELETED 8 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO +def information_schema TABLE_STATISTICS ROWS_INSERTED 6 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO def information_schema TABLE_STATISTICS ROWS_READ 3 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO +def information_schema TABLE_STATISTICS ROWS_UPDATED 7 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO def information_schema TABLE_STATISTICS TABLE_NAME 2 NULL NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) select NEVER NULL NO NO def information_schema TABLE_STATISTICS TABLE_SCHEMA 1 NULL NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) select NEVER NULL NO NO def information_schema TRIGGERS ACTION_CONDITION 9 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext select NEVER NULL NO NO @@ -498,30 +505,32 @@ def information_schema USER_PRIVILEGES GRANTEE 1 NULL NO varchar 385 1155 NULL N def information_schema USER_PRIVILEGES IS_GRANTABLE 4 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL NO NO def information_schema USER_PRIVILEGES PRIVILEGE_TYPE 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL NO NO def information_schema USER_PRIVILEGES TABLE_CATALOG 2 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL NO NO -def information_schema USER_STATISTICS ACCESS_DENIED 22 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO +def information_schema USER_STATISTICS ACCESS_DENIED 24 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO def information_schema USER_STATISTICS BINLOG_BYTES_WRITTEN 9 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO def information_schema USER_STATISTICS BUSY_TIME 5 NULL NO double NULL NULL 21 NULL NULL NULL NULL double select NEVER NULL NO NO def information_schema USER_STATISTICS BYTES_RECEIVED 7 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO def information_schema USER_STATISTICS BYTES_SENT 8 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO -def information_schema USER_STATISTICS COMMIT_TRANSACTIONS 18 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO +def information_schema USER_STATISTICS COMMIT_TRANSACTIONS 20 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO def information_schema USER_STATISTICS CONCURRENT_CONNECTIONS 3 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) select NEVER NULL NO NO def information_schema USER_STATISTICS CONNECTED_TIME 4 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) select NEVER NULL NO NO def information_schema USER_STATISTICS CPU_TIME 6 NULL NO double NULL NULL 21 NULL NULL NULL NULL double select NEVER NULL NO NO -def information_schema USER_STATISTICS DENIED_CONNECTIONS 20 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO -def information_schema USER_STATISTICS EMPTY_QUERIES 23 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO -def information_schema USER_STATISTICS LOST_CONNECTIONS 21 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO -def information_schema USER_STATISTICS MAX_STATEMENT_TIME_EXCEEDED 25 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO -def information_schema USER_STATISTICS OTHER_COMMANDS 17 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO -def information_schema USER_STATISTICS ROLLBACK_TRANSACTIONS 19 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO +def information_schema USER_STATISTICS DENIED_CONNECTIONS 22 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO +def information_schema USER_STATISTICS EMPTY_QUERIES 25 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO +def information_schema USER_STATISTICS KEY_READ_HITS 15 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO +def information_schema USER_STATISTICS KEY_READ_MISSES 16 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO +def information_schema USER_STATISTICS LOST_CONNECTIONS 23 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO +def information_schema USER_STATISTICS MAX_STATEMENT_TIME_EXCEEDED 27 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO +def information_schema USER_STATISTICS OTHER_COMMANDS 19 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO +def information_schema USER_STATISTICS ROLLBACK_TRANSACTIONS 21 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO def information_schema USER_STATISTICS ROWS_DELETED 12 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO def information_schema USER_STATISTICS ROWS_INSERTED 13 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO def information_schema USER_STATISTICS ROWS_READ 10 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO def information_schema USER_STATISTICS ROWS_SENT 11 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO def information_schema USER_STATISTICS ROWS_UPDATED 14 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO -def information_schema USER_STATISTICS SELECT_COMMANDS 15 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO +def information_schema USER_STATISTICS SELECT_COMMANDS 17 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO def information_schema USER_STATISTICS TOTAL_CONNECTIONS 2 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) select NEVER NULL NO NO -def information_schema USER_STATISTICS TOTAL_SSL_CONNECTIONS 24 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL NO NO -def information_schema USER_STATISTICS UPDATE_COMMANDS 16 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO +def information_schema USER_STATISTICS TOTAL_SSL_CONNECTIONS 26 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL NO NO +def information_schema USER_STATISTICS UPDATE_COMMANDS 18 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL NO NO def information_schema USER_STATISTICS USER 1 NULL NO varchar 128 384 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(128) select NEVER NULL NO NO def information_schema VIEWS ALGORITHM 11 NULL NO varchar 10 30 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(10) select NEVER NULL NO NO def information_schema VIEWS CHARACTER_SET_CLIENT 9 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL NO NO @@ -638,6 +647,8 @@ NULL information_schema CLIENT_STATISTICS ROWS_SENT bigint NULL NULL NULL NULL b NULL information_schema CLIENT_STATISTICS ROWS_DELETED bigint NULL NULL NULL NULL bigint(21) NULL information_schema CLIENT_STATISTICS ROWS_INSERTED bigint NULL NULL NULL NULL bigint(21) NULL information_schema CLIENT_STATISTICS ROWS_UPDATED bigint NULL NULL NULL NULL bigint(21) +NULL information_schema CLIENT_STATISTICS KEY_READ_HITS bigint NULL NULL NULL NULL bigint(21) +NULL information_schema CLIENT_STATISTICS KEY_READ_MISSES bigint NULL NULL NULL NULL bigint(21) NULL information_schema CLIENT_STATISTICS SELECT_COMMANDS bigint NULL NULL NULL NULL bigint(21) NULL information_schema CLIENT_STATISTICS UPDATE_COMMANDS bigint NULL NULL NULL NULL bigint(21) NULL information_schema CLIENT_STATISTICS OTHER_COMMANDS bigint NULL NULL NULL NULL bigint(21) @@ -1066,6 +1077,11 @@ NULL information_schema TABLESPACES NODEGROUP_ID bigint NULL NULL NULL NULL bigi NULL information_schema TABLE_STATISTICS ROWS_READ bigint NULL NULL NULL NULL bigint(21) NULL information_schema TABLE_STATISTICS ROWS_CHANGED bigint NULL NULL NULL NULL bigint(21) NULL information_schema TABLE_STATISTICS ROWS_CHANGED_X_INDEXES bigint NULL NULL NULL NULL bigint(21) +NULL information_schema TABLE_STATISTICS ROWS_INSERTED bigint NULL NULL NULL NULL bigint(21) +NULL information_schema TABLE_STATISTICS ROWS_UPDATED bigint NULL NULL NULL NULL bigint(21) +NULL information_schema TABLE_STATISTICS ROWS_DELETED bigint NULL NULL NULL NULL bigint(21) +NULL information_schema TABLE_STATISTICS KEY_READ_HITS bigint NULL NULL NULL NULL bigint(21) +NULL information_schema TABLE_STATISTICS KEY_READ_MISSES bigint NULL NULL NULL NULL bigint(21) 3.0000 information_schema TRIGGERS TRIGGER_CATALOG varchar 512 1536 utf8mb3 utf8mb3_general_ci varchar(512) 3.0000 information_schema TRIGGERS TRIGGER_SCHEMA varchar 64 192 utf8mb3 utf8mb3_general_ci varchar(64) 3.0000 information_schema TRIGGERS TRIGGER_NAME varchar 64 192 utf8mb3 utf8mb3_general_ci varchar(64) @@ -1106,6 +1122,8 @@ NULL information_schema USER_STATISTICS ROWS_SENT bigint NULL NULL NULL NULL big NULL information_schema USER_STATISTICS ROWS_DELETED bigint NULL NULL NULL NULL bigint(21) NULL information_schema USER_STATISTICS ROWS_INSERTED bigint NULL NULL NULL NULL bigint(21) NULL information_schema USER_STATISTICS ROWS_UPDATED bigint NULL NULL NULL NULL bigint(21) +NULL information_schema USER_STATISTICS KEY_READ_HITS bigint NULL NULL NULL NULL bigint(21) +NULL information_schema USER_STATISTICS KEY_READ_MISSES bigint NULL NULL NULL NULL bigint(21) NULL information_schema USER_STATISTICS SELECT_COMMANDS bigint NULL NULL NULL NULL bigint(21) NULL information_schema USER_STATISTICS UPDATE_COMMANDS bigint NULL NULL NULL NULL bigint(21) NULL information_schema USER_STATISTICS OTHER_COMMANDS bigint NULL NULL NULL NULL bigint(21) diff --git a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result index 293068718ea..d8926710645 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result @@ -30,31 +30,33 @@ def information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME 4 NULL NO varchar 64 19 def information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL NO NO def information_schema CHECK_CONSTRAINTS LEVEL 5 NULL NO varchar 6 18 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(6) NEVER NULL NO NO def information_schema CHECK_CONSTRAINTS TABLE_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL NO NO -def information_schema CLIENT_STATISTICS ACCESS_DENIED 22 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO +def information_schema CLIENT_STATISTICS ACCESS_DENIED 24 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO def information_schema CLIENT_STATISTICS BINLOG_BYTES_WRITTEN 9 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO def information_schema CLIENT_STATISTICS BUSY_TIME 5 NULL NO double NULL NULL 21 NULL NULL NULL NULL double NEVER NULL NO NO def information_schema CLIENT_STATISTICS BYTES_RECEIVED 7 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO def information_schema CLIENT_STATISTICS BYTES_SENT 8 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO def information_schema CLIENT_STATISTICS CLIENT 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL NO NO -def information_schema CLIENT_STATISTICS COMMIT_TRANSACTIONS 18 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO +def information_schema CLIENT_STATISTICS COMMIT_TRANSACTIONS 20 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO def information_schema CLIENT_STATISTICS CONCURRENT_CONNECTIONS 3 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO def information_schema CLIENT_STATISTICS CONNECTED_TIME 4 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO def information_schema CLIENT_STATISTICS CPU_TIME 6 NULL NO double NULL NULL 21 NULL NULL NULL NULL double NEVER NULL NO NO -def information_schema CLIENT_STATISTICS DENIED_CONNECTIONS 20 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO -def information_schema CLIENT_STATISTICS EMPTY_QUERIES 23 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO -def information_schema CLIENT_STATISTICS LOST_CONNECTIONS 21 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO -def information_schema CLIENT_STATISTICS MAX_STATEMENT_TIME_EXCEEDED 25 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO -def information_schema CLIENT_STATISTICS OTHER_COMMANDS 17 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO -def information_schema CLIENT_STATISTICS ROLLBACK_TRANSACTIONS 19 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO +def information_schema CLIENT_STATISTICS DENIED_CONNECTIONS 22 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO +def information_schema CLIENT_STATISTICS EMPTY_QUERIES 25 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO +def information_schema CLIENT_STATISTICS KEY_READ_HITS 15 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO +def information_schema CLIENT_STATISTICS KEY_READ_MISSES 16 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO +def information_schema CLIENT_STATISTICS LOST_CONNECTIONS 23 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO +def information_schema CLIENT_STATISTICS MAX_STATEMENT_TIME_EXCEEDED 27 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO +def information_schema CLIENT_STATISTICS OTHER_COMMANDS 19 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO +def information_schema CLIENT_STATISTICS ROLLBACK_TRANSACTIONS 21 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO def information_schema CLIENT_STATISTICS ROWS_DELETED 12 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO def information_schema CLIENT_STATISTICS ROWS_INSERTED 13 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO def information_schema CLIENT_STATISTICS ROWS_READ 10 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO def information_schema CLIENT_STATISTICS ROWS_SENT 11 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO def information_schema CLIENT_STATISTICS ROWS_UPDATED 14 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO -def information_schema CLIENT_STATISTICS SELECT_COMMANDS 15 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO +def information_schema CLIENT_STATISTICS SELECT_COMMANDS 17 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO def information_schema CLIENT_STATISTICS TOTAL_CONNECTIONS 2 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO -def information_schema CLIENT_STATISTICS TOTAL_SSL_CONNECTIONS 24 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL NO NO -def information_schema CLIENT_STATISTICS UPDATE_COMMANDS 16 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO +def information_schema CLIENT_STATISTICS TOTAL_SSL_CONNECTIONS 26 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL NO NO +def information_schema CLIENT_STATISTICS UPDATE_COMMANDS 18 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO def information_schema COLLATIONS CHARACTER_SET_NAME 2 NULL YES varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL NO NO def information_schema COLLATIONS COLLATION_NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL NO NO def information_schema COLLATIONS ID 3 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(11) NEVER NULL NO NO @@ -467,9 +469,14 @@ def information_schema TABLE_PRIVILEGES PRIVILEGE_TYPE 5 NULL NO varchar 64 192 def information_schema TABLE_PRIVILEGES TABLE_CATALOG 2 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL NO NO def information_schema TABLE_PRIVILEGES TABLE_NAME 4 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL NO NO def information_schema TABLE_PRIVILEGES TABLE_SCHEMA 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL NO NO +def information_schema TABLE_STATISTICS KEY_READ_HITS 9 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO +def information_schema TABLE_STATISTICS KEY_READ_MISSES 10 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO def information_schema TABLE_STATISTICS ROWS_CHANGED 4 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO def information_schema TABLE_STATISTICS ROWS_CHANGED_X_INDEXES 5 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO +def information_schema TABLE_STATISTICS ROWS_DELETED 8 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO +def information_schema TABLE_STATISTICS ROWS_INSERTED 6 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO def information_schema TABLE_STATISTICS ROWS_READ 3 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO +def information_schema TABLE_STATISTICS ROWS_UPDATED 7 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO def information_schema TABLE_STATISTICS TABLE_NAME 2 NULL NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) NEVER NULL NO NO def information_schema TABLE_STATISTICS TABLE_SCHEMA 1 NULL NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) NEVER NULL NO NO def information_schema TRIGGERS ACTION_CONDITION 9 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext NEVER NULL NO NO @@ -498,30 +505,32 @@ def information_schema USER_PRIVILEGES GRANTEE 1 NULL NO varchar 385 1155 NULL N def information_schema USER_PRIVILEGES IS_GRANTABLE 4 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL NO NO def information_schema USER_PRIVILEGES PRIVILEGE_TYPE 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL NO NO def information_schema USER_PRIVILEGES TABLE_CATALOG 2 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL NO NO -def information_schema USER_STATISTICS ACCESS_DENIED 22 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO +def information_schema USER_STATISTICS ACCESS_DENIED 24 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO def information_schema USER_STATISTICS BINLOG_BYTES_WRITTEN 9 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO def information_schema USER_STATISTICS BUSY_TIME 5 NULL NO double NULL NULL 21 NULL NULL NULL NULL double NEVER NULL NO NO def information_schema USER_STATISTICS BYTES_RECEIVED 7 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO def information_schema USER_STATISTICS BYTES_SENT 8 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO -def information_schema USER_STATISTICS COMMIT_TRANSACTIONS 18 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO +def information_schema USER_STATISTICS COMMIT_TRANSACTIONS 20 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO def information_schema USER_STATISTICS CONCURRENT_CONNECTIONS 3 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) NEVER NULL NO NO def information_schema USER_STATISTICS CONNECTED_TIME 4 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) NEVER NULL NO NO def information_schema USER_STATISTICS CPU_TIME 6 NULL NO double NULL NULL 21 NULL NULL NULL NULL double NEVER NULL NO NO -def information_schema USER_STATISTICS DENIED_CONNECTIONS 20 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO -def information_schema USER_STATISTICS EMPTY_QUERIES 23 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO -def information_schema USER_STATISTICS LOST_CONNECTIONS 21 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO -def information_schema USER_STATISTICS MAX_STATEMENT_TIME_EXCEEDED 25 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO -def information_schema USER_STATISTICS OTHER_COMMANDS 17 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO -def information_schema USER_STATISTICS ROLLBACK_TRANSACTIONS 19 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO +def information_schema USER_STATISTICS DENIED_CONNECTIONS 22 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO +def information_schema USER_STATISTICS EMPTY_QUERIES 25 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO +def information_schema USER_STATISTICS KEY_READ_HITS 15 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO +def information_schema USER_STATISTICS KEY_READ_MISSES 16 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO +def information_schema USER_STATISTICS LOST_CONNECTIONS 23 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO +def information_schema USER_STATISTICS MAX_STATEMENT_TIME_EXCEEDED 27 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO +def information_schema USER_STATISTICS OTHER_COMMANDS 19 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO +def information_schema USER_STATISTICS ROLLBACK_TRANSACTIONS 21 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO def information_schema USER_STATISTICS ROWS_DELETED 12 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO def information_schema USER_STATISTICS ROWS_INSERTED 13 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO def information_schema USER_STATISTICS ROWS_READ 10 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO def information_schema USER_STATISTICS ROWS_SENT 11 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO def information_schema USER_STATISTICS ROWS_UPDATED 14 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO -def information_schema USER_STATISTICS SELECT_COMMANDS 15 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO +def information_schema USER_STATISTICS SELECT_COMMANDS 17 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO def information_schema USER_STATISTICS TOTAL_CONNECTIONS 2 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) NEVER NULL NO NO -def information_schema USER_STATISTICS TOTAL_SSL_CONNECTIONS 24 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL NO NO -def information_schema USER_STATISTICS UPDATE_COMMANDS 16 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO +def information_schema USER_STATISTICS TOTAL_SSL_CONNECTIONS 26 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL NO NO +def information_schema USER_STATISTICS UPDATE_COMMANDS 18 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO def information_schema USER_STATISTICS USER 1 NULL NO varchar 128 384 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(128) NEVER NULL NO NO def information_schema VIEWS ALGORITHM 11 NULL NO varchar 10 30 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(10) NEVER NULL NO NO def information_schema VIEWS CHARACTER_SET_CLIENT 9 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL NO NO @@ -638,6 +647,8 @@ NULL information_schema CLIENT_STATISTICS ROWS_SENT bigint NULL NULL NULL NULL b NULL information_schema CLIENT_STATISTICS ROWS_DELETED bigint NULL NULL NULL NULL bigint(21) NULL information_schema CLIENT_STATISTICS ROWS_INSERTED bigint NULL NULL NULL NULL bigint(21) NULL information_schema CLIENT_STATISTICS ROWS_UPDATED bigint NULL NULL NULL NULL bigint(21) +NULL information_schema CLIENT_STATISTICS KEY_READ_HITS bigint NULL NULL NULL NULL bigint(21) +NULL information_schema CLIENT_STATISTICS KEY_READ_MISSES bigint NULL NULL NULL NULL bigint(21) NULL information_schema CLIENT_STATISTICS SELECT_COMMANDS bigint NULL NULL NULL NULL bigint(21) NULL information_schema CLIENT_STATISTICS UPDATE_COMMANDS bigint NULL NULL NULL NULL bigint(21) NULL information_schema CLIENT_STATISTICS OTHER_COMMANDS bigint NULL NULL NULL NULL bigint(21) @@ -1066,6 +1077,11 @@ NULL information_schema TABLESPACES NODEGROUP_ID bigint NULL NULL NULL NULL bigi NULL information_schema TABLE_STATISTICS ROWS_READ bigint NULL NULL NULL NULL bigint(21) NULL information_schema TABLE_STATISTICS ROWS_CHANGED bigint NULL NULL NULL NULL bigint(21) NULL information_schema TABLE_STATISTICS ROWS_CHANGED_X_INDEXES bigint NULL NULL NULL NULL bigint(21) +NULL information_schema TABLE_STATISTICS ROWS_INSERTED bigint NULL NULL NULL NULL bigint(21) +NULL information_schema TABLE_STATISTICS ROWS_UPDATED bigint NULL NULL NULL NULL bigint(21) +NULL information_schema TABLE_STATISTICS ROWS_DELETED bigint NULL NULL NULL NULL bigint(21) +NULL information_schema TABLE_STATISTICS KEY_READ_HITS bigint NULL NULL NULL NULL bigint(21) +NULL information_schema TABLE_STATISTICS KEY_READ_MISSES bigint NULL NULL NULL NULL bigint(21) 3.0000 information_schema TRIGGERS TRIGGER_CATALOG varchar 512 1536 utf8mb3 utf8mb3_general_ci varchar(512) 3.0000 information_schema TRIGGERS TRIGGER_SCHEMA varchar 64 192 utf8mb3 utf8mb3_general_ci varchar(64) 3.0000 information_schema TRIGGERS TRIGGER_NAME varchar 64 192 utf8mb3 utf8mb3_general_ci varchar(64) @@ -1106,6 +1122,8 @@ NULL information_schema USER_STATISTICS ROWS_SENT bigint NULL NULL NULL NULL big NULL information_schema USER_STATISTICS ROWS_DELETED bigint NULL NULL NULL NULL bigint(21) NULL information_schema USER_STATISTICS ROWS_INSERTED bigint NULL NULL NULL NULL bigint(21) NULL information_schema USER_STATISTICS ROWS_UPDATED bigint NULL NULL NULL NULL bigint(21) +NULL information_schema USER_STATISTICS KEY_READ_HITS bigint NULL NULL NULL NULL bigint(21) +NULL information_schema USER_STATISTICS KEY_READ_MISSES bigint NULL NULL NULL NULL bigint(21) NULL information_schema USER_STATISTICS SELECT_COMMANDS bigint NULL NULL NULL NULL bigint(21) NULL information_schema USER_STATISTICS UPDATE_COMMANDS bigint NULL NULL NULL NULL bigint(21) NULL information_schema USER_STATISTICS OTHER_COMMANDS bigint NULL NULL NULL NULL bigint(21) diff --git a/mysql-test/suite/innodb/r/table_index_statistics.result b/mysql-test/suite/innodb/r/table_index_statistics.result index ddb23afd346..3b8e0a5b139 100644 --- a/mysql-test/suite/innodb/r/table_index_statistics.result +++ b/mysql-test/suite/innodb/r/table_index_statistics.result @@ -34,12 +34,12 @@ DROP TABLE t1; CREATE TABLE t2 (c1 INT UNSIGNED); ALTER TABLE t2 MODIFY c1 FLOAT; SELECT * FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t2'; -TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES +TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES ROWS_INSERTED ROWS_UPDATED ROWS_DELETED KEY_READ_HITS KEY_READ_MISSES DROP TABLE t2; CREATE TABLE t2 (c1 INT UNSIGNED); ALTER TABLE t2 MODIFY c1 FLOAT; SELECT * FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t2'; -TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES +TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES ROWS_INSERTED ROWS_UPDATED ROWS_DELETED KEY_READ_HITS KEY_READ_MISSES DROP TABLE t2; SET GLOBAL userstat= @userstat_old; SET SESSION default_storage_engine = @default_storage_engine_old; diff --git a/plugin/userstat/client_stats.cc b/plugin/userstat/client_stats.cc index 72c71785606..7d48643e82c 100644 --- a/plugin/userstat/client_stats.cc +++ b/plugin/userstat/client_stats.cc @@ -16,6 +16,8 @@ static ST_FIELD_INFO client_stats_fields[]= Column("ROWS_DELETED", SLonglong(), NOT_NULL, "Rows_deleted"), Column("ROWS_INSERTED", SLonglong(), NOT_NULL, "Rows_inserted"), Column("ROWS_UPDATED", SLonglong(), NOT_NULL, "Rows_updated"), + Column("KEY_READ_HITS", SLonglong(), NOT_NULL, "Key_read_hits"), + Column("KEY_READ_MISSES", SLonglong(), NOT_NULL, "Key_read_misses"), Column("SELECT_COMMANDS", SLonglong(), NOT_NULL, "Select_commands"), Column("UPDATE_COMMANDS", SLonglong(), NOT_NULL, "Update_commands"), Column("OTHER_COMMANDS", SLonglong(), NOT_NULL, "Other_commands"), @@ -50,11 +52,13 @@ static int send_user_stats(THD* thd, HASH *all_user_stats, TABLE *table) table->field[j++]->store((longlong)user_stats->bytes_received, TRUE); table->field[j++]->store((longlong)user_stats->bytes_sent, TRUE); table->field[j++]->store((longlong)user_stats->binlog_bytes_written, TRUE); - table->field[j++]->store((longlong)user_stats->rows_read, TRUE); + table->field[j++]->store((longlong)user_stats->rows_stats.read, TRUE); table->field[j++]->store((longlong)user_stats->rows_sent, TRUE); - table->field[j++]->store((longlong)user_stats->rows_deleted, TRUE); - table->field[j++]->store((longlong)user_stats->rows_inserted, TRUE); - table->field[j++]->store((longlong)user_stats->rows_updated, TRUE); + table->field[j++]->store((longlong)user_stats->rows_stats.deleted, TRUE); + table->field[j++]->store((longlong)user_stats->rows_stats.inserted, TRUE); + table->field[j++]->store((longlong)user_stats->rows_stats.updated, TRUE); + table->field[j++]->store((longlong)user_stats->rows_stats.key_read_hit, TRUE); + table->field[j++]->store((longlong)user_stats->rows_stats.key_read_miss, TRUE); table->field[j++]->store((longlong)user_stats->select_commands, TRUE); table->field[j++]->store((longlong)user_stats->update_commands, TRUE); table->field[j++]->store((longlong)user_stats->other_commands, TRUE); diff --git a/plugin/userstat/table_stats.cc b/plugin/userstat/table_stats.cc index 0a656793063..59153297807 100644 --- a/plugin/userstat/table_stats.cc +++ b/plugin/userstat/table_stats.cc @@ -7,6 +7,11 @@ static ST_FIELD_INFO table_stats_fields[]= Column("ROWS_READ", SLonglong(), NOT_NULL, "Rows_read"), Column("ROWS_CHANGED", SLonglong(), NOT_NULL, "Rows_changed"), Column("ROWS_CHANGED_X_INDEXES",SLonglong(), NOT_NULL, "Rows_changed_x_#indexes"), + Column("ROWS_INSERTED", SLonglong(), NOT_NULL, "Rows_inserted"), + Column("ROWS_UPDATED", SLonglong(), NOT_NULL, "Rows_updated"), + Column("ROWS_DELETED", SLonglong(), NOT_NULL, "Rows_deleted"), + Column("KEY_READ_HITS", SLonglong(), NOT_NULL, "Key_read_hits"), + Column("KEY_READ_MISSES", SLonglong(), NOT_NULL, "Key_read_misses"), CEnd() }; @@ -24,6 +29,8 @@ static int table_stats_fill(THD *thd, TABLE_LIST *tables, COND *cond) (TABLE_STATS*)my_hash_element(&global_table_stats, i); TABLE_LIST tmp_table; size_t schema_length, table_name_length; + struct rows_stats *rows_stats= &table_stats->rows_stats; + ulonglong rows_changed; end_of_schema= strend(table_stats->table); schema_length= (size_t) (end_of_schema - table_stats->table); @@ -40,14 +47,22 @@ static int table_stats_fill(THD *thd, TABLE_LIST *tables, COND *cond) check_grant(thd, SELECT_ACL, &tmp_table, 1, 1, 1)) continue; + rows_changed= (rows_stats->inserted + rows_stats->updated + + rows_stats->updated); table->field[0]->store(table_stats->table, schema_length, system_charset_info); table->field[1]->store(table_stats->table + schema_length+1, table_name_length, system_charset_info); - table->field[2]->store((longlong)table_stats->rows_read, TRUE); - table->field[3]->store((longlong)table_stats->rows_changed, TRUE); + table->field[2]->store((longlong) rows_stats->read, TRUE); + table->field[3]->store((longlong) rows_changed, TRUE); table->field[4]->store((longlong)table_stats->rows_changed_x_indexes, TRUE); + table->field[5]->store((longlong) rows_stats->inserted, TRUE); + table->field[6]->store((longlong) rows_stats->updated, TRUE); + table->field[7]->store((longlong) rows_stats->deleted, TRUE); + table->field[8]->store((longlong) rows_stats->key_read_hit, TRUE); + table->field[9]->store((longlong) rows_stats->key_read_miss, TRUE); + if (schema_table_store_record(thd, table)) { mysql_mutex_unlock(&LOCK_global_table_stats); diff --git a/plugin/userstat/user_stats.cc b/plugin/userstat/user_stats.cc index de3d4e12fb1..3629a8281c7 100644 --- a/plugin/userstat/user_stats.cc +++ b/plugin/userstat/user_stats.cc @@ -16,6 +16,8 @@ static ST_FIELD_INFO user_stats_fields[]= Column("ROWS_DELETED", SLonglong(), NOT_NULL, "Rows_deleted"), Column("ROWS_INSERTED", SLonglong(), NOT_NULL, "Rows_inserted"), Column("ROWS_UPDATED", SLonglong(), NOT_NULL, "Rows_updated"), + Column("KEY_READ_HITS", SLonglong(), NOT_NULL, "Key_read_hits"), + Column("KEY_READ_MISSES", SLonglong(), NOT_NULL, "Key_read_misses"), Column("SELECT_COMMANDS", SLonglong(), NOT_NULL, "Select_commands"), Column("UPDATE_COMMANDS", SLonglong(), NOT_NULL, "Update_commands"), Column("OTHER_COMMANDS", SLonglong(), NOT_NULL, "Other_commands"), diff --git a/sql/ha_sequence.cc b/sql/ha_sequence.cc index f4f46d64a5c..35cee4ed74e 100644 --- a/sql/ha_sequence.cc +++ b/sql/ha_sequence.cc @@ -298,7 +298,7 @@ int ha_sequence::write_row(const uchar *buf) Log_func *log_func= Write_rows_log_event::binlog_row_logging_function; if (!sequence_locked) sequence->copy(&tmp_seq); - rows_changed++; + rows_stats.updated++; /* We have to do the logging while we hold the sequence mutex */ error= binlog_log_row(0, buf, log_func); } diff --git a/sql/handler.cc b/sql/handler.cc index a9d4ec4cc8e..6686d4d6b4a 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -3627,7 +3627,8 @@ int handler::ha_close(void) In_use is 0 for tables that was closed from the table cache. */ if (table->in_use) - status_var_add(table->in_use->status_var.rows_tmp_read, rows_tmp_read); + status_var_add(table->in_use->status_var.rows_tmp_read, + rows_stats.tmp_read); PSI_CALL_close_table(table_share, m_psi); m_psi= NULL; /* instrumentation handle, invalid after close_table() */ DBUG_ASSERT(m_psi_batch_mode == PSI_BATCH_MODE_NONE); @@ -3738,10 +3739,16 @@ int handler::ha_index_read_map(uchar *buf, const uchar *key, increment_statistics(&SSV::ha_read_key_count); if (!result) { + rows_stats.key_read_hit++; // For userstat update_index_statistics(); if (table->vfield && buf == table->record[0]) table->update_virtual_fields(this, VCOL_UPDATE_FOR_READ); } + else + { + status_var_increment(table->in_use->status_var.ha_read_key_miss); + rows_stats.key_read_miss++; // For userstat + } table->status=result ? STATUS_NOT_FOUND: 0; DBUG_RETURN(result); } @@ -3766,11 +3773,17 @@ int handler::ha_index_read_idx_map(uchar *buf, uint index, const uchar *key, increment_statistics(&SSV::ha_read_key_count); if (!result) { + rows_stats.key_read_hit++; update_rows_read(); index_rows_read[index]++; if (table->vfield && buf == table->record[0]) table->update_virtual_fields(this, VCOL_UPDATE_FOR_READ); } + else + { + status_var_increment(table->in_use->status_var.ha_read_key_miss); + rows_stats.key_read_miss++; + } table->status=result ? STATUS_NOT_FOUND: 0; return result; } @@ -6006,19 +6019,19 @@ void handler::get_dynamic_partition_info(PARTITION_STATS *stat_info, void handler::update_global_table_stats() { + ulonglong changed; TABLE_STATS * table_stats; - status_var_add(table->in_use->status_var.rows_read, rows_read); - DBUG_ASSERT(rows_tmp_read == 0); + status_var_add(table->in_use->status_var.rows_read, rows_stats.read); + DBUG_ASSERT(rows_stats.tmp_read == 0); - if (!table->in_use->userstat_running) - { - rows_read= rows_changed= 0; - return; - } + if (!table->in_use->userstat_running || + table->s->table_category != TABLE_CATEGORY_USER) + goto reset; - if (rows_read + rows_changed == 0) - return; // Nothing to update. + if (rows_stats.read + rows_stats.updated + rows_stats.inserted + + rows_stats.deleted + rows_stats.key_read_miss == 0) + goto reset; // Nothing to update. DBUG_ASSERT(table->s); DBUG_ASSERT(table->s->table_cache_key.str); @@ -6051,14 +6064,20 @@ void handler::update_global_table_stats() } } // Updates the global table stats. - table_stats->rows_read+= rows_read; - table_stats->rows_changed+= rows_changed; - table_stats->rows_changed_x_indexes+= (rows_changed * + table_stats->rows_stats.read+= rows_stats.read; + table_stats->rows_stats.updated+= rows_stats.updated; + table_stats->rows_stats.inserted+= rows_stats.inserted; + table_stats->rows_stats.deleted+= rows_stats.deleted; + table_stats->rows_stats.key_read_hit+= rows_stats.key_read_hit; + table_stats->rows_stats.key_read_miss+= rows_stats.key_read_miss; + changed= rows_stats.updated + rows_stats.inserted + rows_stats.deleted; + table_stats->rows_changed_x_indexes+= (changed * (table->s->keys ? table->s->keys : 1)); - rows_read= rows_changed= 0; end: mysql_mutex_unlock(&LOCK_global_table_stats); +reset: + bzero(&rows_stats, sizeof(rows_stats)); } @@ -8013,7 +8032,7 @@ int handler::ha_write_row(const uchar *buf) MYSQL_INSERT_ROW_DONE(error); if (likely(!error)) { - rows_changed++; + rows_stats.inserted++; Log_func *log_func= Write_rows_log_event::binlog_row_logging_function; error= binlog_log_row(0, buf, log_func); @@ -8064,7 +8083,7 @@ int handler::ha_update_row(const uchar *old_data, const uchar *new_data) MYSQL_UPDATE_ROW_DONE(error); if (likely(!error)) { - rows_changed++; + rows_stats.updated++; Log_func *log_func= Update_rows_log_event::binlog_row_logging_function; error= binlog_log_row(old_data, new_data, log_func); @@ -8140,7 +8159,7 @@ int handler::ha_delete_row(const uchar *buf) MYSQL_DELETE_ROW_DONE(error); if (likely(!error)) { - rows_changed++; + rows_stats.deleted++; Log_func *log_func= Delete_rows_log_event::binlog_row_logging_function; error= binlog_log_row(buf, 0, log_func); diff --git a/sql/handler.h b/sql/handler.h index 99641c838a6..e5f39436a4b 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -3325,9 +3325,7 @@ public: inserter. */ /* Statistics variables */ - ulonglong rows_read; - ulonglong rows_tmp_read; - ulonglong rows_changed; + struct rows_stats rows_stats; /* One bigger than needed to avoid to test if key == MAX_KEY */ ulonglong index_rows_read[MAX_KEY+1]; ha_copy_info copy_info; @@ -3713,7 +3711,7 @@ public: { DBUG_ASSERT(false); return(false); } void reset_statistics() { - rows_read= rows_changed= rows_tmp_read= 0; + bzero(&rows_stats, sizeof(rows_stats)); bzero(index_rows_read, sizeof(index_rows_read)); bzero(©_info, sizeof(copy_info)); } @@ -4263,9 +4261,9 @@ protected: inline void update_rows_read() { if (likely(!internal_tmp_table)) - rows_read++; + rows_stats.read++; else - rows_tmp_read++; + rows_stats.tmp_read++; } inline void update_index_statistics() { diff --git a/sql/sql_class.h b/sql/sql_class.h index d8d9a847fa7..2d671139a6c 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -950,6 +950,7 @@ typedef struct system_status_var ulong ha_read_first_count; ulong ha_read_last_count; ulong ha_read_key_count; + ulong ha_read_key_miss; ulong ha_read_next_count; ulong ha_read_prev_count; ulong ha_read_retry_count; diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index 0241ca329b9..4b9a483a3b7 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -430,10 +430,7 @@ void init_user_stats(USER_STATS *user_stats, ulonglong bytes_sent, ulonglong binlog_bytes_written, ha_rows rows_sent, - ha_rows rows_read, - ha_rows rows_inserted, - ha_rows rows_deleted, - ha_rows rows_updated, + rows_stats *rows_stats, ulonglong select_commands, ulonglong update_commands, ulonglong other_commands, @@ -464,10 +461,7 @@ void init_user_stats(USER_STATS *user_stats, user_stats->bytes_sent= bytes_sent; user_stats->binlog_bytes_written= binlog_bytes_written; user_stats->rows_sent= rows_sent; - user_stats->rows_read= rows_read; - user_stats->rows_inserted= rows_inserted; - user_stats->rows_deleted= rows_deleted; - user_stats->rows_updated= rows_updated; + user_stats->rows_stats= *rows_stats; user_stats->select_commands= select_commands; user_stats->update_commands= update_commands; user_stats->other_commands= other_commands; @@ -576,6 +570,8 @@ static bool increment_count_by_name(const char *name, size_t name_length, if (!(user_stats= (USER_STATS*) my_hash_search(users_or_clients, (uchar*) name, name_length))) { + struct rows_stats rows_stats; + bzero(&rows_stats, sizeof(rows_stats)); /* First connection for this user or client */ if (!(user_stats= ((USER_STATS*) my_malloc(PSI_INSTRUMENT_ME, sizeof(USER_STATS), @@ -586,8 +582,8 @@ static bool increment_count_by_name(const char *name, size_t name_length, 0, 0, 0, // connections 0, 0, 0, // time 0, 0, 0, // bytes sent, received and written - 0, 0, // rows sent and read - 0, 0, 0, // rows inserted, deleted and updated + 0, + &rows_stats, 0, 0, 0, // select, update and other commands 0, 0, // commit and rollback trans thd->status_var.access_denied_errors, @@ -678,16 +674,22 @@ static void update_global_user_stats_with_user(THD *thd, (thd->status_var.binlog_bytes_written - thd->org_status_var.binlog_bytes_written); /* We are not counting rows in internal temporary tables here ! */ - user_stats->rows_read+= (thd->status_var.rows_read - - thd->org_status_var.rows_read); - user_stats->rows_sent+= (thd->status_var.rows_sent - - thd->org_status_var.rows_sent); - user_stats->rows_inserted+= (thd->status_var.ha_write_count - - thd->org_status_var.ha_write_count); - user_stats->rows_deleted+= (thd->status_var.ha_delete_count - - thd->org_status_var.ha_delete_count); - user_stats->rows_updated+= (thd->status_var.ha_update_count - - thd->org_status_var.ha_update_count); + user_stats->rows_sent+= (thd->status_var.rows_sent - + thd->org_status_var.rows_sent); + user_stats->rows_stats.read+= (thd->status_var.rows_read - + thd->org_status_var.rows_read); + user_stats->rows_stats.inserted+= (thd->status_var.ha_write_count - + thd->org_status_var.ha_write_count); + user_stats->rows_stats.deleted+= (thd->status_var.ha_delete_count - + thd->org_status_var.ha_delete_count); + user_stats->rows_stats.updated+= (thd->status_var.ha_update_count - + thd->org_status_var.ha_update_count); + user_stats->rows_stats.key_read_hit+= (thd->status_var.ha_read_key_count - + thd->org_status_var.ha_read_key_count - + (thd->status_var.ha_read_key_miss - + thd->org_status_var.ha_read_key_miss)); + user_stats->rows_stats.key_read_miss+= (thd->status_var.ha_read_key_miss - + thd->org_status_var.ha_read_key_miss); user_stats->select_commands+= thd->select_commands; user_stats->update_commands+= thd->update_commands; user_stats->other_commands+= thd->other_commands; diff --git a/sql/structs.h b/sql/structs.h index 0546c5b23b7..da8e3a702c0 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -337,6 +337,21 @@ typedef struct user_conn { } } USER_CONN; + +/* Statistics used by user_stats */ + +struct rows_stats +{ + ha_rows key_read_hit; + ha_rows key_read_miss; + ha_rows read; + ha_rows tmp_read; + ha_rows updated; + ha_rows inserted; + ha_rows deleted; +}; + + typedef struct st_user_stats { char user[MY_MAX(USERNAME_LENGTH, LIST_PROCESS_HOST_LEN) + 1]; @@ -352,8 +367,8 @@ typedef struct st_user_stats uint total_ssl_connections; uint concurrent_connections; time_t connected_time; // in seconds - ha_rows rows_read, rows_sent; - ha_rows rows_updated, rows_deleted, rows_inserted; + struct rows_stats rows_stats; + ha_rows rows_sent; ulonglong bytes_received; ulonglong bytes_sent; ulonglong binlog_bytes_written; @@ -366,16 +381,18 @@ typedef struct st_user_stats double cpu_time; // in seconds } USER_STATS; + typedef struct st_table_stats { char table[NAME_LEN * 2 + 2]; // [db] + '\0' + [table] + '\0' size_t table_name_length; - ulonglong rows_read, rows_changed; + struct rows_stats rows_stats; ulonglong rows_changed_x_indexes; /* Stores enum db_type, but forward declarations cannot be done */ int engine_type; } TABLE_STATS; + typedef struct st_index_stats { // [db] + '\0' + [table] + '\0' + [index] + '\0' diff --git a/storage/rocksdb/mysql-test/rocksdb/r/table_stats.result b/storage/rocksdb/mysql-test/rocksdb/r/table_stats.result index 31cb1b6477b..653c79b5ef0 100644 --- a/storage/rocksdb/mysql-test/rocksdb/r/table_stats.result +++ b/storage/rocksdb/mysql-test/rocksdb/r/table_stats.result @@ -9,4 +9,9 @@ TABLE_NAME t1 ROWS_READ 1000 ROWS_CHANGED 1000 ROWS_CHANGED_X_INDEXES 1000 +ROWS_INSERTED 1000 +ROWS_UPDATED 0 +ROWS_DELETED 0 +KEY_READ_HITS 0 +KEY_READ_MISSES 0 DROP TABLE t1;