Bryan Duxbury wrote:
No, we can't scan in reverse. I don't think it's possible to do so with the components we have today - there's no previous method on mapfile, only next. Out of curiosity, hat's the use case for getting the last N records in the table?

-Bryan

The use cases come from a standard transactional web application benchmark TPC-W, which models an online bookshop.

Use cases:
1) obtain the latest order of a specified user
As new order is inserted at the end of table,
it is better to start scan in reverse direction.

2) obtain the top 50 books which sells best recently.
The calculation is based on the information of 3333 most recent orders.
Again, better to start scan from the end of table.

- Zhou
On Apr 29, 2008, at 8:08 AM, Zhou Wei wrote:


Hm, tricky. You don't have the scan the whole table - just the last region. You can find out what the start key of the last region is by using HTable#getStartKeys. If this isn't an acceptable solution, we might be able to think up a way to get the last real row of a table more efficiently.
Actually, I need to obtain the 3333 rows starting from the last row rather than the first row. So I wonder is it possible to obtain a scanner that scan in the reverse direction.
I.e. Starting from the last row to the first row.

Zhou

-Bryan

On Apr 28, 2008, at 7:53 PM, Zhou Wei wrote:

Hi

I want to find out the maximum value of the row id of a table.
Is there a simple and efficient way to do this without scan through the
whole table starting from the first row?

Thanks.

Zhou








Reply via email to