SlideShare a Scribd company logo
Submit Search
Upload
Cassandra Basics: Indexing
Report
Benjamin Black
Mayor at Giggleton
Follow
•
44 likes
•
22,795 views
1
of
48
Cassandra Basics: Indexing
•
44 likes
•
22,795 views
Download Now
Download to read offline
Report
Technology
Education
Business
An introduction to indexing with supercolumns and range queries in Cassandra.
Read more
Benjamin Black
Mayor at Giggleton
Follow
Recommended
DBI
Lambert Lum
160 views
•
24 slides
Exemple de création de base
Saber LAJILI
539 views
•
2 slides
SetFocus Portfolio
donjoshu
305 views
•
14 slides
Growing jQuery
gueste8d8bc
661 views
•
12 slides
Cassandra Explained
Eric Evans
22.1K views
•
50 slides
[Infographie] Comment ameliorer la qualité de vos données pour votre DMP mark...
Camp de Bases (Webedia Data Services)
1.1K views
•
1 slide
More Related Content
Viewers also liked
Cassandra
오석 한
641 views
•
25 slides
Graphite cluster setup blueprint
Anatoliy Dobrosynets
9.6K views
•
6 slides
Understanding BYOE and How Today's User Experience Drives Value for UC
ShoreTel
1.3K views
•
24 slides
The Big 3 - 3 Keys to the Customer Kingdom - Business process, Big data, and ...
aliproductninja
841 views
•
10 slides
What is a DMP
Sarah Jones
814 views
•
40 slides
Highly Available Graphite
Matthew Barlocker
6.7K views
•
26 slides
Viewers also liked
(20)
Cassandra
오석 한
•
641 views
Graphite cluster setup blueprint
Anatoliy Dobrosynets
•
9.6K views
Understanding BYOE and How Today's User Experience Drives Value for UC
ShoreTel
•
1.3K views
The Big 3 - 3 Keys to the Customer Kingdom - Business process, Big data, and ...
aliproductninja
•
841 views
What is a DMP
Sarah Jones
•
814 views
Highly Available Graphite
Matthew Barlocker
•
6.7K views
Cassandra Basics, Counters and Time Series Modeling
Vassilis Bekiaris
•
7.7K views
Cassandra and Spark
datastaxjp
•
1.2K views
data science toolkit 101: set up Python, Spark, & Jupyter
Raj Singh
•
546 views
Introduction to Apache Spark
Juan Pedro Moreno
•
1.2K views
Presentation of Apache Cassandra
Nikiforos Botis
•
8K views
Introduction to Cassandra - Denver
Jon Haddad
•
3.1K views
Developers summit cassandraで見るNoSQL
Ryu Kobayashi
•
2.4K views
Intro to py spark (and cassandra)
Jon Haddad
•
6.7K views
The Nitty Gritty of Advanced Analytics Using Apache Spark in Python
Miklos Christine
•
1.4K views
Python & Cassandra - Best Friends
Jon Haddad
•
684 views
Diagnosing Problems in Production: Cassandra Summit 2014
Jon Haddad
•
1.4K views
Intro to Cassandra
Jon Haddad
•
1.5K views
The Cassandra Distributed Database
Eric Evans
•
9.1K views
PySpark Cassandra - Amsterdam Spark Meetup
Frens Jan Rumph
•
2K views
Similar to Cassandra Basics: Indexing
Building Your First Java Application with MongoDB
MongoDB
1.9K views
•
50 slides
Elasticsearch for SQL Users
All Things Open
641 views
•
26 slides
MongoDB - Features and Operations
ramyaranjith
43 views
•
30 slides
Json at work overview and ecosystem-v2.0
Boulder Java User's Group
1.4K views
•
67 slides
Elasticsearch for SQL Users
Great Wide Open
286 views
•
26 slides
Embedding a language into string interpolator
Michael Limansky
360 views
•
57 slides
Similar to Cassandra Basics: Indexing
(10)
Building Your First Java Application with MongoDB
MongoDB
•
1.9K views
Elasticsearch for SQL Users
All Things Open
•
641 views
MongoDB - Features and Operations
ramyaranjith
•
43 views
Json at work overview and ecosystem-v2.0
Boulder Java User's Group
•
1.4K views
Elasticsearch for SQL Users
Great Wide Open
•
286 views
Embedding a language into string interpolator
Michael Limansky
•
360 views
Native json in the Cache' ObjectScript 2016.*
Timur Safin
•
474 views
The Aggregation Framework
MongoDB
•
46.8K views
MongoDB .local Bengaluru 2019: Aggregation Pipeline Power++: How MongoDB 4.2 ...
MongoDB
•
298 views
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB
•
359 views
Recently uploaded
Liqid: Composable CXL Preview
CXL Forum
118 views
•
8 slides
[2023] Putting the R! in R&D.pdf
Eleanor McHugh
34 views
•
127 slides
PyCon ID 2023 - Ridwan Fadjar Septian.pdf
Ridwan Fadjar
163 views
•
45 slides
Webinar : Competing for tomorrow’s leaders – How MENA insurers can win the wa...
The Digital Insurer
24 views
•
18 slides
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
Vadym Kazulkin
45 views
•
64 slides
Empathic Computing: Delivering the Potential of the Metaverse
Mark Billinghurst
389 views
•
80 slides
Recently uploaded
(20)
Liqid: Composable CXL Preview
CXL Forum
•
118 views
[2023] Putting the R! in R&D.pdf
Eleanor McHugh
•
34 views
PyCon ID 2023 - Ridwan Fadjar Septian.pdf
Ridwan Fadjar
•
163 views
Webinar : Competing for tomorrow’s leaders – How MENA insurers can win the wa...
The Digital Insurer
•
24 views
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
Vadym Kazulkin
•
45 views
Empathic Computing: Delivering the Potential of the Metaverse
Mark Billinghurst
•
389 views
AI: mind, matter, meaning, metaphors, being, becoming, life values
Twain Liu 刘秋艳
•
28 views
TE Connectivity: Card Edge Interconnects
CXL Forum
•
93 views
Micron CXL product and architecture update
CXL Forum
•
23 views
Throughput
Moisés Armani Ramírez
•
28 views
Java 21 and Beyond- A Roadmap of Innovations .pdf
Ana-Maria Mihalceanu
•
51 views
Transcript: The Details of Description Techniques tips and tangents on altern...
BookNet Canada
•
99 views
Green Leaf Consulting: Capabilities Deck
GreenLeafConsulting
•
170 views
JCon Live 2023 - Lice coding some integration problems
Bernd Ruecker
•
61 views
"Ukrainian Mobile Banking Scaling in Practice. From 0 to 100 and beyond", Vad...
Fwdays
•
33 views
Five Things You SHOULD Know About Postman
Postman
•
20 views
CXL at OCP
CXL Forum
•
183 views
The details of description: Techniques, tips, and tangents on alternative tex...
BookNet Canada
•
97 views
Web Dev - 1 PPT.pdf
gdsczhcet
•
48 views
Microchip: CXL Use Cases and Enabling Ecosystem
CXL Forum
•
107 views
Cassandra Basics: Indexing
1.
Cassandra Basics
Indexing Benjamin Black, b@b3k.us
2.
Relational stores are SCHEMA
ORIENTED
3.
Start from your
SCHEMA & WORK FORWARDS
4.
Column stores are QUERY
ORIENTED
5.
Start from your
QUERIES & WORK BACKWARDS
6.
AT SCALE
7.
AT SCALE
Denormalization is THE NORM
8.
AT SCALE
9.
AT SCALE
Everything depends on THE INDICES
10.
Cassandra is an INDEX
CONSTRUCTION KIT
11.
Column Family
12.
Two-level Map key: {
column: value, column: value, ... }
13.
Super Column Family
14.
Three-level Map key: {
supercolumn: { column:value, column: value }, supercolumn: { ... } }
15.
column sorting defined
by CompareWith/ CompareSubcolumnsWith
16.
TimeUUIDType UTF8Type
ASCIIType LongType LexicalUUIDType
17.
row placement determined
by Partitioner
18.
RandomPartitioner Place based on
MD5 of key OrderPreservingPartitioner Place based on actual key
19.
Rows are sorted
by key on each node Regardless of partitioner
20.
One example in TWO
ACTS
21.
Prelude A USER DATABASE
22.
<ColumnFamily Name=”Users”
CompareWith=”UTF8Type” />
23.
“b”:
{“name”:”Ben”, “street”:”1234 Oak St.”, “city”:”Seattle”, “state”:”WA”} “jason”: {”name”:”Jason”, “street”:”456 First Ave.”, “city”:”Bellingham”, “state”:”WA”} “zack”: {”name”: “Zack”, “street”: “4321 Pine St.”, “city”: “Seattle”, “state”: “WA”} “jen1982”: {”name”:”Jennifer”, “street”:”1120 Foo Lane”, “city”:”San Francisco”, “state”:”CA”} “albert”: {”name”:”Albert”, “street”:”2364 South St.”, “city”:”Boston”, “state”:”MA”}
24.
SELECT name FROM
Users WHERE state=”WA”
25.
SELECT name FROM
Users WHERE state=”WA” How is WHERE clause formed?
26.
Act One Supercolumn Indexing
27.
<ColumnFamily Name=”LocationUserIndexSCF”
CompareWith=”UTF8Type” CompareSubcolumnsWith=”UTF8Type” ColumnType=”Super” />
28.
[state]: {
[city1]: {[name1]:[user1], [name2]:[user2], ... }, [city2]: {[name3]:[user3], [name4]:[user4], ... }, ... [cityX]: {[name5]:[user5], [name6]:[user6], ... } }
29.
“CA”: { “San
Francisco”: {”Jennifer”: “jen1982”} } “MA”: { “Boston”: {”Albert”: “albert”} } “WA”: { “Bellingham”: {”Jason”: “jason”}, “Seattle”: {”Ben”: “b”, ”Zack”: “zack”} }
30.
Row Key “CA”: {
“San Francisco”: {”Jennifer”: “jen1982”} } “MA”: { “Boston”: {”Albert”: “albert”} } “WA”: { “Bellingham”: {”Jason”: “jason”}, “Seattle”: {”Ben”: “b”, ”Zack”: “zack”} }
31.
Row Key
Super Column “CA”: { “San Francisco”: {”Jennifer”: “jen1982”} } “MA”: { “Boston”: {”Albert”: “albert”} } “WA”: { “Bellingham”: {”Jason”: “jason”}, “Seattle”: {”Ben”: “b”, ”Zack”: “zack”} }
32.
Row Key
Colum Super Column n “CA”: { “San Francisco”: {”Jennifer”: “jen1982”} } “MA”: { “Boston”: {”Albert”: “albert”} } “WA”: { “Bellingham”: {”Jason”: “jason”}, “Seattle”: {”Ben”: “b”, ”Zack”: “zack”} }
33.
Row Key
Colum Super Column Value n “CA”: { “San Francisco”: {”Jennifer”: “jen1982”} } “MA”: { “Boston”: {”Albert”: “albert”} } “WA”: { “Bellingham”: {”Jason”: “jason”}, “Seattle”: {”Ben”: “b”, ”Zack”: “zack”} }
34.
Show me EVERYONE IN
WASHINGTON
35.
get(:LocationUserIndexSCF, ‘WA’)
36.
{
“Bellingham”: {”Jason”: “jason”}, “Seattle”: {”Ben”: “b”, ”Zack”: “zack”} }
37.
Act Two Composite Key
Indexing
38.
Order Preserving Partitioner
+ Range Queries
39.
<ColumnFamily Name=”LocationUserIndexCF”
CompareWith=”UTF8Type” />
40.
[state1]/[city1]:
{[name1]:[user1], [name2]:[user2], ... } [state1]/[city2]: {[name3]:[user3], [name4]:[user4], ... } [state2]/[city1]: {[name5]:[user5], [name6]:[user6], ... } ... [stateX]/[cityY]: {[name7]:[user7], [name8]:[user8], ... }
41.
“CA/San Francisco”: {”Jennifer”:
“jen1982”} “MA/Boston”: {”Albert”: “albert”} “WA/Bellingham”: {”Jason”: “jason”} “WA/Seattle”: {”Ben”: “b”, “Zack”: “zack”}
42.
Show me EVERYONE IN
WASHINGTON
43.
get_range(:LocationUserIndexCF, {:start: 'WA',
:finish:'WB'})
44.
{
”WA/Bellingham”: {”Jason”: “jason”}, “WA/Seattle”: {”Ben”: “b”, “Zack”: “zack”} }
45.
Finale BUILD SOMETHING AWESOME
46.
(This part is
up to you)
47.
Appendix EXAMPLE KEYSPACE
48.
<Keyspace Name="UserDb">
<ColumnFamily Name="Users" CompareWith="UTF8Type" /> <ColumnFamily Name="LocationUserIndexSCF" CompareWith="UTF8Type" CompareSubcolumnsWith="UTF8Type" ColumnType="Super" /> <ColumnFamily Name="LocationUserIndexCF" CompareWith="UTF8Type" /> <ReplicaPlacementStrategy> org.apache.cassandra.locator.RackUnawareStrategy </ReplicaPlacementStrategy> <ReplicationFactor>1</ReplicationFactor> <EndPointSnitch>org.apache.cassandra.locator.EndPointSnitch</EndPointSnitch> </Keyspace>
Editor's Notes