Debian Codegraph @

mysql-test/suite/perfschema/t/status_reprepare.test

raw
1 # Tests for PERFORMANCE_SCHEMA
2
3 # Test requires: sp-protocol/ps-protocol/view-protocol/cursor-protocol disabled
4 --source include/no_protocol.inc
5
6 --echo
7 --echo ================================================================================
8 --echo SETUP
9 --echo ================================================================================
10
11 # Create a new connection, to get clean statistics
12 connect(con1, localhost, root,,);
13
14 # Create a table
15 CREATE TABLE test.t1 (c1 INT);
16
17 #prepare a statement
18 PREPARE stmt1 FROM "SELECT c1 FROM test.t1";
19
20 #execute prepared statement;
21 EXECUTE stmt1;
22
23 # Check status from SHOW STATUS
24 SHOW SESSION STATUS LIKE "%com_stmt_%prepare%";
25
26 #check the statistics
27 SELECT * FROM performance_schema.session_status WHERE VARIABLE_NAME LIKE "%com_stmt%";
28
29 SELECT VARIABLE_VALUE FROM performance_schema.global_status
30 WHERE VARIABLE_NAME LIKE "Com_stmt_reprepare"
31 INTO @count_global_reprepare_before;
32
33 # Alter table to make server reprepare the statement
34 ALTER TABLE test.t1 ADD COLUMN c2 INTEGER;
35
36 #execute prepared statement;
37 EXECUTE stmt1;
38
39 # Check status from SHOW STATUS
40 SHOW SESSION STATUS LIKE "%com_stmt_%prepare%";
41
42 #check the statistics
43 SELECT * FROM performance_schema.session_status WHERE VARIABLE_NAME LIKE "%com_stmt%";
44
45 SELECT VARIABLE_VALUE FROM performance_schema.global_status
46 WHERE VARIABLE_NAME LIKE "Com_stmt_reprepare"
47 INTO @count_global_reprepare_after;
48
49 # Should increment by 1
50 SELECT @count_global_reprepare_after - @count_global_reprepare_before;
51
52 --echo
53 --echo ================================================================================
54 --echo CLEANUP
55 --echo ================================================================================
56
57 DROP TABLE test.t1;
58
59 --disconnect con1
60 --connection default