数据库性能测试

select count(*) from AHBDDATA_DATAPROCESS_HISTORY.Ga_Gps_History_2017_02_15

(17229387  8.315s)

2月15号的表的记录大约1700万条数据

110216_0cLi_2693297.png

 

  select count(*) from AHBDDATA_DATAPROCESS_HISTORY.Ga_Gps_History_2017_02_17

(1107824 0.6s)

2月17号的表的记录大约110万条数据

 

select gpsid,max(time) from AHBDDATA_DATAPROCESS_HISTORY.Ga_Gps_History_2017_02_15 group by gpsid (14s  353条记录) 13秒

查询离线时间14秒了 如果加关联的估计 15秒

select gpsid,max(time) from AHBDDATA_DATAPROCESS_HISTORY.Ga_Gps_History_2017_02_17 group by gpsid (94条记录 0.609)  0.8 0.9 都出现过
 

 

 

1700/110 约等于15  13/0.8 = 16.25 

100万条记录 相当于0.8秒

 

 

 

 

 

 

 

 

where 过滤条件 把记录数变少 用时

where time>to_date('2017/2/15 00:00:00','yyyy-mm-dd hh24:mi:ss')

854945条记录

离线查询用时 331条记录 0.85秒

where time>to_date('2017/2/15 18:00:00','yyyy-mm-dd hh24:mi:ss')

42855条记录

离线查询用时 303条记录 0.15秒

where time>to_date('2017/2/14 18:00:00','yyyy-mm-dd hh24:mi:ss')

1947531条记录

  (334 1.653) 离线查询用时 334条记录 1.653秒

 

 

where time>to_date('2017/2/10 18:00:00','yyyy-mm-dd hh24:mi:ss')

过滤完6142347条记录

离线查询用时 338条记录 5秒

 

where time>to_date('2017/2/1 00:00:00','yyyy-mm-dd hh24:mi:ss')

过滤完有 1100万条记录

离线查询用时 343条记录 12秒


 

根上个结论差不多
  
 

 

 

 

 

当查询的结果包括轨迹x,y

 

  select * from
 select q.*,row_number() over(partition by gpsid order by time desc) rn 
 from  AHBDDATA_DATAPROCESS_HISTORY.Ga_Gps_History_2017_02_17  q
) t where t.rn <=1
 大约110万条记录 3.6s 

select * from AHBDDATA_DATAPROCESS_HISTORY.Ga_Gps_History_2017_02_15 x1 ,
    (select gpsid,max(time) time from AHBDDATA_DATAPROCESS_HISTORY.Ga_Gps_History_2017_02_15  group by gpsid ) x2
    where x1.gpsid=x2.gpsid and x1.time=x2.time

走索引的话 大概也是1700万调数据13

 

 

跟结果集也有关系 100万条记录 结果1万条是2

 

 

 

离线表的问题

100万条*(0.8)8秒  1000万

1000万 3000台数据 一年的时间 (一天3000条 一年300天 900000万 10年 9000000 )

1万条是2秒  3000条0.6s

主要就是10年

转载于:https://my.oschina.net/xcOschina/blog/893064

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值