Debian Codegraph @

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

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