SlideShare a Scribd company logo
The CQL3/Cassandra
Mapping
John Berryman
OpenSource Connections

OpenSource Connections
Outline
•
•
•
•
•
•
•

What Problem does CQL Solve?
The Cassandra Data Model
Pain Points of “Old” Cassandra
Introducing CQL
Understanding the CQL/Cassandra Mapping
CQL for Sets, Lists, and Maps
Putting it All Together

OpenSource Connections
What Problem does CQL Solve?
• The Awesomeness that is Cassandra:
o
o
o
o
o
o

Distributed columnar data store
No single point of failure
Optimized for availability (though “Tunably” consistent)
Optimized for writes
Easily maintainable
Almost infinitely scalable

.

OpenSource Connections
What Problem does CQL Solve?
• The Awesomeness that is Cassandra:
o
o
o
o
o
o

Distributed columnar data store
No single point of failure
Optimized for availability (though “Tunably” consistent)
Optimized for writes
Easily maintainable
Almost infinitely scalable

• Cassandra’s usability challenges
o NoSQL – “Where are my JOINS? No Schema? De-normalize!?”
o BigTable – “Tables with millions of columns!?”

.

OpenSource Connections
What Problem does CQL Solve?
• The Awesomeness that is Cassandra:
o
o
o
o
o
o

Distributed columnar data store
No single point of failure
Optimized for availability (though “Tunably” consistent)
Optimized for writes
Easily maintainable
Almost infinitely scalable

• Cassandra’s usability challenges
o NoSQL – “Where are my JOINS? No Schema? De-normalize!?”
o BigTable – “Tables with millions of columns!?”

• CQL saves the day!
o A best-practices interface to Cassandra
o Uses familiar SQL-like language
OpenSource Connections
C* Data Model
Keyspace

OpenSource Connections
C* Data Model
Keyspace
Column Family

Column Family

OpenSource Connections
C* Data Model
Keyspace
Column Family

Column Family

OpenSource Connections
C* Data Model
Keyspace
Column Family

Column Family

OpenSource Connections
C* Data Model
Row Key

OpenSource Connections
C* Data Model
Row Key

Column
Column Name

Column Value
(or Tombstone)
Timestamp
Time-to-live

OpenSource Connections
C* Data Model
Row Key

Column
Column Name

Column Value
(or Tombstone)
Timestamp
Time-to-live

● Row Key, Column Name, Column
Value have types
● Column Name has comparator
● RowKey has partitioner
● Rows can have any number of
columns - even in same column family
● Rows can have many columns
● Column Values can be omitted
● Time-to-live is useful!
● Tombstones
OpenSource Connections
C* Data Model: Writes

Mem
Table

CommitLog
Row
Cache

Bloom
Filter

● Insert into
MemTable
● Dump to
CommitLog
● No read
● Very Fast!
● Blocks on CPU
before O/I!
Key
Cache
Key
Cache
Key
Cache
Key
Cache

SSTable
SSTable
SSTable
SSTable

OpenSource Connections
C* Data Model: Writes

Mem
Table

CommitLog
Row
Cache

Bloom
Filter

● Insert into
MemTable
● Dump to
CommitLog
● No read
● Very Fast!
● Blocks on CPU
before O/I!
Key
Cache
Key
Cache
Key
Cache
Key
Cache

SSTable
SSTable
SSTable
SSTable

OpenSource Connections
C* Data Model: Writes

Mem
Table

CommitLog
Row
Cache

Bloom
Filter

● Insert into
MemTable
● Dump to
CommitLog
● No read
● Very Fast!
● Blocks on CPU
before O/I!
Key
Cache
Key
Cache
Key
Cache
Key
Cache

SSTable
SSTable
SSTable
SSTable

OpenSource Connections
C* Data Model:
Reads
Mem
Table

CommitLog
Row
Cache

Bloom
Filter

● Get values from Memtable
● Get values from row
cache if present
● Otherwise check bloom
filter to find appropriate
SSTables
● Check Key Cache for fast
SSTable Search
● Get values from SSTables
● Repopulate Row Cache
● Super Fast Col. retrieval
● Fast row slicing
Key
Cache
Key
Cache
Key
Cache
Key
Cache

SSTable
SSTable
SSTable
SSTable

OpenSource Connections
C* Data Model:
Reads
Mem
Table

CommitLog
Row
Cache

Bloom
Filter

● Get values from Memtable
● Get values from row
cache if present
● Otherwise check bloom
filter to find appropriate
SSTables
● Check Key Cache for fast
SSTable Search
● Get values from SSTables
● Repopulate Row Cache
● Super Fast Col. retrieval
● Fast row slicing
Key
Cache
Key
Cache
Key
Cache
Key
Cache

SSTable
SSTable
SSTable
SSTable

OpenSource Connections
C* Data Model:
Reads
Mem
Table

CommitLog
Row
Cache

Bloom
Filter

● Get values from Memtable
● Get values from row
cache if present
● Otherwise check bloom
filter to find appropriate
SSTables
● Check Key Cache for fast
SSTable Search
● Get values from SSTables
● Repopulate Row Cache
● Super Fast Col. retrieval
● Fast row slicing
Key
Cache
Key
Cache
Key
Cache
Key
Cache

SSTable
SSTable
SSTable
SSTable

OpenSource Connections
C* Data Model:
Reads
Mem
Table

CommitLog
Row
Cache

Bloom
Filter

● Get values from Memtable
● Get values from row
cache if present
● Otherwise check bloom
filter to find appropriate
SSTables
● Check Key Cache for fast
SSTable Search
● Get values from SSTables
● Repopulate Row Cache
● Super Fast Col. retrieval
● Fast row slicing
Key
Cache
Key
Cache
Key
Cache
Key
Cache

SSTable
SSTable
SSTable
SSTable

OpenSource Connections
C* Data Model:
Reads
Mem
Table

CommitLog
Row
Cache

Bloom
Filter

● Get values from Memtable
● Get values from row
cache if present
● Otherwise check bloom
filter to find appropriate
SSTables
● Check Key Cache for fast
SSTable Search
● Get values from SSTables
● Repopulate Row Cache
● Super Fast Col. retrieval
● Fast row slicing
Key
Cache
Key
Cache
Key
Cache
Key
Cache

SSTable
SSTable
SSTable
SSTable

OpenSource Connections
C* Data Model:
Reads
Mem
Table

CommitLog
Row
Cache

Bloom
Filter

● Get values from Memtable
● Get values from row
cache if present
● Otherwise check bloom
filter to find appropriate
SSTables
● Check Key Cache for fast
SSTable Search
● Get values from SSTables
● Repopulate Row Cache
● Super Fast Col. retrieval
● Fast row slicing
Key
Cache
Key
Cache
Key
Cache
Key
Cache

SSTable
SSTable
SSTable
SSTable

