diff options
author | Michael Widenius <monty@askmonty.org> | 2011-06-27 19:07:24 +0300 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2011-06-27 19:07:24 +0300 |
commit | ba9a890f0c389a93925c8c21a30e64801f397f18 (patch) | |
tree | 30b4ae8dda481d0c057641fef6eb1edea8b643ec /mysql-test | |
parent | a6542a13abcb0e5632919b30a7bd343757fbccba (diff) | |
download | mariadb-git-ba9a890f0c389a93925c8c21a30e64801f397f18.tar.gz |
New status variables: Rows_tmp_read, Handler_tmp_update and Handler_tmp_write
Split status variable Rows_read to Rows_read and Rows_tmp_read so that one can see how much real data is read.
Same was done with with Handler_update and Handler_write.
Fixed bug in MEMORY tables where some variables was counted twice.
Added new internal handler call 'ha_close()' to have one place to gather statistics.
Fixed bug where thd->open_options was set to wrong value when doing admin_recreate_table()
mysql-test/r/status.result:
Updated test results and added new tests
mysql-test/r/status_user.result:
Udated test results
mysql-test/t/status.test:
Added new test for temporary table status variables
sql/ha_partition.cc:
Changed to call ha_close() instead of close()
sql/handler.cc:
Added internal_tmp_table variable for easy checking of temporary tables.
Added new internal handler call 'ha_close()' to have one place to gather statistics.
Gather statistics for internal temporary tables.
sql/handler.h:
Added handler variables internal_tmp_table, rows_tmp_read.
Split function update_index_statistics() to two.
Added ha_update_tmp_row() for faster tmp table handling with more statistics.
sql/item_sum.cc:
ha_write_row() -> ha_write_tmp_row()
sql/multi_range_read.cc:
close() -> ha_close()
sql/mysqld.cc:
New status variables: Rows_tmp_read, Handler_tmp_update and Handler_tmp_write
sql/opt_range.cc:
close() -> ha_close()
sql/sql_base.cc:
close() -> ha_close()
sql/sql_class.cc:
Added handling of rows_tmp_read
sql/sql_class.h:
Added new satistics variables.
rows_read++ -> update_rows_read() to be able to correctly count reads to internal temp tables.
Added handler::ha_update_tmp_row()
sql/sql_connect.cc:
Added comment
sql/sql_expression_cache.cc:
ha_write_row() -> ha_write_tmp_row()
sql/sql_select.cc:
close() -> ha_close()
ha_update_row() -> ha_update_tmp_row()
sql/sql_show.cc:
ha_write_row() -> ha_write_tmp_row()
sql/sql_table.cc:
Fixed bug where thd->open_options was set to wrong value when doing admin_recreate_table()
sql/sql_union.cc:
ha_write_row() -> ha_write_tmp_row()
sql/sql_update.cc:
ha_write_row() -> ha_write_tmp_row()
sql/table.cc:
close() -> ha_close()
storage/heap/ha_heap.cc:
Removed double counting of statistic variables.
close -> ha_close() to get tmp table statistics.
storage/maria/ha_maria.cc:
close -> ha_close() to get tmp table statistics.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/status.result | 62 | ||||
-rw-r--r-- | mysql-test/r/status_user.result | 7 | ||||
-rw-r--r-- | mysql-test/t/status.test | 17 |
3 files changed, 83 insertions, 3 deletions
diff --git a/mysql-test/r/status.result b/mysql-test/r/status.result index ce3acba9b8a..2c88345646c 100644 --- a/mysql-test/r/status.result +++ b/mysql-test/r/status.result @@ -156,25 +156,33 @@ Variable_name Value Com_show_status 3 show status like 'hand%write%'; Variable_name Value +Handler_tmp_write 0 Handler_write 0 show status like '%tmp%'; Variable_name Value Created_tmp_disk_tables 0 Created_tmp_files 0 Created_tmp_tables 0 +Handler_tmp_update 0 +Handler_tmp_write 0 +Rows_tmp_read 5 show status like 'hand%write%'; Variable_name Value +Handler_tmp_write 0 Handler_write 0 show status like '%tmp%'; Variable_name Value Created_tmp_disk_tables 0 Created_tmp_files 0 Created_tmp_tables 0 +Handler_tmp_update 0 +Handler_tmp_write 0 +Rows_tmp_read 13 show status like 'com_show_status'; Variable_name Value Com_show_status 8 rnd_diff tmp_table_diff -20 8 +28 8 flush status; show status like 'Com%function'; Variable_name Value @@ -238,5 +246,57 @@ SELECT 9; 9 DROP PROCEDURE p1; DROP FUNCTION f1; +flush status; +create table t1 (a int not null auto_increment primary key, g int, b blob); +insert into t1 (g,b) values (1,'a'), (2, 'b'), (3, 'b'), (1, 'c'); +select * from t1; +a g b +1 1 a +2 2 b +3 3 b +4 1 c +select b, count(*) from t1 group by b; +b count(*) +a 1 +b 2 +c 1 +select g, count(*) from t1 group by g; +g count(*) +1 2 +2 1 +3 1 +show status like 'Row%'; +Variable_name Value +Rows_read 12 +Rows_sent 10 +Rows_tmp_read 14 +show status like 'Handler%'; +Variable_name Value +Handler_commit 0 +Handler_delete 0 +Handler_discover 0 +Handler_prepare 0 +Handler_read_first 0 +Handler_read_key 4 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_rnd 7 +Handler_read_rnd_next 23 +Handler_rollback 0 +Handler_savepoint 0 +Handler_savepoint_rollback 0 +Handler_tmp_update 2 +Handler_tmp_write 7 +Handler_update 0 +Handler_write 4 +show status like '%tmp%'; +Variable_name Value +Created_tmp_disk_tables 1 +Created_tmp_files 0 +Created_tmp_tables 2 +Handler_tmp_update 2 +Handler_tmp_write 7 +Rows_tmp_read 34 +drop table t1; set @@global.concurrent_insert= @old_concurrent_insert; SET GLOBAL log_output = @old_log_output; diff --git a/mysql-test/r/status_user.result b/mysql-test/r/status_user.result index 636eeabfffc..0d1d028eb3d 100644 --- a/mysql-test/r/status_user.result +++ b/mysql-test/r/status_user.result @@ -94,6 +94,7 @@ show status like "rows%"; Variable_name Value Rows_read 6 Rows_sent 1 +Rows_tmp_read 0 show status like "ha%"; Variable_name Value Handler_commit 19 @@ -109,6 +110,8 @@ Handler_read_rnd_next 5 Handler_rollback 2 Handler_savepoint 0 Handler_savepoint_rollback 0 +Handler_tmp_update 0 +Handler_tmp_write 0 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"; @@ -133,7 +136,7 @@ CONCURRENT_CONNECTIONS 0 ROWS_READ 6 ROWS_SENT 2 ROWS_DELETED 1 -ROWS_INSERTED 8 +ROWS_INSERTED 7 ROWS_UPDATED 5 SELECT_COMMANDS 3 UPDATE_COMMANDS 11 @@ -150,7 +153,7 @@ CONCURRENT_CONNECTIONS 0 ROWS_READ 6 ROWS_SENT 2 ROWS_DELETED 1 -ROWS_INSERTED 8 +ROWS_INSERTED 7 ROWS_UPDATED 5 SELECT_COMMANDS 3 UPDATE_COMMANDS 11 diff --git a/mysql-test/t/status.test b/mysql-test/t/status.test index 505df0fe8dc..46e454363cc 100644 --- a/mysql-test/t/status.test +++ b/mysql-test/t/status.test @@ -353,6 +353,23 @@ DROP FUNCTION f1; # End of 5.1 tests +# +# Test of internal temporary table status variables +# + +flush status; +create table t1 (a int not null auto_increment primary key, g int, b blob); +insert into t1 (g,b) values (1,'a'), (2, 'b'), (3, 'b'), (1, 'c'); +select * from t1; +select b, count(*) from t1 group by b; +select g, count(*) from t1 group by g; +show status like 'Row%'; +show status like 'Handler%'; +show status like '%tmp%'; +drop table t1; + +# End of 5.3 tests + # Restore global concurrent_insert value. Keep in the end of the test file. --connection default set @@global.concurrent_insert= @old_concurrent_insert; |