Drew..

15

请注意,这并不是建议使用MyISAM一分钟.我只是用它来得到我的id,min,max和count来排队.所以请忽略引擎.

create table ratings

( id int auto_increment primary key,

thing int null

)engine=MyISAM;

insert ratings (thing) values (null),(null),(null),(null),(null),(null),(null),(null),(null);

insert ratings (thing) select thing from ratings;

insert ratings (thing) select thing from ratings;

insert ratings (thing) select thing from ratings;

insert ratings (thing) select thing from ratings;

insert ratings (thing) select thing from ratings;

insert ratings (thing) select thing from ratings;

insert ratings (thing) select thing from ratings;

insert ratings (thing) select thing from ratings;

insert ratings (thing) select thing from ratings;

insert ratings (thing) select thing from ratings;

insert ratings (thing) select thing from ratings;

insert ratings (thing) select thing from ratings;

insert ratings (thing) select thing from ratings;

insert ratings (thing) select thing from ratings;

insert ratings (thing) select thing from ratings;

insert ratings (thing) select thing from ratings;

insert ratings (thing) select thing from ratings;

insert ratings (thing) select thing from ratings;

insert ratings (thing) select thing from ratings;

我现在有4.7M行

select count(*),min(id),max(id) from ratings;

+----------+---------+---------+

| count(*) | min(id) | max(id) |

+----------+---------+---------+

| 4718592 | 1 | 4718592 |

+----------+---------+---------+

select * from `ratings` order by id limit 499500, 500;

-- 1 second on a dumpy laptop

.

explain select * from `ratings` order by id limit 499500, 500;

+----+-------------+---------+------+---------------+------+---------+------+---------+----------------+

| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |

+----+-------------+---------+------+---------------+------+---------+------+---------+----------------+

| 1 | SIMPLE | ratings | ALL | NULL | NULL | NULL | NULL | 4718592 | Using filesort |

+----+-------------+---------+------+---------------+------+---------+------+---------+----------------+

.

explain select * from `ratings` where id>=499501 limit 500;

+----+-------------+---------+-------+---------------+---------+---------+------+---------+-----------------------+

| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |

+----+-------------+---------+-------+---------------+---------+---------+------+---------+-----------------------+

| 1 | SIMPLE | ratings | range | PRIMARY | PRIMARY | 4 | NULL | 4198581 | Using index condition |

+----+-------------+---------+-------+---------------+---------+---------+------+---------+-----------------------+

故事的道德可能是使用where子句.

人们不能排除陷入僵局的可能性.

mysql 一分钟内_MySQL语句需要超过一分钟才能执行相关推荐

  1. mysql 忽略语法错误_MYSQL语句中易忽略的语法错误 | 学步园

    $str="CREATE TABLE test ( id int( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY , name VARCHAR( 255 ...

  2. mysql函数做条件_MySQL语句优化(三):避免条件字段做函数操作

    今天跟各位分享一个生产环境慢查询的例子,是一个比较典型的"条件字段使用了函数导致无法走索引"的例子. 一.定位慢查询 首先发现慢查询告警,通过运维平台看到慢查询主要是下面这条:SE ...

  3. mysql日期加天_MySql日期加天数,小时,分钟...得到新的时间

    在当前的日期上加三天,天数随便改: SELECT date_add(CURRENT_DATE(), interval 3 day); 在指定的日期上加三天: SELECT date_add('2014 ...

  4. mysql产生大量数据_mysql语句批量产生大量测试数据

    CREATE TABLE `t_user` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `name` varchar(255) DEFAULT NULL, ` ...

  5. 微信回应“取消两分钟内删除功能”;甲骨文裁撤北京中心;Redis 6.0.6 发布| 极客头条

    整理 | 屠敏 头图 | CSDN 下载自东方 IC 「极客头条」-- 技术人员的新闻圈! CSDN 的读者朋友们早上好哇,「极客头条」来啦,快来看今天都有哪些值得我们技术人关注的重要新闻吧. 扫描二 ...

  6. mysql or优化_MySQL 语句优化

    官方文档放这里,有什么代码先到官方文档查询: MySQL 8.0 Reference Manual :: 8 Optimization​dev.mysql.com 优化涉及多个级别的配置,调整和测量性 ...

  7. mysql 关联查询慢_mysql慢查询语句分析总结

    我们经常会接触到MySQL,也经常会遇到一些MySQL的性能问题.我们可以借助慢查询日志和explain命令初步分析出SQL语句存在的性能问题 通过SHOW FULL PROCESSLIST查看问题 ...

  8. mysql 日期减10分钟_获取当前时间减去10分钟的话SQL语句怎么写

    获取当前时间减去10分钟的话SQL语句怎么写 Mysql日期和时间函数不求人 本文出自:http://linuxdb.yeah.net 作者: 晏子 (2001-07-05 15:00:00) 对于每 ...

  9. mysql sql 时间比较_mysql中sql语句进行日期比较

    这里是一个使用日期函数的例子.下面的查询选择了所有记录,其date_col的值是在最后30天以内: mysql> SELECT something FROM table WHERE TO_DAY ...

最新文章

  1. OpenCV(十)ROI感兴趣区域
  2. 10个角度分析软件工程师应该知道的100件事
  3. CSS中float属性详解
  4. 采购订单增强(根据公司代码、采购订单类型等相关订单信息给采购订单税码设置默认值)
  5. java自动定义一个map类_自定义实现Map类 高效版
  6. win service 2003 和 win service2008 区别
  7. C#之获取网页标题...
  8. golang panic的错误回收和简单的使用场景
  9. 在未启动程序情况 点击视图设计器 弹出未将对象引用窗体的解决方案
  10. 七夕来临!来支付宝“结个婚”吧 全国5个省市可用
  11. 电脑网络怎么添加计算机,Win10系统如何添加网络共享打印机
  12. 不吹不黑 | 聊聊为什么要用99%精度的数据回测
  13. 苹果ppt_我用PPT复刻了苹果公司的宣传广告,这是对PPT平滑功能的极致应用!
  14. 【9.4】socket模拟http请求
  15. xcode工程编译错误:The maximum number of apps for free development profiles has been reached.
  16. java中的多态与继承_Java中继承与多态
  17. 4.企业应用架构模式 --- Web表现层
  18. 方维直播最新版服务端网站搭建3.1--1
  19. 跳槽面试时不能说的六大离职理由
  20. Android Manifest功能与权限描述大全,flutter安装androidsdk

热门文章

  1. MySQL索引分析和优化(转)
  2. MCPlayerKit 0.0.6 Release
  3. 深入理解React(一)JSX与虚拟DOM
  4. Python+OpenCV图像处理(十五)—— 圆检测
  5. 开发自己的 chart - 每天5分钟玩转 Docker 容器技术(167)
  6. Oracle关于java.sql.SQLException常见错误集锦
  7. Mads Torgersen介绍C# 7及后续版本新特性
  8. Html5必看:教你如何选择移动APP开发框架
  9. Redis数据类型操作(五) —— Sorted Set
  10. Kendo UI开发教程(23): 单页面应用(一)概述