| 1 |
############### suite/perfschema/include/show_aggregate.inc #################### |
| 2 |
# # |
| 3 |
# Gather status by thread, by user, by host, by account and global. # |
| 4 |
# # |
| 5 |
################################################################################ |
| 6 |
|
| 7 |
--echo #================= |
| 8 |
--echo # Global results |
| 9 |
--echo #================= |
| 10 |
USE test; |
| 11 |
UPDATE test.status_results sr, performance_schema.global_status sg |
| 12 |
SET sr.stop = sg.variable_value |
| 13 |
WHERE sr.variable_name = sg.variable_name |
| 14 |
AND sg.variable_name IN ('handler_delete', 'handler_rollback'); |
| 15 |
--echo |
| 16 |
--echo # Global deltas: END - START. |
| 17 |
UPDATE test.status_results sr |
| 18 |
SET sr.delta = sr.stop - sr.start; |
| 19 |
|
| 20 |
#--echo DEBUG |
| 21 |
#SELECT * FROM test.status_results; |
| 22 |
#SELECT * from performance_schema.global_status where variable_name in ('handler_delete', 'handler_rollback'); |
| 23 |
|
| 24 |
--echo #================= |
| 25 |
--echo # Status by thread |
| 26 |
--echo #================= |
| 27 |
--echo # Thread results from CON1. |
| 28 |
UPDATE test.status_results sr, performance_schema.status_by_thread sbt |
| 29 |
SET sr.t1 = sbt.variable_value |
| 30 |
WHERE sr.variable_name = sbt.variable_name |
| 31 |
AND sbt.variable_name IN ('handler_delete', 'handler_rollback') |
| 32 |
AND sbt.thread_id = @con1_id; |
| 33 |
--echo |
| 34 |
--echo # Thread results from CON2. |
| 35 |
UPDATE test.status_results sr, performance_schema.status_by_thread sbt |
| 36 |
SET sr.t2 = sbt.variable_value |
| 37 |
WHERE sr.variable_name = sbt.variable_name |
| 38 |
AND sbt.variable_name IN ('handler_delete', 'handler_rollback') |
| 39 |
AND sbt.thread_id = @con2_id; |
| 40 |
--echo |
| 41 |
--echo # Thread results from CON3. |
| 42 |
UPDATE test.status_results sr, performance_schema.status_by_thread sbt |
| 43 |
SET sr.t3 = sbt.variable_value |
| 44 |
WHERE sr.variable_name = sbt.variable_name |
| 45 |
AND sbt.variable_name IN ('handler_delete', 'handler_rollback') |
| 46 |
AND sbt.thread_id = @con3_id; |
| 47 |
--echo |
| 48 |
--echo # Thread totals for 3 connections. |
| 49 |
UPDATE test.status_results sr |
| 50 |
SET sr.thread = sr.t1 + sr.t2 + sr.t3; |
| 51 |
|
| 52 |
--echo #================= |
| 53 |
--echo # Status by user |
| 54 |
--echo #================= |
| 55 |
--echo # User1 |
| 56 |
UPDATE test.status_results sr, performance_schema.status_by_user sbu |
| 57 |
SET sr.u1 = sbu.variable_value |
| 58 |
WHERE sr.variable_name = sbu.variable_name |
| 59 |
AND sbu.variable_name IN ('handler_delete', 'handler_rollback') |
| 60 |
AND sbu.user IN ('user1'); |
| 61 |
--echo |
| 62 |
--echo # User2 |
| 63 |
UPDATE test.status_results sr, performance_schema.status_by_user sbu |
| 64 |
SET sr.u2 = sbu.variable_value |
| 65 |
WHERE sr.variable_name = sbu.variable_name |
| 66 |
AND sbu.variable_name IN ('handler_delete', 'handler_rollback') |
| 67 |
AND sbu.user IN ('user2'); |
| 68 |
--echo |
| 69 |
--echo # User3 |
| 70 |
UPDATE test.status_results sr, performance_schema.status_by_user sbu |
| 71 |
SET sr.u3 = sbu.variable_value |
| 72 |
WHERE sr.variable_name = sbu.variable_name |
| 73 |
AND sbu.variable_name IN ('handler_delete', 'handler_rollback') |
| 74 |
AND sbu.user IN ('user3'); |
| 75 |
--echo |
| 76 |
--echo # Status totals for 3 users. |
| 77 |
UPDATE test.status_results sr |
| 78 |
SET sr.user = sr.u1 + sr.u2 + sr.u3; |
| 79 |
|
| 80 |
--echo #=========================== |
| 81 |
--echo # Status by host (localhost) |
| 82 |
--echo #=========================== |
| 83 |
--echo |
| 84 |
--echo # host1 = localhost |
| 85 |
UPDATE test.status_results sr, performance_schema.status_by_host sbh |
| 86 |
SET sr.h1 = sbh.variable_value |
| 87 |
WHERE sr.variable_name = sbh.variable_name |
| 88 |
AND sbh.variable_name IN ('handler_delete', 'handler_rollback') |
| 89 |
AND sbh.host IN ('localhost'); |
| 90 |
--echo |
| 91 |
--echo # Status totals for 'localhost' only. |
| 92 |
UPDATE test.status_results sr |
| 93 |
SET sr.host = sr.h1 + sr.h2 + sr.h3; |
| 94 |
|
| 95 |
--echo #================== |
| 96 |
--echo # Status by account |
| 97 |
--echo #================== |
| 98 |
--echo # User1@localhost |
| 99 |
UPDATE test.status_results sr, performance_schema.status_by_account sba |
| 100 |
SET sr.a1 = sba.variable_value |
| 101 |
WHERE sr.variable_name = sba.variable_name |
| 102 |
AND sba.variable_name IN ('handler_delete', 'handler_rollback') |
| 103 |
AND sba.user IN ('user1'); |
| 104 |
--echo |
| 105 |
--echo # User2@localhost |
| 106 |
UPDATE test.status_results sr, performance_schema.status_by_account sba |
| 107 |
SET sr.a2 = sba.variable_value |
| 108 |
WHERE sr.variable_name = sba.variable_name |
| 109 |
AND sba.variable_name IN ('handler_delete', 'handler_rollback') |
| 110 |
AND sba.user IN ('user2'); |
| 111 |
--echo |
| 112 |
--echo # User3@localhost |
| 113 |
UPDATE test.status_results sr, performance_schema.status_by_account sba |
| 114 |
SET sr.a3 = sba.variable_value |
| 115 |
WHERE sr.variable_name = sba.variable_name |
| 116 |
AND sba.variable_name IN ('handler_delete', 'handler_rollback') |
| 117 |
AND sba.user IN ('user3'); |
| 118 |
--echo |
| 119 |
--echo |
| 120 |
--echo # Status totals for 3 accounts. |
| 121 |
UPDATE test.status_results sr |
| 122 |
SET sr.acct = sr.a1 + sr.a2 + sr.a3; |
| 123 |
|
| 124 |
#--echo DEBUG |
| 125 |
#SELECT * FROM test.status_results; |