You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by lei wang <hb...@gmail.com> on 2009/08/17 08:51:21 UTC

Hi, i am still puzzeld to find a row key by a cell.

Hi, if a know a cell in a hbase for its column:<qualifer>:value,  i need to
know which row key it belongs to. I searched the HBase api several times,
but i can not find the right method to solve my problem. Thanks for one's
suggestion to me.

Re: Hi, i am still puzzeld to find a row key by a cell.

Posted by Rocks <nu...@gmail.com>.
Thanks a lot. Maybe i will go with server-side filters.

On Tue, Aug 18, 2009 at 3:24 AM, Bradford Stephens <
bradfordstephens@gmail.com> wrote:

> Just reiterating with JGray says -- usually, when you need a secondary
> index, you can get away with denormalizing and duplicating your data.
>
> On Mon, Aug 17, 2009 at 9:30 AM, Jonathan Gray<jl...@streamy.com> wrote:
> > This is possible by checking the values in your client, through
> server-side
> > filters (see org.apache.hadoop.hbase.filter), or with secondary indexing
> (as
> > described in my previous e-mail).
> >
> > In the first two cases, you are doing a full table scan so it is very
> > inefficient.  That's the same as it would be in an RDBMS if you were not
> > using secondary indexes, however.
> >
> > HBase has limited secondary indexing support, but do not expect the
> > flexibility and performance you get from an RDBMS secondary index.
> >
> > If this is central to your usage of HBase, make sure that HBase is what
> you
> > want and take another look at your schema to see if there might be a
> better
> > design to prevent needing heavy indexing or table scanning.
> >
> > JG
> >
> > Rocks wrote:
> >>
> >> Thanks for you answer.
> >> however, what i want to do just likes "where" keyword of SQL in RDBMS.
> Is
> >> it impossible in hbase ?
> >>
> >> On Mon, Aug 17, 2009 at 2:58 PM, Ryan Rawson <ry...@gmail.com>
> wrote:
> >>
> >>> hey,
> >>>
> >>> That isn't how hbase (or even rdbms) work.  Instead you can retrieve
> >>> rows based on their row key. Otherwise you will have to read the
> >>> entire table to find just that 1 row. Yes this is as inefficient as it
> >>> sounds.
> >>>
> >>> If you frequently have this issue, you may need to build and maintain
> >>> secondary indexes. Unlike relational dbs, there is no built in support
> >>> for this, you have to write your app to handle this.
> >>>
> >>> -yran
> >>>
> >>>
> >>>
> >>> On Sun, Aug 16, 2009 at 11:51 PM, lei wang<hb...@gmail.com>
> >>> wrote:
> >>>>
> >>>> Hi, if a know a cell in a hbase for its column:<qualifer>:value,  i
> need
> >>>
> >>> to
> >>>>
> >>>> know which row key it belongs to. I searched the HBase api several
> >>>> times,
> >>>> but i can not find the right method to solve my problem. Thanks for
> >>>> one's
> >>>> suggestion to me.
> >>>>
> >>
> >
>
>
>
> --
> http://www.roadtofailure.com -- The Fringes of Scalability, Social
> Media, and Computer Science
>

Re: Hi, i am still puzzeld to find a row key by a cell.

Posted by Bradford Stephens <br...@gmail.com>.
Just reiterating with JGray says -- usually, when you need a secondary
index, you can get away with denormalizing and duplicating your data.

On Mon, Aug 17, 2009 at 9:30 AM, Jonathan Gray<jl...@streamy.com> wrote:
> This is possible by checking the values in your client, through server-side
> filters (see org.apache.hadoop.hbase.filter), or with secondary indexing (as
> described in my previous e-mail).
>
> In the first two cases, you are doing a full table scan so it is very
> inefficient.  That's the same as it would be in an RDBMS if you were not
> using secondary indexes, however.
>
> HBase has limited secondary indexing support, but do not expect the
> flexibility and performance you get from an RDBMS secondary index.
>
> If this is central to your usage of HBase, make sure that HBase is what you
> want and take another look at your schema to see if there might be a better
> design to prevent needing heavy indexing or table scanning.
>
> JG
>
> Rocks wrote:
>>
>> Thanks for you answer.
>> however, what i want to do just likes "where" keyword of SQL in RDBMS. Is
>> it impossible in hbase ?
>>
>> On Mon, Aug 17, 2009 at 2:58 PM, Ryan Rawson <ry...@gmail.com> wrote:
>>
>>> hey,
>>>
>>> That isn't how hbase (or even rdbms) work.  Instead you can retrieve
>>> rows based on their row key. Otherwise you will have to read the
>>> entire table to find just that 1 row. Yes this is as inefficient as it
>>> sounds.
>>>
>>> If you frequently have this issue, you may need to build and maintain
>>> secondary indexes. Unlike relational dbs, there is no built in support
>>> for this, you have to write your app to handle this.
>>>
>>> -yran
>>>
>>>
>>>
>>> On Sun, Aug 16, 2009 at 11:51 PM, lei wang<hb...@gmail.com>
>>> wrote:
>>>>
>>>> Hi, if a know a cell in a hbase for its column:<qualifer>:value,  i need
>>>
>>> to
>>>>
>>>> know which row key it belongs to. I searched the HBase api several
>>>> times,
>>>> but i can not find the right method to solve my problem. Thanks for
>>>> one's
>>>> suggestion to me.
>>>>
>>
>



-- 
http://www.roadtofailure.com -- The Fringes of Scalability, Social
Media, and Computer Science

