SlideShare a Scribd company logo
1 of 20
Download to read offline
The State of CQL

Sylvain Lebresne (DataStax)
A short CQL primer
New in Cassandra 2.0
Native protocol
What's next?

2/20
A better API for Cassandra
Thrift is not satisfactory:

· Not user friendly, hard to use.
· Low level, very little abstraction.
· Hard to evolve (in a backward compatible way).
· Unreadable without driver abstraction.
Cassandra has often been regarded as hard to develop against.
It doesn't have to be that way!

3/20
Quick historical notes
· CQL1 first introduced in Cassandra 0.8, became CQL2 in Cassandra 1.0
· "These aren't the CQL you are looking for"
· CQL3 (CQL for short thereafter) introduced in Cassandra 1.2
· Semantically, CQL1/CQL2 are closer to the Thrift API than to CQL3.
· CQL3 is the version that's here to stay: no plan for a CQL4 any time soon.

4/20
A short CQL primer
The Cassandra Query Language
· Syntactically, a subset of SQL (with a few extensions)
CET TBEues(
RAE AL sr
ue_dui,
sri ud
nm tx,
ae et
pswr tx,
asod et
ealtx,
mi et
pcuepoiebo,
itr_rfl lb
PIAYKY(sri)
RMR E ue_d
)

· INSERT and UPDATE are both upserts
· No joins, no sub-queries, no aggregation, ...
· Denormalization is the norm: do the work at write time, not read time
6/20

CL
Q
Denormalization: Cassandra modeling 101
Efficient queries in Cassandra are based on 2 principles:

· the data queried is collocated on one replica set
· the data queried is collocated on disk on those replicas
Denormalization is the technique that allows to achieve this in practice.
But this means CQL exposes:

· how to collocate data on the same replica set
· how to collocate data on disk (for a given replica)

7/20
This is done in CQL through the primary key
CET TBEibxs(
RAE AL noe

CL
Q

ue_dui,
sri ud
eali tmui,
mi_d ieud
sne tx,
edr et
rcpet sttx>
eiins e<et,
sbettx,
ujc et
i_edboen
sra ola,
P I A Y K Y (u e _ d, e a l i
RMR E
sri
m i _ d)
)

CQL distinguishes 2 sub-parts in the PRIMARY KEY:
partition key: decides the node on which the data is stored
clustering columns: within the same partition key, (CQL3) rows are
physically ordered following the clustering columns

·
·

This is important, because CQL only allow queries for which an explicit index
exists:
- Gtls 5 eal i ue 5b2-b ibx
- e at 0 mis n sr 1-3a8 no
8/20

SLC *FO ibxsWEEue_d5b2-b ODRB eali DS LMT5;
EET
RM noe HR sri=1-3a8 RE Y mi_d EC II 0

CL
Q
CQL main features

· Collections (set, map and list)
· Secondary indexes
· Convenience functions (timeuuid, type conversions, ...)
· ...
For more details:

· http://cassandra.apache.org/doc/cql3/CQL.html
· http://www.datastax.com/documentation/cql/3.1/webhelp/index.html

9/20
New in Cassandra 2.0
New in Cassandra 2.0
Lightweight transactions:
ISR IT ts (d nm)VLE (2 'o' I NTEIT;
NET NO et i, ae AUS 4, Tm) F O XSS

CL
Q

UDT ts STpswr=nwas WEEi=2I pswr=odas;
PAE et E asod'eps' HR d4 F asod'lps'

Triggers:
CET TIGRmTigrO ts UIG'ytigrCas;
RAE RGE yrge N et SN m.rge.ls'

CL
Q

ALTER DROP:
CET TBEts ( itPIAYKY po1it po2tx,po3fot;
RAE AL et k n RMR E, rp n, rp et rp la)

CL
Q

ATRTBEts DO po3
LE AL et RP rp;

Preparing TIMESTAMP, TTL and LIMIT:
SLC *FO mTbeLMT?
EET
RM yal II ;
UDT mTbeUIGTL?STv=2WEEk='o'
PAE yal SN T
E
HR
fo;

11/20

CL
Q
New in Cassandra 2.0
Conditional DDL:
CET TBEI NTEIT ts ( itPIAYKY;
RAE AL F O XSS et k n RMR E)

CL
Q

DO KYPC I EIT k;
RP ESAE F XSS s

