diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2022-02-04 14:50:25 +0100 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2022-02-04 14:50:25 +0100 |
commit | 4fb2cb1a30fc188682ae4dbda2f975213e5c3adf (patch) | |
tree | 522b2dc8096cc37ace66686de36b486b73a352f5 /mysql-test/suite/perfschema | |
parent | c0f5fd27549c84607defa64c5b651343dd29e0ee (diff) | |
parent | 9ed8deb656d9378fc9c1c7fb12c15674b6323ab0 (diff) | |
download | mariadb-git-4fb2cb1a30fc188682ae4dbda2f975213e5c3adf.tar.gz |
Merge branch '10.7' into 10.8
Diffstat (limited to 'mysql-test/suite/perfschema')
-rw-r--r-- | mysql-test/suite/perfschema/r/digest_view.result | 122 | ||||
-rw-r--r-- | mysql-test/suite/perfschema/r/show_sanity.result | 4 | ||||
-rw-r--r-- | mysql-test/suite/perfschema/t/digest_view.test | 76 |
3 files changed, 202 insertions, 0 deletions
diff --git a/mysql-test/suite/perfschema/r/digest_view.result b/mysql-test/suite/perfschema/r/digest_view.result index 43a8bdb1577..b2c908109e6 100644 --- a/mysql-test/suite/perfschema/r/digest_view.result +++ b/mysql-test/suite/perfschema/r/digest_view.result @@ -142,3 +142,125 @@ test SHOW WARNINGS 10 test TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1 DROP VIEW test.v1; DROP TABLE test.t1; +CREATE TABLE test.v1 (a int, b int); +INSERT INTO test.v1 VALUES (1, 100), (2, 200), (3, 300); +CREATE TABLE test.t1 (a int, b int); +INSERT INTO test.t1 VALUES (1, 100), (2, 200), (3, 300); +TRUNCATE TABLE performance_schema.events_statements_summary_by_digest; +EXPLAIN SELECT * from test.v1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE v1 ALL NULL NULL NULL NULL 3 +EXPLAIN SELECT * from test.v1 where a = 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE v1 ALL NULL NULL NULL NULL 3 Using where +EXPLAIN SELECT * from test.v1 where b > 100; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE v1 ALL NULL NULL NULL NULL 3 Using where +EXPLAIN SELECT a, b from test.v1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE v1 ALL NULL NULL NULL NULL 3 +EXPLAIN SELECT b, a from test.v1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE v1 ALL NULL NULL NULL NULL 3 +SELECT * from test.v1; +a b +1 100 +2 200 +3 300 +SELECT * from test.v1 where a = 1; +a b +1 100 +SELECT * from test.v1 where b > 100; +a b +2 200 +3 300 +SELECT a, b from test.v1; +a b +1 100 +2 200 +3 300 +SELECT b, a from test.v1; +b a +100 1 +200 2 +300 3 +# +# DIGESTS SEEN ON TABLE +# +SELECT SCHEMA_NAME, DIGEST, DIGEST_TEXT, COUNT_STAR +FROM performance_schema.events_statements_summary_by_digest +ORDER BY DIGEST_TEXT; +SCHEMA_NAME DIGEST DIGEST_TEXT COUNT_STAR +test 325a5266eeb07f609043730630a54f62 EXPLAIN SELECT * FROM `test` . `v1` 1 +test e860d6b0816b2b4854badd34fbbd6207 EXPLAIN SELECT * FROM `test` . `v1` WHERE `a` = ? 1 +test d162188aba15f30fbad441adcd8d96af EXPLAIN SELECT * FROM `test` . `v1` WHERE `b` > ? 1 +test b22e464e9cc580f0e67bfdd65f11402b EXPLAIN SELECT `a` , `b` FROM `test` . `v1` 1 +test ccb1e6631108bba01e42d1755e32399d EXPLAIN SELECT `b` , `a` FROM `test` . `v1` 1 +test ef05c6bd2efecfe1635b58ffc118cabd SELECT * FROM `test` . `v1` 1 +test 7755326c5700a225c95f470c1a909f21 SELECT * FROM `test` . `v1` WHERE `a` = ? 1 +test aa8bcfc412f56c41fbe6161b2a3a971c SELECT * FROM `test` . `v1` WHERE `b` > ? 1 +test 5ea7548b0f49730b2c419ff6a94a3f09 SELECT `a` , `b` FROM `test` . `v1` 1 +test 30756ef4e5a36c461ba9bdce676b9811 SELECT `b` , `a` FROM `test` . `v1` 1 +test 61e13f96828d862446f5e8ee1cade61d TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1 +DROP TABLE test.v1; +CREATE VIEW test.v1 AS SELECT * FROM test.t1; +EXPLAIN SELECT * from test.v1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 +EXPLAIN SELECT * from test.v1 where a = 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +EXPLAIN SELECT * from test.v1 where b > 100; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +EXPLAIN SELECT a, b from test.v1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 +EXPLAIN SELECT b, a from test.v1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 +SELECT * from test.v1; +a b +1 100 +2 200 +3 300 +SELECT * from test.v1 where a = 1; +a b +1 100 +SELECT * from test.v1 where b > 100; +a b +2 200 +3 300 +SELECT a, b from test.v1; +a b +1 100 +2 200 +3 300 +SELECT b, a from test.v1; +b a +100 1 +200 2 +300 3 +# +# DIGESTS SEEN ON VIEW +# +SELECT SCHEMA_NAME, DIGEST, DIGEST_TEXT, COUNT_STAR +FROM performance_schema.events_statements_summary_by_digest +ORDER BY DIGEST_TEXT; +SCHEMA_NAME DIGEST DIGEST_TEXT COUNT_STAR +test 04aae3c6f9b3d3394fbea32dd201320a CREATE VIEW `test` . `v1` AS SELECT * FROM `test` . `t1` 1 +test e551faf16ae3ffe7aeb6d923c8f97452 DROP TABLE `test` . `v1` 1 +test 325a5266eeb07f609043730630a54f62 EXPLAIN SELECT * FROM `test` . `v1` 2 +test e860d6b0816b2b4854badd34fbbd6207 EXPLAIN SELECT * FROM `test` . `v1` WHERE `a` = ? 2 +test d162188aba15f30fbad441adcd8d96af EXPLAIN SELECT * FROM `test` . `v1` WHERE `b` > ? 2 +test b22e464e9cc580f0e67bfdd65f11402b EXPLAIN SELECT `a` , `b` FROM `test` . `v1` 2 +test ccb1e6631108bba01e42d1755e32399d EXPLAIN SELECT `b` , `a` FROM `test` . `v1` 2 +test ef05c6bd2efecfe1635b58ffc118cabd SELECT * FROM `test` . `v1` 2 +test 7755326c5700a225c95f470c1a909f21 SELECT * FROM `test` . `v1` WHERE `a` = ? 2 +test aa8bcfc412f56c41fbe6161b2a3a971c SELECT * FROM `test` . `v1` WHERE `b` > ? 2 +test 9b3c3d8a2f8b2d9775f9d87d0932e5b5 SELECT SCHEMA_NAME , `DIGEST` , `DIGEST_TEXT` , `COUNT_STAR` FROM `performance_schema` . `events_statements_summary_by_digest` ORDER BY `DIGEST_TEXT` 1 +test 5ea7548b0f49730b2c419ff6a94a3f09 SELECT `a` , `b` FROM `test` . `v1` 2 +test 30756ef4e5a36c461ba9bdce676b9811 SELECT `b` , `a` FROM `test` . `v1` 2 +test 61e13f96828d862446f5e8ee1cade61d TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1 +DROP VIEW test.v1; +DROP TABLE test.t1; diff --git a/mysql-test/suite/perfschema/r/show_sanity.result b/mysql-test/suite/perfschema/r/show_sanity.result index 71bc92a2c2f..dc326dd7f64 100644 --- a/mysql-test/suite/perfschema/r/show_sanity.result +++ b/mysql-test/suite/perfschema/r/show_sanity.result @@ -414,6 +414,8 @@ SHOW_MODE SOURCE VARIABLE_NAME 5.6 I_S.SESSION_VARIABLES INNODB_STATS_INCLUDE_DELETE_MARKED 5.6 I_S.SESSION_VARIABLES KEYRING_OPERATIONS 5.6 I_S.SESSION_VARIABLES LOG_STATEMENTS_UNSAFE_FOR_BINLOG +5.6 I_S.SESSION_VARIABLES REPLICATION_OPTIMIZE_FOR_STATIC_PLUGIN_CONFIG +5.6 I_S.SESSION_VARIABLES REPLICATION_SENDER_OBSERVE_COMMIT_ONLY 5.6 I_S.SESSION_VARIABLES TLS_VERSION ================================================================================ @@ -442,6 +444,8 @@ SHOW_MODE SOURCE VARIABLE_NAME 5.6 I_S.SESSION_VARIABLES INNODB_STATS_INCLUDE_DELETE_MARKED 5.6 I_S.SESSION_VARIABLES KEYRING_OPERATIONS 5.6 I_S.SESSION_VARIABLES LOG_STATEMENTS_UNSAFE_FOR_BINLOG +5.6 I_S.SESSION_VARIABLES REPLICATION_OPTIMIZE_FOR_STATIC_PLUGIN_CONFIG +5.6 I_S.SESSION_VARIABLES REPLICATION_SENDER_OBSERVE_COMMIT_ONLY 5.6 I_S.SESSION_VARIABLES TLS_VERSION ================================================================================ diff --git a/mysql-test/suite/perfschema/t/digest_view.test b/mysql-test/suite/perfschema/t/digest_view.test index f718d7530e6..dd862aebd52 100644 --- a/mysql-test/suite/perfschema/t/digest_view.test +++ b/mysql-test/suite/perfschema/t/digest_view.test @@ -75,3 +75,79 @@ SELECT SCHEMA_NAME, DIGEST_TEXT, COUNT_STAR DROP VIEW test.v1; DROP TABLE test.t1; +# ---------------------------------------------------- +# Tests for the performance schema statement Digests. +# ---------------------------------------------------- + +# Test case to show behavior of statements digest when +# using a view + +--source include/not_embedded.inc +--source include/have_perfschema.inc +--source include/no_protocol.inc + +CREATE TABLE test.v1 (a int, b int); +INSERT INTO test.v1 VALUES (1, 100), (2, 200), (3, 300); + +CREATE TABLE test.t1 (a int, b int); +INSERT INTO test.t1 VALUES (1, 100), (2, 200), (3, 300); + + +TRUNCATE TABLE performance_schema.events_statements_summary_by_digest; + +# +# test.v1 is a table. +# Every query here is different, and should have a different digest. +# + +EXPLAIN SELECT * from test.v1; +EXPLAIN SELECT * from test.v1 where a = 1; +EXPLAIN SELECT * from test.v1 where b > 100; +EXPLAIN SELECT a, b from test.v1; +EXPLAIN SELECT b, a from test.v1; + +SELECT * from test.v1; +SELECT * from test.v1 where a = 1; +SELECT * from test.v1 where b > 100; +SELECT a, b from test.v1; +SELECT b, a from test.v1; + +--echo # +--echo # DIGESTS SEEN ON TABLE +--echo # + +SELECT SCHEMA_NAME, DIGEST, DIGEST_TEXT, COUNT_STAR + FROM performance_schema.events_statements_summary_by_digest + ORDER BY DIGEST_TEXT; + +DROP TABLE test.v1; +CREATE VIEW test.v1 AS SELECT * FROM test.t1; + +# +# test.v1 is now a view. +# the query digests should be unchanged. +# + +EXPLAIN SELECT * from test.v1; +EXPLAIN SELECT * from test.v1 where a = 1; +EXPLAIN SELECT * from test.v1 where b > 100; +EXPLAIN SELECT a, b from test.v1; +EXPLAIN SELECT b, a from test.v1; + +SELECT * from test.v1; +SELECT * from test.v1 where a = 1; +SELECT * from test.v1 where b > 100; +SELECT a, b from test.v1; +SELECT b, a from test.v1; + +--echo # +--echo # DIGESTS SEEN ON VIEW +--echo # + +SELECT SCHEMA_NAME, DIGEST, DIGEST_TEXT, COUNT_STAR + FROM performance_schema.events_statements_summary_by_digest + ORDER BY DIGEST_TEXT; + +DROP VIEW test.v1; +DROP TABLE test.t1; + |