HBase教程

HBase 计数和截断

计数

您可以使用 count 命令计算表的行数。其语法如下:
count ‘<table name>’ 
删除第一行后,emp 表会有两行。如下图验证。
hbase(main):023:0> count 'emp'
2 row(s) in 0.090 seconds
⇒ 2 

截断

此命令禁用删除并重新创建表。 truncate 的语法如下:
hbase> truncate 'table name'

示例

下面给出的是 truncate 命令的例子。这里我们截断了 emp 表。
hbase(main):011:0> truncate 'emp'
Truncating 'one' table (it may take a while):
  -Disabling table...
  -Truncating table...
   0 row(s) in 1.5950 seconds
截断表后,使用scan命令进行验证。你会得到一个零行的表格。
hbase(main):017:0> scan ‘emp’
ROW                  COLUMN + CELL
0 row(s) in 0.3110 seconds
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4