mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 02:51:44 +01:00
123 lines
4 KiB
Text
123 lines
4 KiB
Text
####################################
|
|
# SETUP
|
|
####################################
|
|
CREATE DATABASE statements_digest;
|
|
USE statements_digest;
|
|
CREATE TABLE t1(a int);
|
|
CREATE TABLE t2(a int);
|
|
CREATE TABLE t3(a int, b int);
|
|
CREATE TABLE t4(a int, b int);
|
|
CREATE TABLE t5(a int, b int, c int);
|
|
SELECT * FROM performance_schema.setup_consumers;
|
|
NAME ENABLED
|
|
events_stages_current YES
|
|
events_stages_history YES
|
|
events_stages_history_long YES
|
|
events_statements_current NO
|
|
events_statements_history YES
|
|
events_statements_history_long YES
|
|
events_waits_current YES
|
|
events_waits_history YES
|
|
events_waits_history_long YES
|
|
global_instrumentation YES
|
|
thread_instrumentation YES
|
|
statements_digest YES
|
|
TRUNCATE TABLE performance_schema.events_statements_summary_by_digest;
|
|
####################################
|
|
# EXECUTION
|
|
####################################
|
|
SELECT 1 FROM t1;
|
|
1
|
|
SELECT 1 FROM `t1`;
|
|
1
|
|
SELECT 1,2 FROM t1;
|
|
1 2
|
|
SELECT 1, 2, 3, 4 FROM t1;
|
|
1 2 3 4
|
|
SELECT 1 FROM t2;
|
|
1
|
|
SELECT 1,2 FROM t2;
|
|
1 2
|
|
SELECT 1, 2, 3, 4 FROM t2;
|
|
1 2 3 4
|
|
INSERT INTO t1 VALUES (1);
|
|
INSERT INTO t2 VALUES (1);
|
|
INSERT INTO t3 VALUES (1, 2);
|
|
INSERT INTO t4 VALUES (1, 2);
|
|
INSERT INTO t5 VALUES (1, 2, 3);
|
|
INSERT INTO t1 VALUES (1), (2), (3);
|
|
INSERT INTO t1 VALUES (1), (2), (3), (4);
|
|
INSERT INTO t3 VALUES (1, 2), (3, 4), (5, 6);
|
|
INSERT INTO t5 VALUES (1, 2, 3), (4, 5, 6), (7, 8, 9);
|
|
SELECT 1 + 1;
|
|
1 + 1
|
|
2
|
|
SELECT 1;
|
|
1
|
|
1
|
|
SELECT 1 /* This is an inline comment */ + 1;
|
|
1 /* This is an inline comment */ + 1
|
|
2
|
|
SELECT 1+
|
|
/*
|
|
this is a
|
|
multiple-line comment
|
|
*/
|
|
1;
|
|
1+
|
|
/*
|
|
this is a
|
|
multiple-line comment
|
|
*/
|
|
1
|
|
2
|
|
CREATE SCHEMA statements_digest_temp;
|
|
DROP SCHEMA statements_digest_temp;
|
|
CREATE DATABASE statements_digest_temp;
|
|
DROP DATABASE statements_digest_temp;
|
|
SELECT 1 from t11;
|
|
ERROR 42S02: Table 'statements_digest.t11' doesn't exist
|
|
create table t11 (c char(4));
|
|
create table t11 (c char(4));
|
|
ERROR 42S01: Table 't11' already exists
|
|
insert into t11 values("MySQL");
|
|
Warnings:
|
|
Warning 1265 Data truncated for column 'c' at row 1
|
|
####################################
|
|
# QUERYING PS STATEMENT DIGEST
|
|
####################################
|
|
SELECT digest, digest_text, count_star FROM performance_schema.events_statements_summary_by_digest;
|
|
digest digest_text count_star
|
|
b94bc8f50c92e01784d3148b3d2086c8 TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1
|
|
ea6492426a33544a059bc12766c5ba3d SELECT ? FROM t1 1
|
|
692668ddf608983c586aef1c575ee9c6 SELECT ? FROM `t1` 1
|
|
f630f3ea22832be48798c5e51bb88189 SELECT ?, ... FROM t1 2
|
|
a98062477bd693dacfc0df96c68c5585 SELECT ? FROM t2 1
|
|
12cd65a2242b7643f9ad4418c389677a SELECT ?, ... FROM t2 2
|
|
32d8fa3c3ed3b6c26ac792495188f4a4 INSERT INTO t1 VALUES (?) 1
|
|
8bf0b320418673ba7d23f11f61bae318 INSERT INTO t2 VALUES (?) 1
|
|
a411b3681f67af51cddca60a3d5c260f INSERT INTO t3 VALUES (...) 1
|
|
23d0399fcd03fabcc9eeadb387121a44 INSERT INTO t4 VALUES (...) 1
|
|
c0ec9a3fd081147370256fb6b64e2f67 INSERT INTO t5 VALUES (...) 1
|
|
ba58da885d020e31d8c38b67e0f6da4c INSERT INTO t1 VALUES (?) /* , ... */ 2
|
|
9c272a31286b15643b38fecc33599eea INSERT INTO t3 VALUES (...) /* , ... */ 1
|
|
a7d009150c5da8b925776dea63ed77d7 INSERT INTO t5 VALUES (...) /* , ... */ 1
|
|
b695dab1504c4e588a91af231b9c9e26 SELECT ? + ? 3
|
|
a2635fa56a271bdf473419620249f7ef SELECT ? 1
|
|
bce3f7384ae2ab78354b031184fde12d CREATE SCHEMA statements_digest_temp 2
|
|
2a0e36afeaac85dc117c3856388a4fae DROP SCHEMA statements_digest_temp 2
|
|
bb607bee73d602560af915aa4514eac4 SELECT ? FROM t11 1
|
|
4cd9bc5a9ed1ac12cd380187dab2921a CREATE TABLE t11 ( c CHARACTER (?) ) 2
|
|
bd53dcd5e36e77d74df5358baf658cee INSERT INTO t11 VALUES (?) 1
|
|
f62dd76b64fad47e6558f3d1b03ff215 SHOW WARNINGS 1
|
|
SELECT digest, digest_text FROM performance_schema.events_statements_current;
|
|
digest digest_text
|
|
####################################
|
|
# CLEANUP
|
|
####################################
|
|
DROP TABLE IF EXISTS t1;
|
|
DROP TABLE IF EXISTS t2;
|
|
DROP TABLE IF EXISTS t3;
|
|
DROP TABLE IF EXISTS t4;
|
|
DROP TABLE IF EXISTS t5;
|
|
DROP DATABASE IF EXISTS statements_digest;
|