Question

I have a HBase table which would contain millions of records. For some purpose, I need to query the number of records in the table in real time.

  1. Using rowcount MR job is not an option. (need it fast)
  2. Using ResultScanner is slow. It takes seconds when there are just few thousand records.
Was it helpful?

Solution

You can't - HBase does not support this feature. You can use Tariq's suggestion but you should keep in mind that there are no cross-table transactions in HBase so there's no guarantee that the number you accumulate in one reflects the exact number of rows in the other

OTHER TIPS

The only way to make it absolutely realtime is to keep a track of number of rows and store it somewhere. Whenever you put new rows update it. Then serve it whenever you need. Both of the above specified options are not gonna help you if the realtime-ness is really desired.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top