Vijay,

You can try this.

select * from my_table where <primary key>  like '?%' and tid = ? (argument
? is customerid)

This will do a range scan and a filter on server side. Other option is to
change primary key design to (customerId int, transactionId varchar, timestamp
BigInt). This will allow to query on primary key directly resulting in
range scan.

select * from my_table where <primary key>  like '?%'  (your argument
should include both customerid and transactionid)

Above will return all timestamps versioned records for a matching
combination of customerid and transactionid.


Thanks,
Hemal



On Fri, Jun 5, 2015 at 10:00 AM, Vijay Kukkala <[email protected]> wrote:

> Cluster configuration:  Phoenix 4.0.2 with Hbase 0.98 HDP 2.1
>
> One of our table has a primary key (customerId int, timestamp BigInt,
> transactionId varchar).
>  One of our use cases is to retrieve records by customerId and
> transactionID.
>
> select * from my_table where cid = ? and tid = ?
>
> looking at the explain plan, it resulted in a range scan on customerID
> with a filter on transactionID.
>
> I tried to create an index on (CustomerID, transactionID) but didn't
> result any change in the explain plan.
>
> Trying to understand if there is a better way to handle this. In Hbase,
> there is a fuzzyRowKeyFilter which allows to query on parts on the key.
>
> Would appreciate if someone can point me in the right direction.
> thanks,
> Vijay
>
>


-- 

Hemal Parekh
Senior Data Warehouse Architect
 m. 240.449.4396
[image: Bitscopic Inc] <http://bitscopic.com>

Reply via email to