Hummer TimeSeries DB 优势功能(操作)介绍

Hummer TimeSeries DB 针对时序数据存储和查询进行了特色优化,尤其适合时序数据高速写入、按时段(以及key)进行快速查询、数据量估算、数据快速删除 。 接下来来我们就查询优势场景进行简要介绍(我们已Demo 中tpass表为例说明——该表时间跨度1年、pkt 格式)。


给定时段查询
按时间范围查询会利用到时序引擎数序按时间排序优势 —— 数据按时间聚集,顺序连续扫描速度最优。
如:
select count(*) from tpass where  pass_time > unix_timestamp('2014-01-01 00:00:00') * 1000 and pass_time < unix_timestamp('2014-02-05 00:00:00') * 1000 

给定时段聚合计算
按时间段聚合雨按时间段查询类似
select  avg(speed) from tpass where  pass_time > unix_timestamp('2014-01-01 00:00:00') * 1000 and pass_time < unix_timestamp('2014-01-05 00:00:00') * 1000 

给定时段时间正序查询
存储按照时间有序,所以获取时段内最老记录很高效
select * from tpass order by  pass_time limit 10 

给定时段时间倒序查询
存储按照时间有序,所以获取时段内最新记录很高效
select * from tpass order by  pass_time desc limit 10 

给定时段精确key确查询
PKT格式对于给定key精确检索效率很高    —— key 在时段内被有序聚集
select count(*) from tpass where car_card_num='京A27TFG' and pass_time > unix_timestamp('2014-01-01 00:00:00') * 1000 and pass_time < unix_timestamp('2014-02-01 00:00:00') * 1000

给定时段模糊key前缀查询
PKT格式对于前缀key模糊检索效率也很高 —— key 在时段内被有序聚集
select count(*) from tpass where car_card_num like '京A2%' and pass_time > unix_timestamp('2014-01-01 00:00:00') * 1000 and pass_time < unix_timestamp('2014-02-01 00:00:00') * 1000

给定时段精确key聚合计算
select max(speed) from tpass where car_card_num like '京A27TFG' and pass_time > unix_timestamp('2014-01-01 00:00:00') * 1000 and pass_time < unix_timestamp('2014-02-01 00:00:00') * 1000 
给定时段模糊key前缀聚合计算
select max(speed) from tpass where car_card_num like '京A2%' and pass_time > unix_timestamp('2014-01-01 00:00:00') * 1000 and pass_time < unix_timestamp('2014-02-01 00:00:00') * 1000 

给定时段数据记录快速统计/记录大小快速估计(所谓估计是近似估计——如果要准确估计需进行一次整理)
Hummer TimeSeries 支持快速按时间段计算数据量:选择时间起始和结束范围,执行统计操作(下图分别是全年和半年的数据统计结果)


按时段快速删除数据
Hummer TimeSeries 支持按时间段快速删除数据:选定时间起始和结束范围,执行清理操作(再执行整理和统计操作验证结果)



数据随机乱序写入
insert into tpass values('TESTCAR',1500000000000,'aaaa','bbbb',1,'黑','卡车',50,'宝马','轿车','黑','超速','1','京','1')


数据更新、删除——记录见 《Hummer TimeSeries DB 中关于RowId 的使用》 一文


动态建表

create table t_pass (

  car_card_num string comment 'nullable=false',

  pass_time bigint comment 'nullable=false',

  toll_gate_red_id string comment 'length=8,nullable=false',

  road_id string comment 'length=6,nullable=false',

  car_card_type int comment 'nullable=false',

  car_card_color string comment 'length=3,nullable=false',

  car_type string comment 'length=6,nullable=false',

  speed int comment 'nullable=false',

  brand string comment 'length=6,nullable=false',

  car_sharp string comment 'length=6,nullable=false',

  car_color string comment 'length=3,nullable=false',

  paccancy_type string comment 'length=6,nullable=false',

  run_direct string comment 'length=1,nullable=false',

  car_card_loc string comment 'length=3,nullable=false',

  execute_state string comment 'length=1,nullable=false'

) with serdeproperties("hummer.db.columns.mapping" = "key=car_card_num,timestamp=pass_time")

stored as HUMMERFILE TBLPROPERTIES("zkAddress"="10.0.11.120:2181","tablename"="t_pass","keyType"="pkt");


Schema属性有定长,变长,可空等;

表属性有分片数"FragmentSize"=" ?"(默认为没个磁盘一分片)、副本数"ReplicSize"=" ?"(默认为三)

key 属性有唯一和非唯一两种 —— key=xxx代表唯一,index=xxx代表非唯一


动态删表

drop table t_pass;



Hummer TimeSeries DB Dock DEMO 介绍文章和下载见  http://blog.csdn.net/kanghua/article/details/44653149



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值