history

MySQL分页查询优化

邮差的信 提交于 2019-12-10 04:03:12
当需要从数据库查询的表有上万条记录的时候,一次性查询所有结果会变得很慢,特别是随着数据量的增加特别明显,这时需要使用分页查询。对于数据库分页查询,也有很多种方法和优化的点。下面简单说一下我知道的一些方法。 准备工作 为了对下面列举的一些优化进行测试,下面针对已有的一张表进行说明。 表名:order_history 描述:某个业务的订单历史表 主要字段:unsigned int id,tinyint(4) int type 字段情况:该表一共37个字段,不包含text等大型数据,最大为varchar(500),id字段为索引,且为递增。 数据量:5709294 MySQL版本:5.7.16 线下找一张百万级的测试表可不容易,如果需要自己测试的话,可以写shell脚本什么的插入数据进行测试。 以下的 sql 所有语句执行的环境没有发生改变,下面是基本测试结果: select count(*) from orders_history; 返回结果:5709294 三次查询时间分别为: 8903 ms 8323 ms 8401 ms 一般分页查询 一般的分页查询使用简单的 limit 子句就可以实现。limit 子句声明如下: SELECT * FROM table LIMIT [offset,] rows | rows OFFSET offset LIMIT 子句可以被用于指定

MPEG-4 Part 2 had some awesome face- and body- motion concepts, but they disappeared in MPEG-4 Part 10 (H.264). Why?

被刻印的时光 ゝ 提交于 2019-12-10 02:34:50
问题 During the last few weeks, I had the opportunity to read two documents: The MPEG-4 Part 2 specification (ISO/IEC 14496-2), which people just call "mpeg-4" The MPEG-4 Part 10 specification (ISO/IEC 14496-10), which is also called "h.264" or "AVC" After having read all the cool ideas in "mpeg-4" like identifying facial expression, motion of limbs of people, and sprites, I got really excited. The ideas sound very fun, maybe even fantastic, for an idea from 1999. But then I read the "h.264"

History of access control modifiers such as public/private/protected

人盡茶涼 提交于 2019-12-10 00:50:16
问题 How did these keywords and concepts come to life? What were the forces and problems that made them appear? What was the first language to have them? Actually, it's not just about public / private / protected , but rather the whole range of keywords that enforce some rules ( abstract , final , internal ). But, please, do not assume things. Answer if you know at least part of the answer or answer if you lived those moments. References are greatly appreciated. 回答1: Simula (1967), considered to

Linux命令:history命令历史的管理及用

自闭症网瘾萝莉.ら 提交于 2019-12-10 00:49:27
  bash可以保存的过去曾经执行过的命令。当某个用户登录到shell中,会读取该用户家目录中的~/.bash_history文件,并将历史命令列表保存到内存中。当用户退出当前shell时,会将内存中的历史命令列表覆盖至~/.bash_history文件。   我们可以通过# histroy 来查看历史命令。history是bash的内部命令。通过# help history获取帮助。 一、history的常见选项 # history 。。。 # 省略前面 994 man poweroff 995 poweroff --reboot 996 man poweroff 997 man shutdown 998 shutdown +2 "Goodbye SB" 999 shutdown -c 1000 man rm 1001 info rm 1002 man history 1003 enable 1004 enable | grep history 1005 help history 1006 history 1007 history -d 1000 1008 history 1009 echo $HISTORYSIZE 1010 history # history -c 清空命令历史记录 # history -d N N为整数,删除历史中序号是N的命令 # history N

What happened on Dec 31 1969 at 7:00 PM

孤人 提交于 2019-12-09 14:03:38
问题 Every time in PHP when I make a variable such as this one: $date = strtotime($row['date']); $date = date("M d Y \a\\t g:i A", $date); // Mmm dd YYYY at h:mm PM/AM and somehow row['date'] happens to be 0, the date Dec 31 1969 at 7:00 PM is displayed on the screen? Google does not tell me much, I was wondering if this date had any significances. 回答1: The Unix epoch is the time 00:00:00 UTC on 1 January 1970. This is the reference point for all time stamps. When you use PHP's date/time functions

js监听返回事件

那年仲夏 提交于 2019-12-09 07:23:13
最近项目需要,微信中监听用户的点击返回按钮的事件,执行相应处理。 在网上搜了,处理方法基本类似。找了个可以正常使用,记录下来,也感谢原文作者。 原理:在页面中我们可以使用javascript window history,后退到前面页面,但是由于安全原因javascript不允许修改history里已有的url链接,但可以使用pushState方法往history里增加url链接,并且提供popstate事件监测从history栈里弹出url。既然有提供popstate事件监测,那么我们就可以进行监听。 具体实现代码如下: $(function(){ pushHistory(); window.addEventListener("popstate", function(e) { alert("我监听到了浏览器的返回按钮事件啦");//根据自己的需求实现自己的功能 }, false); function pushHistory() { var state = { title: "title", url: "#" }; window.history.pushState(state, "title", "#"); } }); 可以实现返回事件,但是关闭事件一直无法获取。希望知道的同学可以给我留言,谢谢! 原文地址: http://blog.csdn.net/zhengyang7754

JS监听浏览器的返回事件

你。 提交于 2019-12-09 07:20:36
最近在实现一个需求,要求监听浏览器的返回操作,百度之后都是这个方法,原理如下: 在页面中我们可以使用javascript window history,后退到前面页面,但是由于安全原因javascript不允许修改history里已有的url链接,但可以使用pushState方法往history里增加url链接,并且提供popstate事件监测从history栈里弹出url。既然有提供popstate事件监测,那么我们就可以进行监听。 $(function(){ pushHistory(); window.addEventListener("popstate", function(e) { alert("监听到返回按钮事件啦"); //根据自己的需求实现自己的功能 //window.location.href = 'https://www.baidu.com' }, false); function pushHistory() { var state = { title: "title", url: "#" }; window.history.pushState(state, "title", "#"); } }); 来源: CSDN 作者: 柏灿 链接: https://blog.csdn.net/shan1991fei/article/details/84107087

Git subtree merge strategy, possible without merging history?

一世执手 提交于 2019-12-09 04:56:56
问题 I've been trying to move away from submodules in order to get a self-contained repository, and the subtree merge strategy seems to match this use-case. However the merged repos' histories appear in my own project's history, which is reather annoying. I've tried git filter-branch --subdirectory-filter path/to/subtree/ HEAD which works... until I try to update a subtree with git pull -s subtree my-subtree master which rewrites all the subtree's files to my project's root. Is there a way to

Why was argument dependent lookup invented?

帅比萌擦擦* 提交于 2019-12-09 03:02:26
问题 Why was argument dependent lookup (ADL) invented? Is it just so we can write cout << stuff instead of std::operator<<(cout, stuff) ? If that is the case, why wasn't ADL limited to operators instead of all functions? Could the introduction of ADL have been prevented if C++ had had some other way to do generic output of both built-in and user-defined types, for example a type-safe printf via variadic templates? 回答1: ADL was invented to allow the Interface Principle: The Interface Principle For

Clojure : 'lein repl' history grepping?

孤街浪徒 提交于 2019-12-08 17:19:11
问题 I often find myself executing commands like this at bash : history | grep 'find' For example to look up a fancy find / xargs command i might have ran. Im wondering --- where does the "lein repl" store its historical data ? It would be nice to know, because then I could write a leingrep.sh script, which simply grepped through the lein history session. It is obvious that this is on disk somewhere, since history is preserved from one repl to the next. 回答1: Lein is using either readline (if you