data modeling with cassandra and time series data
TRANSCRIPT
data modeling for apache cassandra
with a sprinkle of C* background and some time series fun
dani traphagen@dtrapezoid
quiz time - who is this?
but how do I even
?
query driven methodologyconceptual data
model access patterns
mapping rules and patterns
logical data model
erd queries
diagram it
conceptual data modeling
• abstract view of the domain• technology independent• not specific to any database system
entity relationship diagram
• entity types• relationship types• attribute types
relationship keys
attribute key participation
• relationship attributes can make part of the key
full conceptual model
query driven methodologyconceptual data
model access patterns
mapping rules and patterns
logical data model
erd queries
diagram it
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
application workflow
query driven methodologyconceptual data
model access patterns
mapping rules and patterns
logical data model
erd queries
diagram it
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
mapping rules
1. entities and relationships
2. equality search attributes
3. inequality search attributes
4. ordering attributes 5. key attributes
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
entities and relationships
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
equality search attributes
• equality search attributes become initial columns of a primary key
• querying on: title and type
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
ordering attributes
1. ordering attributes become clustering columns2. querying on: user_id = ? and
uploaded_timestamp > ?3. ordering attributes : uploaded_timestamp (DESC)
key attributes
1. relationship type key attributes are included as primary key columns
2. queries affect primary key design
query driven methodologyconceptual data
model access patterns
mapping rules and patterns
logical data model
erd queries
diagram it
logical data model
this sucks
a real world example, w/time series data
Thisisusingsimplestrategy,butdon’tdothatinprodPLEASE!
time series bucketing
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
& prepare to be wowed
cdmhttps://github.com/riptano/cdm
cdm preview
namaste
but what does it all mean?also, we’re
hiring