OpenSource Connections
Cassandra Pain Points
• Twitter Example
• My tweets
o SET tweets[JnBrymn][2013-07-19 T 09:20] = “Wonderful
morning. This coffee is great.”
o SET tweets[JnBrymn][2013-07-19 T 09:21] = “Oops, smoke is
coming out of the SQL server!”
o SET tweets[JnBrymn][2013-07-19 T 09:51] = “Now my coffee is
cold :-(”

• Get John’s tweets
o GET tweets[JnBrymn]

(output is as expected)

OpenSource Connections
Cassandra Pain Points
• Twitter Example
• My tweets
o SET tweets[JnBrymn][2013-07-19 T 09:20] = “Wonderful
morning. This coffee is great.”
o SET tweets[JnBrymn][2013-07-19 T 09:21] = “Oops, smoke is
coming out of the SQL server!”
o SET tweets[JnBrymn][2013-07-19 T 09:51] = “Now my coffee is
cold :-(”

• Get John’s tweets
o GET tweets[JnBrymn]

(output is as expected)

• Pain-point: schema-less means that you have to
read code to understand data model
OpenSource Connections
Cassandra Pain Points
• My timeline (other’s tweets)
• More complicated – must store corresponding user
names
• Bad Option 1: keep multiple column families
o SET timeline_from[JnBrymn][2013-07-19 T 09:20] =
“softwaredoug”
o SET timeline_text[JnBrymn][2013-07-19 T 09:20] = “Hey John I
posted on reddit, upvote me!”

• Get John’s timeline
o GET timeline_from[JnBrymn]
o GET timeline_text[JnBrymn]

OpenSource Connections
Cassandra Pain Points
• My timeline (other’s tweets)
• More complicated – must store corresponding user
names
• Bad Option 1: keep multiple column families
o SET timeline_from[JnBrymn][2013-07-19 T 09:20] =
“softwaredoug”
o SET timeline_text[JnBrymn][2013-07-19 T 09:20] = “Hey John I
posted on reddit, upvote me!”

• Get John’s timeline
o GET timeline_from[JnBrymn]
o GET timeline_text[JnBrymn]

• Pain-point: Multiple queries required.
OpenSource Connections
Cassandra Pain Points
• My timeline
• Bad Option 2: shove into single column value
o SET timeline[JnBrymn][2013-07-19 T 09:20] =
{from:”softwaredoug”, text: “Hey John I posted on reddit, upvote
me!”

• Get John’s timeline
o GET timeline[JnBrymn] (…not too bad.)

OpenSource Connections
Cassandra Pain Points
• My timeline
• Bad Option 2: shove into single column value
o SET timeline[JnBrymn][2013-07-19 T 09:20] =
{from:”softwaredoug”, text: “Hey John I posted on reddit, upvote
me!”

• Get John’s timeline
o GET timeline[JnBrymn] (…not too bad.)

• Pain-point: Updates require a read-then-modify

OpenSource Connections
Cassandra Pain Points
• My timeline
• Best Option: composite column names
o SET timeline[JnBrymn][2013-07-19 T 09:20|from] =
”softwaredoug”
o SET timeline[JnBrymn][2013-07-19 T 09:20|text] = “Hey John, I
posted on reddit, upvote me!”

• Get John’s timeline
o GET timeline[JnBrymn] (extract from and text in client)

• Resolves prior pain points! Scales well!

OpenSource Connections
Cassandra Pain Points
• My timeline
• Best Option: composite column names
o SET timeline[JnBrymn][2013-07-19 T 09:20|from] =
”softwaredoug”
o SET timeline[JnBrymn][2013-07-19 T 09:20|text] = “Hey John, I
posted on reddit, upvote me!”

• Get John’s timeline
o GET timeline[JnBrymn] (extract from and text in client)

• Resolves prior pain points! Scales well!
• Pain-point: Even more code reading to understand
data model!

OpenSource Connections
Cassandra Pain Points
• Justin Bieber’s timeline (e.g. many tweets)
• Previous solution fails if number of columns > 2Billion
• Best Option: composite row names
o SET timeline[bieber|2013-07][19 T 09:20|from] = ”softwaredoug”
o SET timeline[bieber|2013-07][19 T 09:20|text] = “Justin Bieber,
you complete me.”

• Get Justin’s timeline
o GET timeline[bieber|2013-07] (get other months too)

OpenSource Connections
Cassandra Pain Points
• Justin Bieber’s timeline (e.g. many tweets)
• Previous solution fails if number of columns > 2Billion
• Best Option: composite row names
o SET timeline[bieber|2013-07][19 T 09:20|from] = ”softwaredoug”
o SET timeline[bieber|2013-07][19 T 09:20|text] = “Justin Bieber,
you complete me.”

• Get Justin’s timeline
o GET timeline[bieber|2013-07] (get other months too)

• Pain-point: Even more code reading to understand
data model!

OpenSource Connections
Introducing CQL
• CQL is a reintroduction of schema so that you don’t
have to read code to understand the data model.
• CQL creates a common language so that details of
the data model can be easily communicated.
• CQL is a best-practices Cassandra interface and
hides the messy details.

OpenSource Connections
Introducing CQL
• CQL is a reintroduction of schema so that you don’t
have to read code to understand the data model.
• CQL creates a common language so that details of
the data model can be easily communicated.
• CQL is a best-practices Cassandra interface and
hides the messy details.

Let’s see it!
OpenSource Connections
Introducing CQL
CREATE TABLE users (
id timeuuid PRIMARY KEY,
lastname varchar,
firstname varchar,
dateOfBirth timestamp );

OpenSource Connections
Introducing CQL
CREATE TABLE users (
id timeuuid PRIMARY KEY,
lastname varchar,
firstname varchar,
dateOfBirth timestamp );
INSERT INTO users (id,lastname, firstname, dateofbirth)
VALUES (now(),'Berryman',’John','1975-09-15');

OpenSource Connections
Introducing CQL
CREATE TABLE users (
id timeuuid PRIMARY KEY,
lastname varchar,
firstname varchar,
dateOfBirth timestamp );
INSERT INTO users (id,lastname, firstname, dateofbirth)
VALUES (now(),’Berryman’,’John’,’1975-09-15’);
UPDATE users SET firstname = ’John’
WHERE id = f74c0b20-0862-11e3-8cf6-b74c10b01fc6;

OpenSource Connections
Introducing CQL
CREATE TABLE users (
id timeuuid PRIMARY KEY,
lastname varchar,
firstname varchar,
dateOfBirth timestamp );
INSERT INTO users (id,lastname, firstname, dateofbirth)
VALUES (now(),'Berryman',’John','1975-09-15');
UPDATE users SET firstname = 'John’
WHERE id = f74c0b20-0862-11e3-8cf6-b74c10b01fc6;
SELECT dateofbirth,firstname,lastname FROM users ;
dateofbirth
| firstname | lastname
--------------------------+-----------+---------1975-09-15 00:00:00-0400 |
John | Berryman
OpenSource Connections
Introducing CQL
“Hey sweet! It’s exactly the same as MySQL!”

OpenSource Connections
Introducing CQL
“Hey sweet! It’s exactly the same as MySQL!”
Hold your horses. There are some
important differences.

OpenSource Connections
Introducing CQL
“Hey sweet! It’s exactly the same as MySQL!”
Hold your horses. There are some
important differences.
“Wait? What happened to the
Cassandra’s wide rows?”

OpenSource Connections
Introducing CQL
“Hey sweet! It’s exactly the same as MySQL!”
Hold your horses. There are some
important differences.
“Wait? What happened to the
Cassandra’s wide rows?”
There’s still there. Understanding
the mapping is crucial!

OpenSource Connections
Introducing CQL
“Hey sweet! It’s exactly the same as MySQL!”
Hold your horses. There are some
important differences.
“Wait? What happened to the
Cassandra’s wide rows?”
There’s still there. Understanding
the mapping is crucial!

Remember this:

•Cassandra finds rows fast
•Cassandra scans columns fast
•Cassandra does not scan rows
OpenSource Connections
The CQL/Cassandra Mapping
CREATE TABLE employees (
name text PRIMARY KEY,
age int,
role text
);

OpenSource Connections
The CQL/Cassandra Mapping
CREATE TABLE employees (
name text PRIMARY KEY,
age int,
role text
);

name | age | role
-----+-----+----john | 37 | dev
eric | 38 | ceo

OpenSource Connections
The CQL/Cassandra Mapping
CREATE TABLE employees (
name text PRIMARY KEY,
age int,
role text
);

age
john

role

37

dev

name | age | role
-----+-----+----john | 37 | dev
eric | 38 | ceo

age
eric

role

38

ceo

OpenSource Connections
The CQL/Cassandra Mapping
CREATE TABLE employees (
company text,
name text,
age int,
role text,
PRIMARY KEY (company,name)
);

OpenSource Connections
The CQL/Cassandra Mapping
CREATE TABLE employees (
company text,
name text,
age int,
role text,
PRIMARY KEY (company,name)
);

company | name | age | role
--------+------+-----+----OSC | eric | 38 | ceo
OSC | john | 37 | dev
RKG | anya | 29 | lead
RKG | ben | 27 | dev
RKG | chad | 35 | ops

OpenSource Connections
The CQL/Cassandra Mapping
company | name | age | role
--------+------+-----+----OSC | eric | 38 | ceo
OSC | john | 37 | dev
RKG | anya | 29 | lead
RKG | ben | 27 | dev
RKG | chad | 35 | ops

CREATE TABLE employees (
company text,
name text,
age int,
role text,
PRIMARY KEY (company,name)
);
eric:age
OS
C

eric:role

john:age

john:role

38

dev

37

dev

anya:age
RK
G

anya:role

ben:age

ben:role

chad:age

chad:role

29

lead

27

dev

35

ops

OpenSource Connections
The CQL/Cassandra Mapping
CREATE TABLE example (
A text,
B text,
C text,
D text,
E text,
F text,
PRIMARY KEY ((A,B),C,D)
);

OpenSource Connections
The CQL/Cassandra Mapping
CREATE TABLE example (
A text,
B text,
C text,
D text,
E text,
F text,
PRIMARY KEY ((A,B),C,D)
);

A|B|C| D|E|F
--+---+---+---+---+--a|b|c|d|e|f
a|b|c|g|h|i
a|b|j|k|l|m
a|n|o|p|q|r
s|t|u|v|w|x

OpenSource Connections
The CQL/Cassandra Mapping
CREATE TABLE example (
A text,
B text,
C text,
D text,
E text,
F text,
PRIMARY KEY ((A,B),C,D)
);
c:d:E
c:d:F
a:b

f

o:p:E
a:n

e

r

c:g:E

c:g:F

j:k:E

j:k:F

h

i

l

m

u:v:E

u:v:F

w

x

o:p:F

q

A|B|C| D|E|F
--+---+---+---+---+--a|b|c|d|e|f
a|b|c|g|h|i
a|b|j|k|l|m
a|n|o|p|q|r
s|t|u|v|w|x

s:t

OpenSource Connections
CQL for Sets, Lists, and Maps
• Collection Semantics
o Sets hold list of unique elements
o Lists hold ordered, possibly repeating elements
o Maps hold a list of key-value pairs

• Uses same old Cassandra data structure

OpenSource Connections
CQL for Sets, Lists, and Maps
• Collection Semantics
o Sets hold list of unique elements
o Lists hold ordered, possibly repeating elements
o Maps hold a list of key-value pairs

• Uses same old Cassandra data structure
• Declaring
CREATE TABLE mytable(
X text,
Y text,
myset set<text>,
mylist list<int>,
mymap map<text, text>,
PRIMARY KEY (X,Y)
);
OpenSource Connections
CQL for Sets, Lists, and Maps
• Collection Semantics
o Sets hold list of unique elements
o Lists hold ordered, possibly repeating elements
o Maps hold a list of key-value pairs

• Uses same old Cassandra data structure
• Declaring
CREATE TABLE mytable(
X text,
Y text,
myset set<text>,
mylist list<int>,
mymap map<text, text>,
PRIMARY KEY (X,Y)
);

Collection fields
can not be used
in primary keys
OpenSource Connections
CQL for Sets, Lists, and Maps
• Inserting
INSERT INTO mytable (row, myset)
VALUES (123, { ‘apple’, ‘banana’});

OpenSource Connections
CQL for Sets, Lists, and Maps
• Inserting
INSERT INTO mytable (row, myset)
VALUES (123, { ‘apple’, ‘banana’});
INSERT INTO mytable (row, mylist)
VALUES (123, [‘apple’,’banana’,’apple’]);

OpenSource Connections
CQL for Sets, Lists, and Maps
• Inserting
INSERT INTO mytable (row, myset)
VALUES (123, { ‘apple’, ‘banana’});
INSERT INTO mytable (row, mylist)
VALUES (123, [‘apple’,’banana’,’apple’]);
INSERT INTO mytable (row, mymap)
VALUES (123, {1:’apple’,2:’banana’})

OpenSource Connections
CQL for Sets, Lists, and Maps
• Updating
UPDATE mytable SET myset = myset + {‘apple’,‘banana’}
WHERE row = 123;
UPDATE mytable SET myset = myset - { ‘apple’ }
WHERE row = 123;

OpenSource Connections
CQL for Sets, Lists, and Maps
• Updating
UPDATE mytable SET myset = myset + {‘apple’,‘banana’}
WHERE row = 123;
UPDATE mytable SET myset = myset - { ‘apple’ }
WHERE row = 123;
UPDATE mytable SET mylist = mylist + [‘apple’,‘banana’]
WHERE row = 123;
UPDATE mytable SET mylist = [‘banana’] + mylist
WHERE row = 123;

OpenSource Connections
CQL for Sets, Lists, and Maps
• Updating
UPDATE mytable SET myset = myset + {‘apple’,‘banana’}
WHERE row = 123;
UPDATE mytable SET myset = myset - { ‘apple’ }
WHERE row = 123;
UPDATE mytable SET mylist = mylist + [‘apple’,‘banana’]
WHERE row = 123;
UPDATE mytable SET mylist = [‘banana’] + mylist
WHERE row = 123;
UPDATE mytable SET mymap[‘fruit’] = ‘apple’
WHERE row = 123
UPDATE mytable SET mymap = mymap + { ‘fruit’:‘apple’}
WHERE row = 123
OpenSource Connections
CQL for Sets, Lists, and Maps
SETS
CREATE TABLE mytable(
X text,
Y text,
myset set<int>,
PRIMARY KEY (X,Y)
);

OpenSource Connections
CQL for Sets, Lists, and Maps
SETS
CREATE TABLE mytable(
X text,
Y text,
myset set<int>,
PRIMARY KEY (X,Y)
);

X | Y | myset
---+---+-----------a | b | {1,2}
a | c | {3,4,5}

OpenSource Connections
CQL for Sets, Lists, and Maps
SETS
CREATE TABLE mytable(
X text,
Y text,
myset set<int>,
PRIMARY KEY (X,Y)
);

b:myset:1

b:myset:2

X | Y | myset
---+---+-----------a | b | {1,2}
a | c | {3,4,5}

c:myset:3

c:myset:4

c:myset:5

a

OpenSource Connections
CQL for Sets, Lists, and Maps
LISTS
CREATE TABLE mytable(
X text,
Y text,
mylist list<int>,
PRIMARY KEY (X,Y)
);

OpenSource Connections
CQL for Sets, Lists, and Maps
LISTS
CREATE TABLE mytable(
X text,
Y text,
mylist list<int>,
PRIMARY KEY (X,Y)
);

X | Y | mylist
---+---+-----------a | b | [1,2]

OpenSource Connections
CQL for Sets, Lists, and Maps
LISTS
CREATE TABLE mytable(
X text,
Y text,
mylist list<int>,
PRIMARY KEY (X,Y)
);

X | Y | mylist
---+---+-----------a | b | [1,2]

b:mylist:f7e5450039..8d
a

b:mylist:f7e5450139..8d

1

2

OpenSource Connections
CQL for Sets, Lists, and Maps
LISTS
CREATE TABLE mytable(
X text,
Y text,
mylist list<int>,
PRIMARY KEY (X,Y)
);

X | Y | mylist
---+---+-----------a | b | [1,2]

b:mylist:f7e5450039..8d
a

b:mylist:f7e5450139..8d

1

2

OpenSource Connections
CQL for Sets, Lists, and Maps
MAPS
CREATE TABLE mytable(
X text,
Y text,
mymap map<text,int>,
PRIMARY KEY (X,Y)
);

OpenSource Connections
CQL for Sets, Lists, and Maps
MAPS
CREATE TABLE mytable(
X text,
Y text,
mymap map<text,int>,
PRIMARY KEY (X,Y)
);

X | Y | mymap
---+---+-----------a | b | {m:1,n:2}
a | c |{n:3,p:4,q:5}

OpenSource Connections
CQL for Sets, Lists, and Maps
MAPS
X | Y | mymap
---+---+-----------a | b | {m:1,n:2}
a | c |{n:3,p:4,q:5}

CREATE TABLE mytable(
X text,
Y text,
mymap map<text,int>,
PRIMARY KEY (X,Y)
);

b:mymap:m
a

b:mymap:n

c:mymap:n

c:mymap:p

c:mymap:q

1

2

3

4

5

OpenSource Connections
Peek Behind the Scenes! Do it!
(in cqlsh)
CREATE KEYSPACE test WITH replication =
{'class': 'SimpleStrategy', 'replication_factor': 1};
USE test;
CREATE TABLE stuff ( a int, b int, myset set<int>,
mylist list<int>, mymap map<int,int>, PRIMARY KEY (a,b));
UPDATE stuff SET myset = {1,2}, mylist = [3,4,5], mymap = {6:7,8:9} WHERE a = 0
AND b = 1;
SELECT * FROM stuff;
(in cassandra-cli)
use test;
list stuff ;
(in cqlsh)
SELECT key_aliases,column_aliases from system.schema_columnfamilies WHERE
keyspace_name = 'test' AND columnfamily_name = 'stuff';
OpenSource Connections
Putting it All Together
…you already know
• CQL is a reintroduction of schema
• CQL creates a common data modeling language
• CQL is a best-practices Cassandra interface

.
OpenSource Connections
Putting it All Together
…you already know
• CQL is a reintroduction of schema
• CQL creates a common data modeling language
• CQL is a best-practices Cassandra interface
…now you know
• CQL let’s you take advantage of the C* Data structure

.
OpenSource Connections
Putting it All Together
…you already know
• CQL is a reintroduction of schema
• CQL creates a common data modeling language
• CQL is a best-practices Cassandra interface
…now you know
• CQL let’s you take advantage of the C* Data structure
…but also
• CQL protocol is binary and therefore interoperable with
any language
• CQL is asynchronous and fast (Thrift transport layer is
synchronous)
• CQL allows the possibility for prepared statements
OpenSource Connections
Thanks!
Follow me on Twitter @JnBrymn
Check out the OpenSource Connection Blog
http://www.opensourceconnections.com/blog/

OpenSource Connections

More Related Content

What's hot

The Rise of ZStandard: Apache Spark/Parquet/ORC/Avro
The Rise of ZStandard: Apache Spark/Parquet/ORC/AvroThe Rise of ZStandard: Apache Spark/Parquet/ORC/Avro
The Rise of ZStandard: Apache Spark/Parquet/ORC/Avro
Databricks
 
주니어의 쿠버네티스 생태계에서 살아남기
주니어의 쿠버네티스 생태계에서 살아남기주니어의 쿠버네티스 생태계에서 살아남기
주니어의 쿠버네티스 생태계에서 살아남기
InfraEngineer
 
Real-time Analytics with Trino and Apache Pinot
Real-time Analytics with Trino and Apache PinotReal-time Analytics with Trino and Apache Pinot
Real-time Analytics with Trino and Apache Pinot
Xiang Fu
 
Amazon Aurora: Under the Hood
Amazon Aurora: Under the HoodAmazon Aurora: Under the Hood
Amazon Aurora: Under the Hood
Amazon Web Services
 
Side by Side with Elasticsearch & Solr, Part 2
Side by Side with Elasticsearch & Solr, Part 2Side by Side with Elasticsearch & Solr, Part 2
Side by Side with Elasticsearch & Solr, Part 2
Sematext Group, Inc.
 
Top 5 mistakes when writing Spark applications
Top 5 mistakes when writing Spark applicationsTop 5 mistakes when writing Spark applications
Top 5 mistakes when writing Spark applications
hadooparchbook
 
Infrastructure at Scale: Apache Kafka, Twitter Storm & Elastic Search (ARC303...
Infrastructure at Scale: Apache Kafka, Twitter Storm & Elastic Search (ARC303...Infrastructure at Scale: Apache Kafka, Twitter Storm & Elastic Search (ARC303...
Infrastructure at Scale: Apache Kafka, Twitter Storm & Elastic Search (ARC303...
Amazon Web Services
 
Scylla Summit 2022: How to Migrate a Counter Table for 68 Billion Records
Scylla Summit 2022: How to Migrate a Counter Table for 68 Billion RecordsScylla Summit 2022: How to Migrate a Counter Table for 68 Billion Records
Scylla Summit 2022: How to Migrate a Counter Table for 68 Billion Records
ScyllaDB
 
Load Data Fast!
Load Data Fast!Load Data Fast!
Our answer to Uber
Our answer to UberOur answer to Uber
Our answer to Uber
Alexander Korotkov
 
Building robust CDC pipeline with Apache Hudi and Debezium
Building robust CDC pipeline with Apache Hudi and DebeziumBuilding robust CDC pipeline with Apache Hudi and Debezium
Building robust CDC pipeline with Apache Hudi and Debezium
Tathastu.ai
 
C* Summit 2013: The World's Next Top Data Model by Patrick McFadin
C* Summit 2013: The World's Next Top Data Model by Patrick McFadinC* Summit 2013: The World's Next Top Data Model by Patrick McFadin
C* Summit 2013: The World's Next Top Data Model by Patrick McFadin
DataStax Academy
 
InnoDB Internal
InnoDB InternalInnoDB Internal
InnoDB Internal
mysqlops
 
Using Apache Arrow, Calcite, and Parquet to Build a Relational Cache
Using Apache Arrow, Calcite, and Parquet to Build a Relational CacheUsing Apache Arrow, Calcite, and Parquet to Build a Relational Cache
Using Apache Arrow, Calcite, and Parquet to Build a Relational Cache
Dremio Corporation
 
Don’t optimize my queries, optimize my data!
Don’t optimize my queries, optimize my data!Don’t optimize my queries, optimize my data!
Don’t optimize my queries, optimize my data!
Julian Hyde
 
Wait! What’s going on inside my database?
Wait! What’s going on inside my database?Wait! What’s going on inside my database?
Wait! What’s going on inside my database?
Jeremy Schneider
 
Optimizing Kubernetes Resource Requests/Limits for Cost-Efficiency and Latenc...
Optimizing Kubernetes Resource Requests/Limits for Cost-Efficiency and Latenc...Optimizing Kubernetes Resource Requests/Limits for Cost-Efficiency and Latenc...
Optimizing Kubernetes Resource Requests/Limits for Cost-Efficiency and Latenc...
Henning Jacobs
 
Trino at linkedIn - 2021
Trino at linkedIn - 2021Trino at linkedIn - 2021
Trino at linkedIn - 2021
Akshay Rai
 
M|18 Deep Dive: InnoDB Transactions and Write Paths
M|18 Deep Dive: InnoDB Transactions and Write PathsM|18 Deep Dive: InnoDB Transactions and Write Paths
M|18 Deep Dive: InnoDB Transactions and Write Paths
MariaDB plc
 
Iceberg: A modern table format for big data (Strata NY 2018)
Iceberg: A modern table format for big data (Strata NY 2018)Iceberg: A modern table format for big data (Strata NY 2018)
Iceberg: A modern table format for big data (Strata NY 2018)
Ryan Blue
 

What's hot (20)

The Rise of ZStandard: Apache Spark/Parquet/ORC/Avro
The Rise of ZStandard: Apache Spark/Parquet/ORC/AvroThe Rise of ZStandard: Apache Spark/Parquet/ORC/Avro
The Rise of ZStandard: Apache Spark/Parquet/ORC/Avro
 
주니어의 쿠버네티스 생태계에서 살아남기
주니어의 쿠버네티스 생태계에서 살아남기주니어의 쿠버네티스 생태계에서 살아남기
주니어의 쿠버네티스 생태계에서 살아남기
 
Real-time Analytics with Trino and Apache Pinot
Real-time Analytics with Trino and Apache PinotReal-time Analytics with Trino and Apache Pinot
Real-time Analytics with Trino and Apache Pinot
 
Amazon Aurora: Under the Hood
Amazon Aurora: Under the HoodAmazon Aurora: Under the Hood
Amazon Aurora: Under the Hood
 
Side by Side with Elasticsearch & Solr, Part 2
Side by Side with Elasticsearch & Solr, Part 2Side by Side with Elasticsearch & Solr, Part 2
Side by Side with Elasticsearch & Solr, Part 2
 
Top 5 mistakes when writing Spark applications
Top 5 mistakes when writing Spark applicationsTop 5 mistakes when writing Spark applications
Top 5 mistakes when writing Spark applications
 
Infrastructure at Scale: Apache Kafka, Twitter Storm & Elastic Search (ARC303...
Infrastructure at Scale: Apache Kafka, Twitter Storm & Elastic Search (ARC303...Infrastructure at Scale: Apache Kafka, Twitter Storm & Elastic Search (ARC303...
Infrastructure at Scale: Apache Kafka, Twitter Storm & Elastic Search (ARC303...
 
Scylla Summit 2022: How to Migrate a Counter Table for 68 Billion Records
Scylla Summit 2022: How to Migrate a Counter Table for 68 Billion RecordsScylla Summit 2022: How to Migrate a Counter Table for 68 Billion Records
Scylla Summit 2022: How to Migrate a Counter Table for 68 Billion Records
 
Load Data Fast!
Load Data Fast!Load Data Fast!
Load Data Fast!
 
Our answer to Uber
Our answer to UberOur answer to Uber
Our answer to Uber
 
Building robust CDC pipeline with Apache Hudi and Debezium
Building robust CDC pipeline with Apache Hudi and DebeziumBuilding robust CDC pipeline with Apache Hudi and Debezium
Building robust CDC pipeline with Apache Hudi and Debezium
 
C* Summit 2013: The World's Next Top Data Model by Patrick McFadin
C* Summit 2013: The World's Next Top Data Model by Patrick McFadinC* Summit 2013: The World's Next Top Data Model by Patrick McFadin
C* Summit 2013: The World's Next Top Data Model by Patrick McFadin
 
InnoDB Internal
InnoDB InternalInnoDB Internal
InnoDB Internal
 
Using Apache Arrow, Calcite, and Parquet to Build a Relational Cache
Using Apache Arrow, Calcite, and Parquet to Build a Relational CacheUsing Apache Arrow, Calcite, and Parquet to Build a Relational Cache
Using Apache Arrow, Calcite, and Parquet to Build a Relational Cache
 
Don’t optimize my queries, optimize my data!
Don’t optimize my queries, optimize my data!Don’t optimize my queries, optimize my data!
Don’t optimize my queries, optimize my data!
 
Wait! What’s going on inside my database?
Wait! What’s going on inside my database?Wait! What’s going on inside my database?
Wait! What’s going on inside my database?
 
Optimizing Kubernetes Resource Requests/Limits for Cost-Efficiency and Latenc...
Optimizing Kubernetes Resource Requests/Limits for Cost-Efficiency and Latenc...Optimizing Kubernetes Resource Requests/Limits for Cost-Efficiency and Latenc...
Optimizing Kubernetes Resource Requests/Limits for Cost-Efficiency and Latenc...
 
Trino at linkedIn - 2021
Trino at linkedIn - 2021Trino at linkedIn - 2021
Trino at linkedIn - 2021
 
M|18 Deep Dive: InnoDB Transactions and Write Paths
M|18 Deep Dive: InnoDB Transactions and Write PathsM|18 Deep Dive: InnoDB Transactions and Write Paths
M|18 Deep Dive: InnoDB Transactions and Write Paths
 
Iceberg: A modern table format for big data (Strata NY 2018)
Iceberg: A modern table format for big data (Strata NY 2018)Iceberg: A modern table format for big data (Strata NY 2018)
Iceberg: A modern table format for big data (Strata NY 2018)
 

Similar to Understanding How CQL3 Maps to Cassandra's Internal Data Structure

Cassandra Summit 2014: Understanding CQL3 Inside and Out
Cassandra Summit 2014: Understanding CQL3 Inside and OutCassandra Summit 2014: Understanding CQL3 Inside and Out
Cassandra Summit 2014: Understanding CQL3 Inside and Out
DataStax Academy
 
Cassandra Community Webinar: Back to Basics with CQL3
Cassandra Community Webinar: Back to Basics with CQL3Cassandra Community Webinar: Back to Basics with CQL3
Cassandra Community Webinar: Back to Basics with CQL3
DataStax
 
Apache Cassandra Developer Training Slide Deck
Apache Cassandra Developer Training Slide DeckApache Cassandra Developer Training Slide Deck
Apache Cassandra Developer Training Slide Deck
DataStax Academy
 
Cassandra Basics, Counters and Time Series Modeling
Cassandra Basics, Counters and Time Series ModelingCassandra Basics, Counters and Time Series Modeling
Cassandra Basics, Counters and Time Series Modeling
Vassilis Bekiaris
 
Delta: Building Merge on Read
Delta: Building Merge on ReadDelta: Building Merge on Read
Delta: Building Merge on Read
Databricks
 
Advanced Schema Design Patterns
Advanced Schema Design PatternsAdvanced Schema Design Patterns
Advanced Schema Design Patterns
MongoDB
 
Sizing MongoDB Clusters
Sizing MongoDB Clusters Sizing MongoDB Clusters
Sizing MongoDB Clusters
MongoDB
 
Introduction to Apache Cassandra
Introduction to Apache CassandraIntroduction to Apache Cassandra
Introduction to Apache Cassandra
Luke Tillman
 
Observer, a "real life" time series application
Observer, a "real life" time series applicationObserver, a "real life" time series application
Observer, a "real life" time series application
Kévin LOVATO
 
Apache Cassandra - Data modelling
Apache Cassandra - Data modellingApache Cassandra - Data modelling
Apache Cassandra - Data modelling
Alex Thompson
 
Ten query tuning techniques every SQL Server programmer should know
Ten query tuning techniques every SQL Server programmer should knowTen query tuning techniques every SQL Server programmer should know
Ten query tuning techniques every SQL Server programmer should know
Kevin Kline
 
MongoDB at Baidu
MongoDB at BaiduMongoDB at Baidu
MongoDB at Baidu
Mat Keep
 
Getting Started with Apache Cassandra by Junior Evangelist Rebecca Mills
Getting Started with Apache Cassandra by Junior Evangelist Rebecca MillsGetting Started with Apache Cassandra by Junior Evangelist Rebecca Mills
Getting Started with Apache Cassandra by Junior Evangelist Rebecca Mills
DataStax Academy
 
Dynamic SQL: How to Build Fast Multi-Parameter Stored Procedures
Dynamic SQL: How to Build Fast Multi-Parameter Stored ProceduresDynamic SQL: How to Build Fast Multi-Parameter Stored Procedures
Dynamic SQL: How to Build Fast Multi-Parameter Stored Procedures
Brent Ozar
 
Data Science Lab Meetup: Cassandra and Spark
Data Science Lab Meetup: Cassandra and SparkData Science Lab Meetup: Cassandra and Spark
Data Science Lab Meetup: Cassandra and Spark
Christopher Batey
 
C* Summit 2013: How Not to Use Cassandra by Axel Liljencrantz
C* Summit 2013: How Not to Use Cassandra by Axel LiljencrantzC* Summit 2013: How Not to Use Cassandra by Axel Liljencrantz
C* Summit 2013: How Not to Use Cassandra by Axel Liljencrantz
DataStax Academy
 
Effective C++
Effective C++Effective C++
Effective C++
Andrey Karpov
 
Acunu Analytics: Simpler Real-Time Cassandra Apps
Acunu Analytics: Simpler Real-Time Cassandra AppsAcunu Analytics: Simpler Real-Time Cassandra Apps
Acunu Analytics: Simpler Real-Time Cassandra Apps
Acunu
 
VSSML16 L5. Basic Data Transformations
VSSML16 L5. Basic Data TransformationsVSSML16 L5. Basic Data Transformations
VSSML16 L5. Basic Data Transformations
BigML, Inc
 
Cassandra introduction apache con 2014 budapest
Cassandra introduction apache con 2014 budapestCassandra introduction apache con 2014 budapest
Cassandra introduction apache con 2014 budapest
Duyhai Doan
 

Similar to Understanding How CQL3 Maps to Cassandra's Internal Data Structure (20)

Cassandra Summit 2014: Understanding CQL3 Inside and Out
Cassandra Summit 2014: Understanding CQL3 Inside and OutCassandra Summit 2014: Understanding CQL3 Inside and Out
Cassandra Summit 2014: Understanding CQL3 Inside and Out
 
Cassandra Community Webinar: Back to Basics with CQL3
Cassandra Community Webinar: Back to Basics with CQL3Cassandra Community Webinar: Back to Basics with CQL3
Cassandra Community Webinar: Back to Basics with CQL3
 
Apache Cassandra Developer Training Slide Deck
Apache Cassandra Developer Training Slide DeckApache Cassandra Developer Training Slide Deck
Apache Cassandra Developer Training Slide Deck
 
Cassandra Basics, Counters and Time Series Modeling
Cassandra Basics, Counters and Time Series ModelingCassandra Basics, Counters and Time Series Modeling
Cassandra Basics, Counters and Time Series Modeling
 
Delta: Building Merge on Read
Delta: Building Merge on ReadDelta: Building Merge on Read
Delta: Building Merge on Read
 
Advanced Schema Design Patterns
Advanced Schema Design PatternsAdvanced Schema Design Patterns
Advanced Schema Design Patterns
 
Sizing MongoDB Clusters
Sizing MongoDB Clusters Sizing MongoDB Clusters
Sizing MongoDB Clusters
 
Introduction to Apache Cassandra
Introduction to Apache CassandraIntroduction to Apache Cassandra
Introduction to Apache Cassandra
 
Observer, a "real life" time series application
Observer, a "real life" time series applicationObserver, a "real life" time series application
Observer, a "real life" time series application
 
Apache Cassandra - Data modelling
Apache Cassandra - Data modellingApache Cassandra - Data modelling
Apache Cassandra - Data modelling
 
Ten query tuning techniques every SQL Server programmer should know
Ten query tuning techniques every SQL Server programmer should knowTen query tuning techniques every SQL Server programmer should know
Ten query tuning techniques every SQL Server programmer should know
 
MongoDB at Baidu
MongoDB at BaiduMongoDB at Baidu
MongoDB at Baidu
 
Getting Started with Apache Cassandra by Junior Evangelist Rebecca Mills
Getting Started with Apache Cassandra by Junior Evangelist Rebecca MillsGetting Started with Apache Cassandra by Junior Evangelist Rebecca Mills
Getting Started with Apache Cassandra by Junior Evangelist Rebecca Mills
 
Dynamic SQL: How to Build Fast Multi-Parameter Stored Procedures
Dynamic SQL: How to Build Fast Multi-Parameter Stored ProceduresDynamic SQL: How to Build Fast Multi-Parameter Stored Procedures
Dynamic SQL: How to Build Fast Multi-Parameter Stored Procedures
 
Data Science Lab Meetup: Cassandra and Spark
Data Science Lab Meetup: Cassandra and SparkData Science Lab Meetup: Cassandra and Spark
Data Science Lab Meetup: Cassandra and Spark
 
C* Summit 2013: How Not to Use Cassandra by Axel Liljencrantz
C* Summit 2013: How Not to Use Cassandra by Axel LiljencrantzC* Summit 2013: How Not to Use Cassandra by Axel Liljencrantz
C* Summit 2013: How Not to Use Cassandra by Axel Liljencrantz
 
Effective C++
Effective C++Effective C++
Effective C++
 
Acunu Analytics: Simpler Real-Time Cassandra Apps
Acunu Analytics: Simpler Real-Time Cassandra AppsAcunu Analytics: Simpler Real-Time Cassandra Apps
Acunu Analytics: Simpler Real-Time Cassandra Apps
 
VSSML16 L5. Basic Data Transformations
VSSML16 L5. Basic Data TransformationsVSSML16 L5. Basic Data Transformations
VSSML16 L5. Basic Data Transformations
 
Cassandra introduction apache con 2014 budapest
Cassandra introduction apache con 2014 budapestCassandra introduction apache con 2014 budapest
Cassandra introduction apache con 2014 budapest
 

More from DataStax

Is Your Enterprise Ready to Shine This Holiday Season?
Is Your Enterprise Ready to Shine This Holiday Season?Is Your Enterprise Ready to Shine This Holiday Season?
Is Your Enterprise Ready to Shine This Holiday Season?
DataStax
 
Designing Fault-Tolerant Applications with DataStax Enterprise and Apache Cas...
Designing Fault-Tolerant Applications with DataStax Enterprise and Apache Cas...Designing Fault-Tolerant Applications with DataStax Enterprise and Apache Cas...
Designing Fault-Tolerant Applications with DataStax Enterprise and Apache Cas...
DataStax
 
Running DataStax Enterprise in VMware Cloud and Hybrid Environments
Running DataStax Enterprise in VMware Cloud and Hybrid EnvironmentsRunning DataStax Enterprise in VMware Cloud and Hybrid Environments
Running DataStax Enterprise in VMware Cloud and Hybrid Environments
DataStax
 
Best Practices for Getting to Production with DataStax Enterprise Graph
Best Practices for Getting to Production with DataStax Enterprise GraphBest Practices for Getting to Production with DataStax Enterprise Graph
Best Practices for Getting to Production with DataStax Enterprise Graph
DataStax
 
Webinar | Data Management for Hybrid and Multi-Cloud: A Four-Step Journey
Webinar | Data Management for Hybrid and Multi-Cloud: A Four-Step JourneyWebinar | Data Management for Hybrid and Multi-Cloud: A Four-Step Journey
Webinar | Data Management for Hybrid and Multi-Cloud: A Four-Step Journey
DataStax
 
Webinar | How to Understand Apache Cassandra™ Performance Through Read/Writ...
Webinar  |  How to Understand Apache Cassandra™ Performance Through Read/Writ...Webinar  |  How to Understand Apache Cassandra™ Performance Through Read/Writ...
Webinar | How to Understand Apache Cassandra™ Performance Through Read/Writ...
DataStax
 
Webinar | Better Together: Apache Cassandra and Apache Kafka
Webinar  |  Better Together: Apache Cassandra and Apache KafkaWebinar  |  Better Together: Apache Cassandra and Apache Kafka
Webinar | Better Together: Apache Cassandra and Apache Kafka
DataStax
 
Top 10 Best Practices for Apache Cassandra and DataStax Enterprise
Top 10 Best Practices for Apache Cassandra and DataStax EnterpriseTop 10 Best Practices for Apache Cassandra and DataStax Enterprise
Top 10 Best Practices for Apache Cassandra and DataStax Enterprise
DataStax
 
Introduction to Apache Cassandra™ + What’s New in 4.0
Introduction to Apache Cassandra™ + What’s New in 4.0Introduction to Apache Cassandra™ + What’s New in 4.0
Introduction to Apache Cassandra™ + What’s New in 4.0
DataStax
 
Webinar: How Active Everywhere Database Architecture Accelerates Hybrid Cloud...
Webinar: How Active Everywhere Database Architecture Accelerates Hybrid Cloud...Webinar: How Active Everywhere Database Architecture Accelerates Hybrid Cloud...
Webinar: How Active Everywhere Database Architecture Accelerates Hybrid Cloud...
DataStax
 
Webinar | Aligning GDPR Requirements with Today's Hybrid Cloud Realities
Webinar  |  Aligning GDPR Requirements with Today's Hybrid Cloud RealitiesWebinar  |  Aligning GDPR Requirements with Today's Hybrid Cloud Realities
Webinar | Aligning GDPR Requirements with Today's Hybrid Cloud Realities
DataStax
 
Designing a Distributed Cloud Database for Dummies
Designing a Distributed Cloud Database for DummiesDesigning a Distributed Cloud Database for Dummies
Designing a Distributed Cloud Database for Dummies
DataStax
 
How to Power Innovation with Geo-Distributed Data Management in Hybrid Cloud
How to Power Innovation with Geo-Distributed Data Management in Hybrid CloudHow to Power Innovation with Geo-Distributed Data Management in Hybrid Cloud
How to Power Innovation with Geo-Distributed Data Management in Hybrid Cloud
DataStax
 
How to Evaluate Cloud Databases for eCommerce
How to Evaluate Cloud Databases for eCommerceHow to Evaluate Cloud Databases for eCommerce
How to Evaluate Cloud Databases for eCommerce
DataStax
 
Webinar: DataStax Enterprise 6: 10 Ways to Multiply the Power of Apache Cassa...
Webinar: DataStax Enterprise 6: 10 Ways to Multiply the Power of Apache Cassa...Webinar: DataStax Enterprise 6: 10 Ways to Multiply the Power of Apache Cassa...
Webinar: DataStax Enterprise 6: 10 Ways to Multiply the Power of Apache Cassa...
DataStax
 
Webinar: DataStax and Microsoft Azure: Empowering the Right-Now Enterprise wi...
Webinar: DataStax and Microsoft Azure: Empowering the Right-Now Enterprise wi...Webinar: DataStax and Microsoft Azure: Empowering the Right-Now Enterprise wi...
Webinar: DataStax and Microsoft Azure: Empowering the Right-Now Enterprise wi...
DataStax
 
Webinar - Real-Time Customer Experience for the Right-Now Enterprise featurin...
Webinar - Real-Time Customer Experience for the Right-Now Enterprise featurin...Webinar - Real-Time Customer Experience for the Right-Now Enterprise featurin...
Webinar - Real-Time Customer Experience for the Right-Now Enterprise featurin...
DataStax
 
Datastax - The Architect's guide to customer experience (CX)
Datastax - The Architect's guide to customer experience (CX)Datastax - The Architect's guide to customer experience (CX)
Datastax - The Architect's guide to customer experience (CX)
DataStax
 
An Operational Data Layer is Critical for Transformative Banking Applications
An Operational Data Layer is Critical for Transformative Banking ApplicationsAn Operational Data Layer is Critical for Transformative Banking Applications
An Operational Data Layer is Critical for Transformative Banking Applications
DataStax
 
Becoming a Customer-Centric Enterprise Via Real-Time Data and Design Thinking
Becoming a Customer-Centric Enterprise Via Real-Time Data and Design ThinkingBecoming a Customer-Centric Enterprise Via Real-Time Data and Design Thinking
Becoming a Customer-Centric Enterprise Via Real-Time Data and Design Thinking
DataStax
 

More from DataStax (20)

Is Your Enterprise Ready to Shine This Holiday Season?
Is Your Enterprise Ready to Shine This Holiday Season?Is Your Enterprise Ready to Shine This Holiday Season?
Is Your Enterprise Ready to Shine This Holiday Season?
 
Designing Fault-Tolerant Applications with DataStax Enterprise and Apache Cas...
Designing Fault-Tolerant Applications with DataStax Enterprise and Apache Cas...Designing Fault-Tolerant Applications with DataStax Enterprise and Apache Cas...
Designing Fault-Tolerant Applications with DataStax Enterprise and Apache Cas...
 
Running DataStax Enterprise in VMware Cloud and Hybrid Environments
Running DataStax Enterprise in VMware Cloud and Hybrid EnvironmentsRunning DataStax Enterprise in VMware Cloud and Hybrid Environments
Running DataStax Enterprise in VMware Cloud and Hybrid Environments
 
Best Practices for Getting to Production with DataStax Enterprise Graph
Best Practices for Getting to Production with DataStax Enterprise GraphBest Practices for Getting to Production with DataStax Enterprise Graph
Best Practices for Getting to Production with DataStax Enterprise Graph
 
Webinar | Data Management for Hybrid and Multi-Cloud: A Four-Step Journey
Webinar | Data Management for Hybrid and Multi-Cloud: A Four-Step JourneyWebinar | Data Management for Hybrid and Multi-Cloud: A Four-Step Journey
Webinar | Data Management for Hybrid and Multi-Cloud: A Four-Step Journey
 
Webinar | How to Understand Apache Cassandra™ Performance Through Read/Writ...
Webinar  |  How to Understand Apache Cassandra™ Performance Through Read/Writ...Webinar  |  How to Understand Apache Cassandra™ Performance Through Read/Writ...
Webinar | How to Understand Apache Cassandra™ Performance Through Read/Writ...
 
Webinar | Better Together: Apache Cassandra and Apache Kafka
Webinar  |  Better Together: Apache Cassandra and Apache KafkaWebinar  |  Better Together: Apache Cassandra and Apache Kafka
Webinar | Better Together: Apache Cassandra and Apache Kafka
 
Top 10 Best Practices for Apache Cassandra and DataStax Enterprise
Top 10 Best Practices for Apache Cassandra and DataStax EnterpriseTop 10 Best Practices for Apache Cassandra and DataStax Enterprise
Top 10 Best Practices for Apache Cassandra and DataStax Enterprise
 
Introduction to Apache Cassandra™ + What’s New in 4.0
Introduction to Apache Cassandra™ + What’s New in 4.0Introduction to Apache Cassandra™ + What’s New in 4.0
Introduction to Apache Cassandra™ + What’s New in 4.0
 
Webinar: How Active Everywhere Database Architecture Accelerates Hybrid Cloud...
Webinar: How Active Everywhere Database Architecture Accelerates Hybrid Cloud...Webinar: How Active Everywhere Database Architecture Accelerates Hybrid Cloud...
Webinar: How Active Everywhere Database Architecture Accelerates Hybrid Cloud...
 
Webinar | Aligning GDPR Requirements with Today's Hybrid Cloud Realities
Webinar  |  Aligning GDPR Requirements with Today's Hybrid Cloud RealitiesWebinar  |  Aligning GDPR Requirements with Today's Hybrid Cloud Realities
Webinar | Aligning GDPR Requirements with Today's Hybrid Cloud Realities
 
Designing a Distributed Cloud Database for Dummies
Designing a Distributed Cloud Database for DummiesDesigning a Distributed Cloud Database for Dummies
Designing a Distributed Cloud Database for Dummies
 
How to Power Innovation with Geo-Distributed Data Management in Hybrid Cloud
How to Power Innovation with Geo-Distributed Data Management in Hybrid CloudHow to Power Innovation with Geo-Distributed Data Management in Hybrid Cloud
How to Power Innovation with Geo-Distributed Data Management in Hybrid Cloud
 
How to Evaluate Cloud Databases for eCommerce
How to Evaluate Cloud Databases for eCommerceHow to Evaluate Cloud Databases for eCommerce
How to Evaluate Cloud Databases for eCommerce
 
Webinar: DataStax Enterprise 6: 10 Ways to Multiply the Power of Apache Cassa...
Webinar: DataStax Enterprise 6: 10 Ways to Multiply the Power of Apache Cassa...Webinar: DataStax Enterprise 6: 10 Ways to Multiply the Power of Apache Cassa...
Webinar: DataStax Enterprise 6: 10 Ways to Multiply the Power of Apache Cassa...
 
Webinar: DataStax and Microsoft Azure: Empowering the Right-Now Enterprise wi...
Webinar: DataStax and Microsoft Azure: Empowering the Right-Now Enterprise wi...Webinar: DataStax and Microsoft Azure: Empowering the Right-Now Enterprise wi...
Webinar: DataStax and Microsoft Azure: Empowering the Right-Now Enterprise wi...
 
Webinar - Real-Time Customer Experience for the Right-Now Enterprise featurin...
Webinar - Real-Time Customer Experience for the Right-Now Enterprise featurin...Webinar - Real-Time Customer Experience for the Right-Now Enterprise featurin...
Webinar - Real-Time Customer Experience for the Right-Now Enterprise featurin...
 
Datastax - The Architect's guide to customer experience (CX)
Datastax - The Architect's guide to customer experience (CX)Datastax - The Architect's guide to customer experience (CX)
Datastax - The Architect's guide to customer experience (CX)
 
An Operational Data Layer is Critical for Transformative Banking Applications
An Operational Data Layer is Critical for Transformative Banking ApplicationsAn Operational Data Layer is Critical for Transformative Banking Applications
An Operational Data Layer is Critical for Transformative Banking Applications
 
Becoming a Customer-Centric Enterprise Via Real-Time Data and Design Thinking
Becoming a Customer-Centric Enterprise Via Real-Time Data and Design ThinkingBecoming a Customer-Centric Enterprise Via Real-Time Data and Design Thinking
Becoming a Customer-Centric Enterprise Via Real-Time Data and Design Thinking
 

Recently uploaded

Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
Dinusha Kumarasiri
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
AstuteBusiness
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
saastr
 
dbms calicut university B. sc Cs 4th sem.pdf
dbms  calicut university B. sc Cs 4th sem.pdfdbms  calicut university B. sc Cs 4th sem.pdf
dbms calicut university B. sc Cs 4th sem.pdf
Shinana2
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
Javier Junquera
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
AWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptxAWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptx
HarisZaheer8
 
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - HiikeSystem Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
Hiike
 
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
alexjohnson7307
 

Recently uploaded (20)

Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
 
dbms calicut university B. sc Cs 4th sem.pdf
dbms  calicut university B. sc Cs 4th sem.pdfdbms  calicut university B. sc Cs 4th sem.pdf
dbms calicut university B. sc Cs 4th sem.pdf
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
AWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptxAWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptx
 
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - HiikeSystem Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
 
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
 

Understanding How CQL3 Maps to Cassandra's Internal Data Structure

  • 1. The CQL3/Cassandra Mapping John Berryman OpenSource Connections OpenSource Connections
  • 2. Outline • • • • • • • What Problem does CQL Solve? The Cassandra Data Model Pain Points of “Old” Cassandra Introducing CQL Understanding the CQL/Cassandra Mapping CQL for Sets, Lists, and Maps Putting it All Together OpenSource Connections
  • 3. What Problem does CQL Solve? • The Awesomeness that is Cassandra: o o o o o o Distributed columnar data store No single point of failure Optimized for availability (though “Tunably” consistent) Optimized for writes Easily maintainable Almost infinitely scalable . OpenSource Connections
  • 4. What Problem does CQL Solve? • The Awesomeness that is Cassandra: o o o o o o Distributed columnar data store No single point of failure Optimized for availability (though “Tunably” consistent) Optimized for writes Easily maintainable Almost infinitely scalable • Cassandra’s usability challenges o NoSQL – “Where are my JOINS? No Schema? De-normalize!?” o BigTable – “Tables with millions of columns!?” . OpenSource Connections
  • 5. What Problem does CQL Solve? • The Awesomeness that is Cassandra: o o o o o o Distributed columnar data store No single point of failure Optimized for availability (though “Tunably” consistent) Optimized for writes Easily maintainable Almost infinitely scalable • Cassandra’s usability challenges o NoSQL – “Where are my JOINS? No Schema? De-normalize!?” o BigTable – “Tables with millions of columns!?” • CQL saves the day! o A best-practices interface to Cassandra o Uses familiar SQL-like language OpenSource Connections
  • 7. C* Data Model Keyspace Column Family Column Family OpenSource Connections
  • 8. C* Data Model Keyspace Column Family Column Family OpenSource Connections
  • 9. C* Data Model Keyspace Column Family Column Family OpenSource Connections
  • 10. C* Data Model Row Key OpenSource Connections
  • 11. C* Data Model Row Key Column Column Name Column Value (or Tombstone) Timestamp Time-to-live OpenSource Connections
  • 12. C* Data Model Row Key Column Column Name Column Value (or Tombstone) Timestamp Time-to-live ● Row Key, Column Name, Column Value have types ● Column Name has comparator ● RowKey has partitioner ● Rows can have any number of columns - even in same column family ● Rows can have many columns ● Column Values can be omitted ● Time-to-live is useful! ● Tombstones OpenSource Connections
  • 13. C* Data Model: Writes Mem Table CommitLog Row Cache Bloom Filter ● Insert into MemTable ● Dump to CommitLog ● No read ● Very Fast! ● Blocks on CPU before O/I! Key Cache Key Cache Key Cache Key Cache SSTable SSTable SSTable SSTable OpenSource Connections
  • 14. C* Data Model: Writes Mem Table CommitLog Row Cache Bloom Filter ● Insert into MemTable ● Dump to CommitLog ● No read ● Very Fast! ● Blocks on CPU before O/I! Key Cache Key Cache Key Cache Key Cache SSTable SSTable SSTable SSTable OpenSource Connections
  • 15. C* Data Model: Writes Mem Table CommitLog Row Cache Bloom Filter ● Insert into MemTable ● Dump to CommitLog ● No read ● Very Fast! ● Blocks on CPU before O/I! Key Cache Key Cache Key Cache Key Cache SSTable SSTable SSTable SSTable OpenSource Connections
  • 16. C* Data Model: Reads Mem Table CommitLog Row Cache Bloom Filter ● Get values from Memtable ● Get values from row cache if present ● Otherwise check bloom filter to find appropriate SSTables ● Check Key Cache for fast SSTable Search ● Get values from SSTables ● Repopulate Row Cache ● Super Fast Col. retrieval ● Fast row slicing Key Cache Key Cache Key Cache Key Cache SSTable SSTable SSTable SSTable OpenSource Connections
  • 17. C* Data Model: Reads Mem Table CommitLog Row Cache Bloom Filter ● Get values from Memtable ● Get values from row cache if present ● Otherwise check bloom filter to find appropriate SSTables ● Check Key Cache for fast SSTable Search ● Get values from SSTables ● Repopulate Row Cache ● Super Fast Col. retrieval ● Fast row slicing Key Cache Key Cache Key Cache Key Cache SSTable SSTable SSTable SSTable OpenSource Connections
  • 18. C* Data Model: Reads Mem Table CommitLog Row Cache Bloom Filter ● Get values from Memtable ● Get values from row cache if present ● Otherwise check bloom filter to find appropriate SSTables ● Check Key Cache for fast SSTable Search ● Get values from SSTables ● Repopulate Row Cache ● Super Fast Col. retrieval ● Fast row slicing Key Cache Key Cache Key Cache Key Cache SSTable SSTable SSTable SSTable OpenSource Connections
  • 19. C* Data Model: Reads Mem Table CommitLog Row Cache Bloom Filter ● Get values from Memtable ● Get values from row cache if present ● Otherwise check bloom filter to find appropriate SSTables ● Check Key Cache for fast SSTable Search ● Get values from SSTables ● Repopulate Row Cache ● Super Fast Col. retrieval ● Fast row slicing Key Cache Key Cache Key Cache Key Cache SSTable SSTable SSTable SSTable OpenSource Connections
  • 20. C* Data Model: Reads Mem Table CommitLog Row Cache Bloom Filter ● Get values from Memtable ● Get values from row cache if present ● Otherwise check bloom filter to find appropriate SSTables ● Check Key Cache for fast SSTable Search ● Get values from SSTables ● Repopulate Row Cache ● Super Fast Col. retrieval ● Fast row slicing Key Cache Key Cache Key Cache Key Cache SSTable SSTable SSTable SSTable OpenSource Connections
  • 21. C* Data Model: Reads Mem Table CommitLog Row Cache Bloom Filter ● Get values from Memtable ● Get values from row cache if present ● Otherwise check bloom filter to find appropriate SSTables ● Check Key Cache for fast SSTable Search ● Get values from SSTables ● Repopulate Row Cache ● Super Fast Col. retrieval ● Fast row slicing Key Cache Key Cache Key Cache Key Cache SSTable SSTable SSTable SSTable OpenSource Connections
  • 22. Cassandra Pain Points • Twitter Example • My tweets o SET tweets[JnBrymn][2013-07-19 T 09:20] = “Wonderful morning. This coffee is great.” o SET tweets[JnBrymn][2013-07-19 T 09:21] = “Oops, smoke is coming out of the SQL server!” o SET tweets[JnBrymn][2013-07-19 T 09:51] = “Now my coffee is cold :-(” • Get John’s tweets o GET tweets[JnBrymn] (output is as expected) OpenSource Connections
  • 23. Cassandra Pain Points • Twitter Example • My tweets o SET tweets[JnBrymn][2013-07-19 T 09:20] = “Wonderful morning. This coffee is great.” o SET tweets[JnBrymn][2013-07-19 T 09:21] = “Oops, smoke is coming out of the SQL server!” o SET tweets[JnBrymn][2013-07-19 T 09:51] = “Now my coffee is cold :-(” • Get John’s tweets o GET tweets[JnBrymn] (output is as expected) • Pain-point: schema-less means that you have to read code to understand data model OpenSource Connections
  • 24. Cassandra Pain Points • My timeline (other’s tweets) • More complicated – must store corresponding user names • Bad Option 1: keep multiple column families o SET timeline_from[JnBrymn][2013-07-19 T 09:20] = “softwaredoug” o SET timeline_text[JnBrymn][2013-07-19 T 09:20] = “Hey John I posted on reddit, upvote me!” • Get John’s timeline o GET timeline_from[JnBrymn] o GET timeline_text[JnBrymn] OpenSource Connections
  • 25. Cassandra Pain Points • My timeline (other’s tweets) • More complicated – must store corresponding user names • Bad Option 1: keep multiple column families o SET timeline_from[JnBrymn][2013-07-19 T 09:20] = “softwaredoug” o SET timeline_text[JnBrymn][2013-07-19 T 09:20] = “Hey John I posted on reddit, upvote me!” • Get John’s timeline o GET timeline_from[JnBrymn] o GET timeline_text[JnBrymn] • Pain-point: Multiple queries required. OpenSource Connections
  • 26. Cassandra Pain Points • My timeline • Bad Option 2: shove into single column value o SET timeline[JnBrymn][2013-07-19 T 09:20] = {from:”softwaredoug”, text: “Hey John I posted on reddit, upvote me!” • Get John’s timeline o GET timeline[JnBrymn] (…not too bad.) OpenSource Connections
  • 27. Cassandra Pain Points • My timeline • Bad Option 2: shove into single column value o SET timeline[JnBrymn][2013-07-19 T 09:20] = {from:”softwaredoug”, text: “Hey John I posted on reddit, upvote me!” • Get John’s timeline o GET timeline[JnBrymn] (…not too bad.) • Pain-point: Updates require a read-then-modify OpenSource Connections
  • 28. Cassandra Pain Points • My timeline • Best Option: composite column names o SET timeline[JnBrymn][2013-07-19 T 09:20|from] = ”softwaredoug” o SET timeline[JnBrymn][2013-07-19 T 09:20|text] = “Hey John, I posted on reddit, upvote me!” • Get John’s timeline o GET timeline[JnBrymn] (extract from and text in client) • Resolves prior pain points! Scales well! OpenSource Connections
  • 29. Cassandra Pain Points • My timeline • Best Option: composite column names o SET timeline[JnBrymn][2013-07-19 T 09:20|from] = ”softwaredoug” o SET timeline[JnBrymn][2013-07-19 T 09:20|text] = “Hey John, I posted on reddit, upvote me!” • Get John’s timeline o GET timeline[JnBrymn] (extract from and text in client) • Resolves prior pain points! Scales well! • Pain-point: Even more code reading to understand data model! OpenSource Connections
  • 30. Cassandra Pain Points • Justin Bieber’s timeline (e.g. many tweets) • Previous solution fails if number of columns > 2Billion • Best Option: composite row names o SET timeline[bieber|2013-07][19 T 09:20|from] = ”softwaredoug” o SET timeline[bieber|2013-07][19 T 09:20|text] = “Justin Bieber, you complete me.” • Get Justin’s timeline o GET timeline[bieber|2013-07] (get other months too) OpenSource Connections
  • 31. Cassandra Pain Points • Justin Bieber’s timeline (e.g. many tweets) • Previous solution fails if number of columns > 2Billion • Best Option: composite row names o SET timeline[bieber|2013-07][19 T 09:20|from] = ”softwaredoug” o SET timeline[bieber|2013-07][19 T 09:20|text] = “Justin Bieber, you complete me.” • Get Justin’s timeline o GET timeline[bieber|2013-07] (get other months too) • Pain-point: Even more code reading to understand data model! OpenSource Connections
  • 32. Introducing CQL • CQL is a reintroduction of schema so that you don’t have to read code to understand the data model. • CQL creates a common language so that details of the data model can be easily communicated. • CQL is a best-practices Cassandra interface and hides the messy details. OpenSource Connections
  • 33. Introducing CQL • CQL is a reintroduction of schema so that you don’t have to read code to understand the data model. • CQL creates a common language so that details of the data model can be easily communicated. • CQL is a best-practices Cassandra interface and hides the messy details. Let’s see it! OpenSource Connections
  • 34. Introducing CQL CREATE TABLE users ( id timeuuid PRIMARY KEY, lastname varchar, firstname varchar, dateOfBirth timestamp ); OpenSource Connections
  • 35. Introducing CQL CREATE TABLE users ( id timeuuid PRIMARY KEY, lastname varchar, firstname varchar, dateOfBirth timestamp ); INSERT INTO users (id,lastname, firstname, dateofbirth) VALUES (now(),'Berryman',’John','1975-09-15'); OpenSource Connections
  • 36. Introducing CQL CREATE TABLE users ( id timeuuid PRIMARY KEY, lastname varchar, firstname varchar, dateOfBirth timestamp ); INSERT INTO users (id,lastname, firstname, dateofbirth) VALUES (now(),’Berryman’,’John’,’1975-09-15’); UPDATE users SET firstname = ’John’ WHERE id = f74c0b20-0862-11e3-8cf6-b74c10b01fc6; OpenSource Connections
  • 37. Introducing CQL CREATE TABLE users ( id timeuuid PRIMARY KEY, lastname varchar, firstname varchar, dateOfBirth timestamp ); INSERT INTO users (id,lastname, firstname, dateofbirth) VALUES (now(),'Berryman',’John','1975-09-15'); UPDATE users SET firstname = 'John’ WHERE id = f74c0b20-0862-11e3-8cf6-b74c10b01fc6; SELECT dateofbirth,firstname,lastname FROM users ; dateofbirth | firstname | lastname --------------------------+-----------+---------1975-09-15 00:00:00-0400 | John | Berryman OpenSource Connections
  • 38. Introducing CQL “Hey sweet! It’s exactly the same as MySQL!” OpenSource Connections
  • 39. Introducing CQL “Hey sweet! It’s exactly the same as MySQL!” Hold your horses. There are some important differences. OpenSource Connections
  • 40. Introducing CQL “Hey sweet! It’s exactly the same as MySQL!” Hold your horses. There are some important differences. “Wait? What happened to the Cassandra’s wide rows?” OpenSource Connections
  • 41. Introducing CQL “Hey sweet! It’s exactly the same as MySQL!” Hold your horses. There are some important differences. “Wait? What happened to the Cassandra’s wide rows?” There’s still there. Understanding the mapping is crucial! OpenSource Connections
  • 42. Introducing CQL “Hey sweet! It’s exactly the same as MySQL!” Hold your horses. There are some important differences. “Wait? What happened to the Cassandra’s wide rows?” There’s still there. Understanding the mapping is crucial! Remember this: •Cassandra finds rows fast •Cassandra scans columns fast •Cassandra does not scan rows OpenSource Connections
  • 43. The CQL/Cassandra Mapping CREATE TABLE employees ( name text PRIMARY KEY, age int, role text ); OpenSource Connections
  • 44. The CQL/Cassandra Mapping CREATE TABLE employees ( name text PRIMARY KEY, age int, role text ); name | age | role -----+-----+----john | 37 | dev eric | 38 | ceo OpenSource Connections
  • 45. The CQL/Cassandra Mapping CREATE TABLE employees ( name text PRIMARY KEY, age int, role text ); age john role 37 dev name | age | role -----+-----+----john | 37 | dev eric | 38 | ceo age eric role 38 ceo OpenSource Connections
  • 46. The CQL/Cassandra Mapping CREATE TABLE employees ( company text, name text, age int, role text, PRIMARY KEY (company,name) ); OpenSource Connections
  • 47. The CQL/Cassandra Mapping CREATE TABLE employees ( company text, name text, age int, role text, PRIMARY KEY (company,name) ); company | name | age | role --------+------+-----+----OSC | eric | 38 | ceo OSC | john | 37 | dev RKG | anya | 29 | lead RKG | ben | 27 | dev RKG | chad | 35 | ops OpenSource Connections
  • 48. The CQL/Cassandra Mapping company | name | age | role --------+------+-----+----OSC | eric | 38 | ceo OSC | john | 37 | dev RKG | anya | 29 | lead RKG | ben | 27 | dev RKG | chad | 35 | ops CREATE TABLE employees ( company text, name text, age int, role text, PRIMARY KEY (company,name) ); eric:age OS C eric:role john:age john:role 38 dev 37 dev anya:age RK G anya:role ben:age ben:role chad:age chad:role 29 lead 27 dev 35 ops OpenSource Connections
  • 49. The CQL/Cassandra Mapping CREATE TABLE example ( A text, B text, C text, D text, E text, F text, PRIMARY KEY ((A,B),C,D) ); OpenSource Connections
  • 50. The CQL/Cassandra Mapping CREATE TABLE example ( A text, B text, C text, D text, E text, F text, PRIMARY KEY ((A,B),C,D) ); A|B|C| D|E|F --+---+---+---+---+--a|b|c|d|e|f a|b|c|g|h|i a|b|j|k|l|m a|n|o|p|q|r s|t|u|v|w|x OpenSource Connections
  • 51. The CQL/Cassandra Mapping CREATE TABLE example ( A text, B text, C text, D text, E text, F text, PRIMARY KEY ((A,B),C,D) ); c:d:E c:d:F a:b f o:p:E a:n e r c:g:E c:g:F j:k:E j:k:F h i l m u:v:E u:v:F w x o:p:F q A|B|C| D|E|F --+---+---+---+---+--a|b|c|d|e|f a|b|c|g|h|i a|b|j|k|l|m a|n|o|p|q|r s|t|u|v|w|x s:t OpenSource Connections
  • 52. CQL for Sets, Lists, and Maps • Collection Semantics o Sets hold list of unique elements o Lists hold ordered, possibly repeating elements o Maps hold a list of key-value pairs • Uses same old Cassandra data structure OpenSource Connections
  • 53. CQL for Sets, Lists, and Maps • Collection Semantics o Sets hold list of unique elements o Lists hold ordered, possibly repeating elements o Maps hold a list of key-value pairs • Uses same old Cassandra data structure • Declaring CREATE TABLE mytable( X text, Y text, myset set<text>, mylist list<int>, mymap map<text, text>, PRIMARY KEY (X,Y) ); OpenSource Connections
  • 54. CQL for Sets, Lists, and Maps • Collection Semantics o Sets hold list of unique elements o Lists hold ordered, possibly repeating elements o Maps hold a list of key-value pairs • Uses same old Cassandra data structure • Declaring CREATE TABLE mytable( X text, Y text, myset set<text>, mylist list<int>, mymap map<text, text>, PRIMARY KEY (X,Y) ); Collection fields can not be used in primary keys OpenSource Connections
  • 55. CQL for Sets, Lists, and Maps • Inserting INSERT INTO mytable (row, myset) VALUES (123, { ‘apple’, ‘banana’}); OpenSource Connections
  • 56. CQL for Sets, Lists, and Maps • Inserting INSERT INTO mytable (row, myset) VALUES (123, { ‘apple’, ‘banana’}); INSERT INTO mytable (row, mylist) VALUES (123, [‘apple’,’banana’,’apple’]); OpenSource Connections
  • 57. CQL for Sets, Lists, and Maps • Inserting INSERT INTO mytable (row, myset) VALUES (123, { ‘apple’, ‘banana’}); INSERT INTO mytable (row, mylist) VALUES (123, [‘apple’,’banana’,’apple’]); INSERT INTO mytable (row, mymap) VALUES (123, {1:’apple’,2:’banana’}) OpenSource Connections
  • 58. CQL for Sets, Lists, and Maps • Updating UPDATE mytable SET myset = myset + {‘apple’,‘banana’} WHERE row = 123; UPDATE mytable SET myset = myset - { ‘apple’ } WHERE row = 123; OpenSource Connections
  • 59. CQL for Sets, Lists, and Maps • Updating UPDATE mytable SET myset = myset + {‘apple’,‘banana’} WHERE row = 123; UPDATE mytable SET myset = myset - { ‘apple’ } WHERE row = 123; UPDATE mytable SET mylist = mylist + [‘apple’,‘banana’] WHERE row = 123; UPDATE mytable SET mylist = [‘banana’] + mylist WHERE row = 123; OpenSource Connections
  • 60. CQL for Sets, Lists, and Maps • Updating UPDATE mytable SET myset = myset + {‘apple’,‘banana’} WHERE row = 123; UPDATE mytable SET myset = myset - { ‘apple’ } WHERE row = 123; UPDATE mytable SET mylist = mylist + [‘apple’,‘banana’] WHERE row = 123; UPDATE mytable SET mylist = [‘banana’] + mylist WHERE row = 123; UPDATE mytable SET mymap[‘fruit’] = ‘apple’ WHERE row = 123 UPDATE mytable SET mymap = mymap + { ‘fruit’:‘apple’} WHERE row = 123 OpenSource Connections
  • 61. CQL for Sets, Lists, and Maps SETS CREATE TABLE mytable( X text, Y text, myset set<int>, PRIMARY KEY (X,Y) ); OpenSource Connections
  • 62. CQL for Sets, Lists, and Maps SETS CREATE TABLE mytable( X text, Y text, myset set<int>, PRIMARY KEY (X,Y) ); X | Y | myset ---+---+-----------a | b | {1,2} a | c | {3,4,5} OpenSource Connections
  • 63. CQL for Sets, Lists, and Maps SETS CREATE TABLE mytable( X text, Y text, myset set<int>, PRIMARY KEY (X,Y) ); b:myset:1 b:myset:2 X | Y | myset ---+---+-----------a | b | {1,2} a | c | {3,4,5} c:myset:3 c:myset:4 c:myset:5 a OpenSource Connections
  • 64. CQL for Sets, Lists, and Maps LISTS CREATE TABLE mytable( X text, Y text, mylist list<int>, PRIMARY KEY (X,Y) ); OpenSource Connections
  • 65. CQL for Sets, Lists, and Maps LISTS CREATE TABLE mytable( X text, Y text, mylist list<int>, PRIMARY KEY (X,Y) ); X | Y | mylist ---+---+-----------a | b | [1,2] OpenSource Connections
  • 66. CQL for Sets, Lists, and Maps LISTS CREATE TABLE mytable( X text, Y text, mylist list<int>, PRIMARY KEY (X,Y) ); X | Y | mylist ---+---+-----------a | b | [1,2] b:mylist:f7e5450039..8d a b:mylist:f7e5450139..8d 1 2 OpenSource Connections
  • 67. CQL for Sets, Lists, and Maps LISTS CREATE TABLE mytable( X text, Y text, mylist list<int>, PRIMARY KEY (X,Y) ); X | Y | mylist ---+---+-----------a | b | [1,2] b:mylist:f7e5450039..8d a b:mylist:f7e5450139..8d 1 2 OpenSource Connections
  • 68. CQL for Sets, Lists, and Maps MAPS CREATE TABLE mytable( X text, Y text, mymap map<text,int>, PRIMARY KEY (X,Y) ); OpenSource Connections
  • 69. CQL for Sets, Lists, and Maps MAPS CREATE TABLE mytable( X text, Y text, mymap map<text,int>, PRIMARY KEY (X,Y) ); X | Y | mymap ---+---+-----------a | b | {m:1,n:2} a | c |{n:3,p:4,q:5} OpenSource Connections
  • 70. CQL for Sets, Lists, and Maps MAPS X | Y | mymap ---+---+-----------a | b | {m:1,n:2} a | c |{n:3,p:4,q:5} CREATE TABLE mytable( X text, Y text, mymap map<text,int>, PRIMARY KEY (X,Y) ); b:mymap:m a b:mymap:n c:mymap:n c:mymap:p c:mymap:q 1 2 3 4 5 OpenSource Connections
  • 71. Peek Behind the Scenes! Do it! (in cqlsh) CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}; USE test; CREATE TABLE stuff ( a int, b int, myset set<int>, mylist list<int>, mymap map<int,int>, PRIMARY KEY (a,b)); UPDATE stuff SET myset = {1,2}, mylist = [3,4,5], mymap = {6:7,8:9} WHERE a = 0 AND b = 1; SELECT * FROM stuff; (in cassandra-cli) use test; list stuff ; (in cqlsh) SELECT key_aliases,column_aliases from system.schema_columnfamilies WHERE keyspace_name = 'test' AND columnfamily_name = 'stuff'; OpenSource Connections
  • 72. Putting it All Together …you already know • CQL is a reintroduction of schema • CQL creates a common data modeling language • CQL is a best-practices Cassandra interface . OpenSource Connections
  • 73. Putting it All Together …you already know • CQL is a reintroduction of schema • CQL creates a common data modeling language • CQL is a best-practices Cassandra interface …now you know • CQL let’s you take advantage of the C* Data structure . OpenSource Connections
  • 74. Putting it All Together …you already know • CQL is a reintroduction of schema • CQL creates a common data modeling language • CQL is a best-practices Cassandra interface …now you know • CQL let’s you take advantage of the C* Data structure …but also • CQL protocol is binary and therefore interoperable with any language • CQL is asynchronous and fast (Thrift transport layer is synchronous) • CQL allows the possibility for prepared statements OpenSource Connections
  • 75. Thanks! Follow me on Twitter @JnBrymn Check out the OpenSource Connection Blog http://www.opensourceconnections.com/blog/ OpenSource Connections

Editor's Notes

  1. No need to bother with composite column names or row keys.Grouping fields into SQL-like rows.Easy-to-use collections.
  2. No need to bother with composite column names or row keys.Grouping fields into SQL-like rows.Easy-to-use collections.
  3. No need to bother with composite column names or row keys.Grouping fields into SQL-like rows.Easy-to-use collections.