Contenu connexe Similaire à Introduction to Cassandra and Data Modeling Similaire à Introduction to Cassandra and Data Modeling (8) Introduction to Cassandra and Data Modeling23. ©2012 DataStax
Static - Users Column Family
23
Row Key
g_m_bluth
password:
banana stand
name: George
Michael
tobias_f
password:
c_weathers
name:Tobias phone: 512-7777
Thursday, May 30, 13
24. ©2012 DataStax
Dynamic - Friend Column Family
24
Row Key
g_m_bluth <date>:ann_v <date>:maeby
tobias_f <date>:barry_z <date>:carl_w <date>:lindsay ...
Thursday, May 30, 13
26. ©2012 DataStax
Time Series - Login CF
26
Row Key
g_m_bluth
1369633061:
United States
1369625839:
Mexico
...
tobias_f
1369932413:
Canada
1369681738:
United States
...
Thursday, May 30, 13
32. ©2012 DataStax 32
CREATE COLUMNFAMILY songs (
id uuid PRIMARY KEY,
title text,
album text,
artist text,
data blob);
INSERT INTO songs (id, title, artist, album)
VALUES ('a3e64f8f...', 'La Grange', 'ZZ Top', 'Tres Hombres');
SELECT * FROM songs;
id | album | artist | title
-------------+--------------+----------------+----------------
2b09185b... | Roll Away | Back Door Slam | Outside Woman...
8a172618... | We Must Obey | Fu Manchu | Moving in Ste...
a3e64f8f... | Tres Hombres | ZZ Top | La Grange
Thursday, May 30, 13
41. ©2012 DataStax 41
g_m_bluth
1369633061:
United States
1369625839:
Mexico
....
1369622839:
Canada
1369422839:
Canada
1368422839:
Canada
....
1368421839:
Canada
1367421839:
United States
1367411839:
Mexico
....
Thursday, May 30, 13
46. ©2012 DataStax 46
g_m_bluth
1369633061:
<United States,
Austin,
Texas,
78701>
1369625839:
<Mexico,
Tiajuana,
88191>
1358633061:
<United
States,Austin,
Texas,
78701>
Thursday, May 30, 13
52. ©2012 DataStax
Queues
• More generally, many deletes within a row
• A delete in Cassandra is actually a tombstone
• Read 1000 tombstones in order to find 10
columns
52
Thursday, May 30, 13
58. ©2012 DataStax
Social Signals
• Like, Own, Want
• Need:
• scalable counters
• high performance writes
• want to find most popular items in a given
category
58
Thursday, May 30, 13
59. ©2012 DataStax
Social Signals
59
Row Key
item_id_1 like: 300 own:104 want:105
item_id_2 ... ... ...
ItemCount
Row Key
user_id_1 like: 50 own:10 want:75
user_id_2 ... ... ...
UserCount
Thursday, May 30, 13
60. ©2012 DataStax
Social Signals
60
Row Key
item_id_1 user_id_1:<time> user_id_2:<time> ...
item_id_2 ... ... ...
ItemLike
Row Key
user_id_1 <time>: <item_id> <time>: <item_id> ...
user_id_2 ... ... ...
UserLike
Thursday, May 30, 13
61. ©2012 DataStax
Social Signals - Possibilities
• Store aggregated counts per category
• Column names are counts
• Get top N items in a category
61
Thursday, May 30, 13
63. Come to the Summit!
Ask me for a discount code
June 11-12, 2013
San Francisco, CA
http://www.datastax.com/company/news-and-events/events/
cassandrasummit2013
Thursday, May 30, 13