Cassandra datamodel

1,326 views

Published on

cassandra data model

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,326
On SlideShare
0
From Embeds
0
Number of Embeds
23
Actions
Shares
0
Downloads
13
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Cassandra datamodel

  1. 1. Cassandra Data Model http://znest.cn 1
  2. 2. 随需应变,快速构建。 卓越品质,成就你我! Column family Column Name Column Family:Emps 5 Name Birthdate City 张三 25/04/1975 长沙 7 Name User_ID City 李四 05/07/1979 北京 Row key Column value Column Family:Deps 12 Name 程序员 13 Name 销售员 2
  3. 3. 随需应变,快速构建。 卓越品质,成就你我! Column family vs Select Column Family:Birthdate_Emps 25/04/1975 5 33 … - - 05/07/1979 7 23 … - - select * from Emps where Birthdate = '25/04/1975„ get_slice(keySpace, “25/04/1975”, columnFamily, slicePredicate, ConsistencyLevel.ONE) 3
  4. 4. 随需应变,快速构建。 卓越品质,成就你我! Super Column family Super Column Name Column Name Column Family:User_Timelines 25/04/1975 5 33 … Name City … … 张三 长沙 05/07/1979 7 … Text City 李四 北京 4
  5. 5. 随需应变,快速构建。 卓越品质,成就你我! Super Column family & timestamp Super Column Name Column Name Column Family:User_Timelines 25/04/1975 5 33 … Name Name City City … … 张三 长沙 Timestamp =1 张三 上海 Timestamp =2 05/07/1979 7 … Text City 李四 北京 5
  6. 6. 随需应变,快速构建。 卓越品质,成就你我! Column family vs Join Column Family:Dep_Emps 12 7 130 … - - 13 5 51 … - - select * from Emps e, Deps d where e.dep_id = d.dep_id get_range_slice(keySpace,columnFamily,slicePredicate,keyRange,ConsistencyLevel.ONE) 6
  7. 7. 随需应变,快速构建。 卓越品质,成就你我! Column family vs Group By Column Family:Dep_Emps 长沙 7 23 … - - 北京 5 61 … - - select count(*) from Emps group by City get_count(keySpace, rowkey, columnParent, ConsistencyLevel) 7

×