# Percona MySQL Index Bug

**URL:** <https://forums.percona.com/t/percona-mysql-index-bug/7553>\
**Category:** Percona Server for MySQL 5.7\
**Created:** [April 17, 2020, 10:31am UTC](https://forums.percona.com/t/percona-mysql-index-bug/7553 "2020-04-17T10:31:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sqlercn](https://avatars.discourse-cdn.com/v4/letter/s/a88e57/32.png) [@sqlercn](https://forums.percona.com/u/sqlercn)\
**Post date:** [April 17, 2020, 10:31am UTC](https://forums.percona.com/t/percona-mysql-index-bug/7553/1 "2020-04-17T10:31:09Z")

</div>

My table schema is&nbsp;

```auto
CREATE TABLE test (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT ,
`class_id` int(11) unsigned NOT NULL DEFAULT '0' ,
`stu_id` int(11) unsigned NOT NULL DEFAULT '0' ,
`work_id` int(11) unsigned NOT NULL DEFAULT '0',
`img_id` int(11) unsigned NOT NULL DEFAULT '0' ,
`commit_id` int(11) unsigned NOT NULL DEFAULT '0' ,
`test_id` int(11) unsigned NOT NULL DEFAULT '0',
`audio_ids` varchar(500) NOT NULL DEFAULT '0' ,
`correct_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ,
`is_wrong` tinyint(1) unsigned NOT NULL DEFAULT '0' ,
`status` tinyint(1) unsigned NOT NULL DEFAULT '0' ,
PRIMARY KEY (`id`),
KEY `commit_id` (`commit_id`),
KEY `correct_time` (`correct_time`),
KEY `commit_test` (`commit_id`,`test_id`)
) ENGINE=InnoDB AUTO_INCREMENT=242058182 

```

my query this table for commit\_id =&nbsp;93317439 and commit\_id =&nbsp;93317438&nbsp;

```auto
explain select count(*) from test where commit_id=93317438
+----+-------------+------------------------+------------+------+---------------+-----------+---------+-------+------
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra 
+----+-------------+------------------------+------------+------+---------------+-----------+---------+-------+------
| 1 | SIMPLE | test| NULL | ref | commit_id | commit_id | 4 | const | 1 | 100.00 | Using index |
+----+-------------+------------------------+------------+------+---------------+-----------+---------+-------+------
explain select count(*) from test where commit_id=93317439
+----+-------------+------------------------+------------+------+-----------------------+-----------+---------+-------
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+------------------------+------------+------+-----------------------+-----------+---------+-------| 1 | SIMPLE | test| NULL | ref | commit_id,commit_test | commit_id | 4 | const | 44587972 | 100.00 | Using index |
+----+-------------+------------------------+------------+------+-----------------------+-----------+---------+-------

```

but commit\_id=93317439 only 2 rows

---

<div class="post-metadata">

**Author:** ![lorraine.pocklington](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/lorraine.pocklington/32/37_2.png) [@lorraine.pocklington](https://forums.percona.com/u/lorraine.pocklington)\
**Post date:** [April 21, 2020, 4:00am UTC](https://forums.percona.com/t/percona-mysql-index-bug/7553/2 "2020-04-21T04:00:55Z")

</div>

Hello @sqlercn   
What were you expecting to see here and how does it differ from the result you had?&nbsp;
