Bug #116058 row_examined in slowlog is not correct when using index_merge

Submitted: 11 Sep 2024 9:13 Modified: 12 Sep 2024 1:38
Reporter: Luodan Zhang Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Logging Severity:S3 (Non-critical)
Version:8.0.35 OS:Any
Assigned to: CPU Architecture:Any

[11 Sep 2024 9:13] Luodan Zhang
Description:
row_examined in slowlog is not correct when using index_merge

How to repeat:
1. prepare table and data
CREATE TABLE `test_merge` (
  `id` int NOT NULL AUTO_INCREMENT,
  `c1` int DEFAULT NULL,
  `c2` int DEFAULT NULL,
  `c3` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_c1` (`c1`),
  KEY `idx_c2` (`c2`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

INSERT INTO `test_merge` VALUES (1,1,2,'a'),(2,1,3,'a'),(3,1,4,'a'),(4,1,5,'a'),(5,3,2,'a'),(6,4,2,'a'),(7,5,2,'a'),(8,6,2,'a'),(9,2,2,'a'),(10,2,3,'a'),(11,2,4,'a'),(12,2,5,'a'),(13,2,6,'a');

2. execute sql and observe slowlog comparing with performance_schema.table_io_waits_summary_by_index_usage

explain select * from test_merge where c1=1 and c2=2;   -- Ensure Extra: Using intersect(idx_c1,idx_c2);

truncate table performance_schema.table_io_waits_summary_by_index_usage;

select OBJECT_TYPE,OBJECT_SCHEMA,OBJECT_NAME,INDEX_NAME,COUNT_STAR,COUNT_READ,COUNT_WRITE,COUNT_FETCH,COUNT_INSERT,COUNT_UPDATE,COUNT_DELETE  from performance_schema.table_io_waits_summary_by_index_usage where object_schema='test'
and object_name='test_merge';   -- count_xxx: 0

set long_query_time=0;

select * from test_merge where c1=1 and c2=2;

-- slow log:Rows_examined: 0   not correct
# Time: 2024-09-11T09:05:32.035131Z
# User@Host: root[root] @ xxx [xxx]  Id:  2438
# Query_time: 0.000474  Lock_time: 0.000003 Rows_sent: 1  Rows_examined: 0 Execution_time: 0.000471
SET timestamp=1726045532;
select * from test_merge where c1=1 and c2=2;

select OBJECT_TYPE,OBJECT_SCHEMA,OBJECT_NAME,INDEX_NAME,COUNT_STAR,COUNT_READ,COUNT_WRITE,COUNT_FETCH,COUNT_INSERT,COUNT_UPDATE,COUNT_DELETE  from performance_schema.table_io_waits_summary_by_index_usage where object_schema='test'
and object_name='test_merge';   -- count_xxx increased
[11 Sep 2024 15:25] MySQL Verification Team
Hello Luodan Zhang,

Thank you for the report and feedback.

regards,
Umesh
[12 Sep 2024 1:38] Luodan Zhang
It looks similiar with https://bugs.mysql.com/bug.php?id=112959

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.051 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.