Re: Hi, i am still puzzeld to find a row key by a cell.

Posted by Jonathan Gray <jl...@streamy.com>.
This is possible by checking the values in your client, through 
server-side filters (see org.apache.hadoop.hbase.filter), or with 
secondary indexing (as described in my previous e-mail).

In the first two cases, you are doing a full table scan so it is very 
inefficient.  That's the same as it would be in an RDBMS if you were not 
using secondary indexes, however.

HBase has limited secondary indexing support, but do not expect the 
flexibility and performance you get from an RDBMS secondary index.

If this is central to your usage of HBase, make sure that HBase is what 
you want and take another look at your schema to see if there might be a 
better design to prevent needing heavy indexing or table scanning.

JG

Rocks wrote:
> Thanks for you answer.
> however, what i want to do just likes "where" keyword of SQL in RDBMS. Is
> it impossible in hbase ?
> 
> On Mon, Aug 17, 2009 at 2:58 PM, Ryan Rawson <ry...@gmail.com> wrote:
> 
>> hey,
>>
>> That isn't how hbase (or even rdbms) work.  Instead you can retrieve
>> rows based on their row key. Otherwise you will have to read the
>> entire table to find just that 1 row. Yes this is as inefficient as it
>> sounds.
>>
>> If you frequently have this issue, you may need to build and maintain
>> secondary indexes. Unlike relational dbs, there is no built in support
>> for this, you have to write your app to handle this.
>>
>> -yran
>>
>>
>>
>> On Sun, Aug 16, 2009 at 11:51 PM, lei wang<hb...@gmail.com> wrote:
>>> Hi, if a know a cell in a hbase for its column:<qualifer>:value,  i need
>> to
>>> know which row key it belongs to. I searched the HBase api several times,
>>> but i can not find the right method to solve my problem. Thanks for one's
>>> suggestion to me.
>>>
> 

Re: Hi, i am still puzzeld to find a row key by a cell.

Posted by Rocks <nu...@gmail.com>.
Thanks for you answer.
however, what i want to do just likes "where" keyword of SQL in RDBMS. Is
it impossible in hbase ?

On Mon, Aug 17, 2009 at 2:58 PM, Ryan Rawson <ry...@gmail.com> wrote:

> hey,
>
> That isn't how hbase (or even rdbms) work.  Instead you can retrieve
> rows based on their row key. Otherwise you will have to read the
> entire table to find just that 1 row. Yes this is as inefficient as it
> sounds.
>
> If you frequently have this issue, you may need to build and maintain
> secondary indexes. Unlike relational dbs, there is no built in support
> for this, you have to write your app to handle this.
>
> -yran
>
>
>
> On Sun, Aug 16, 2009 at 11:51 PM, lei wang<hb...@gmail.com> wrote:
> > Hi, if a know a cell in a hbase for its column:<qualifer>:value,  i need
> to
> > know which row key it belongs to. I searched the HBase api several times,
> > but i can not find the right method to solve my problem. Thanks for one's
> > suggestion to me.
> >
>

Re: Hi, i am still puzzeld to find a row key by a cell.

Posted by Jonathan Gray <jl...@streamy.com>.
There is some built-in support for secondary indexes.

Look at IndexedTable.  It is in contrib for 0.20 and part of the main 
codebase for 0.19.

0.20 Javadoc:

http://jgray.la/javadoc/hbase-0.20.0/org/apache/hadoop/hbase/client/tableindexed/package-summary.html

0.19 Javadoc:

http://hadoop.apache.org/hbase/docs/r0.19.3/api/org/apache/hadoop/hbase/client/tableindexed/package-summary.html


There have been some performance issues in the past, but I've not used 
the built-in facilities for some time.  I do know of some people using 
this in production.  Internally, we implement some indexes in the same 
manner but manage it in the application.  See my previous e-mail to the 
list to understand how it's implemented.

JG

Ryan Rawson wrote:
> hey,
> 
> That isn't how hbase (or even rdbms) work.  Instead you can retrieve
> rows based on their row key. Otherwise you will have to read the
> entire table to find just that 1 row. Yes this is as inefficient as it
> sounds.
> 
> If you frequently have this issue, you may need to build and maintain
> secondary indexes. Unlike relational dbs, there is no built in support
> for this, you have to write your app to handle this.
> 
> -yran
> 
> 
> 
> On Sun, Aug 16, 2009 at 11:51 PM, lei wang<hb...@gmail.com> wrote:
>> Hi, if a know a cell in a hbase for its column:<qualifer>:value,  i need to
>> know which row key it belongs to. I searched the HBase api several times,
>> but i can not find the right method to solve my problem. Thanks for one's
>> suggestion to me.
>>
> 

Re: Hi, i am still puzzeld to find a row key by a cell.

Posted by Ryan Rawson <ry...@gmail.com>.
hey,

That isn't how hbase (or even rdbms) work.  Instead you can retrieve
rows based on their row key. Otherwise you will have to read the
entire table to find just that 1 row. Yes this is as inefficient as it
sounds.

If you frequently have this issue, you may need to build and maintain
secondary indexes. Unlike relational dbs, there is no built in support
for this, you have to write your app to handle this.

-yran



On Sun, Aug 16, 2009 at 11:51 PM, lei wang<hb...@gmail.com> wrote:
> Hi, if a know a cell in a hbase for its column:<qualifer>:value,  i need to
> know which row key it belongs to. I searched the HBase api several times,
> but i can not find the right method to solve my problem. Thanks for one's
> suggestion to me.
>