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
140
May 22, 2017 09:32AM
72
May 22, 2017 11:24AM
60
May 22, 2017 11:38AM
65
May 23, 2017 10:43AM
Re: Select count very slow
105
May 23, 2017 11:10AM
56
May 23, 2017 02:24PM
66
May 23, 2017 04:05PM
65
May 23, 2017 08:04PM


Sorry, only registered users may post in this forum.

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.