You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Oleg Ruchovets <or...@gmail.com> on 2010/10/20 12:24:03 UTC

scan specific hbase region

Hi ,

    I am running hbase scan on daily basis.
HBase table become bigger and as a result it takes to more time to scan it ,
but actually I don't need to scan all the table. Most of the time I need to
scan partial data of it.
The question is: is it possible to scan specific region/regions of  hbase
table or in case I know start/end key of needed region, using it to scan
partial data and not all table?
 Please post me link or example how to do it (google was not so helpfull).

Thanks Oleg.

Re: scan specific hbase region

Posted by Oleg Ruchovets <or...@gmail.com>.
Great ,
 thank you.

On Wed, Oct 20, 2010 at 3:56 PM, Matthew LeMieux <md...@mlogiciels.com> wrote:

> Yes, what are you using to do the scan?
>
> * In the "hbase shell", you can do this: "hbase> scan 't1', {COLUMNS =>
> ['c1', 'c2'], LIMIT => 10, STARTROW => 'xyz'}"  (Note the STARTROW argument)
> (taken directly from the help inside the tool)
>
> * When scanning from java client, you can pass a Scan object to [HTable
> object].getScanner(scan), the scan object has .setStartRow and .setStopRow
> methods.  (http://hbase.apa<http://hbase.apache.org/docs/current/api/org/apache/hadoop/hbase/client/Scan.html>

*  /***

*   * Apply the specified server-side filter when performing the Scan.*

*   * @param filter filter to run on the server*

*   */*

che.org/docs/current/api/org/apache/hadoop/hbase/client/Scan.html<http://hbase.apache.org/docs/current/api/org/apache/hadoop/hbase/client/Scan.html>and
> http://hbase.apache.org/docs/current/api/org/apache/hadoop/hbase/client/HTable.html)  Set the stop row and the start row before calling getScanner, and you
> will only iterate over the range of keys you specified.
>
> -Matthew
>
> On Oct 20, 2010, at 3:24 AM, Oleg Ruchovets wrote:
>
> > Hi ,
> >
> >    I am running hbase scan on daily basis.
> > HBase table become bigger and as a result it takes to more time to scan
> it ,
> > but actually I don't need to scan all the table. Most of the time I need
> to
> > scan partial data of it.
> > The question is: is it possible to scan specific region/regions of  hbase
> > table or in case I know start/end key of needed region, using it to scan
> > partial data and not all table?
> > Please post me link or example how to do it (google was not so helpfull).
> >
> > Thanks Oleg.
>
>

Re: scan specific hbase region

Posted by Matthew LeMieux <md...@mlogiciels.com>.
Yes, what are you using to do the scan?

* In the "hbase shell", you can do this: "hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => 10, STARTROW => 'xyz'}"  (Note the STARTROW argument) (taken directly from the help inside the tool)

* When scanning from java client, you can pass a Scan object to [HTable object].getScanner(scan), the scan object has .setStartRow and .setStopRow methods.  (http://hbase.apache.org/docs/current/api/org/apache/hadoop/hbase/client/Scan.html and http://hbase.apache.org/docs/current/api/org/apache/hadoop/hbase/client/HTable.html )  Set the stop row and the start row before calling getScanner, and you will only iterate over the range of keys you specified.  

-Matthew

On Oct 20, 2010, at 3:24 AM, Oleg Ruchovets wrote:

> Hi ,
> 
>    I am running hbase scan on daily basis.
> HBase table become bigger and as a result it takes to more time to scan it ,
> but actually I don't need to scan all the table. Most of the time I need to
> scan partial data of it.
> The question is: is it possible to scan specific region/regions of  hbase
> table or in case I know start/end key of needed region, using it to scan
> partial data and not all table?
> Please post me link or example how to do it (google was not so helpfull).
> 
> Thanks Oleg.