Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase, mail # user - How to query by rowKey-infix


Copy link to this message
-
Re: How to query by rowKey-infix
Matt Corgan 2012-08-03, 01:29
Yeah - just thought i'd point it out since people often have small tables
in their cluster alongside the big ones, and when generating reports,
sometimes you don't care if it finishes in 10 minutes vs an hour.
On Thu, Aug 2, 2012 at 6:15 PM, Alex Baranau <[EMAIL PROTECTED]>wrote:

> I think this is exactly what Christian is trying to (and should be trying
> to) avoid ;).
>
> I can't imagine use-case when you need to filter something and you can do
> it with (at least) server-side filter, and yet in this situation you want
> to try to do it on the client-side... Doing filtering on client-side when
> you can do it on server-side just feels wrong. Esp. given that there's a
> lot of data in HBase (otherwise why would you use it).
>
> Alex Baranau
> ------
> Sematext :: http://blog.sematext.com/ :: Hadoop - HBase - ElasticSearch -
> Solr
>
> On Thu, Aug 2, 2012 at 7:09 PM, Matt Corgan <[EMAIL PROTECTED]> wrote:
>
> > Also Christian, don't forget you can read all the rows back to the client
> > and do the filtering there using whatever logic you like.  HBase Filters
> > can be thought of as an optimization (predicate push-down) over
> client-side
> > filtering.  Pulling all the rows over the network will be slower, but I
> > don't think we know enough about your data or speed requirements to rule
> it
> > out.
> >
> >
> > On Thu, Aug 2, 2012 at 3:57 PM, Alex Baranau <[EMAIL PROTECTED]
> > >wrote:
> >
> > > Hi Christian!
> > >
> > > If to put off secondary indexes and assume you are going with "heavy
> > > scans", you can try two following things to make it much faster. If
> this
> > is
> > > appropriate to your situation, of course.
> > >
> > > 1.
> > >
> > > > Is there a more elegant way to collect rows within time range X?
> > > > (Unfortunately, the date attribute is not equal to the timestamp that
> > is
> > > stored by hbase automatically.)
> > >
> > > Can you set timestamp of the Puts to the one you have in row key?
> Instead
> > > of relying on the one that HBase puts automatically (current ts). If
> you
> > > can, this will improve reading speed a lot by setting time range on
> > > scanner. Depending on how you are writing your data of course, but I
> > assume
> > > that you mostly write data in "time-increasing" manner.
> > >
> > > 2.
> > >
> > > If your userId has fixed length, or you can change it so that it has
> > fixed
> > > length, then you can actually use smth like "wildcard"  in row key.
> > There's
> > > a way in Filter implementation to fast-forward to the record with
> > specific
> > > row key and by doing this skip many records. This might be used as
> > follows:
> > > * suppose your userId is 5 characters in length
> > > * suppose you are scanning for records with time between 2012-08-01
> > > and 2012-08-08
> > > * when you scanning records and you face e.g. key
> > > "aaaaa_2012-08-09_3jh345j345kjh", where "aaaaa" is user id, you can
> tell
> > > the scanner from your filter to fast-forward to key "aaaab_
> 2012-08-01".
> > > Because you know that all remained records of user "aaaaa" don't fall
> > into
> > > the interval you need (as the time for its records will be >> > 2012-08-09).
> > >
> > > As of now, I believe you will have to implement your custom filter to
> do
> > > that.
> > > Pointer:
> > > org.apache.hadoop.hbase.filter.Filter.ReturnCode.SEEK_NEXT_USING_HINT
> > > I believe I implemented similar thing some time ago. If this idea works
> > for
> > > you I could look for the implementation and share it if it helps. Or
> may
> > be
> > > even simply add it to HBase codebase.
> > >
> > > Hope this helps,
> > >
> > > Alex Baranau
> > > ------
> > > Sematext :: http://blog.sematext.com/ :: Hadoop - HBase -
> ElasticSearch
> > -
> > > Solr
> > >
> > >
> > > On Thu, Aug 2, 2012 at 8:40 AM, Christian Schäfer <
> [EMAIL PROTECTED]
> > > >wrote:
> > >
> > > >
> > > >
> > > > Excuse my double posting.
> > > > Here is the complete mail:
> > > >
> > > >
> > > > OK,
> > > >
> > > > at first I will try the scans.