HBASE如何提升根据rowkey前缀扫描?
如果rowkey设计为: rowkey=<userid>#<other-field> 查询某个指定用户userid用户下的所有数据,即按照userid来做前缀扫描,则可以使用前缀bloomfilter特性来提升查询性能,创建语法如下:
Add two bloom filter type : ROWPREFIX_FIXED_LENGTH and ROWPREFIX_DELIMITED
- ROWPREFIX_FIXED_LENGTH: specify the length of the prefix
- ROWPREFIX_DELIMITED: specify the delimiter of the prefix
Need to specify parameters for these two types of bloomfilter, otherwise the table will fail to create
Example:
create 't1', {NAME => 'f1', BLOOMFILTER => 'ROWPREFIX_FIXED_LENGTH', CONFIGURATION => {'RowPrefixBloomFilter.prefix_length' => '10'}}
create 't1', {NAME => 'f1', BLOOMFILTER => 'ROWPREFIX_DELIMITED', CONFIGURATION => {'RowPrefixDelimitedBloomFilter.delimiter' => '#'}}
https://issues.apache.org/jira/browse/HBASE-20636
该特性HBASE 2.2.0版本以后支持
网友评论