Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用主键中断MySQL行检查_Mysql_Sql_Database - Fatal编程技术网

使用主键中断MySQL行检查

使用主键中断MySQL行检查,mysql,sql,database,Mysql,Sql,Database,考虑: id int(primary key , unique) status enum('enable','disable') round tinyint(1) (index) core tinyint(1) (index) timestamp int(10) (index) 我在一个大约有1800000行的表中得到了一个查询。有这样一个查询: SELECT * FROM tblmatch WHERE status = 'disable' and round

考虑:

id int(primary key , unique)   
status enum('enable','disable')   
round tinyint(1) (index)  
core tinyint(1) (index)  
timestamp int(10) (index)
我在一个大约有1800000行的表中得到了一个查询。有这样一个查询:

SELECT *  
FROM  tblmatch 
WHERE status = 'disable' 
  and round=0 
  AND core = 3 
  AND time_stamp < UNIX_TIMESTAMP() 
ORDER BY time_stamp ASC 
LIMIT 0,10

然而,row考试是一样的。有没有办法打破排考?

你说的“*排考”到底是什么意思?这在“数据库世界”中不是一个常用术语。id是否从1开始?我没有看到任何自动增量。发布一些示例数据。实际上它记录在我的慢速查询日志中,需要6-10秒。那排考试也在那里!PEACE,你能详细说明什么是“行检查”吗?完整的
SHOW CREATE TABLE
&
EXPLAIN
输出比你总结它更有用。你能分享一下吗?另外,
显示tablename中的索引
可能有助于提高索引的基数。另一方面:如果有1.8M行,然后假设id大于1.6M,则只选择其顶部,则可能不正确。这取决于活动的
id
是什么。
SELECT * 
FROM tblmatch 
WHERE id > 1600000 
  AND status = 'disable' 
  and round=0 
  AND time_stamp < UNIX_TIMESTAMP() 
ORDER BY time_stamp ASC 
LIMIT 0,10