You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by ch huang <ju...@gmail.com> on 2013/06/28 08:41:00 UTC

about schema design problem

hi,all:
      i have two search pattern , search for row with specific id ,and
search for row with specific token,how can i design schema fit two search
pattern effectly?

RE: about schema design problem

Posted by Jyothi Mandava <jy...@huawei.com>.
There is no built-in support but you can check these

   http://jyates.github.io/2013/06/11/hbase-consistent-secondary-indexing.html
   https://github.com/jyates/phoenix/tree/hbase-index/contrib/hbase-index

Recently there was a discussion in Hbase users group on indexing columns. Please find it below.

http://comments.gmane.org/gmane.comp.java.hadoop.hbase.user/35546

Jyothi

________________________________________
From: ch huang [justlooks@gmail.com]
Sent: Friday, June 28, 2013 2:38 PM
To: user@hbase.apache.org
Subject: Re: about schema design problem

As i know ,hbase only can index key ( rowkey+column qualifier + ts) ,how
can i set secondary key on HBase Table?

On Fri, Jun 28, 2013 at 4:28 PM, Jyothi Mandava
<jy...@huawei.com>wrote:

>
> If you add both(id+token) to the row key and if you want to search with
> any one of these (id , token), giving only id in row key can use prefix
> filter to get the rows. giving only token can use FuzzyRowFilter (
> ????Token) but here id length should be fixed length to use FuzzyRowFilter
>
> If your id is unique you can have id as the row key and token as value.
> search query with id ( row key) as input will be faster as you can get the
> row directly with row key. if you want to search with the token , you can
> apply filter on the single column to read the rows. Having secondary index
> on the column value gives best performance in this case ( id as row key and
> token as column).
>
> Jyothi
> ________________________________________
> From: ch huang [justlooks@gmail.com]
> Sent: Friday, June 28, 2013 1:07 PM
> To: user@hbase.apache.org
> Subject: Re: about schema design problem
>
> no , i have a old RDMS(mysql) table ,have two search pattern , i want to
> change to HBase schema,i do not know how to design to get
> best performance (can i put id and token together into rowkey?)
>
> On Fri, Jun 28, 2013 at 2:55 PM, Jyothi Mandava
> <jy...@huawei.com>wrote:
>
> > HI,
> > do you mean search wuth id is Search with row key and search with token
> is
> > search with column value?
> >
> > Jyothi
> > ________________________________________
> > From: ch huang [justlooks@gmail.com]
> > Sent: Friday, June 28, 2013 12:11 PM
> > To: user@hbase.apache.org
> > Subject: about schema design problem
> >
> > hi,all:
> >       i have two search pattern , search for row with specific id ,and
> > search for row with specific token,how can i design schema fit two search
> > pattern effectly?
> >
>

Re: about schema design problem

Posted by ch huang <ju...@gmail.com>.
As i know ,hbase only can index key ( rowkey+column qualifier + ts) ,how
can i set secondary key on HBase Table?

On Fri, Jun 28, 2013 at 4:28 PM, Jyothi Mandava
<jy...@huawei.com>wrote:

>
> If you add both(id+token) to the row key and if you want to search with
> any one of these (id , token), giving only id in row key can use prefix
> filter to get the rows. giving only token can use FuzzyRowFilter (
> ????Token) but here id length should be fixed length to use FuzzyRowFilter
>
> If your id is unique you can have id as the row key and token as value.
> search query with id ( row key) as input will be faster as you can get the
> row directly with row key. if you want to search with the token , you can
> apply filter on the single column to read the rows. Having secondary index
> on the column value gives best performance in this case ( id as row key and
> token as column).
>
> Jyothi
> ________________________________________
> From: ch huang [justlooks@gmail.com]
> Sent: Friday, June 28, 2013 1:07 PM
> To: user@hbase.apache.org
> Subject: Re: about schema design problem
>
> no , i have a old RDMS(mysql) table ,have two search pattern , i want to
> change to HBase schema,i do not know how to design to get
> best performance (can i put id and token together into rowkey?)
>
> On Fri, Jun 28, 2013 at 2:55 PM, Jyothi Mandava
> <jy...@huawei.com>wrote:
>
> > HI,
> > do you mean search wuth id is Search with row key and search with token
> is
> > search with column value?
> >
> > Jyothi
> > ________________________________________
> > From: ch huang [justlooks@gmail.com]
> > Sent: Friday, June 28, 2013 12:11 PM
> > To: user@hbase.apache.org
> > Subject: about schema design problem
> >
> > hi,all:
> >       i have two search pattern , search for row with specific id ,and
> > search for row with specific token,how can i design schema fit two search
> > pattern effectly?
> >
>

RE: about schema design problem

Posted by Jyothi Mandava <jy...@huawei.com>.
If you add both(id+token) to the row key and if you want to search with any one of these (id , token), giving only id in row key can use prefix filter to get the rows. giving only token can use FuzzyRowFilter ( ????Token) but here id length should be fixed length to use FuzzyRowFilter

If your id is unique you can have id as the row key and token as value. search query with id ( row key) as input will be faster as you can get the row directly with row key. if you want to search with the token , you can apply filter on the single column to read the rows. Having secondary index on the column value gives best performance in this case ( id as row key and token as column).

Jyothi
________________________________________
From: ch huang [justlooks@gmail.com]
Sent: Friday, June 28, 2013 1:07 PM
To: user@hbase.apache.org
Subject: Re: about schema design problem

no , i have a old RDMS(mysql) table ,have two search pattern , i want to
change to HBase schema,i do not know how to design to get
best performance (can i put id and token together into rowkey?)

On Fri, Jun 28, 2013 at 2:55 PM, Jyothi Mandava
<jy...@huawei.com>wrote:

> HI,
> do you mean search wuth id is Search with row key and search with token is
> search with column value?
>
> Jyothi
> ________________________________________
> From: ch huang [justlooks@gmail.com]
> Sent: Friday, June 28, 2013 12:11 PM
> To: user@hbase.apache.org
> Subject: about schema design problem
>
> hi,all:
>       i have two search pattern , search for row with specific id ,and
> search for row with specific token,how can i design schema fit two search
> pattern effectly?
>

Re: about schema design problem

Posted by ch huang <ju...@gmail.com>.
no , i have a old RDMS(mysql) table ,have two search pattern , i want to
change to HBase schema,i do not know how to design to get
best performance (can i put id and token together into rowkey?)

On Fri, Jun 28, 2013 at 2:55 PM, Jyothi Mandava
<jy...@huawei.com>wrote:

> HI,
> do you mean search wuth id is Search with row key and search with token is
> search with column value?
>
> Jyothi
> ________________________________________
> From: ch huang [justlooks@gmail.com]
> Sent: Friday, June 28, 2013 12:11 PM
> To: user@hbase.apache.org
> Subject: about schema design problem
>
> hi,all:
>       i have two search pattern , search for row with specific id ,and
> search for row with specific token,how can i design schema fit two search
> pattern effectly?
>

RE: about schema design problem

Posted by Jyothi Mandava <jy...@huawei.com>.
HI,
do you mean search wuth id is Search with row key and search with token is search with column value?

Jyothi
________________________________________
From: ch huang [justlooks@gmail.com]
Sent: Friday, June 28, 2013 12:11 PM
To: user@hbase.apache.org
Subject: about schema design problem

hi,all:
      i have two search pattern , search for row with specific id ,and
search for row with specific token,how can i design schema fit two search
pattern effectly?