summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/perfschema/include/show_aggregate.inc
blob: 4489cf7a37b7fb78c3bc37ce49cfc49064e654e0 (plain)
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
############### suite/perfschema/include/show_aggregate.inc ####################
#                                                                              #
# Gather status by thread, by user, by host, by account and global.            #
#                                                                              #
################################################################################

--echo #=================
--echo # Global results
--echo #=================
USE test;
UPDATE test.status_results sr, performance_schema.global_status sg
  SET sr.stop = sg.variable_value
  WHERE sr.variable_name = sg.variable_name
    AND sg.variable_name IN ('handler_delete', 'handler_rollback');
--echo #
--echo # Global deltas: END - START.
UPDATE test.status_results sr
  SET sr.delta = sr.stop - sr.start;

#--echo DEBUG
#SELECT * FROM test.status_results;
#SELECT * from performance_schema.global_status where variable_name in ('handler_delete', 'handler_rollback');

--echo #=================
--echo # Status by thread
--echo #=================
--echo # Thread results from CON1.
UPDATE test.status_results sr, performance_schema.status_by_thread sbt
  SET sr.t1 = sbt.variable_value
  WHERE sr.variable_name = sbt.variable_name
    AND sbt.variable_name IN ('handler_delete', 'handler_rollback')
    AND sbt.thread_id = @con1_id;
--echo #
--echo # Thread results from CON2.
UPDATE test.status_results sr, performance_schema.status_by_thread sbt
  SET sr.t2 = sbt.variable_value
  WHERE sr.variable_name = sbt.variable_name
    AND sbt.variable_name IN ('handler_delete', 'handler_rollback')
    AND sbt.thread_id = @con2_id;
--echo #
--echo # Thread results from CON3.
UPDATE test.status_results sr, performance_schema.status_by_thread sbt
  SET sr.t3 = sbt.variable_value
  WHERE sr.variable_name = sbt.variable_name
    AND sbt.variable_name IN ('handler_delete', 'handler_rollback')
    AND sbt.thread_id = @con3_id;
--echo #
--echo # Thread totals for 3 connections.
UPDATE test.status_results sr
  SET sr.thread = sr.t1 + sr.t2 + sr.t3;

--echo #=================
--echo # Status by user
--echo #=================
--echo # User1
UPDATE test.status_results sr, performance_schema.status_by_user sbu
  SET sr.u1 = sbu.variable_value
  WHERE sr.variable_name = sbu.variable_name
    AND sbu.variable_name IN ('handler_delete', 'handler_rollback')
    AND sbu.user IN ('user1');
--echo #
--echo # User2
UPDATE test.status_results sr, performance_schema.status_by_user sbu
  SET sr.u2 = sbu.variable_value
  WHERE sr.variable_name = sbu.variable_name
    AND sbu.variable_name IN ('handler_delete', 'handler_rollback')
    AND sbu.user IN ('user2');
--echo #
--echo # User3
UPDATE test.status_results sr, performance_schema.status_by_user sbu
  SET sr.u3 = sbu.variable_value
  WHERE sr.variable_name = sbu.variable_name
    AND sbu.variable_name IN ('handler_delete', 'handler_rollback')
    AND sbu.user IN ('user3');
--echo #
--echo # Status totals for 3 users.
UPDATE test.status_results sr
  SET sr.user = sr.u1 + sr.u2 + sr.u3;

--echo #===========================
--echo # Status by host (localhost)
--echo #===========================
--echo #
--echo # host1 = localhost
UPDATE test.status_results sr, performance_schema.status_by_host sbh
  SET sr.h1 = sbh.variable_value
  WHERE sr.variable_name = sbh.variable_name
    AND sbh.variable_name IN ('handler_delete', 'handler_rollback')
    AND sbh.host IN ('localhost');
--echo #
--echo # Status totals for 'localhost' only.
UPDATE test.status_results sr
  SET sr.host = sr.h1 + sr.h2 + sr.h3;

--echo #==================
--echo # Status by account
--echo #==================
--echo # User1@localhost
UPDATE test.status_results sr, performance_schema.status_by_account sba
  SET sr.a1 = sba.variable_value
  WHERE sr.variable_name = sba.variable_name
    AND sba.variable_name IN ('handler_delete', 'handler_rollback')
    AND sba.user IN ('user1');
--echo #
--echo # User2@localhost
UPDATE test.status_results sr, performance_schema.status_by_account sba
  SET sr.a2 = sba.variable_value
  WHERE sr.variable_name = sba.variable_name
    AND sba.variable_name IN ('handler_delete', 'handler_rollback')
    AND sba.user IN ('user2');
--echo #
--echo # User3@localhost
UPDATE test.status_results sr, performance_schema.status_by_account sba
  SET sr.a3 = sba.variable_value
  WHERE sr.variable_name = sba.variable_name
    AND sba.variable_name IN ('handler_delete', 'handler_rollback')
    AND sba.user IN ('user3');
--echo #
--echo #
--echo # Status totals for 3 accounts.
UPDATE test.status_results sr
  SET sr.acct = sr.a1 + sr.a2 + sr.a3;

#--echo DEBUG
#SELECT * FROM test.status_results;