Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit 1870b32

Browse files
committed
Update statements_with_full_table_scans.sql
adding db, rows_sent_avg, rows_examined_avg, first_seen, last_seen
1 parent 54f1d76 commit 1870b32

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

views/p_s/statements_with_full_table_scans.sql

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,38 @@
66
* then by the number of times the statement executed
77
*
88
* mysql> select * from statements_with_full_table_scans limit 5;
9-
* +-------------------------------------------------------------------+------------+---------------------+--------------------------+-------------------+-----------+---------------+----------------------------------+
10-
* | query | exec_count | no_index_used_count | no_good_index_used_count | no_index_used_pct | rows_sent | rows_examined | digest |
11-
* +-------------------------------------------------------------------+------------+---------------------+--------------------------+-------------------+-----------+---------------+----------------------------------+
12-
* | SELECT DISTINCTROW `agent0_` . ... ERE `agent0_` . `id` IN (...) | 1474 | 1474 | 0 | 100 | 2948 | 2948 | 4f5d5cc354ebb4746ccb71d9c750e978 |
13-
* | SELECT COUNT ( * ) FROM `INFOR ... NE = ? AND `SUPPORT` IN (...) | 1228 | 1228 | 0 | 100 | 1228 | 11052 | 491ee7143ca1d98f36c24d7eb6d25272 |
14-
* | SELECT DISTINCTROW `mysqlconne ... conne0_` . `socketPath` AS ... | 1135 | 1132 | 0 | 100 | 5 | 3393 | 15024988ff6ff3510057b48ca2dfd5d3 |
15-
* | SELECT `InterfaceAddress4` . ` ... . `hid` WHERE `Os` . `id` = ? | 1132 | 1132 | 0 | 100 | 7924 | 82588 | 42d79211cc5e82e32e00340bc6a50b14 |
16-
* | SELECT COUNT ( * ) FROM `infor ... NAME = ? AND `index_name` = ? | 772 | 772 | 0 | 100 | 772 | 3301 | c8a721d366327a8170d4260fe789941a |
17-
* +-------------------------------------------------------------------+------------+---------------------+--------------------------+-------------------+-----------+---------------+----------------------------------+
18-
* 5 rows in set (0.03 sec) *
9+
* +-------------------------------------------------------------------+-------+------------+---------------------+--------------------------+-------------------+-----------+---------------+---------------+-------------------+---------------------+---------------------+----------------------------------+
10+
* | query | db | exec_count | no_index_used_count | no_good_index_used_count | no_index_used_pct | rows_sent | rows_examined | rows_sent_avg | rows_examined_avg | first_seen | last_seen | digest |
11+
* +-------------------------------------------------------------------+-------+------------+---------------------+--------------------------+-------------------+-----------+---------------+---------------+-------------------+---------------------+---------------------+----------------------------------+
12+
* | SELECT `InterfaceAddress4` . ` ... . `hid` WHERE `Os` . `id` = ? | mem | 355189 | 355277 | 0 | 100 | 404862 | 4987778 | 1 | 14 | 2013-12-04 20:04:54 | 2013-12-18 18:54:34 | 42d79211cc5e82e32e00340bc6a50b14 |
13+
* | SELECT COUNT ( * ) FROM `INFOR ... NE = ? AND `SUPPORT` IN (...) | mysql | 172765 | 172776 | 0 | 100 | 172773 | 1554966 | 1 | 9 | 2013-12-04 20:04:52 | 2013-12-18 18:54:34 | 491ee7143ca1d98f36c24d7eb6d25272 |
14+
* | SELECT CAST ( `SUM_NUMBER_OF_B ... HERE `EVENT_NAME` = ? LIMIT ? | mysql | 100455 | 100455 | 0 | 100 | 100455 | 3094014 | 1 | 31 | 2013-12-04 20:04:52 | 2013-12-18 18:54:34 | b5a370d80095c69a2085547e3a24f552 |
15+
* | SELECT COUNT ( * ) FROM `INFOR ... CHEMA` = ? AND TABLE_NAME = ? | mysql | 80360 | 80360 | 0 | 100 | 80360 | 0 | 1 | 0 | 2013-12-04 20:05:37 | 2013-12-18 18:54:34 | 6567aa2ac8ad7fe7831b4114dee7c849 |
16+
* | SELECT DISTINCTROW `mysqlconne ... conne0_` . `socketPath` AS ... | mem | 67832 | 67821 | 0 | 100 | 92 | 406943 | 0 | 6 | 2013-12-04 20:04:54 | 2013-12-18 18:54:34 | fc358ad6384cc77adff425602a0a8fc1 |
17+
* +-------------------------------------------------------------------+-------+------------+---------------------+--------------------------+-------------------+-----------+---------------+---------------+-------------------+---------------------+---------------------+----------------------------------+
18+
* 5 rows in set (0.02 sec)
1919
*
20-
* (Example from 5.6.6)
20+
* (Example from 5.6.14)
2121
*
22-
* Versions: 5.6.5+
22+
* Versions: 5.6.9+
2323
*
2424
*/
2525

2626
DROP VIEW IF EXISTS statements_with_full_table_scans;
2727

2828
CREATE SQL SECURITY INVOKER VIEW statements_with_full_table_scans AS
2929
SELECT ps_helper.format_statement(DIGEST_TEXT) AS query,
30+
SCHEMA_NAME as db,
3031
COUNT_STAR AS exec_count,
3132
SUM_NO_INDEX_USED AS no_index_used_count,
3233
SUM_NO_GOOD_INDEX_USED AS no_good_index_used_count,
3334
ROUND((SUM_NO_INDEX_USED / COUNT_STAR) * 100) AS no_index_used_pct,
3435
SUM_ROWS_SENT AS rows_sent,
3536
SUM_ROWS_EXAMINED AS rows_examined,
37+
ROUND(SUM_ROWS_SENT/COUNT_STAR) AS rows_sent_avg,
38+
ROUND(SUM_ROWS_EXAMINED/COUNT_STAR) AS rows_examined_avg,
39+
FIRST_SEEN as first_seen,
40+
LAST_SEEN as last_seen,
3641
DIGEST AS digest
3742
FROM performance_schema.events_statements_summary_by_digest
3843
WHERE SUM_NO_INDEX_USED > 0

0 commit comments

Comments
 (0)