Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
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 methodology
conceptual data
model
access patterns
mapping
rules and
patterns
logical data
model
erd queries
d...
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 methodology
conceptual data
model
access patterns
mapping
rules and
patterns
logical data
model
erd queries
d...
application workflow
• each application has a workflow
• access patterns help us get how data
is accessed
• know your quer...
application workflow
query driven methodology
conceptual data
model
access patterns
mapping
rules and
patterns
logical data
model
erd queries
d...
mapping rules & patterns
• mapping rules ensure that a logical
data model is right
• each query has a corresponding table
...
mapping rules
1. entities and
relationships
2. equality search
attributes
3. inequality search
attributes
4. ordering attr...
entities and relationships
1. entity and relationship types map to
tables
2. entities and relationships map to
partitions ...
entities and relationships
Each	relationship	becomes	a	row	in	the	table
Relationship	type	attributes	are	represented	by	columns
Queries	and	relations...
equality search attributes
• equality search attributes become
initial columns of a primary key
• querying on: title and t...
inequality search attributes
• clustering columns follow partition
key columns in a primary key
• the column involved in a...
ordering attributes
1. ordering attributes become clustering columns
2. querying on: user_id = ? and
uploaded_timestamp > ...
key attributes
1. relationship type key attributes are included as
primary key columns
2. queries affect primary key design
query driven methodology
conceptual data
model
access patterns
mapping
rules and
patterns
logical data
model
erd queries
d...
logical data model
this
sucks
a real world example, w/time series data
This	is	using	simple	strategy,	but	don’t	do	that	in	prod	PLEASE!
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 ...
& prepare to be wowed
cdm
https://github.com/riptano/cdm
cdm preview
namaste
but what does
it all mean?
also, we’re
hiring
Data Modeling for Apache Cassandra
Data Modeling for Apache Cassandra
Data Modeling for Apache Cassandra
Data Modeling for Apache Cassandra
Data Modeling for Apache Cassandra
Data Modeling for Apache Cassandra
Data Modeling for Apache Cassandra
Data Modeling for Apache Cassandra
Data Modeling for Apache Cassandra
Data Modeling for Apache Cassandra
Upcoming SlideShare
Loading in …5
×

Data Modeling for Apache Cassandra

2,018 views

Published on

Data Modeling is the one of the first things to sink your teeth into when trying out a new database. That's why we are going to cover this foundational topic in enough detail for you to get dangerous. Data Modeling for relational databases is more than a touch different than the way it's approached with Cassandra. We will address the quintessential query-driven methodology through a couple of different use cases, including working with time series data for IoT. We will also demo a new tool to get you bootstrapped quickly with MovieLens sample data. This talk should give you the basics you need to get serious with Apache Cassandra.

Published in: Technology
  • Be the first to comment

Data Modeling for Apache Cassandra

  1. 1. data modeling for apache cassandra with a sprinkle of C* background and some time series fun dani traphagen @dtrapezoid
  2. 2. quiz time - who is this?
  3. 3. but how do I even ?
  4. 4. query driven methodology conceptual data model access patterns mapping rules and patterns logical data model erd queries diagram it
  5. 5. conceptual data modeling • abstract view of the domain • technology independent • not specific to any database system
  6. 6. entity relationship diagram • entity types • relationship types • attribute types
  7. 7. relationship keys
  8. 8. attribute key participation • relationship attributes can make part of the key
  9. 9. full conceptual model
  10. 10. query driven methodology conceptual data model access patterns mapping rules and patterns logical data model erd queries diagram it
  11. 11. 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
  12. 12. application workflow
  13. 13. query driven methodology conceptual data model access patterns mapping rules and patterns logical data model erd queries diagram it
  14. 14. 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
  15. 15. mapping rules 1. entities and relationships 2. equality search attributes 3. inequality search attributes 4. ordering attributes 5. key attributes
  16. 16. 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
  17. 17. entities and relationships
  18. 18. 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 • 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
  19. 19. equality search attributes • equality search attributes become initial columns of a primary key • querying on: title and type
  20. 20. 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
  21. 21. ordering attributes 1. ordering attributes become clustering columns 2. querying on: user_id = ? and uploaded_timestamp > ? 3. ordering attributes : uploaded_timestamp (DESC)
  22. 22. key attributes 1. relationship type key attributes are included as primary key columns 2. queries affect primary key design
  23. 23. query driven methodology conceptual data model access patterns mapping rules and patterns logical data model erd queries diagram it
  24. 24. logical data model
  25. 25. this sucks a real world example, w/time series data
  26. 26. This is using simple strategy, but don’t do that in prod PLEASE!
  27. 27. time series bucketing
  28. 28. 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
  29. 29. & prepare to be wowed
  30. 30. cdm https://github.com/riptano/cdm cdm preview
  31. 31. namaste but what does it all mean? also, we’re hiring

×