File: idx_prepared_statements_instances.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (92 lines) | stat: -rw-r--r-- 2,715 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Performance schema tests generally depend on specific query plans
# and behavior, and much of the perfschema suite is therefore disabled
# if the hypergraph optimizer is active.
--source include/not_hypergraph.inc

# Tests for PERFORMANCE_SCHEMA

# Setup
let $select_column = SUM_ERRORS;
let $table = performance_schema.prepared_statements_instances;

delimiter //;

create procedure proc1(a int, b int)
BEGIN
  prepare st1 from 'SELECT SQRT(POW(?,2) + POW(?,2)) AS hypotenuse';
  execute st1 using @a, @b;
END //

delimiter ;//

SET @a = 3;
SET @b = 4;
call proc1(@a, @b);

select OBJECT_INSTANCE_BEGIN, STATEMENT_ID, STATEMENT_NAME,
       OWNER_THREAD_ID, OWNER_EVENT_ID,
       OWNER_OBJECT_TYPE, OWNER_OBJECT_SCHEMA, OWNER_OBJECT_NAME
  from performance_schema.prepared_statements_instances
  limit 1
  into @oib, @stmt_id, @stmt_name, @o_tid, @o_eid,
       @o_otype, @o_oschema, @o_oname;

###########################################################################
# Test index on OBJECT_INSTANCE_BEGIN
###########################################################################

let $column_count = 1;
let $col1 = OBJECT_INSTANCE_BEGIN;
let $col1_act = @oib;

--source ../include/idx_explain_test.inc

###########################################################################
# Test index on STATEMENT_ID
###########################################################################

let $column_count = 1;
let $col1 = STATEMENT_ID;
let $col1_act = @stmt_id;

--source ../include/idx_explain_test.inc

###########################################################################
# Test index on STATEMENT_NAME
###########################################################################

let $column_count = 1;
let $col1 = STATEMENT_NAME;
let $col1_act = @stmt_name;

--source ../include/idx_explain_test.inc

###########################################################################
# Test index on OWNER_THREAD_ID, OWNER_EVENT_ID
###########################################################################

let $column_count = 2;
let $col1 = OWNER_THREAD_ID;
let $col2= OWNER_EVENT_ID;
let $col1_act = @o_tid;
let $col2_act = @o_eid;

--source ../include/idx_explain_test.inc

###########################################################################
# Test index on  OWNER_OBJECT_TYPE, OWNER_OBJECT_SCHEMA, OWNER_OBJECT_NAME
###########################################################################

let $column_count = 3;
let $col1 = OWNER_OBJECT_TYPE;
let $col2 = OWNER_OBJECT_SCHEMA;
let $col3 = OWNER_OBJECT_NAME;
let $col1_act = @o_otype;
let $col2_act = @o_oschema;
let $col3_act = @o_oname;

--source ../include/idx_explain_test.inc

# Cleanup
deallocate prepare st1;
drop procedure proc1;