Current Path : /home/usr.opt/mysql57/mysql-test/suite/perfschema/r/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //home/usr.opt/mysql57/mysql-test/suite/perfschema/r/prepared_stmts_by_stored_programs.result |
TRUNCATE TABLE performance_schema.prepared_statements_instances; CREATE DATABASE db; USE db; CREATE TABLE t ( a INT, b CHAR(10), name CHAR(10) ); SET sql_mode = 'NO_ENGINE_SUBSTITUTION'; Warnings: Warning 3090 Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release. INSERT INTO t VALUES (1,"kuchipudi","Vempati"); INSERT INTO t VALUES (2,"odissi","Mohapatra"); INSERT INTO t VALUES (3,"kathak","Maharaj"); INSERT INTO t VALUES (4,"mohiyattam","Kalyanikutty"); Warnings: Warning 1265 Data truncated for column 'name' at row 1 INSERT INTO t VALUES (5,"manipuri","Guru"); INSERT INTO t VALUES (6,"kathakali","Manavedan"); SET sql_mode= default; CREATE PROCEDURE p1() BEGIN PREPARE st FROM 'SELECT * FROM t WHERE a<=?' ; SET @a=3; EXECUTE st using @a; END| CALL p1()| a b name 1 kuchipudi Vempati 2 odissi Mohapatra 3 kathak Maharaj SELECT STATEMENT_NAME, SQL_TEXT, COUNT_EXECUTE, COUNT_REPREPARE, OWNER_OBJECT_TYPE, OWNER_OBJECT_SCHEMA, OWNER_OBJECT_NAME FROM performance_schema.prepared_statements_instances| STATEMENT_NAME SQL_TEXT COUNT_EXECUTE COUNT_REPREPARE OWNER_OBJECT_TYPE OWNER_OBJECT_SCHEMA OWNER_OBJECT_NAME st SELECT * FROM t WHERE a<=? 1 0 PROCEDURE db p1 DEALLOCATE PREPARE st| SELECT STATEMENT_NAME, SQL_TEXT, COUNT_EXECUTE, COUNT_REPREPARE, OWNER_OBJECT_TYPE, OWNER_OBJECT_SCHEMA, OWNER_OBJECT_NAME FROM performance_schema.prepared_statements_instances| STATEMENT_NAME SQL_TEXT COUNT_EXECUTE COUNT_REPREPARE OWNER_OBJECT_TYPE OWNER_OBJECT_SCHEMA OWNER_OBJECT_NAME CREATE PROCEDURE p2() BEGIN PREPARE st1 FROM 'INSERT INTO t SELECT * FROM t WHERE a<=?' ; END| CALL p2()| SELECT STATEMENT_NAME, SQL_TEXT, COUNT_EXECUTE, COUNT_REPREPARE, OWNER_OBJECT_TYPE, OWNER_OBJECT_SCHEMA, OWNER_OBJECT_NAME FROM performance_schema.prepared_statements_instances| STATEMENT_NAME SQL_TEXT COUNT_EXECUTE COUNT_REPREPARE OWNER_OBJECT_TYPE OWNER_OBJECT_SCHEMA OWNER_OBJECT_NAME st1 INSERT INTO t SELECT * FROM t WHERE a<=? 0 0 PROCEDURE db p2 SET @a=4| EXECUTE st1 using @a| SELECT STATEMENT_NAME, SQL_TEXT, COUNT_EXECUTE, COUNT_REPREPARE, OWNER_OBJECT_TYPE, OWNER_OBJECT_SCHEMA, OWNER_OBJECT_NAME FROM performance_schema.prepared_statements_instances| STATEMENT_NAME SQL_TEXT COUNT_EXECUTE COUNT_REPREPARE OWNER_OBJECT_TYPE OWNER_OBJECT_SCHEMA OWNER_OBJECT_NAME st1 INSERT INTO t SELECT * FROM t WHERE a<=? 1 0 PROCEDURE db p2 CREATE PROCEDURE p3() BEGIN SET @a=2; EXECUTE st1 using @a; END| CALL p3()| SELECT STATEMENT_NAME, SQL_TEXT, COUNT_EXECUTE, COUNT_REPREPARE, OWNER_OBJECT_TYPE, OWNER_OBJECT_SCHEMA, OWNER_OBJECT_NAME FROM performance_schema.prepared_statements_instances| STATEMENT_NAME SQL_TEXT COUNT_EXECUTE COUNT_REPREPARE OWNER_OBJECT_TYPE OWNER_OBJECT_SCHEMA OWNER_OBJECT_NAME st1 INSERT INTO t SELECT * FROM t WHERE a<=? 2 0 PROCEDURE db p2 DEALLOCATE PREPARE st1| SELECT STATEMENT_NAME, SQL_TEXT, COUNT_EXECUTE, COUNT_REPREPARE, OWNER_OBJECT_TYPE, OWNER_OBJECT_SCHEMA, OWNER_OBJECT_NAME FROM performance_schema.prepared_statements_instances| STATEMENT_NAME SQL_TEXT COUNT_EXECUTE COUNT_REPREPARE OWNER_OBJECT_TYPE OWNER_OBJECT_SCHEMA OWNER_OBJECT_NAME PREPARE st2 FROM 'UPDATE t SET a=a+1 WHERE b=?'| SELECT STATEMENT_NAME, SQL_TEXT, COUNT_EXECUTE, COUNT_REPREPARE, OWNER_OBJECT_TYPE, OWNER_OBJECT_SCHEMA, OWNER_OBJECT_NAME FROM performance_schema.prepared_statements_instances| STATEMENT_NAME SQL_TEXT COUNT_EXECUTE COUNT_REPREPARE OWNER_OBJECT_TYPE OWNER_OBJECT_SCHEMA OWNER_OBJECT_NAME st2 UPDATE t SET a=a+1 WHERE b=? 0 0 NULL NULL NULL CREATE PROCEDURE p4() BEGIN SET @b='kuchipudi'; EXECUTE st2 USING @b; END| CALL p4()| SELECT STATEMENT_NAME, SQL_TEXT, COUNT_EXECUTE, COUNT_REPREPARE, OWNER_OBJECT_TYPE, OWNER_OBJECT_SCHEMA, OWNER_OBJECT_NAME FROM performance_schema.prepared_statements_instances| STATEMENT_NAME SQL_TEXT COUNT_EXECUTE COUNT_REPREPARE OWNER_OBJECT_TYPE OWNER_OBJECT_SCHEMA OWNER_OBJECT_NAME st2 UPDATE t SET a=a+1 WHERE b=? 1 0 NULL NULL NULL ALTER TABLE t DROP COLUMN name; # COUNT_REPREPARE must be 1 CALL p4()| SELECT STATEMENT_NAME, SQL_TEXT, COUNT_EXECUTE, COUNT_REPREPARE, OWNER_OBJECT_TYPE, OWNER_OBJECT_SCHEMA, OWNER_OBJECT_NAME FROM performance_schema.prepared_statements_instances| STATEMENT_NAME SQL_TEXT COUNT_EXECUTE COUNT_REPREPARE OWNER_OBJECT_TYPE OWNER_OBJECT_SCHEMA OWNER_OBJECT_NAME st2 UPDATE t SET a=a+1 WHERE b=? 2 1 NULL NULL NULL DEALLOCATE PREPARE st2| SELECT STATEMENT_NAME, SQL_TEXT, COUNT_EXECUTE, COUNT_REPREPARE, OWNER_OBJECT_TYPE, OWNER_OBJECT_SCHEMA, OWNER_OBJECT_NAME FROM performance_schema.prepared_statements_instances| STATEMENT_NAME SQL_TEXT COUNT_EXECUTE COUNT_REPREPARE OWNER_OBJECT_TYPE OWNER_OBJECT_SCHEMA OWNER_OBJECT_NAME CREATE PROCEDURE p5() BEGIN SET @a=1; SELECT @a; END| PREPARE st3 FROM 'CALL p5()'| SELECT STATEMENT_NAME, SQL_TEXT, COUNT_EXECUTE, COUNT_REPREPARE, OWNER_OBJECT_TYPE, OWNER_OBJECT_SCHEMA, OWNER_OBJECT_NAME FROM performance_schema.prepared_statements_instances| STATEMENT_NAME SQL_TEXT COUNT_EXECUTE COUNT_REPREPARE OWNER_OBJECT_TYPE OWNER_OBJECT_SCHEMA OWNER_OBJECT_NAME st3 CALL p5() 0 0 NULL NULL NULL EXECUTE st3| @a 1 SELECT STATEMENT_NAME, SQL_TEXT, COUNT_EXECUTE, COUNT_REPREPARE, OWNER_OBJECT_TYPE, OWNER_OBJECT_SCHEMA, OWNER_OBJECT_NAME FROM performance_schema.prepared_statements_instances| STATEMENT_NAME SQL_TEXT COUNT_EXECUTE COUNT_REPREPARE OWNER_OBJECT_TYPE OWNER_OBJECT_SCHEMA OWNER_OBJECT_NAME st3 CALL p5() 1 0 NULL NULL NULL DEALLOCATE PREPARE st3| SELECT STATEMENT_NAME, SQL_TEXT, COUNT_EXECUTE, COUNT_REPREPARE, OWNER_OBJECT_TYPE, OWNER_OBJECT_SCHEMA, OWNER_OBJECT_NAME FROM performance_schema.prepared_statements_instances| STATEMENT_NAME SQL_TEXT COUNT_EXECUTE COUNT_REPREPARE OWNER_OBJECT_TYPE OWNER_OBJECT_SCHEMA OWNER_OBJECT_NAME CREATE TABLE tab(a INT); SET GLOBAL event_scheduler=ON; CREATE EVENT e1 ON SCHEDULE EVERY 10 HOUR DO BEGIN PREPARE st FROM 'INSERT INTO tab VALUES(?)'; SET @a=1; EXECUTE st USING @a; END| SELECT * FROM tab LIMIT 1; a 1 SET GLOBAL event_scheduler=OFF; SELECT STATEMENT_NAME, SQL_TEXT, COUNT_EXECUTE, COUNT_REPREPARE, OWNER_OBJECT_TYPE, OWNER_OBJECT_SCHEMA, OWNER_OBJECT_NAME FROM performance_schema.prepared_statements_instances; STATEMENT_NAME SQL_TEXT COUNT_EXECUTE COUNT_REPREPARE OWNER_OBJECT_TYPE OWNER_OBJECT_SCHEMA OWNER_OBJECT_NAME TRUNCATE TABLE performance_schema.prepared_statements_instances; TRUNCATE TABLE performance_schema.events_statements_history_long; DROP TABLE t; DROP TABLE tab; DROP PROCEDURE p1; DROP PROCEDURE p2; DROP PROCEDURE p3; DROP PROCEDURE p4; DROP PROCEDURE p5; DROP EVENT IF EXISTS e1; DROP DATABASE db;