On Tue, Jun 14, 2011 at 9: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?
>

If you know anything about the column qualifiers that are going to appear in
your time range query, you could use a QualifierFilter. If they are
basically random, I think you're stuck with what you're doing now.


> Also, is there a way to find out how many columns a given row has without
> reading all the columns in the "get" operation?


Not that I know of, apart from keeping a count somewhere, perhaps in a
separate column family.

Jesse

Reply via email to