You know a column exists only when you can read it, so you can't get
the number without first getting the columns.

It seems like you should use a taller table table instead of a wide
one, and then with a clever row key design you would be able to do a
partial row key scan (maybe using the user id) and then limit the
number of rows you get.

In your current schema, it would be best if the qualifier contained a
date so that they would arrive sorted, and then you could use a Scan
instead of a Get to use the batching feature and only receive N
values.

J-D

On Tue, Jun 14, 2011 at 6:14 AM, Deepankar Sarkar
<[email protected]> wrote:
> Hi,
>
> I have a HBase table which has dynamically named columns, and hence, the 
> number of columns keep increasing as the usage of the application by a user.  
> This table stores the audit logs of each operation performed by the user.
>
> I want to look up latest  N transactions done by user.  To do this, I have to 
> do a "get" on the row key and programmatically scan through all columns to 
> determine which are the latest N entries.  I can specify a time range in the 
> "get" to narrow down the number of columns I have to read and bring into 
> memory of the client application, however, I will have to do try this few 
> times before I can get hold of latest N entries.  This is because there may 
> not be any entries in the time range I had specified, and I will have to 
> re-try the get with larger time ranges.
>
> Is there any better way to do this?
> Also, is there a way to find out how many columns a given row has without 
> reading all the columns in the "get" operation?
>
> Regards,
> Deepankar
>
>
> ________________________________
>
> http://www.mindtree.com/email/disclaimer.html
>

Reply via email to