简体   繁体   中英

Hbase design to scan table

I have data format

timestame (long), useid (long) ,value(String)

I want to put data to Hbase.And i have to scan this table daily.So i intent to set rowkey is timestame. If i want to scan in date 1 and date 2 , i will scan rowkey r > date 1 and rowkey r < date2.

But rowkey is increased steadily (ex:1352029502000, 1352029502001 , 1352029502003 ... ) that insert is very slow.

What is the best hbase table schema in this case ?

Thanks.

The common way to avoid a hot-spot when handling timestamp or other monotonously increasing keys is to add some prefix before it (see for example OpenTSDB schema .

you can also add arbitrary key (say the last digit from the timestamp) and get arbitrary partitions (10 in the example).

Note, however, that when you add a prefix you have to scan all the prefixes so your reads become more complicated (but actually map-reduce will also work better)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM