You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Mark <st...@gmail.com> on 2011/11/17 19:47:18 UTC

Scan with Stop/Start or Prefix?

Say i have record in the following format {user_id}/{timestamp}. Now 
when scanning for all records for a particular user is it generally 
preferred that I use a start/stop key or a prefix scan? Which one and why?

Thanks

Re: Scan with Stop/Start or Prefix?

Posted by Jean-Daniel Cryans <jd...@apache.org>.
Using a filter requires a few more CPU cycles.

J-D

On Thu, Nov 17, 2011 at 3:38 PM, Mark <st...@gmail.com> wrote:
> Are they both the same in terms of performance?
>
> On 11/17/11 2:13 PM, Jean-Daniel Cryans wrote:
>>
>> Use a prefix when you don't want to invent a stop row key (in your
>> case it would be userid+1). You could still use one if you only wanted
>> to go only up to a certain timestamp.
>>
>> Start/stop is when there's no prefix that can be set, you just want a
>> chunk of sequential rows. MapReduce on HBase does exactly that, where
>> each Map starts at the beginning of a region and the stop is the
>> beginning of the next one.
>>
>> J-D
>>
>> On Thu, Nov 17, 2011 at 10:47 AM, Mark<st...@gmail.com>  wrote:
>>>
>>> Say i have record in the following format {user_id}/{timestamp}. Now when
>>> scanning for all records for a particular user is it generally preferred
>>> that I use a start/stop key or a prefix scan? Which one and why?
>>>
>>> Thanks
>>>
>

Re: Scan with Stop/Start or Prefix?

Posted by Mark <st...@gmail.com>.
Are they both the same in terms of performance?

On 11/17/11 2:13 PM, Jean-Daniel Cryans wrote:
> Use a prefix when you don't want to invent a stop row key (in your
> case it would be userid+1). You could still use one if you only wanted
> to go only up to a certain timestamp.
>
> Start/stop is when there's no prefix that can be set, you just want a
> chunk of sequential rows. MapReduce on HBase does exactly that, where
> each Map starts at the beginning of a region and the stop is the
> beginning of the next one.
>
> J-D
>
> On Thu, Nov 17, 2011 at 10:47 AM, Mark<st...@gmail.com>  wrote:
>> Say i have record in the following format {user_id}/{timestamp}. Now when
>> scanning for all records for a particular user is it generally preferred
>> that I use a start/stop key or a prefix scan? Which one and why?
>>
>> Thanks
>>

Re: Scan with Stop/Start or Prefix?

Posted by Jean-Daniel Cryans <jd...@apache.org>.
Use a prefix when you don't want to invent a stop row key (in your
case it would be userid+1). You could still use one if you only wanted
to go only up to a certain timestamp.

Start/stop is when there's no prefix that can be set, you just want a
chunk of sequential rows. MapReduce on HBase does exactly that, where
each Map starts at the beginning of a region and the stop is the
beginning of the next one.

J-D

On Thu, Nov 17, 2011 at 10:47 AM, Mark <st...@gmail.com> wrote:
> Say i have record in the following format {user_id}/{timestamp}. Now when
> scanning for all records for a particular user is it generally preferred
> that I use a start/stop key or a prefix scan? Which one and why?
>
> Thanks
>