0

table structure :

CREATE TABLE `table` (
  `ID` char(36) NOT NULL,
  `Value` varchar(21000) DEFAULT NULL,
  `Content` mediumblob,
  `CRDateTime` datetime NOT NULL,
  `Status` int(11) NOT NULL,
  PRIMARY KEY (`ID`),
  UNIQUE KEY `ID_UNIQUE` (`ID`),
  KEY `Time_INDEX` (`CRDateTime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Value has 100 strs , Content field is empty , the table has 60000 rows

another table:

CREATE TABLE `table2` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  PRIMARY KEY (`ID`),
  UNIQUE KEY `ID_UNIQUE` (`ID`),
  UNIQUE KEY `name_UNIQUE` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

table has 0 row , it's a empty table , no delete and update\insert action , only select

some slow query in log like this:

Id: 14568

Query_time: 10.935600 Lock_time: 0.000000 Rows_sent: 0 Rows_examined: 0

SET timestamp=1484230695; SELECT * FROM table WHERE (ID = 'aaaaaaaa') LIMIT 2;

Query_time: 11.700000 Lock_time: 0.000000 Rows_sent: 1 Rows_examined: 1

SET timestamp=1486821357; SELECT GroupBy1.A1 AS C1 FROM (SELECT COUNT(1) AS A1 FROM table2 AS Extent1 WHERE (Extent1.name = '24977496') AND ('24977496' IS NOT NULL)) AS GroupBy1;

windows server 2008 r2 mysql 5.6.19

On the peak , all table query have this problem

Eeh
  • 1
  • 1
  • How big is the table. What is the structure of the table. Is there a index on ID? – Raymond Nijland Feb 24 '17 at 11:39
  • `id is pk` , But its type is text ? – Oto Shavadze Feb 24 '17 at 11:40
  • if it is big table data then you can select specific filed which you want and add index , if id primary key then then id = 'aaaa' i think not correct also – Shafiqul Islam Feb 24 '17 at 12:09
  • yes, id data type is CHAR(36) , and the table has 60000 rows , only 5 fields , very small , another table also has the same slow query , but the table has 0 row , it's a empty table , has 2 fields , id(pk,int) and name(varchar(11)) , in peak period time – Eeh Feb 24 '17 at 12:45
  • A `PRIMARY KEY` is a `UNIQUE`, so `DROP INDEX ID_UNIQUE` in both tables. – Rick James Feb 25 '17 at 02:12

0 Answers0