MySQL Forums
Forum List  »  InnoDB

Re: Select count very slow
Posted by: soufiane wahi
Date: May 23, 2017 11:10AM

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

Options: ReplyQuote


Subject
Views
Written By
Posted
6311
May 22, 2017 09:32AM
1935
May 22, 2017 11:24AM
1418
May 22, 2017 11:38AM
1183
May 23, 2017 10:43AM
Re: Select count very slow
1196
May 23, 2017 11:10AM
1181
May 23, 2017 02:24PM
1259
May 23, 2017 04:05PM
1384
May 23, 2017 08:04PM


Sorry, you can't reply to this topic. It has been closed.

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.