|
2 | 2 | * Procedure: analyze_statement_digest() |
3 | 3 | * |
4 | 4 | * Parameters |
5 | | - * digest_in: The statement digest identifier you would like to analyze |
6 | | - * runtime: The number of seconds to run analysis for (defaults to a minute) |
7 | | - * interval_in: The interval (in seconds, may be fractional) at which to try |
8 | | - * and take snapshots (defaults to a second) |
9 | | - * start_fresh: Whether to TRUNCATE the events_statements_history_long and |
10 | | - * events_stages_history_long tables before starting (default false) |
11 | | - * auto_enable: Whether to automatically turn on required consumers (default false) |
| 5 | + * in_digest: The statement digest identifier you would like to analyze |
| 6 | + * in_runtime: The number of seconds to run analysis for (defaults to a minute) |
| 7 | + * in_interval: The interval (in seconds, may be fractional) at which to try |
| 8 | + * and take snapshots (defaults to a second) |
| 9 | + * in_start_fresh: Whether to TRUNCATE the events_statements_history_long and |
| 10 | + * events_stages_history_long tables before starting (default false) |
| 11 | + * in_auto_enable: Whether to automatically turn on required consumers (default false) |
12 | 12 | * |
13 | 13 | * mysql> call analyze_statement_digest('891ec6860f98ba46d89dd20b0c03652c', 10, 0.1, true, true); |
14 | 14 | * +--------------------+ |
@@ -110,9 +110,9 @@ DROP PROCEDURE IF EXISTS analyze_statement_digest; |
110 | 110 |
|
111 | 111 | DELIMITER $$ |
112 | 112 |
|
113 | | -CREATE PROCEDURE analyze_statement_digest(IN digest_in VARCHAR(32), IN runtime INT, |
114 | | - IN interval_in DECIMAL(2,2), IN start_fresh BOOLEAN, IN auto_enable BOOLEAN) |
115 | | - COMMENT 'Parameters: digest_in (varchar(32)), runtime (int), interval_in (decimal(2,2)), start_fresh (boolean), auto_enable (boolean)' |
| 113 | +CREATE PROCEDURE analyze_statement_digest(IN in_digest VARCHAR(32), IN in_runtime INT, |
| 114 | + IN in_interval DECIMAL(2,2), IN in_start_fresh BOOLEAN, IN in_auto_enable BOOLEAN) |
| 115 | + COMMENT 'Parameters: in_digest (varchar(32)), in_runtime (int), in_interval (decimal(2,2)), in_start_fresh (boolean), in_auto_enable (boolean)' |
116 | 116 | SQL SECURITY INVOKER |
117 | 117 | BEGIN |
118 | 118 |
|
@@ -152,33 +152,33 @@ BEGIN |
152 | 152 | PRIMARY KEY (event_id) |
153 | 153 | ); |
154 | 154 |
|
155 | | - SET v_start_fresh = start_fresh; |
| 155 | + SET v_start_fresh = in_start_fresh; |
156 | 156 | IF v_start_fresh THEN |
157 | 157 | TRUNCATE TABLE performance_schema.events_statements_history_long; |
158 | 158 | TRUNCATE TABLE performance_schema.events_stages_history_long; |
159 | 159 | END IF; |
160 | 160 |
|
161 | | - SET v_auto_enable = auto_enable; |
| 161 | + SET v_auto_enable = in_auto_enable; |
162 | 162 | IF v_auto_enable THEN |
163 | 163 | CALL ps_helper.save_current_config(); |
164 | 164 | END IF; |
165 | 165 |
|
166 | | - WHILE v_runtime < runtime DO |
| 166 | + WHILE v_runtime < in_runtime DO |
167 | 167 | SELECT UNIX_TIMESTAMP() INTO v_start; |
168 | 168 |
|
169 | 169 | INSERT IGNORE INTO stmt_trace |
170 | 170 | SELECT thread_id, timer_start, event_id, sql_text, timer_wait, lock_time, errors, mysql_errno, |
171 | 171 | rows_affected, rows_examined, created_tmp_tables, created_tmp_disk_tables, no_index_used |
172 | 172 | FROM performance_schema.events_statements_history_long |
173 | | - WHERE digest = digest_in; |
| 173 | + WHERE digest = in_digest; |
174 | 174 |
|
175 | 175 | INSERT IGNORE INTO stmt_stages |
176 | 176 | SELECT stages.event_id, stmt_trace.event_id, |
177 | 177 | stages.event_name, stages.timer_wait |
178 | 178 | FROM performance_schema.events_stages_history_long AS stages |
179 | 179 | JOIN stmt_trace ON stages.nesting_event_id = stmt_trace.event_id; |
180 | 180 |
|
181 | | - SELECT SLEEP(interval_in) INTO @sleep; |
| 181 | + SELECT SLEEP(in_interval) INTO @sleep; |
182 | 182 | SET v_runtime = v_runtime + (UNIX_TIMESTAMP() - v_start); |
183 | 183 | END WHILE; |
184 | 184 |
|
|
0 commit comments