summaryrefslogtreecommitdiff
path: root/mysql-test/suite/perfschema/t/misc.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/suite/perfschema/t/misc.test')
-rw-r--r--mysql-test/suite/perfschema/t/misc.test100
1 files changed, 100 insertions, 0 deletions
diff --git a/mysql-test/suite/perfschema/t/misc.test b/mysql-test/suite/perfschema/t/misc.test
index 5cff586c5f0..ee6dfe95e8c 100644
--- a/mysql-test/suite/perfschema/t/misc.test
+++ b/mysql-test/suite/perfschema/t/misc.test
@@ -5,6 +5,60 @@
--source include/have_perfschema.inc
#
+# Bug#12790483 OBJECTS_SUMMARY_GLOBAL_BY_TYPE AND RENAME TABLE
+#
+# Rename table leaves old tables names behind in
+# performance_schema.objects_summary_global_by_type
+#
+SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type
+ WHERE object_schema='test';
+
+CREATE TABLE test.t_before(a INT);
+INSERT INTO test.t_before VALUES (1);
+
+# The new table should appear in OBJECTS_SUMMARY_GLOBAL_BY_TYPE.
+
+SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type
+ WHERE object_schema='test';
+
+RENAME TABLE test.t_before TO test.t_after;
+
+# The renamed table should appear in OBJECTS_SUMMARY_GLOBAL_BY_TYPE, but only
+# after it is accessed.
+
+SELECT COUNT(*) FROM test.t_after;
+
+SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type
+ WHERE object_schema='test';
+
+DROP TABLE test.t_after;
+
+# The renamed table should not appear in OBJECTS_SUMMARY_GLOBAL_BY_TYPE.
+
+SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type
+ WHERE object_schema='test';
+
+#
+# Verify table views are ignored by the table io instrumentation.
+#
+
+CREATE TABLE test.t1(a INT);
+INSERT INTO test.t1 VALUES (1);
+CREATE VIEW test.v1 AS SELECT * FROM test.t1;
+SELECT COUNT(*) FROM test.v1;
+
+# Verify that a PFS table share was not created for the view.
+SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type
+ WHERE object_schema='test';
+
+DROP VIEW test.v1;
+DROP TABLE test.t1;
+
+SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type
+ WHERE object_schema='test';
+
+
+#
# Bug#45496 Performance schema: assertion fails in
# ha_perfschema::rnd_init:223
#
@@ -26,6 +80,11 @@ LIMIT 1;
--error ER_CANT_CREATE_TABLE
create table test.t1(a int) engine=performance_schema;
+# The table should not appear in OBJECTS_SUMMARY_GLOBAL_BY_TYPE
+
+SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type
+ WHERE object_schema='test';
+
#
# Bug#44897 Performance Schema: can create a ghost table in another database
#
@@ -33,6 +92,11 @@ create table test.t1(a int) engine=performance_schema;
--error ER_CANT_CREATE_TABLE
create table test.t1 like performance_schema.events_waits_current;
+# The table should not appear in OBJECTS_SUMMARY_GLOBAL_BY_TYPE
+
+SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type
+ WHERE object_schema='test';
+
#
# Bug#44898 PerformanceSchema: can create a table in db performance_schema, cannot insert
#
@@ -40,6 +104,11 @@ create table test.t1 like performance_schema.events_waits_current;
--error ER_TABLEACCESS_DENIED_ERROR
create table performance_schema.t1(a int);
+# The table should not appear in OBJECTS_SUMMARY_GLOBAL_BY_TYPE
+
+SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type
+ WHERE object_schema='test';
+
#
# Bug#51447 performance schema evil twin files
#
@@ -68,3 +137,34 @@ select * from performance_schema.file_instances
--error ER_NO_SUCH_TABLE
select * from performance_schema.no_such_table;
+#
+# Bug#12370950 - 60905: TABLE_IO_WAITS_SUMMARY_BY_INDEX_USAGE AGGREGATES NON-INSERT DML WRONGLY
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t_60905;
+--enable_warnings
+CREATE TABLE t_60905 (i INT, j INT, KEY(i)) ENGINE = InnoDB;
+INSERT INTO t_60905 VALUES
+(1,2), (3,4), (5,6), (7,8), (9,10);
+
+# should delete with a "single" PRIMARY lookup (2 PRIMARY fetch, 1 PRIMARY delete)
+DELETE FROM t_60905 WHERE i = 1;
+
+# should delete with a full scan (5 NULL fetch, 1 NULL delete)
+DELETE FROM t_60905 WHERE j = 8;
+
+# show the instrument data
+SELECT object_schema,
+ object_name,
+ index_name,
+ count_fetch,
+ count_insert,
+ count_update,
+ count_delete
+ FROM performance_schema.table_io_waits_summary_by_index_usage
+ WHERE object_schema = 'test'
+ AND object_name = 't_60905';
+
+DROP TABLE t_60905;
+