HBase - Count & Truncate
You can count the number of rows of a table using the count command. Its syntax is as follows:
count ‘<table name>’
After deleting the first row, emp table will have two rows. Verify it as shown below.
hbase(main):023:0> count 'emp' 2 row(s) in 0.090 seconds ⇒ 2
This command disables drops and recreates a table. The syntax of truncate is as follows:
hbase> truncate 'table name'
Given below is the example of truncate command. Here we have truncated the emp table.
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
After truncating the table, use the scan command to verify. You will get a table with zero rows.
hbase(main):017:0> scan ‘emp’ ROW COLUMN + CELL 0 row(s) in 0.3110 seconds