But Phoenix does this for you (creates a composite key, special separator)
- you just have to specify the PK while creating the table.

CREATE TABLE IF NOT EXISTS us_population (
      state CHAR(2) NOT NULL,
      city VARCHAR NOT NULL,
      population BIGINT
      CONSTRAINT my_pk PRIMARY KEY (state, city));

from http://phoenix.apache.org/Phoenix-in-15-minutes-or-less.html

Take care that the PK fields will be placed in the HBASE table row keys -
and would dramatically speed up the scans, all other fields would be
accessible via filters (full partition scan) in case you still know a range
of keys (use PK wisely for that).


2016-09-22 10:38 GMT+02:00 AZELMAT Hamza <hamza.azel...@batiment.setec.fr>:

> I’m designing a nosql database with hbase and phoenix, and i was thinking
> of making a composite primary key in this form.
>
> HbaseRowKey (path_id,sensor_id,date) and C.Value ( Column Family).
>
> my path_id will be composed like this : R1#P1#C1#B2.
>
> and i was thinking with a SQL request without knowning R1 and P1 and C1
> can i get all Rows with path_id containing B2 with a substring ? will it be
> very costly in Phoenix ?
>
> To be more specific this is an iot project and we have use cases like this
> :
>
>
>
> Root -à Project 1 à Cluster 1 -à Cluser 2 à  Building 1 à  Sensor 1
>
> Root -à Project 2à  Building 1 à  Sensor 1
>
> Root -à Building 3 à  Sensor 1
>
> Root -à Floor 3 à  Sensor 1
>
>
>
> I May have growing new type of nodes, that’s why I want something flexible
> in my composite primary Key , R1 will be the root id, P1 the project with
> ID 1 etc ..
>
>
>
> So I have requests like getting all sensors data of building with ID 1
> with this kind of conception do you think it’s a costly method ?
>
>
>
> I have thought of neo4j but I like the easy of use of phoenix with SQL,
> also it’s free of use and open source .
>
>
>
> Thank you for your help
>
>
>

Reply via email to