上一页 1 2 3 4 5 6 7 8 9 ··· 58 下一页
  2015年7月5日
摘要: 1、考虑下面的方法void Print(const Student& s){ printf("Student[%s:%d]\n", s._Name.c_str(), s._Age);}2、方法Print接收一个Student对象,定义Student对象,并调用方法,有哪些方式?方式一: Stud... 阅读全文
posted @ 2015-07-05 10:31 Andy Niu 阅读(605) 评论(0) 推荐(0) 编辑
摘要: 1、考虑下面的需求,在一个int的vector中,找出一个比5的元素,容易想到的解决办法,定义一个方法对象,使用模板,如下:vector::iterator iter = find_if(intVec.begin(),intVec.end(),Finder(3));2、分析find_if的伪代码如下... 阅读全文
posted @ 2015-07-05 10:30 Andy Niu 阅读(1583) 评论(0) 推荐(0) 编辑
  2015年6月28日
摘要: 1、mysql执行查询计划,key_len表示索引使用的字节数,这个字节数和三个条件有关。mysql> create table t1(v1 char(10));Query OK, 0 rows affectedmysql> create index index_v1 on t1(v1);Query... 阅读全文
posted @ 2015-06-28 15:54 Andy Niu 阅读(10078) 评论(0) 推荐(0) 编辑
摘要: 1、执行计划就是在sql语句之前加上explain,使用desc 也可以。2、desc有两个选项extended和partitions,desc extended 将原sql语句进行优化,通过show warnings 可以看到优化后的sql语句。 desc partitions 可以查看使用分... 阅读全文
posted @ 2015-06-28 15:49 Andy Niu 阅读(346) 评论(0) 推荐(0) 编辑
  2015年6月27日
摘要: 场景:模拟一天的数据,每个10秒,遍历1000个设备,每个设备模拟一个实时数据,总的数据量为:24*60*60/10*1000 = 864万条记录。----------------------------------------------------------------------------... 阅读全文
posted @ 2015-06-27 20:50 Andy Niu 阅读(229) 评论(0) 推荐(0) 编辑
摘要: 1、场景,模拟一天的数据,每个10秒,遍历1000个设备,每个设备模拟一个实时数据,总的数据量为:24*60*60/10*1000 = 864万条记录。2、采用策略,对时间分段,拼接sql语句查询,对于一个设备,查询一天每个小时的平均值,时间开销186.757秒。3、现在考虑简单的情况,求一个小时的... 阅读全文
posted @ 2015-06-27 20:49 Andy Niu 阅读(236) 评论(0) 推荐(0) 编辑
摘要: 1、执行一个查询,发现时间开销都在sending data,为什么?2、sending data容易误导,让人以为只是发送数据给客户端,实际上sending data包含两个过程:读取数据并处理,发送给客户端,而时间开销都在读取数据并处理的过程中。 阅读全文
posted @ 2015-06-27 20:48 Andy Niu 阅读(424) 评论(0) 推荐(0) 编辑
摘要: 1、考虑下面的情况,mysql> desc student;+----------+-------------+------+-----+---------+-------+| Field | Type | Null | Key | Default | Extra |+-----... 阅读全文
posted @ 2015-06-27 20:46 Andy Niu 阅读(1100) 评论(0) 推荐(0) 编辑
摘要: insert 1、过滤一段时间内重复的数据2、数据缓存起来,批量写入select1、使用分区表2、主主复制,连接不同的mysql3、建立索引4、定时求平均值,写入一个新的表中 阅读全文
posted @ 2015-06-27 20:45 Andy Niu 阅读(986) 评论(0) 推荐(0) 编辑
摘要: 1、这里的int(11) 与int的大小和存储字节,没有一毛钱关系,int的存储字节是4个字节,最大值为 65536*65536 = 40多亿,对于有符号的int,是20多亿。2、那么这里的(11) 表示什么意思? 考虑下面的需求,ID字段显示宽度为2,宽度不够的补充0。3、测试如下:mysql> ... 阅读全文
posted @ 2015-06-27 20:44 Andy Niu 阅读(1415) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 58 下一页