How does the use of startrow and stoprow not result in a full table scan in HBase? How does the use of startrow and stoprow not result in a full table scan in HBase? hadoop hadoop

How does the use of startrow and stoprow not result in a full table scan in HBase?


In HBase a table is split into regions. A region is a set of rows that is served by a specific region server. A region server has (in general) multiple regions from multiple tables for which it handles the requests.

Because the rows are sorted by key it is known in the hbase master which start and stop keys are the boundaries of a each region AND on which region server this region can be queried.

So if a scan is done that uses an explicit start and stop row then the query is directed ONLY to the regions/region servers that have keys that may be in the requested range.

If the query has a 'small' range of keys then you'll find that in almost all queries only a single region is accessed.

It is common to have dozens of regions for a HBase table and by using the start and stop row to limit the scan you may find that 99 of the 100 regions of your table do not even know a query on the table has been done.