在Trafodion数据库中,我们经常需要对一个超大表进行扫描,如count,或者查询大批量的数量,这无疑对性能是一个严峻的考验。
针对这种超大数据集的查询计算,Trafodion利用HBase snapshot特性提高性能,关于HBase snapshot的概念及Trafodion中如何使用snpashot提升性能如下,
什么是snapshot?
A snapshot is a set of metadata information that allows an admin to get back to a previous state of the table. A snapshot is not a copy of the table; it’s just a list of file names and doesn’t copy the data. A full snapshot restore means that you get back to the previous “table schema” and you get back your previous data losing any changes made since the snapshot was taken.
关于snapshot的更多内容,请参考官方文档: http://blog.cloudera.com/blog/2013/03/introduction-to-apache-hbase-snapshots/
在Trafodion中使用snapshot?
- 创建表的snapshot
hbase shell
snapshot 'tablename', 'snapshot_name'
- 使用cqd
cqd hbase_coprocessors 'off';
cqd traf_table_snapshot_scan 'latest';
使用cqd后通过explain查看详细计划可以看到下面几行,表示执行计划已经使用snapshot方式来做count(*)
use_snapshot_scan ...... TRUE
full_table_name ........ TRAFODION.SEABASE.XXX
snapshot_name .......... SNAPSHOT_XXX
snapshot_temp_location /bulkload/20170720030104/