You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by Buntu Dev <bu...@gmail.com> on 2015/10/03 03:55:17 UTC

Schema design

I'm trying to design the Phoenix/HBase table schema in order to answer
these questions:

* Does the given user have attribute X with value Y? and at given time t1.
* Get list of users who had attribute X with value Y between timestamps t1
and t2?
* Get all the attributes of user at or around a given time t1.

Is there a way to design the schema (or multiple table schema) to answer
these questions and if there are any restrictions on querying using
Phoenix? Please let me know.


Thanks!

Re: Schema design

Posted by Sumit Nigam <su...@yahoo.com>.
Hi Buntu,
Possibly, following schema can help?
Rowkey with columns user, X, Y, timestamp. (Composite PK with user as leading column). You can MD5 each field to make it fixed length if want.Then, also make timestamp column as your secondary index. Salt the table.
I think single table is enough here.
Thanks,Sumit
      From: Buntu Dev <bu...@gmail.com>
 To: user@phoenix.apache.org 
 Sent: Saturday, October 3, 2015 7:25 AM
 Subject: Schema design
   
I'm trying to design the Phoenix/HBase table schema in order to answer these questions:
* Does the given user have attribute X with value Y? and at given time t1.* Get list of users who had attribute X with value Y between timestamps t1 and t2?* Get all the attributes of user at or around a given time t1.
Is there a way to design the schema (or multiple table schema) to answer these questions and if there are any restrictions on querying using Phoenix? Please let me know.

Thanks!