Bug #115372 Please consider adding fields to P_S "Digest" table.
Submitted: 18 Jun 17:43 Modified: 18 Jun 17:52
Reporter: Jean-François Gagné Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Performance Schema Severity:S4 (Feature request)
Version:8.4, 8.0 OS:Any
Assigned to: CPU Architecture:Any

[18 Jun 17:43] Jean-François Gagné
Description:
Hi,

There could be more fields in the P_S "digest" table (performance_schema.events_statements_summary_by_digest).  I can think of at least nine (name from slow query log file, the first two always being in the file, the other seven being there with log_slow_extra = ON):

- Bytes_received and Bytes_sent;
- Read_first, Read_last, Read_key, Read_next, Read_prev, Read_rnd and Read_rnd_next.

I would expect all relevant fields from the slow query log file to be in the table performance_schema.events_statements_summary_by_digest.

Related: Bug#114961 for adding field from the digest table in the slow query log file.

Related: Bug#89637 and WL#12393 for adding log_slow_extra and the fields Read_first, Read_last, Read_key, Read_next, Read_prev, Read_rnd and Read_rnd_next.

Many thanks for looking into this,

Jean-François Gagné

How to repeat:
N/A to feature request, but...

(below copied from Bug#114961)

This is an example of a slow log entry with log_slow_extra...

# Time: 2024-05-10T19:41:28.293662Z
# User@Host: msandbox[msandbox] @ localhost []  Id:    15
# Query_time: 0.000256  Lock_time: 0.000005 Rows_sent: 0  Rows_examined: 0 Thread_id: 15 Errno: 0 Killed: 0 Bytes_received: 22 Bytes_sent: 56 Read_first: 1 Read_last: 0 Read_key: 1 Read_next: 0 Read_prev: 0 Read_rnd: 0 Read_rnd_next: 1 Sort_merge_passes: 0 Sort_range_count: 0 Sort_rows: 0 Sort_scan_count: 0 Created_tmp_disk_tables: 0 Created_tmp_tables: 0 Start: 2024-05-10T19:41:28.293406Z End: 2024-05-10T19:41:28.293662Z
SET timestamp=1715370088;
select * from t;

And this is the structure of the table performance_schema.events_statements_summary_by_digest.

mysql [localhost:8400] {msandbox} ((none)) > show create table performance_schema.events_statements_summary_by_digest\G
*************************** 1. row ***************************
       Table: events_statements_summary_by_digest
Create Table: CREATE TABLE `events_statements_summary_by_digest` (
  `SCHEMA_NAME` varchar(64) DEFAULT NULL,
  `DIGEST` varchar(64) DEFAULT NULL,
  `DIGEST_TEXT` longtext,
  `COUNT_STAR` bigint unsigned NOT NULL,
  `SUM_TIMER_WAIT` bigint unsigned NOT NULL,
  `MIN_TIMER_WAIT` bigint unsigned NOT NULL,
  `AVG_TIMER_WAIT` bigint unsigned NOT NULL,
  `MAX_TIMER_WAIT` bigint unsigned NOT NULL,
  `SUM_LOCK_TIME` bigint unsigned NOT NULL,
  `SUM_ERRORS` bigint unsigned NOT NULL,
  `SUM_WARNINGS` bigint unsigned NOT NULL,
  `SUM_ROWS_AFFECTED` bigint unsigned NOT NULL,
  `SUM_ROWS_SENT` bigint unsigned NOT NULL,
  `SUM_ROWS_EXAMINED` bigint unsigned NOT NULL,
  `SUM_CREATED_TMP_DISK_TABLES` bigint unsigned NOT NULL,
  `SUM_CREATED_TMP_TABLES` bigint unsigned NOT NULL,
  `SUM_SELECT_FULL_JOIN` bigint unsigned NOT NULL,
  `SUM_SELECT_FULL_RANGE_JOIN` bigint unsigned NOT NULL,
  `SUM_SELECT_RANGE` bigint unsigned NOT NULL,
  `SUM_SELECT_RANGE_CHECK` bigint unsigned NOT NULL,
  `SUM_SELECT_SCAN` bigint unsigned NOT NULL,
  `SUM_SORT_MERGE_PASSES` bigint unsigned NOT NULL,
  `SUM_SORT_RANGE` bigint unsigned NOT NULL,
  `SUM_SORT_ROWS` bigint unsigned NOT NULL,
  `SUM_SORT_SCAN` bigint unsigned NOT NULL,
  `SUM_NO_INDEX_USED` bigint unsigned NOT NULL,
  `SUM_NO_GOOD_INDEX_USED` bigint unsigned NOT NULL,
  `SUM_CPU_TIME` bigint unsigned NOT NULL,
  `MAX_CONTROLLED_MEMORY` bigint unsigned NOT NULL,
  `MAX_TOTAL_MEMORY` bigint unsigned NOT NULL,
  `COUNT_SECONDARY` bigint unsigned NOT NULL,
  `FIRST_SEEN` timestamp(6) NOT NULL,
  `LAST_SEEN` timestamp(6) NOT NULL,
  `QUANTILE_95` bigint unsigned NOT NULL,
  `QUANTILE_99` bigint unsigned NOT NULL,
  `QUANTILE_999` bigint unsigned NOT NULL,
  `QUERY_SAMPLE_TEXT` longtext,
  `QUERY_SAMPLE_SEEN` timestamp(6) NOT NULL,
  `QUERY_SAMPLE_TIMER_WAIT` bigint unsigned NOT NULL,
  UNIQUE KEY `SCHEMA_NAME` (`SCHEMA_NAME`,`DIGEST`)
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
1 row in set (0.00 sec)
[18 Jun 17:47] MySQL Verification Team
Salut Monsieur Gagne,

Thank you for the feature request.

We consider this a valuable addition to our Performance Schema.

Verified as reported for the version 8.0 and higher.
[18 Jun 17:52] Jean-François Gagné
(adding version: was set to 8.0 by default, setting to 8.4 and 8.0)