My key has three components: num, type, name
The 'type' is only of two kinds A and B while num can have more values e.g. 0,1,2..,30
I have to fetch data with respect to num and type i.e. fetch all rows which have keys with the specified num and type.
I can either store data in the form:
1. num|type|name
or
2. type|num|name
Considering how HBase scans through data if I use partial key scanning, which is the best strategy to store data?
This is how I will set my partial key scanning: For 1.
scan.setStartRow(Bytes.toBytes(num);
scan.setStopRow(Bytes.toBytes(num+1);
For 2.
scan.setStartRow(Bytes.toBytes(type + "|" + num);
scan.setStopRow(Bytes.toBytes(type + "|" + (num+1));