The query is:
select * from record where treated = 0;
The explain is :
+----+-------------+--------+------------+------+---------------+------+---------+------+----------+----------+-------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+--------+------------+------+---------------+------+---------+------+----------+----------+-------------+
| 1 | SIMPLE | record | NULL | ALL | NULL | NULL | NULL | NULL | 22520495 | 10.00 | Using where |
+----+-------------+--------+------------+------+---------------+------+---------+------+----------+----------+-------------+
The schema is :
CREATE TABLE `record` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`altitude` smallint(6) DEFAULT NULL,
`counter` double DEFAULT NULL,
`datetime` datetime NOT NULL,
`details` longtext,
`deviation` smallint(6) DEFAULT NULL,
`engine` smallint(6) DEFAULT NULL,
`event` smallint(6) DEFAULT NULL,
`fuel_level` double DEFAULT NULL,
`gsm_level` int(11) DEFAULT NULL,
`latitude` double NOT NULL,
`longitude` double NOT NULL,
`satellite` smallint(6) DEFAULT NULL,
`speed` smallint(6) DEFAULT NULL,
`time` time NOT NULL,
`treated` tinyint(1) NOT NULL DEFAULT '0',
`id_driver` bigint(20) DEFAULT NULL,
`id_vehicle_device` bigint(20) NOT NULL,
PRIMARY KEY (`id`),
KEY `FK_ai9y9d52lx1xvtaiv3w0x60a5` (`id_driver`),
KEY `FK_ilwlg0mt87bxyemx4tov1elni` (`id_vehicle_device`),
CONSTRAINT `FK_ai9y9d52lx1xvtaiv3w0x60a5` FOREIGN KEY (`id_driver`) REFERENCES `driver` (`id`),
CONSTRAINT `FK_ilwlg0mt87bxyemx4tov1elni` FOREIGN KEY (`id_vehicle_device`) REFERENCES `vehicle_device` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=29911571 DEFAULT CHARSET=latin1