hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stack <st...@duboce.net>
Subject Re: how to - get last inserted row id
Date Mon, 25 Feb 2008 20:28:48 GMT
There is no 'order by' in hbase.

The best that I can come up with answering your question is to get the 
last region in the table to find its start key and then start scanning 
until you run off the end of the table.  In pseudo code:

HTable t = new HTable(conf, YOUR_TABLE_NAME);
Text [] startKeys = t.getStartKeys();
if (startKeys.length > 0) {
  HScannerInterface scanner = t.obtainScanner(COLUMNS, 
startKeys[startKeys.length -1]);
  while(scanner.next(...)) {
     // Copy current key aside  -- or the last 100 -- so you have the 
last-keys-seen when scanner runs out
  }
}

We have an FAQ with answers to commonly asked questions such as how to 
up heap size or how to enable DEBUG.  Would this be the place to put 
'frequently used patterns'?   If you think otherwise, please startup a 
new wiki page.

Thanks for writing,
St.Ack

P.S. Would be interested in hearing more about our 500M cluster if you 
have the time to describe: # of regionservers, data size, etc.


cure@poczta.xg.pl wrote:
>    Hi
>
>     Sorry for my maby stupid question, but i can't find answer. Is there
> any way to get last inserted row id ?
>
>     i have realy big table - now there is about 480 000 000 rows and i
> need to get last 100 inserted.
>
>    maby there is some fuctionality like sql "order by" ?
>
>    unfortunately my row id are random guids.
>
>    i think that it will be very use full to create wiki page with
> frequently used patterns, like how to join two tables, how to realize
> where and how to use versions. but it's ony my own sugesion.
>
>      Thx Antony
>   


Mime
View raw message