count
Definition
Returns the number of rows in the table. As calculating can take a long time, the current count is shown
every 1000 rows by default — this interval can be changed by setting the input parameter INTERVAL
.
Scan caching is also enabled. The default cache size is 10 rows — this value can be changed by setting the input parameter CACHE
. If your rows are small in size, you can increase its default value.
Usage
-
The basic syntax:
count '[<namespace_name>:]<table_name>'[, COLUMNS => <columns_array[]>][, STARTROW => '<start_row_key>'][, STOPROW => '<stop_row_key>']
-
Using optimization parameters:
count '[<namespace_name>:]<table_name>'[, INTERVAL => <interval_value>][, CACHE => <cache_value>]
-
Using filters:
count '[<namespace_name>:]<table_name>', {FILTER => "<filter_description>"}
Parameter | Description |
---|---|
namespace_name |
A namespace name |
table_name |
A table name |
columns_array |
An array of strings specified in the format |
start_row_key |
A start value for searching row keys |
stop_row_key |
A stop value for searching row keys |
interval_value |
An interval for showing the intermediate result |
cache_value |
A cache size |
filter_description |
A filter used for searching the table cells |
Examples
Counting a number of all rows in the table
hbase(main):024:0> count 't4' 1 row(s) Took 0.0175 seconds => 1
Counting a number of rows having the specified column
hbase(main):029:0> count 't4', COLUMNS => ['cf1:1'] 0 row(s) Took 0.0079 seconds => 0 hbase(main):030:0> count 't4', COLUMNS => ['cf1:c1'] 1 row(s) Took 0.0053 seconds => 1
Counting a number of rows matching the defined filter
hbase(main):027:0> count 't4', {FILTER => "ValueFilter(=, 'regexstring:value*')"} 1 row(s) Took 0.0346 seconds => 1