![Page 1: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/1.jpg)
data modeling for apache cassandra
with a sprinkle of C* background and some time series fun
dani traphagen@dtrapezoid
![Page 2: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/2.jpg)
quiz time - who is this?
![Page 3: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/3.jpg)
but how do I even
?
![Page 4: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/4.jpg)
query driven methodologyconceptual data
model access patterns
mapping rules and patterns
logical data model
erd queries
diagram it
![Page 5: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/5.jpg)
conceptual data modeling
• abstract view of the domain• technology independent• not specific to any database system
![Page 6: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/6.jpg)
entity relationship diagram
• entity types• relationship types• attribute types
![Page 7: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/7.jpg)
relationship keys
![Page 8: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/8.jpg)
attribute key participation
• relationship attributes can make part of the key
![Page 9: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/9.jpg)
full conceptual model
![Page 10: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/10.jpg)
query driven methodologyconceptual data
model access patterns
mapping rules and patterns
logical data model
erd queries
diagram it
![Page 11: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/11.jpg)
application workflow
• each application has a workflow• access patterns help us get how data
is accessed• know your queries you will run before
you design your model
![Page 12: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/12.jpg)
application workflow
![Page 13: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/13.jpg)
query driven methodologyconceptual data
model access patterns
mapping rules and patterns
logical data model
erd queries
diagram it
![Page 14: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/14.jpg)
mapping rules & patterns
•mapping rules ensure that a logical data model is right• each query has a corresponding table• tables are designed to allow queries to
execute properly• tables return data in the correct order
![Page 15: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/15.jpg)
mapping rules
1. entities and relationships
2. equality search attributes
3. inequality search attributes
4. ordering attributes 5. key attributes
![Page 16: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/16.jpg)
entities and relationships
1. entity and relationship types map to tables
2. entities and relationships map to partitions or rows
3. partition may have data about one or more entities and relationships
4. attributes are represented by columns
![Page 17: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/17.jpg)
entities and relationships
![Page 18: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/18.jpg)
EachrelationshipbecomesarowinthetableRelationshiptypeattributesarerepresentedbycolumnsQueriesandrelationshipcardinalityaffectsthedesignoftheprimarykey
• each relationship becomes a row in the table• relationship type attributes are represented by columns• queries and relationship cardinality affects the design
of the primary key
![Page 19: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/19.jpg)
equality search attributes
• equality search attributes become initial columns of a primary key
• querying on: title and type
![Page 20: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/20.jpg)
inequality search attributes
• clustering columns follow partition key columns in a primary key
• the column involved in an inequality search must come after columns in the primary key that are used in an equality search
![Page 21: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/21.jpg)
ordering attributes
1. ordering attributes become clustering columns2. querying on: user_id = ? and
uploaded_timestamp > ?3. ordering attributes : uploaded_timestamp (DESC)
![Page 22: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/22.jpg)
key attributes
1. relationship type key attributes are included as primary key columns
2. queries affect primary key design
![Page 23: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/23.jpg)
query driven methodologyconceptual data
model access patterns
mapping rules and patterns
logical data model
erd queries
diagram it
![Page 24: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/24.jpg)
logical data model
![Page 25: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/25.jpg)
this sucks
a real world example, w/time series data
![Page 26: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/26.jpg)
Thisisusingsimplestrategy,butdon’tdothatinprodPLEASE!
![Page 27: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/27.jpg)
![Page 28: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/28.jpg)
![Page 29: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/29.jpg)
![Page 30: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/30.jpg)
![Page 31: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/31.jpg)
![Page 32: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/32.jpg)
time series bucketing
![Page 33: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/33.jpg)
![Page 34: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/34.jpg)
![Page 35: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/35.jpg)
![Page 36: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/36.jpg)
![Page 37: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/37.jpg)
well dani this is all great and everything…but just how do i get
started? hm? i mean i want to learn cassandra and try it and everything
but it is just so daunting. i mean you showed me all this stuff and i am overwhelmed and it is sort of
making me insecure. what exactly do i do next to learn more? how do i
really dig in and learn these concepts? have you thought about
that? have you thought about what i NEED?
HMMMM DANI, HAVE YOU??!!!!!!!!!!11
![Page 38: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/38.jpg)
![Page 39: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/39.jpg)
& prepare to be wowed
![Page 40: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/40.jpg)
cdmhttps://github.com/riptano/cdm
cdm preview
![Page 41: Data Modeling with Cassandra and Time Series Data](https://reader030.vdocuments.net/reader030/viewer/2022032710/588b2e9c1a28abed688b705f/html5/thumbnails/41.jpg)
namaste
but what does it all mean?also, we’re
hiring