| 1 |
use test; |
| 2 |
SET @threadid = ps_current_thread_id(); |
| 3 |
CREATE TABLE t1 (id INT PRIMARY KEY, val int); |
| 4 |
INSERT INTO test.t1 VALUES (1, 9); |
| 5 |
SET @digest.insert = (SELECT DIGEST FROM performance_schema.events_statements_history WHERE THREAD_ID = @threadid AND SQL_TEXT LIKE 'INSERT INTO test.t1 VALUES (1, 9)'); |
| 6 |
SELECT * FROM t1; |
| 7 |
id val |
| 8 |
1 9 |
| 9 |
SET @digest.select = (SELECT DIGEST FROM performance_schema.events_statements_history WHERE THREAD_ID = @threadid AND SQL_TEXT LIKE 'SELECT * FROM t1'); |
| 10 |
SHOW CREATE TABLE test.t1; |
| 11 |
Table Create Table |
| 12 |
t1 CREATE TABLE `t1` ( |
| 13 |
`id` int NOT NULL, |
| 14 |
`val` int DEFAULT NULL, |
| 15 |
PRIMARY KEY (`id`) |
| 16 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
| 17 |
SET @digest.show = (SELECT DIGEST FROM performance_schema.events_statements_history WHERE THREAD_ID = @threadid AND SQL_TEXT LIKE 'SHOW CREATE TABLE test.t1'); |
| 18 |
CREATE SCHEMA test_sys; |
| 19 |
use test_sys; |
| 20 |
CALL sys.ps_trace_statement_digest(@digest.insert, 0.5, 0.1, FALSE, FALSE); |
| 21 |
CALL sys.ps_trace_statement_digest(@digest.select, 0.5, 0.1, FALSE, FALSE); |
| 22 |
CALL sys.ps_trace_statement_digest(@digest.show , 0.5, 0.1, FALSE, FALSE); |
| 23 |
CALL sys.ps_trace_statement_digest(@digest.insert, 0.5, 0.1, TRUE , FALSE); |
| 24 |
use test; |
| 25 |
DROP SCHEMA test_sys; |
| 26 |
DROP TABLE t1; |
| 27 |
SET @threadid = NULL, |
| 28 |
@digest.insert = NULL, |
| 29 |
@digest.select = NULL, |
| 30 |
@digest.show = NULL; |