Secondary indexes everywhere (almost):
CET TBEtmln (
RAE AL ieie

CL
Q

eeti ui,
vn_d ud
cetda tmui,
rae_t ieud
cnetbo,
otn lb
PIAYKY(vn_d cetda)
RMR E eeti, rae_t
)
;
CET IDXO tmln (rae_t;
RAE NE N ieie cetda)

SELECT aliases:
SLC eeti,
EET vn_d
dtO(rae_t A ceto_ae
aefcetda) S raindt,
12/20

FO tmln;
RM ieie

CL
Q
Coming in Cassandra 2.0.2
Named bind variables:
L
S L C * F O t m l n W E E c e t d a > : l w A D c e t d a < : h g A D k y = Q;
EET
RM ieie HR rae_t
t o N r a e _ t = t i h N e Ck
:

Prepared IN:
SLC *FO uesWEEue_dI ?
EET
RM sr HR sri N ;

CL
Q

Limited SELECT DISTINCT:
CET TBEts (
RAE AL et
eeti it
vn_d n,
cetda tmsap
rae_t ietm,
cnetbo,
otn lb
PIAYKY(vn_d cetda)
RMR E eeti, rae_t
)
;
SLC DSIC eeti FO ts;
EET ITNT vn_d RM et

13/20

CL
Q
The native protocol
A binary transport protocol for CQL
Native protocol
· Binary transport protocol for CQL
· Query execution, prepared statements, authentication, compression, ...
· Asynchronous (allows multiple concurrent queries per connection)
· Server notifications (Only generic cluster events currently)
· Existing drivers for Java, C#, Python, C++, Golang, ...
Example usage of the Java driver (https://github.com/datastax/java-driver):
Cutrcutr=Cutrbidr)adotcPit"2...".ul(;
lse lse
lse.ule(.dCnaton(17001)bid)
Ssinssin=cutrcnet"yesae)
eso eso
lse.onc(mKypc";
fr(o rw:ssineeue"EET*FO mTbe)
o Rw o
eso.xct(SLC
RM yal")
/ D smtig..
/ o oehn .

15/20

JV
AA
New in Cassandra 2.0: native protocol 2
Cursors:
fr(o rw:ssineeue"EET*FO mTbe)
o Rw o
eso.xct(SLC
RM yal")

JV
AA

/ D smtig..
/ o oehn .

Batching prepared statements:
P e a e S a e e t p = s s i n p e a e " N E T I T m T b e ( 1 p ) V L E ( , ?A ;
rprdttmn s
eso.rpr(ISR NO yal p, 1 AUS ? J V
))
"A
Bthttmn b =nwBthttmn(;
acSaeet s
e acSaeet)
b.d(sbn(,"1);
sadp.id0 v")
b.d(sbn(,"2);
sadp.id1 v")
b.d(sbn(,"3);
sadp.id2 v")
ssineeueb)
eso.xct(s;

One-shot prepare and execute:
s s i n e e u e " N E T I T u e s ( d p o o V L E ( , ? " s m I , p o o y eJ V
e s o . x c t ( I S R N O s r i , h t ) A U S ? ) , o e d h t B t sA A
)
;

SASL for authentication

16/20
What's next?
Cassandra 2.1 and beyond
CQL: some ideas
· Storage engine optimizations for CQL
· Secondary index for collections
· Server side functions
· User defined types
· ...

18/20
User defined types
CET TP ades(
RAE YE drs
sre tx,
tet et
zpcd it
i_oe n,
saetx,
tt et
poe sttx>
hns e<et
)
;
CET TBEues(
RAE AL sr
i ui PIAYKY
d ud RMR E,
nm tx,
ae et
adessmptx,ades
drse a<et drs>
)
;
ISR IT ues(d nm)VLE (3-a71 "yvi Lben";
NET NO sr i, ae AUS 244-6, Slan erse)
UDT uesSTadess"ok]={
PAE sr E drse[wr"
sre:'7 Mrnr Iln Bv #1'
tet 77 aies sad ld 50,
zpcd:944
i_oe 40,
sae 'A,
tt: C'
19/20

poe:{603960 }
hns
5-8-00
}WEEi =244-6;
HR d
3-a71

CL
Q
Thank You!
(Questions?)

More Related Content

Similar to C* Summit EU 2013: The State of CQL

Improving Software Reliability via Mining Software Engineering Data
Improving Software Reliability via Mining Software Engineering DataImproving Software Reliability via Mining Software Engineering Data
Improving Software Reliability via Mining Software Engineering DataTao Xie
 
Embedded JavaScript
Embedded JavaScriptEmbedded JavaScript
Embedded JavaScriptJens Siebert
 
Code GPU with CUDA - Identifying performance limiters
Code GPU with CUDA - Identifying performance limitersCode GPU with CUDA - Identifying performance limiters
Code GPU with CUDA - Identifying performance limitersMarina Kolpakova
 
224698998 moshell-commands
224698998 moshell-commands224698998 moshell-commands
224698998 moshell-commandsAchmad Salsabil
 
Constructing Distributed Doubly Linked Lists without Distributed Locking
Constructing Distributed Doubly Linked Lists without Distributed LockingConstructing Distributed Doubly Linked Lists without Distributed Locking
Constructing Distributed Doubly Linked Lists without Distributed LockingKota Abe
 
QR Factorizations and SVDs for Tall-and-skinny Matrices in MapReduce Architec...
QR Factorizations and SVDs for Tall-and-skinny Matrices in MapReduce Architec...QR Factorizations and SVDs for Tall-and-skinny Matrices in MapReduce Architec...
QR Factorizations and SVDs for Tall-and-skinny Matrices in MapReduce Architec...Austin Benson
 
Formal Semantics of SQL and Cypher
Formal Semantics of SQL and CypherFormal Semantics of SQL and Cypher
Formal Semantics of SQL and CypheropenCypher
 
Introduction to Compiler Development
Introduction to Compiler DevelopmentIntroduction to Compiler Development
Introduction to Compiler DevelopmentLogan Chien
 
3.ASSEMBLERS.pptx
3.ASSEMBLERS.pptx3.ASSEMBLERS.pptx
3.ASSEMBLERS.pptxGaganaP13
 
Arquillian - extensions which you have to take with you to a deserted island
Arquillian - extensions which you have to take with you to a deserted islandArquillian - extensions which you have to take with you to a deserted island
Arquillian - extensions which you have to take with you to a deserted islandSoftwareMill
 
T-S Fuzzy Observer and Controller of Doubly-Fed Induction Generator
T-S Fuzzy Observer and Controller of Doubly-Fed Induction GeneratorT-S Fuzzy Observer and Controller of Doubly-Fed Induction Generator
T-S Fuzzy Observer and Controller of Doubly-Fed Induction GeneratorIJPEDS-IAES
 
#include LPC17xx.h#include Lights.h#include traffic_fo.docx
#include LPC17xx.h#include Lights.h#include traffic_fo.docx#include LPC17xx.h#include Lights.h#include traffic_fo.docx
#include LPC17xx.h#include Lights.h#include traffic_fo.docxajoy21
 

Similar to C* Summit EU 2013: The State of CQL (20)

Wien2k getting started
Wien2k getting startedWien2k getting started
Wien2k getting started
 
Improving Software Reliability via Mining Software Engineering Data
Improving Software Reliability via Mining Software Engineering DataImproving Software Reliability via Mining Software Engineering Data
Improving Software Reliability via Mining Software Engineering Data
 
JavaFX, because you're worth it
JavaFX, because you're worth itJavaFX, because you're worth it
JavaFX, because you're worth it
 
OptimizingARM
OptimizingARMOptimizingARM
OptimizingARM
 
191010 opie2
191010 opie2191010 opie2
191010 opie2
 
Embedded JavaScript
Embedded JavaScriptEmbedded JavaScript
Embedded JavaScript
 
1st and 2nd Semester M Tech: Computer Science and Engineering (Dec-2015; Jan-...
1st and 2nd Semester M Tech: Computer Science and Engineering (Dec-2015; Jan-...1st and 2nd Semester M Tech: Computer Science and Engineering (Dec-2015; Jan-...
1st and 2nd Semester M Tech: Computer Science and Engineering (Dec-2015; Jan-...
 
Code GPU with CUDA - Identifying performance limiters
Code GPU with CUDA - Identifying performance limitersCode GPU with CUDA - Identifying performance limiters
Code GPU with CUDA - Identifying performance limiters
 
224698998 moshell-commands
224698998 moshell-commands224698998 moshell-commands
224698998 moshell-commands
 
Constructing Distributed Doubly Linked Lists without Distributed Locking
Constructing Distributed Doubly Linked Lists without Distributed LockingConstructing Distributed Doubly Linked Lists without Distributed Locking
Constructing Distributed Doubly Linked Lists without Distributed Locking
 
QR Factorizations and SVDs for Tall-and-skinny Matrices in MapReduce Architec...
QR Factorizations and SVDs for Tall-and-skinny Matrices in MapReduce Architec...QR Factorizations and SVDs for Tall-and-skinny Matrices in MapReduce Architec...
QR Factorizations and SVDs for Tall-and-skinny Matrices in MapReduce Architec...
 
Assembler Numerical in system programming
Assembler Numerical in system programmingAssembler Numerical in system programming
Assembler Numerical in system programming
 
Formal Semantics of SQL and Cypher
Formal Semantics of SQL and CypherFormal Semantics of SQL and Cypher
Formal Semantics of SQL and Cypher
 
Introduction to Compiler Development
Introduction to Compiler DevelopmentIntroduction to Compiler Development
Introduction to Compiler Development
 
3.ASSEMBLERS.pptx
3.ASSEMBLERS.pptx3.ASSEMBLERS.pptx
3.ASSEMBLERS.pptx
 
Arquillian - extensions which you have to take with you to a deserted island
Arquillian - extensions which you have to take with you to a deserted islandArquillian - extensions which you have to take with you to a deserted island
Arquillian - extensions which you have to take with you to a deserted island
 
T-S Fuzzy Observer and Controller of Doubly-Fed Induction Generator
T-S Fuzzy Observer and Controller of Doubly-Fed Induction GeneratorT-S Fuzzy Observer and Controller of Doubly-Fed Induction Generator
T-S Fuzzy Observer and Controller of Doubly-Fed Induction Generator
 
#include LPC17xx.h#include Lights.h#include traffic_fo.docx
#include LPC17xx.h#include Lights.h#include traffic_fo.docx#include LPC17xx.h#include Lights.h#include traffic_fo.docx
#include LPC17xx.h#include Lights.h#include traffic_fo.docx
 
An Example MIPS
An Example  MIPSAn Example  MIPS
An Example MIPS
 
NLP@ICLR2019
NLP@ICLR2019NLP@ICLR2019
NLP@ICLR2019
 

More from DataStax Academy

Forrester CXNYC 2017 - Delivering great real-time cx is a true craft
Forrester CXNYC 2017 - Delivering great real-time cx is a true craftForrester CXNYC 2017 - Delivering great real-time cx is a true craft
Forrester CXNYC 2017 - Delivering great real-time cx is a true craftDataStax Academy
 
Introduction to DataStax Enterprise Graph Database
Introduction to DataStax Enterprise Graph DatabaseIntroduction to DataStax Enterprise Graph Database
Introduction to DataStax Enterprise Graph DatabaseDataStax Academy
 
Introduction to DataStax Enterprise Advanced Replication with Apache Cassandra
Introduction to DataStax Enterprise Advanced Replication with Apache CassandraIntroduction to DataStax Enterprise Advanced Replication with Apache Cassandra
Introduction to DataStax Enterprise Advanced Replication with Apache CassandraDataStax Academy
 
Cassandra on Docker @ Walmart Labs
Cassandra on Docker @ Walmart LabsCassandra on Docker @ Walmart Labs
Cassandra on Docker @ Walmart LabsDataStax Academy
 
Cassandra 3.0 Data Modeling
Cassandra 3.0 Data ModelingCassandra 3.0 Data Modeling
Cassandra 3.0 Data ModelingDataStax Academy
 
Cassandra Adoption on Cisco UCS & Open stack
Cassandra Adoption on Cisco UCS & Open stackCassandra Adoption on Cisco UCS & Open stack
Cassandra Adoption on Cisco UCS & Open stackDataStax Academy
 
Data Modeling for Apache Cassandra
Data Modeling for Apache CassandraData Modeling for Apache Cassandra
Data Modeling for Apache CassandraDataStax Academy
 
Production Ready Cassandra
Production Ready CassandraProduction Ready Cassandra
Production Ready CassandraDataStax Academy
 
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & PythonCassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & PythonDataStax Academy
 
Cassandra @ Sony: The good, the bad, and the ugly part 1
Cassandra @ Sony: The good, the bad, and the ugly part 1Cassandra @ Sony: The good, the bad, and the ugly part 1
Cassandra @ Sony: The good, the bad, and the ugly part 1DataStax Academy
 
Cassandra @ Sony: The good, the bad, and the ugly part 2
Cassandra @ Sony: The good, the bad, and the ugly part 2Cassandra @ Sony: The good, the bad, and the ugly part 2
Cassandra @ Sony: The good, the bad, and the ugly part 2DataStax Academy
 
Standing Up Your First Cluster
Standing Up Your First ClusterStanding Up Your First Cluster
Standing Up Your First ClusterDataStax Academy
 
Real Time Analytics with Dse
Real Time Analytics with DseReal Time Analytics with Dse
Real Time Analytics with DseDataStax Academy
 
Introduction to Data Modeling with Apache Cassandra
Introduction to Data Modeling with Apache CassandraIntroduction to Data Modeling with Apache Cassandra
Introduction to Data Modeling with Apache CassandraDataStax Academy
 
Enabling Search in your Cassandra Application with DataStax Enterprise
Enabling Search in your Cassandra Application with DataStax EnterpriseEnabling Search in your Cassandra Application with DataStax Enterprise
Enabling Search in your Cassandra Application with DataStax EnterpriseDataStax Academy
 
Advanced Data Modeling with Apache Cassandra
Advanced Data Modeling with Apache CassandraAdvanced Data Modeling with Apache Cassandra
Advanced Data Modeling with Apache CassandraDataStax Academy
 

More from DataStax Academy (20)

Forrester CXNYC 2017 - Delivering great real-time cx is a true craft
Forrester CXNYC 2017 - Delivering great real-time cx is a true craftForrester CXNYC 2017 - Delivering great real-time cx is a true craft
Forrester CXNYC 2017 - Delivering great real-time cx is a true craft
 
Introduction to DataStax Enterprise Graph Database
Introduction to DataStax Enterprise Graph DatabaseIntroduction to DataStax Enterprise Graph Database
Introduction to DataStax Enterprise Graph Database
 
Introduction to DataStax Enterprise Advanced Replication with Apache Cassandra
Introduction to DataStax Enterprise Advanced Replication with Apache CassandraIntroduction to DataStax Enterprise Advanced Replication with Apache Cassandra
Introduction to DataStax Enterprise Advanced Replication with Apache Cassandra
 
Cassandra on Docker @ Walmart Labs
Cassandra on Docker @ Walmart LabsCassandra on Docker @ Walmart Labs
Cassandra on Docker @ Walmart Labs
 
Cassandra 3.0 Data Modeling
Cassandra 3.0 Data ModelingCassandra 3.0 Data Modeling
Cassandra 3.0 Data Modeling
 
Cassandra Adoption on Cisco UCS & Open stack
Cassandra Adoption on Cisco UCS & Open stackCassandra Adoption on Cisco UCS & Open stack
Cassandra Adoption on Cisco UCS & Open stack
 
Data Modeling for Apache Cassandra
Data Modeling for Apache CassandraData Modeling for Apache Cassandra
Data Modeling for Apache Cassandra
 
Coursera Cassandra Driver
Coursera Cassandra DriverCoursera Cassandra Driver
Coursera Cassandra Driver
 
Production Ready Cassandra
Production Ready CassandraProduction Ready Cassandra
Production Ready Cassandra
 
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & PythonCassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
 
Cassandra @ Sony: The good, the bad, and the ugly part 1
Cassandra @ Sony: The good, the bad, and the ugly part 1Cassandra @ Sony: The good, the bad, and the ugly part 1
Cassandra @ Sony: The good, the bad, and the ugly part 1
 
Cassandra @ Sony: The good, the bad, and the ugly part 2
Cassandra @ Sony: The good, the bad, and the ugly part 2Cassandra @ Sony: The good, the bad, and the ugly part 2
Cassandra @ Sony: The good, the bad, and the ugly part 2
 
Standing Up Your First Cluster
Standing Up Your First ClusterStanding Up Your First Cluster
Standing Up Your First Cluster
 
Real Time Analytics with Dse
Real Time Analytics with DseReal Time Analytics with Dse
Real Time Analytics with Dse
 
Introduction to Data Modeling with Apache Cassandra
Introduction to Data Modeling with Apache CassandraIntroduction to Data Modeling with Apache Cassandra
Introduction to Data Modeling with Apache Cassandra
 
Cassandra Core Concepts
Cassandra Core ConceptsCassandra Core Concepts
Cassandra Core Concepts
 
Enabling Search in your Cassandra Application with DataStax Enterprise
Enabling Search in your Cassandra Application with DataStax EnterpriseEnabling Search in your Cassandra Application with DataStax Enterprise
Enabling Search in your Cassandra Application with DataStax Enterprise
 
Bad Habits Die Hard
Bad Habits Die Hard Bad Habits Die Hard
Bad Habits Die Hard
 
Advanced Data Modeling with Apache Cassandra
Advanced Data Modeling with Apache CassandraAdvanced Data Modeling with Apache Cassandra
Advanced Data Modeling with Apache Cassandra
 
Advanced Cassandra
Advanced CassandraAdvanced Cassandra
Advanced Cassandra
 

Recently uploaded

The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 

Recently uploaded (20)

The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 

C* Summit EU 2013: The State of CQL

  • 1. The State of CQL Sylvain Lebresne (DataStax)
  • 2. A short CQL primer New in Cassandra 2.0 Native protocol What's next? 2/20
  • 3. A better API for Cassandra Thrift is not satisfactory: · Not user friendly, hard to use. · Low level, very little abstraction. · Hard to evolve (in a backward compatible way). · Unreadable without driver abstraction. Cassandra has often been regarded as hard to develop against. It doesn't have to be that way! 3/20
  • 4. Quick historical notes · CQL1 first introduced in Cassandra 0.8, became CQL2 in Cassandra 1.0 · "These aren't the CQL you are looking for" · CQL3 (CQL for short thereafter) introduced in Cassandra 1.2 · Semantically, CQL1/CQL2 are closer to the Thrift API than to CQL3. · CQL3 is the version that's here to stay: no plan for a CQL4 any time soon. 4/20
  • 5. A short CQL primer
  • 6. The Cassandra Query Language · Syntactically, a subset of SQL (with a few extensions) CET TBEues( RAE AL sr ue_dui, sri ud nm tx, ae et pswr tx, asod et ealtx, mi et pcuepoiebo, itr_rfl lb PIAYKY(sri) RMR E ue_d ) · INSERT and UPDATE are both upserts · No joins, no sub-queries, no aggregation, ... · Denormalization is the norm: do the work at write time, not read time 6/20 CL Q
  • 7. Denormalization: Cassandra modeling 101 Efficient queries in Cassandra are based on 2 principles: · the data queried is collocated on one replica set · the data queried is collocated on disk on those replicas Denormalization is the technique that allows to achieve this in practice. But this means CQL exposes: · how to collocate data on the same replica set · how to collocate data on disk (for a given replica) 7/20
  • 8. This is done in CQL through the primary key CET TBEibxs( RAE AL noe CL Q ue_dui, sri ud eali tmui, mi_d ieud sne tx, edr et rcpet sttx> eiins e<et, sbettx, ujc et i_edboen sra ola, P I A Y K Y (u e _ d, e a l i RMR E sri m i _ d) ) CQL distinguishes 2 sub-parts in the PRIMARY KEY: partition key: decides the node on which the data is stored clustering columns: within the same partition key, (CQL3) rows are physically ordered following the clustering columns · · This is important, because CQL only allow queries for which an explicit index exists: - Gtls 5 eal i ue 5b2-b ibx - e at 0 mis n sr 1-3a8 no 8/20 SLC *FO ibxsWEEue_d5b2-b ODRB eali DS LMT5; EET RM noe HR sri=1-3a8 RE Y mi_d EC II 0 CL Q
  • 9. CQL main features · Collections (set, map and list) · Secondary indexes · Convenience functions (timeuuid, type conversions, ...) · ... For more details: · http://cassandra.apache.org/doc/cql3/CQL.html · http://www.datastax.com/documentation/cql/3.1/webhelp/index.html 9/20
  • 11. New in Cassandra 2.0 Lightweight transactions: ISR IT ts (d nm)VLE (2 'o' I NTEIT; NET NO et i, ae AUS 4, Tm) F O XSS CL Q UDT ts STpswr=nwas WEEi=2I pswr=odas; PAE et E asod'eps' HR d4 F asod'lps' Triggers: CET TIGRmTigrO ts UIG'ytigrCas; RAE RGE yrge N et SN m.rge.ls' CL Q ALTER DROP: CET TBEts ( itPIAYKY po1it po2tx,po3fot; RAE AL et k n RMR E, rp n, rp et rp la) CL Q ATRTBEts DO po3 LE AL et RP rp; Preparing TIMESTAMP, TTL and LIMIT: SLC *FO mTbeLMT? EET RM yal II ; UDT mTbeUIGTL?STv=2WEEk='o' PAE yal SN T E HR fo; 11/20 CL Q
  • 12. New in Cassandra 2.0 Conditional DDL: CET TBEI NTEIT ts ( itPIAYKY; RAE AL F O XSS et k n RMR E) CL Q DO KYPC I EIT k; RP ESAE F XSS s Secondary indexes everywhere (almost): CET TBEtmln ( RAE AL ieie CL Q eeti ui, vn_d ud cetda tmui, rae_t ieud cnetbo, otn lb PIAYKY(vn_d cetda) RMR E eeti, rae_t ) ; CET IDXO tmln (rae_t; RAE NE N ieie cetda) SELECT aliases: SLC eeti, EET vn_d dtO(rae_t A ceto_ae aefcetda) S raindt, 12/20 FO tmln; RM ieie CL Q
  • 13. Coming in Cassandra 2.0.2 Named bind variables: L S L C * F O t m l n W E E c e t d a > : l w A D c e t d a < : h g A D k y = Q; EET RM ieie HR rae_t t o N r a e _ t = t i h N e Ck : Prepared IN: SLC *FO uesWEEue_dI ? EET RM sr HR sri N ; CL Q Limited SELECT DISTINCT: CET TBEts ( RAE AL et eeti it vn_d n, cetda tmsap rae_t ietm, cnetbo, otn lb PIAYKY(vn_d cetda) RMR E eeti, rae_t ) ; SLC DSIC eeti FO ts; EET ITNT vn_d RM et 13/20 CL Q
  • 14. The native protocol A binary transport protocol for CQL
  • 15. Native protocol · Binary transport protocol for CQL · Query execution, prepared statements, authentication, compression, ... · Asynchronous (allows multiple concurrent queries per connection) · Server notifications (Only generic cluster events currently) · Existing drivers for Java, C#, Python, C++, Golang, ... Example usage of the Java driver (https://github.com/datastax/java-driver): Cutrcutr=Cutrbidr)adotcPit"2...".ul(; lse lse lse.ule(.dCnaton(17001)bid) Ssinssin=cutrcnet"yesae) eso eso lse.onc(mKypc"; fr(o rw:ssineeue"EET*FO mTbe) o Rw o eso.xct(SLC RM yal") / D smtig.. / o oehn . 15/20 JV AA
  • 16. New in Cassandra 2.0: native protocol 2 Cursors: fr(o rw:ssineeue"EET*FO mTbe) o Rw o eso.xct(SLC RM yal") JV AA / D smtig.. / o oehn . Batching prepared statements: P e a e S a e e t p = s s i n p e a e " N E T I T m T b e ( 1 p ) V L E ( , ?A ; rprdttmn s eso.rpr(ISR NO yal p, 1 AUS ? J V )) "A Bthttmn b =nwBthttmn(; acSaeet s e acSaeet) b.d(sbn(,"1); sadp.id0 v") b.d(sbn(,"2); sadp.id1 v") b.d(sbn(,"3); sadp.id2 v") ssineeueb) eso.xct(s; One-shot prepare and execute: s s i n e e u e " N E T I T u e s ( d p o o V L E ( , ? " s m I , p o o y eJ V e s o . x c t ( I S R N O s r i , h t ) A U S ? ) , o e d h t B t sA A ) ; SASL for authentication 16/20
  • 18. CQL: some ideas · Storage engine optimizations for CQL · Secondary index for collections · Server side functions · User defined types · ... 18/20
  • 19. User defined types CET TP ades( RAE YE drs sre tx, tet et zpcd it i_oe n, saetx, tt et poe sttx> hns e<et ) ; CET TBEues( RAE AL sr i ui PIAYKY d ud RMR E, nm tx, ae et adessmptx,ades drse a<et drs> ) ; ISR IT ues(d nm)VLE (3-a71 "yvi Lben"; NET NO sr i, ae AUS 244-6, Slan erse) UDT uesSTadess"ok]={ PAE sr E drse[wr" sre:'7 Mrnr Iln Bv #1' tet 77 aies sad ld 50, zpcd:944 i_oe 40, sae 'A, tt: C' 19/20 poe:{603960 } hns 5-8-00 }WEEi =244-6; HR d 3-a71 CL Q