SlideShare a Scribd company logo
A deep look at the CQL WHERE clause
CQL WHERE clause
2© 2015. All Rights Reserved.
Driver
The WHERE clause restrictions are dependent on:
• The type of statement: SELECT, UPDATE or DELETE
• The type of column: partition key, clustering or regular column
• If a secondary index is used or not
3© 2015. All Rights Reserved.
Driver
SELECT statements
Partition key restrictions
4© 2015. All Rights Reserved.
Driver
Cluster Date Time Count
‘cluster 1’ ‘2015-09-21’ ‘12:00’ 251
‘cluster 1’ ‘2015-09-22’ ‘12:00’ 342
‘cluster 2’ ‘2015-09-21’ ‘12:00’ 403
‘cluster 2’ ‘2015-09-22’ ‘12:00’ 451
CREATE TABLE numberOfRequests (
cluster text,
date text,
time text,
count int,
PRIMARY KEY ((cluster, date))
)
Partition Key
Partition key restrictions
5© 2015. All Rights Reserved.
Driver
Cluster Date Murmur3 hash
‘cluster 1’ ‘2015-09-21’ -4782752162231423249
‘cluster 1’ ‘2015-09-22’ 4936127188075462704
‘cluster 2’ ‘2015-09-21’ 5822105674898716412
‘cluster 2’ ‘2015-09-22’ 2698159220916609751
A
C
D B
4611686018427387904
to
9223372036854775807
-9223372036854775808
to
-4611686018427387903
-1
to
4611686018427387903
-4611686018427387904
to
-1
Partition key restrictions
6© 2015. All Rights Reserved.
Driver
Cluster Date Node
‘cluster 1’ ‘2015-09-21’ A
‘cluster 1’ ‘2015-09-22’ D
‘cluster 2’ ‘2015-09-21’ D
‘cluster 2’ ‘2015-09-22’ C
A
C
D B
Partition key restrictions
7© 2015. All Rights Reserved.
Driver
A
C
D B
SELECT * FROM numberOfRequests;
Driver
Partition key restrictions
8© 2015. All Rights Reserved.
Driver
SELECT * FROM numberOfRequests WHERE cluster= ‘cluster 1’;
InvalidRequest: code=2200 [Invalid query]
message="Partition key parts: date must be restricted as other parts are"
Partition key restrictions
9© 2015. All Rights Reserved.
Driver
A
C
D B
SELECT * FROM numberOfRequests WHERE cluster= ‘cluster 1’
AND date = ‘2015-09-21’;
Driver
Partition key restrictions
10© 2015. All Rights Reserved.
Driver
A
C
D B
SELECT * FROM numberOfRequests WHERE cluster= ‘cluster 1’
AND date = ‘2015-09-21’;
Driver
…with TokenAwarePolicy
Partition key restrictions
11© 2015. All Rights Reserved.
Driver
A
C
D B
SELECT * FROM numberOfRequests WHERE cluster= ‘cluster 2’
AND date IN (‘2015-09-21’, ‘2015-09-22’);
Driver
Partition key restrictions
12© 2015. All Rights Reserved.
Driver
A
C
D B
SELECT * FROM numberOfRequests WHERE cluster = ‘cluster 2’
AND date = ‘2015-09-21’;
Driver
…with TokenAwarePolicy
and asynchronous calls
SELECT * FROM numberOfRequests WHERE cluster = ‘cluster 2’
AND date = ‘2015-09-22’;
Partition key restrictions
13© 2015. All Rights Reserved.
Driver
SELECT * FROM numberOfRequests WHERE cluster= ‘cluster 1’
AND date >= ‘2015-09-21’;
InvalidRequest: code=2200 [Invalid query]
message="Only EQ and IN relation are supported on the partition key (unless
you use the token() function)"
Partition key restrictions
14© 2015. All Rights Reserved.
Driver
Cluster Date Node
‘cluster 1’ ‘2015-09-21’ A
‘cluster 1’ ‘2015-09-22’ D
‘cluster 2’ ‘2015-09-21’ D
‘cluster 2’ ‘2015-09-22’ C
A
C
D B
SELECT * FROM numberOfRequests WHERE cluster= ‘cluster 1’
AND date >= ‘2015-09-21’;
Partition key restrictions
15© 2015. All Rights Reserved.
Driver
• Murmur3Partitioner (default): uniformly distributes data across
the cluster based on MurmurHash hash values.
• RandomPartitioner: uniformly distributes data across the
cluster based on MD5 hash values.
• ByteOrderedPartitioner: keeps an ordered distribution of data
lexically by key bytes
Partition key restrictions
16© 2015. All Rights Reserved.
Driver
SELECT * FROM numberOfRequests
WHERE token(cluster, date) > token(‘cluster 1’, ‘2015-09-21’)
AND token(cluster, date) < token(‘cluster 1’, ‘2015-09-23’);
Partition key restrictions (SELECT)
17© 2015. All Rights Reserved.
• Without secondary index, either all partition key components must be
restricted or none of them
• = restrictions are allowed on any partition key component
• IN restrictions are allowed on any partition key component since 2.2
• Prior to 2.2, IN restrictions were only allowed on the last partition key
component
• =, >, >=, <= and < restrictions are allowed with the token function
Clustering column restrictions
18© 2015. All Rights Reserved.
CREATE TABLE numberOfRequests (
cluster text,
date text,
datacenter text,
server inet,
time text,
count int,
PRIMARY KEY((cluster, date), datacenter, server, time))
…
Clustering column restrictions
19© 2015. All Rights Reserved.
…
Datacenter Server Time Count
Iowa 196.8.7.134 00:00 130
Iowa 196.8.7.134 00:01 125
Iowa 196.8.7.134 00:02 97
Iowa 196.8.7.135 00:00 178
Iowa 196.8.7.135 00:01 201
[Iowa, 196.8.7.134, 00:02, count] :
97
In the Memtables:
[Iowa, 196.8.7.134, 00:00, count] :
130
[Iowa, 196.8.7.134, 00:01, count] :
125
[Iowa, 196.8.7.135, 00:00, count] :
178
[Iowa, 196.8.7.135, 00:01, count] :
201
[Iowa, 196.8.7.134, 00:00, count] :
130
Cell name
Cell
Column name
Clustering column restrictions
20© 2015. All Rights Reserved.
…
Datacenter Server Time Count
Iowa 196.8.7.134 00:00 130
Iowa 196.8.7.134 00:01 125
Iowa 196.8.7.134 00:02 97
Iowa 196.8.7.135 00:00 178
Iowa 196.8.7.135 00:01 201
[Iowa, 196.8.7.134, 00:02, count] :
97
In the SSTables:
[Iowa, 196.8.7.134, 00:00, count] :
130
[Iowa, 196.8.7.134, 00:01, count] :
125
[Iowa, 196.8.7.135, 00:00, count] :
178
[Iowa, 196.8.7.135, 00:0
201
[Iowa, 196.8.7.134, 00:00, count] :
130
Cell name
Cell
Column name
Clustering column restrictions
21© 2015. All Rights Reserved.
…
[Iowa, 196.8.7.134, 00:02, count] :
97
In the Memtables:
[Iowa, 196.8.7.134, 00:00, count] :
130
[Iowa, 196.8.7.134, 00:01, count] :
125
[Iowa, 196.8.7.135, 00:00, count] :
178
[Iowa, 196.8.7.135, 00:01, count] :
201
SELECT * FROM numberOfRequests
WHERE cluster = ‘cluster1’ AND date =‘2015-09-21’
AND datacenter = ‘Iowa’ AND server = ‘196.8.7.135’ AND time = ‘00:00’;
[Iowa,196.8.7.135,00:00]
Clustering column restrictions
22© 2015. All Rights Reserved.
…
SELECT * FROM numberOfRequests
WHERE cluster = ‘cluster1’ AND date =‘2015-09-21’
AND datacenter = ‘Iowa’ AND server = ‘196.8.7.135’ AND time = ‘00:00’;
[Iowa,196.8.7.135,00:00]
…
[Iowa, 196.8.7.134, 00:02, count] :
97
In the SSTables:
[Iowa, 196.8.7.134, 00:00, count] :
130
[Iowa, 196.8.7.134, 00:01, count] :
125
[Iowa, 196.8.7.135, 00:00, count] :
178
[Iowa, 196.8.7.135, 00:0
201
Clustering column restrictions
23© 2015. All Rights Reserved.
[Iowa, 196.8.7.134, 00:02, count] :
97
In the Memtables:
[Iowa, 196.8.7.134, 00:00, count] :
130
[Iowa, 196.8.7.134, 00:01, count] :
125
[Iowa, 196.8.7.135, 00:00, count] :
178
[Iowa, 196.8.7.135, 00:01, count] :
201
SELECT * FROM numberOfRequests
WHERE cluster = ‘cluster1’ AND date =‘2015-09-21’
AND datacenter = ‘Iowa’ AND server = ‘196.8.7.135’;
[Iowa,196.8.7.135]
Clustering column restrictions
24© 2015. All Rights Reserved.
…
SELECT * FROM numberOfRequests
WHERE cluster = ‘cluster1’ AND date =‘2015-09-21’
AND datacenter = ‘Iowa’ AND server = ‘196.8.7.135’;
[Iowa,196.8.7.135]
…[Iowa, 196.8.7.134, 00:02, count] :
97
In the SSTables:
[Iowa, 196.8.7.134, 00:00, count] :
130
[Iowa, 196.8.7.134, 00:01, count] :
125
[Iowa, 196.8.7.135, 00:00, count] :
178
[Iowa, 196.8.7.135, 00:0
201
Clustering column restrictions
SELECT * FROM numberOfRequests
WHERE cluster = ‘cluster1’ AND date =‘2015-09-21’
AND time = ‘00:00’;
[?,?,00:00]
InvalidRequest: code=2200 [Invalid query]
message="PRIMARY KEY column "time" cannot be restricted as preceding
column "datacenter" is not restricted"
Clustering column restrictions
26© 2015. All Rights Reserved.
…
AND datacenter = ‘Iowa’
AND server IN (‘196.8.7.134’, ‘196.8.7.135’)
AND time = ‘00:00’;
In 2.2:
[Iowa,196.8.7.134,00:00]
[Iowa,196.8.7.135,00:00]
…[Iowa, 196.8.7.134, 00:02, count] :
97
In the SSTables:
[Iowa, 196.8.7.134, 00:00, count] :
130
[Iowa, 196.8.7.134, 00:01, count] :
125
[Iowa, 196.8.7.135, 00:00, count] :
178
[Iowa, 196.8.7.135, 00:0
201
Clustering column restrictions
27© 2015. All Rights Reserved.
…
AND datacenter = ‘Iowa’
AND server IN (‘196.8.7.134’, ‘196.8.7.135’)
AND time = ‘00:00’;
In 2.1:
InvalidRequest: code=2200 [Invalid query]
message="Clustering column "server" cannot be restricted by an IN relation"
Clustering column restrictions
28© 2015. All Rights Reserved.
= multi-column restriction:
(clustering1, clustering2, clustering3) = (?, ?, ?)
IN multi-column restriction:
(clustering1, clustering2, clustering3) IN ((?, ?, ?), (?, ?, ?))
Slice multi-column restriction:
(clustering1, clustering2, clustering3) > (?, ?, ?)
(clustering1, clustering2, clustering3) >= (?, ?, ?)
(clustering1, clustering2, clustering3) <= (?, ?, ?)
(clustering1, clustering2, clustering3) < (?, ?, ?)
Clustering column restrictions
29© 2015. All Rights Reserved.
…
AND datacenter = ‘Iowa’
AND (server, time) IN ((‘196.8.7.134’, ‘00:00’),
(‘196.8.7.135’, ‘00:00’));
In 2.1:
[Iowa,196.8.7.134,00:00]
[Iowa,196.8.7.135,00:00]
…[Iowa, 196.8.7.134, 00:02, count] :
97
In the SSTables:
[Iowa, 196.8.7.134, 00:00, count] :
130
[Iowa, 196.8.7.134, 00:01, count] :
125
[Iowa, 196.8.7.135, 00:00, count] :
178
[Iowa, 196.8.7.135, 00:0
201
Clustering column restrictions
30© 2015. All Rights Reserved.
…
AND datacenter = ‘Iowa’
AND server = ‘196.8.7.134’
AND time > ’00:00’;
from after [Iowa,196.8.7.134,00:00]
to end of [Iowa,196.8.7.134]
…[Iowa, 196.8.7.134, 00:02, count] :
97
In the SSTables:
[Iowa, 196.8.7.134, 00:00, count] :
130
[Iowa, 196.8.7.134, 00:01, count] :
125
[Iowa, 196.8.7.135, 00:00, count] :
178
[Iowa, 196.8.7.135, 00:0
201
Clustering column restrictions (SELECT)
31© 2015. All Rights Reserved.
• Without secondary index, a clustering column cannot be restricted if
one of the previous ones was not
• = restrictions (single and multi) are allowed on any clustering column
• IN restrictions (single and multi) are allowed on any clustering column
since 2.2
• Prior to 2.2, IN restrictions (single and multi) were only allowed on the
last clustering column or set of clustering columns
• >, >=, <=, < restrictions (single and multi) are only allowed on the last
restricted clustering column or set of clustering columns
• CONTAINS and CONTAINS KEY restrictions are only allowed on
indexed collections
Secondary index queries
32© 2015. All Rights Reserved.
CREATE TABLE numberOfRequests (
cluster text,
date text,
datacenter text,
server inet,
time text,
count int,
PRIMARY KEY((cluster, date), datacenter, server, time));
CREATE INDEX ON numberOfRequests (time);
…
Secondary index queries
33© 2015. All Rights Reserved.
CREATE INDEX ON numberOfRequests (time);
CREATE LOCAL TABLE numberOfRequests_time_idx (
time text,
cluster text,
date text,
datacenter text,
server inet,
PRIMARY KEY(time, cluster, date, datacenter, server);
…
Table Partition Key
Table remaining clustering columns
IDX-BIDX-D
IDX-C
IDX-A
Secondary index queries
34© 2015. All Rights Reserved.
Driver
A
C
D B
SELECT * FROM numberOfRequests WHERE time = ‘12:00’;
Driver
Secondary index queries
35© 2015. All Rights Reserved.
Driver
SELECT * FROM numberOfRequests WHERE time = ‘12:00’;
idx
SELECT * FROM numberOfRequests_time_idx
WHERE time = ‘12:00’;
Results (Primary Keys)
table
SELECT with full PK;
[For each]
Add to rows
Secondary index queries
36© 2015. All Rights Reserved.
Driver
SELECT * FROM numberOfRequests WHERE time >= ‘12:00’;
InvalidRequest: code=2200 [Invalid query]
message="PRIMARY KEY column "time" cannot be restricted as preceding
column "datacenter" is not restricted"
Direct queries on secondary index support only =, CONTAINS or CONTAINS
KEY restrictions.
Secondary index queries
37© 2015. All Rights Reserved.
Driver
SELECT * FROM numberOfRequests WHERE time = ‘12:00’
AND count >= 500 ALLOW FILTERING;
idx
SELECT * FROM numberOfRequests_time_idx
WHERE time = ‘12:00’;
Results (Primary Keys)
table
SELECT with full PK;
[For each]
Add to rows
[if count >= 500]
IDX-BIDX-D
IDX-C
IDX-A
Secondary index queries
38© 2015. All Rights Reserved.
Driver
A
C
D B
SELECT * FROM numberOfRequests
WHERE cluster = ‘cluster 1’ AND date = ‘2015-09-21’AND time = ‘12:00’;
Driver
Secondary index queries
39© 2015. All Rights Reserved.
Driver
SELECT * FROM numberOfRequests
WHERE cluster = ‘cluster 1’ AND date = ‘2015-09-21’ AND time = ‘12:00’;
idx
SELECT * FROM numberOfRequests_time_idx
WHERE time = ‘12:00’ AND cluster = ‘1’ AND
date = ‘2015-09-21’;
Results (Primary Keys)
table
SELECT with full PK
[For each]
Add to rows
40© 2015. All Rights Reserved.
Driver
UPDATE/DELETE statements
UPDATE statements
41© 2015. All Rights Reserved.
Driver
In the UPDATE statements all the primary key columns must be restricted and
the only allowed restrictions are:
• Prior to 3.0:
• Single column = restriction on any partition key or clustering column
• Single column IN restriction on the last partition key column
• In 3.0:
• = and IN single column restrictions on any partition key column
• = and IN single or multi column restrictions on any clustering column
DELETE statements
42© 2015. All Rights Reserved.
Driver
Before 3.0, in the DELETE statements all the primary key columns must be
restricted and the only allowed restrictions were:
• Single column = restriction on any partition key or clustering column
• Single column IN restriction on the last partition key column
DELETE statements
43© 2015. All Rights Reserved.
Driver
Since 3.0:
• The partition key columns must be restricted by = or IN restrictions
• A clustering column might not be restricted if none of the following is
• Clustering columns can be restricted by:
• Single or multi column = restriction
• Single or multi column IN restriction
• Single or multi column >, >=, <=, < restriction
© 2015. All Rights Reserved. 44
Design your tables for the queries
you want to perform.
Thank you

More Related Content

What's hot

Working with JSON Data in PostgreSQL vs. MongoDB
Working with JSON Data in PostgreSQL vs. MongoDBWorking with JSON Data in PostgreSQL vs. MongoDB
Working with JSON Data in PostgreSQL vs. MongoDB
ScaleGrid.io
 
Apache doris (incubating) introduction
Apache doris (incubating) introductionApache doris (incubating) introduction
Apache doris (incubating) introduction
leanderlee2
 
Linux tuning to improve PostgreSQL performance
Linux tuning to improve PostgreSQL performanceLinux tuning to improve PostgreSQL performance
Linux tuning to improve PostgreSQL performance
PostgreSQL-Consulting
 
Polyglot persistence @ netflix (CDE Meetup)
Polyglot persistence @ netflix (CDE Meetup) Polyglot persistence @ netflix (CDE Meetup)
Polyglot persistence @ netflix (CDE Meetup)
Roopa Tangirala
 
Bulk Loading into Cassandra
Bulk Loading into CassandraBulk Loading into Cassandra
Bulk Loading into Cassandra
Brian Hess
 
Cassandra 101
Cassandra 101Cassandra 101
Cassandra 101
Nader Ganayem
 
Performance Tuning RocksDB for Kafka Streams' State Stores (Dhruba Borthakur,...
Performance Tuning RocksDB for Kafka Streams' State Stores (Dhruba Borthakur,...Performance Tuning RocksDB for Kafka Streams' State Stores (Dhruba Borthakur,...
Performance Tuning RocksDB for Kafka Streams' State Stores (Dhruba Borthakur,...
confluent
 
Diving into the Deep End - Kafka Connect
Diving into the Deep End - Kafka ConnectDiving into the Deep End - Kafka Connect
Diving into the Deep End - Kafka Connect
confluent
 
Apache Calcite: A Foundational Framework for Optimized Query Processing Over ...
Apache Calcite: A Foundational Framework for Optimized Query Processing Over ...Apache Calcite: A Foundational Framework for Optimized Query Processing Over ...
Apache Calcite: A Foundational Framework for Optimized Query Processing Over ...
Julian Hyde
 
Deletes Without Tombstones or TTLs (Eric Stevens, ProtectWise) | Cassandra Su...
Deletes Without Tombstones or TTLs (Eric Stevens, ProtectWise) | Cassandra Su...Deletes Without Tombstones or TTLs (Eric Stevens, ProtectWise) | Cassandra Su...
Deletes Without Tombstones or TTLs (Eric Stevens, ProtectWise) | Cassandra Su...
DataStax
 
Introduction to Kafka with Spring Integration
Introduction to Kafka with Spring IntegrationIntroduction to Kafka with Spring Integration
Introduction to Kafka with Spring Integration
Borislav Markov
 
Using Apache Spark as ETL engine. Pros and Cons
Using Apache Spark as ETL engine. Pros and Cons          Using Apache Spark as ETL engine. Pros and Cons
Using Apache Spark as ETL engine. Pros and Cons
Provectus
 
Storing time series data with Apache Cassandra
Storing time series data with Apache CassandraStoring time series data with Apache Cassandra
Storing time series data with Apache Cassandra
Patrick McFadin
 
Optimizing Apache Spark SQL Joins
Optimizing Apache Spark SQL JoinsOptimizing Apache Spark SQL Joins
Optimizing Apache Spark SQL Joins
Databricks
 
Kafka to the Maxka - (Kafka Performance Tuning)
Kafka to the Maxka - (Kafka Performance Tuning)Kafka to the Maxka - (Kafka Performance Tuning)
Kafka to the Maxka - (Kafka Performance Tuning)
DataWorks Summit
 
Deep Dive: Memory Management in Apache Spark
Deep Dive: Memory Management in Apache SparkDeep Dive: Memory Management in Apache Spark
Deep Dive: Memory Management in Apache Spark
Databricks
 
Tech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of Facebook
Tech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of FacebookTech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of Facebook
Tech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of Facebook
The Hive
 
Database-Migration and -Upgrade with Transportable Tablespaces
Database-Migration and -Upgrade with Transportable TablespacesDatabase-Migration and -Upgrade with Transportable Tablespaces
Database-Migration and -Upgrade with Transportable Tablespaces
Markus Flechtner
 
Almost Perfect Service Discovery and Failover with ProxySQL and Orchestrator
Almost Perfect Service Discovery and Failover with ProxySQL and OrchestratorAlmost Perfect Service Discovery and Failover with ProxySQL and Orchestrator
Almost Perfect Service Discovery and Failover with ProxySQL and Orchestrator
Jean-François Gagné
 
JSON in Solr: from top to bottom
JSON in Solr: from top to bottomJSON in Solr: from top to bottom
JSON in Solr: from top to bottom
Alexandre Rafalovitch
 

What's hot (20)

Working with JSON Data in PostgreSQL vs. MongoDB
Working with JSON Data in PostgreSQL vs. MongoDBWorking with JSON Data in PostgreSQL vs. MongoDB
Working with JSON Data in PostgreSQL vs. MongoDB
 
Apache doris (incubating) introduction
Apache doris (incubating) introductionApache doris (incubating) introduction
Apache doris (incubating) introduction
 
Linux tuning to improve PostgreSQL performance
Linux tuning to improve PostgreSQL performanceLinux tuning to improve PostgreSQL performance
Linux tuning to improve PostgreSQL performance
 
Polyglot persistence @ netflix (CDE Meetup)
Polyglot persistence @ netflix (CDE Meetup) Polyglot persistence @ netflix (CDE Meetup)
Polyglot persistence @ netflix (CDE Meetup)
 
Bulk Loading into Cassandra
Bulk Loading into CassandraBulk Loading into Cassandra
Bulk Loading into Cassandra
 
Cassandra 101
Cassandra 101Cassandra 101
Cassandra 101
 
Performance Tuning RocksDB for Kafka Streams' State Stores (Dhruba Borthakur,...
Performance Tuning RocksDB for Kafka Streams' State Stores (Dhruba Borthakur,...Performance Tuning RocksDB for Kafka Streams' State Stores (Dhruba Borthakur,...
Performance Tuning RocksDB for Kafka Streams' State Stores (Dhruba Borthakur,...
 
Diving into the Deep End - Kafka Connect
Diving into the Deep End - Kafka ConnectDiving into the Deep End - Kafka Connect
Diving into the Deep End - Kafka Connect
 
Apache Calcite: A Foundational Framework for Optimized Query Processing Over ...
Apache Calcite: A Foundational Framework for Optimized Query Processing Over ...Apache Calcite: A Foundational Framework for Optimized Query Processing Over ...
Apache Calcite: A Foundational Framework for Optimized Query Processing Over ...
 
Deletes Without Tombstones or TTLs (Eric Stevens, ProtectWise) | Cassandra Su...
Deletes Without Tombstones or TTLs (Eric Stevens, ProtectWise) | Cassandra Su...Deletes Without Tombstones or TTLs (Eric Stevens, ProtectWise) | Cassandra Su...
Deletes Without Tombstones or TTLs (Eric Stevens, ProtectWise) | Cassandra Su...
 
Introduction to Kafka with Spring Integration
Introduction to Kafka with Spring IntegrationIntroduction to Kafka with Spring Integration
Introduction to Kafka with Spring Integration
 
Using Apache Spark as ETL engine. Pros and Cons
Using Apache Spark as ETL engine. Pros and Cons          Using Apache Spark as ETL engine. Pros and Cons
Using Apache Spark as ETL engine. Pros and Cons
 
Storing time series data with Apache Cassandra
Storing time series data with Apache CassandraStoring time series data with Apache Cassandra
Storing time series data with Apache Cassandra
 
Optimizing Apache Spark SQL Joins
Optimizing Apache Spark SQL JoinsOptimizing Apache Spark SQL Joins
Optimizing Apache Spark SQL Joins
 
Kafka to the Maxka - (Kafka Performance Tuning)
Kafka to the Maxka - (Kafka Performance Tuning)Kafka to the Maxka - (Kafka Performance Tuning)
Kafka to the Maxka - (Kafka Performance Tuning)
 
Deep Dive: Memory Management in Apache Spark
Deep Dive: Memory Management in Apache SparkDeep Dive: Memory Management in Apache Spark
Deep Dive: Memory Management in Apache Spark
 
Tech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of Facebook
Tech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of FacebookTech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of Facebook
Tech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of Facebook
 
Database-Migration and -Upgrade with Transportable Tablespaces
Database-Migration and -Upgrade with Transportable TablespacesDatabase-Migration and -Upgrade with Transportable Tablespaces
Database-Migration and -Upgrade with Transportable Tablespaces
 
Almost Perfect Service Discovery and Failover with ProxySQL and Orchestrator
Almost Perfect Service Discovery and Failover with ProxySQL and OrchestratorAlmost Perfect Service Discovery and Failover with ProxySQL and Orchestrator
Almost Perfect Service Discovery and Failover with ProxySQL and Orchestrator
 
JSON in Solr: from top to bottom
JSON in Solr: from top to bottomJSON in Solr: from top to bottom
JSON in Solr: from top to bottom
 

Viewers also liked

Cassandra Summit 2014: CQL Under the Hood
Cassandra Summit 2014: CQL Under the HoodCassandra Summit 2014: CQL Under the Hood
Cassandra Summit 2014: CQL Under the Hood
DataStax Academy
 
A deep look at the cql where clause
A deep look at the cql where clauseA deep look at the cql where clause
A deep look at the cql where clause
Benjamin Lerer
 
Indexing in Cassandra
Indexing in CassandraIndexing in Cassandra
Indexing in Cassandra
Ed Anuff
 
NoSQL Database- cassandra column Base DB
NoSQL Database- cassandra column Base DBNoSQL Database- cassandra column Base DB
NoSQL Database- cassandra column Base DB
sadegh salehi
 
Cassandra internals
Cassandra internalsCassandra internals
Cassandra internals
narsiman
 
Capital One: Using Cassandra In Building A Reporting Platform
Capital One: Using Cassandra In Building A Reporting PlatformCapital One: Using Cassandra In Building A Reporting Platform
Capital One: Using Cassandra In Building A Reporting Platform
DataStax Academy
 
AdStage: Monacella: An Relational Object Database using Cassandra as the Data...
AdStage: Monacella: An Relational Object Database using Cassandra as the Data...AdStage: Monacella: An Relational Object Database using Cassandra as the Data...
AdStage: Monacella: An Relational Object Database using Cassandra as the Data...
DataStax Academy
 
DataStax: Testing Cassandra Guarantees Under Diverse Failure Modes With Jepsen
DataStax: Testing Cassandra Guarantees Under Diverse Failure Modes With JepsenDataStax: Testing Cassandra Guarantees Under Diverse Failure Modes With Jepsen
DataStax: Testing Cassandra Guarantees Under Diverse Failure Modes With Jepsen
DataStax Academy
 
MyDrive Solutions: Case Study: Troubleshooting Production Issues as a Developer.
MyDrive Solutions: Case Study: Troubleshooting Production Issues as a Developer.MyDrive Solutions: Case Study: Troubleshooting Production Issues as a Developer.
MyDrive Solutions: Case Study: Troubleshooting Production Issues as a Developer.
DataStax Academy
 
DataStax: The Cassandra Validation Harness: Achieving More Stable Releases
DataStax: The Cassandra Validation Harness: Achieving More Stable ReleasesDataStax: The Cassandra Validation Harness: Achieving More Stable Releases
DataStax: The Cassandra Validation Harness: Achieving More Stable Releases
DataStax Academy
 
The Last Pickle: Repeatable, Scalable, Reliable, Observable: Cassandra
The Last Pickle: Repeatable, Scalable, Reliable, Observable: CassandraThe Last Pickle: Repeatable, Scalable, Reliable, Observable: Cassandra
The Last Pickle: Repeatable, Scalable, Reliable, Observable: Cassandra
DataStax Academy
 
CQL Under the Hood
CQL Under the HoodCQL Under the Hood
CQL Under the Hood
Robbie Strickland
 
Silicon Valley Data Science: From Oracle to Cassandra with Spark
Silicon Valley Data Science: From Oracle to Cassandra with SparkSilicon Valley Data Science: From Oracle to Cassandra with Spark
Silicon Valley Data Science: From Oracle to Cassandra with Spark
DataStax Academy
 
C* Keys: Partitioning, Clustering, & CrossFit (Adam Hutson, DataScale) | Cass...
C* Keys: Partitioning, Clustering, & CrossFit (Adam Hutson, DataScale) | Cass...C* Keys: Partitioning, Clustering, & CrossFit (Adam Hutson, DataScale) | Cass...
C* Keys: Partitioning, Clustering, & CrossFit (Adam Hutson, DataScale) | Cass...
DataStax
 
Intro to Cassandra
Intro to CassandraIntro to Cassandra
Intro to Cassandra
DataStax Academy
 
AddThis: Scaling Cassandra up and down into containers with ZFS
AddThis: Scaling Cassandra up and down into containers with ZFSAddThis: Scaling Cassandra up and down into containers with ZFS
AddThis: Scaling Cassandra up and down into containers with ZFS
DataStax Academy
 
Hardening cassandra q2_2016
Hardening cassandra q2_2016Hardening cassandra q2_2016
Hardening cassandra q2_2016
zznate
 
Hadoop 2.0 - The Next Level
Hadoop 2.0 - The Next LevelHadoop 2.0 - The Next Level
Hadoop 2.0 - The Next Level
Sascha Dittmann
 
Stratio: Geospatial and bitemporal search in Cassandra with pluggable Lucene ...
Stratio: Geospatial and bitemporal search in Cassandra with pluggable Lucene ...Stratio: Geospatial and bitemporal search in Cassandra with pluggable Lucene ...
Stratio: Geospatial and bitemporal search in Cassandra with pluggable Lucene ...
DataStax Academy
 
Cassandra presentation at NoSQL
Cassandra presentation at NoSQLCassandra presentation at NoSQL
Cassandra presentation at NoSQL
Evan Weaver
 

Viewers also liked (20)

Cassandra Summit 2014: CQL Under the Hood
Cassandra Summit 2014: CQL Under the HoodCassandra Summit 2014: CQL Under the Hood
Cassandra Summit 2014: CQL Under the Hood
 
A deep look at the cql where clause
A deep look at the cql where clauseA deep look at the cql where clause
A deep look at the cql where clause
 
Indexing in Cassandra
Indexing in CassandraIndexing in Cassandra
Indexing in Cassandra
 
NoSQL Database- cassandra column Base DB
NoSQL Database- cassandra column Base DBNoSQL Database- cassandra column Base DB
NoSQL Database- cassandra column Base DB
 
Cassandra internals
Cassandra internalsCassandra internals
Cassandra internals
 
Capital One: Using Cassandra In Building A Reporting Platform
Capital One: Using Cassandra In Building A Reporting PlatformCapital One: Using Cassandra In Building A Reporting Platform
Capital One: Using Cassandra In Building A Reporting Platform
 
AdStage: Monacella: An Relational Object Database using Cassandra as the Data...
AdStage: Monacella: An Relational Object Database using Cassandra as the Data...AdStage: Monacella: An Relational Object Database using Cassandra as the Data...
AdStage: Monacella: An Relational Object Database using Cassandra as the Data...
 
DataStax: Testing Cassandra Guarantees Under Diverse Failure Modes With Jepsen
DataStax: Testing Cassandra Guarantees Under Diverse Failure Modes With JepsenDataStax: Testing Cassandra Guarantees Under Diverse Failure Modes With Jepsen
DataStax: Testing Cassandra Guarantees Under Diverse Failure Modes With Jepsen
 
MyDrive Solutions: Case Study: Troubleshooting Production Issues as a Developer.
MyDrive Solutions: Case Study: Troubleshooting Production Issues as a Developer.MyDrive Solutions: Case Study: Troubleshooting Production Issues as a Developer.
MyDrive Solutions: Case Study: Troubleshooting Production Issues as a Developer.
 
DataStax: The Cassandra Validation Harness: Achieving More Stable Releases
DataStax: The Cassandra Validation Harness: Achieving More Stable ReleasesDataStax: The Cassandra Validation Harness: Achieving More Stable Releases
DataStax: The Cassandra Validation Harness: Achieving More Stable Releases
 
The Last Pickle: Repeatable, Scalable, Reliable, Observable: Cassandra
The Last Pickle: Repeatable, Scalable, Reliable, Observable: CassandraThe Last Pickle: Repeatable, Scalable, Reliable, Observable: Cassandra
The Last Pickle: Repeatable, Scalable, Reliable, Observable: Cassandra
 
CQL Under the Hood
CQL Under the HoodCQL Under the Hood
CQL Under the Hood
 
Silicon Valley Data Science: From Oracle to Cassandra with Spark
Silicon Valley Data Science: From Oracle to Cassandra with SparkSilicon Valley Data Science: From Oracle to Cassandra with Spark
Silicon Valley Data Science: From Oracle to Cassandra with Spark
 
C* Keys: Partitioning, Clustering, & CrossFit (Adam Hutson, DataScale) | Cass...
C* Keys: Partitioning, Clustering, & CrossFit (Adam Hutson, DataScale) | Cass...C* Keys: Partitioning, Clustering, & CrossFit (Adam Hutson, DataScale) | Cass...
C* Keys: Partitioning, Clustering, & CrossFit (Adam Hutson, DataScale) | Cass...
 
Intro to Cassandra
Intro to CassandraIntro to Cassandra
Intro to Cassandra
 
AddThis: Scaling Cassandra up and down into containers with ZFS
AddThis: Scaling Cassandra up and down into containers with ZFSAddThis: Scaling Cassandra up and down into containers with ZFS
AddThis: Scaling Cassandra up and down into containers with ZFS
 
Hardening cassandra q2_2016
Hardening cassandra q2_2016Hardening cassandra q2_2016
Hardening cassandra q2_2016
 
Hadoop 2.0 - The Next Level
Hadoop 2.0 - The Next LevelHadoop 2.0 - The Next Level
Hadoop 2.0 - The Next Level
 
Stratio: Geospatial and bitemporal search in Cassandra with pluggable Lucene ...
Stratio: Geospatial and bitemporal search in Cassandra with pluggable Lucene ...Stratio: Geospatial and bitemporal search in Cassandra with pluggable Lucene ...
Stratio: Geospatial and bitemporal search in Cassandra with pluggable Lucene ...
 
Cassandra presentation at NoSQL
Cassandra presentation at NoSQLCassandra presentation at NoSQL
Cassandra presentation at NoSQL
 

Similar to DataStax: A deep look at the CQL WHERE clause

OSMC 2008 | Monitoring MySQL by Geert Vanderkelen
OSMC 2008 | Monitoring MySQL by Geert VanderkelenOSMC 2008 | Monitoring MySQL by Geert Vanderkelen
OSMC 2008 | Monitoring MySQL by Geert Vanderkelen
NETWAYS
 
Hailey_Database_Performance_Made_Easy_through_Graphics.pdf
Hailey_Database_Performance_Made_Easy_through_Graphics.pdfHailey_Database_Performance_Made_Easy_through_Graphics.pdf
Hailey_Database_Performance_Made_Easy_through_Graphics.pdf
cookie1969
 
Everything you always wanted to know about datetime types but didn’t have tim...
Everything you always wanted to know about datetime types but didn’t have tim...Everything you always wanted to know about datetime types but didn’t have tim...
Everything you always wanted to know about datetime types but didn’t have tim...
MartinHanssonOracle
 
Macy's: Changing Engines in Mid-Flight
Macy's: Changing Engines in Mid-FlightMacy's: Changing Engines in Mid-Flight
Macy's: Changing Engines in Mid-Flight
DataStax Academy
 
Execution plans for mere mortals
Execution plans for mere mortalsExecution plans for mere mortals
Execution plans for mere mortals
Mike Lawell
 
Perf Tuning Short
Perf Tuning ShortPerf Tuning Short
Perf Tuning Short
Ligaya Turmelle
 
INFLUXQL & TICKSCRIPT
INFLUXQL & TICKSCRIPTINFLUXQL & TICKSCRIPT
INFLUXQL & TICKSCRIPT
InfluxData
 
Hash join use memory optimization
Hash join use memory optimizationHash join use memory optimization
Hash join use memory optimization
ICTeam S.p.A.
 
Php forum2015 tomas_final
Php forum2015 tomas_finalPhp forum2015 tomas_final
Php forum2015 tomas_final
Bertrand Matthelie
 
201809 DB tech showcase
201809 DB tech showcase201809 DB tech showcase
201809 DB tech showcase
Keisuke Suzuki
 
Dun ddd
Dun dddDun ddd
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
Dave Stokes
 
Partitioning 101
Partitioning 101Partitioning 101
Partitioning 101
Connor McDonald
 
Jboss World 2011 Infinispan
Jboss World 2011 InfinispanJboss World 2011 Infinispan
Jboss World 2011 Infinispancbo_
 
Performance schema and sys schema
Performance schema and sys schemaPerformance schema and sys schema
Performance schema and sys schema
Mark Leith
 
Connor McDonald Partitioning
Connor McDonald PartitioningConnor McDonald Partitioning
Connor McDonald Partitioning
InSync Conference
 
Metadata Matters
Metadata MattersMetadata Matters
Metadata Mattersafa reg
 
Modeling the IoT with TitanDB and Cassandra
Modeling the IoT with TitanDB and CassandraModeling the IoT with TitanDB and Cassandra
Modeling the IoT with TitanDB and Cassandra
twilmes
 
Informix Warehouse Accelerator (IWA) features in version 12.1
Informix Warehouse Accelerator (IWA) features in version 12.1Informix Warehouse Accelerator (IWA) features in version 12.1
Informix Warehouse Accelerator (IWA) features in version 12.1
Keshav Murthy
 

Similar to DataStax: A deep look at the CQL WHERE clause (20)

OSMC 2008 | Monitoring MySQL by Geert Vanderkelen
OSMC 2008 | Monitoring MySQL by Geert VanderkelenOSMC 2008 | Monitoring MySQL by Geert Vanderkelen
OSMC 2008 | Monitoring MySQL by Geert Vanderkelen
 
Hailey_Database_Performance_Made_Easy_through_Graphics.pdf
Hailey_Database_Performance_Made_Easy_through_Graphics.pdfHailey_Database_Performance_Made_Easy_through_Graphics.pdf
Hailey_Database_Performance_Made_Easy_through_Graphics.pdf
 
Everything you always wanted to know about datetime types but didn’t have tim...
Everything you always wanted to know about datetime types but didn’t have tim...Everything you always wanted to know about datetime types but didn’t have tim...
Everything you always wanted to know about datetime types but didn’t have tim...
 
Macy's: Changing Engines in Mid-Flight
Macy's: Changing Engines in Mid-FlightMacy's: Changing Engines in Mid-Flight
Macy's: Changing Engines in Mid-Flight
 
Execution plans for mere mortals
Execution plans for mere mortalsExecution plans for mere mortals
Execution plans for mere mortals
 
Perf Tuning Short
Perf Tuning ShortPerf Tuning Short
Perf Tuning Short
 
INFLUXQL & TICKSCRIPT
INFLUXQL & TICKSCRIPTINFLUXQL & TICKSCRIPT
INFLUXQL & TICKSCRIPT
 
Hash join use memory optimization
Hash join use memory optimizationHash join use memory optimization
Hash join use memory optimization
 
Php forum2015 tomas_final
Php forum2015 tomas_finalPhp forum2015 tomas_final
Php forum2015 tomas_final
 
201809 DB tech showcase
201809 DB tech showcase201809 DB tech showcase
201809 DB tech showcase
 
Rmoug ashmaster
Rmoug ashmasterRmoug ashmaster
Rmoug ashmaster
 
Dun ddd
Dun dddDun ddd
Dun ddd
 
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
 
Partitioning 101
Partitioning 101Partitioning 101
Partitioning 101
 
Jboss World 2011 Infinispan
Jboss World 2011 InfinispanJboss World 2011 Infinispan
Jboss World 2011 Infinispan
 
Performance schema and sys schema
Performance schema and sys schemaPerformance schema and sys schema
Performance schema and sys schema
 
Connor McDonald Partitioning
Connor McDonald PartitioningConnor McDonald Partitioning
Connor McDonald Partitioning
 
Metadata Matters
Metadata MattersMetadata Matters
Metadata Matters
 
Modeling the IoT with TitanDB and Cassandra
Modeling the IoT with TitanDB and CassandraModeling the IoT with TitanDB and Cassandra
Modeling the IoT with TitanDB and Cassandra
 
Informix Warehouse Accelerator (IWA) features in version 12.1
Informix Warehouse Accelerator (IWA) features in version 12.1Informix Warehouse Accelerator (IWA) features in version 12.1
Informix Warehouse Accelerator (IWA) features in version 12.1
 

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 craft
DataStax Academy
 
Introduction to DataStax Enterprise Graph Database
Introduction to DataStax Enterprise Graph DatabaseIntroduction to DataStax Enterprise Graph Database
Introduction to DataStax Enterprise Graph Database
DataStax 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 Cassandra
DataStax Academy
 
Cassandra on Docker @ Walmart Labs
Cassandra on Docker @ Walmart LabsCassandra on Docker @ Walmart Labs
Cassandra on Docker @ Walmart Labs
DataStax Academy
 
Cassandra 3.0 Data Modeling
Cassandra 3.0 Data ModelingCassandra 3.0 Data Modeling
Cassandra 3.0 Data Modeling
DataStax 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 stack
DataStax Academy
 
Data Modeling for Apache Cassandra
Data Modeling for Apache CassandraData Modeling for Apache Cassandra
Data Modeling for Apache Cassandra
DataStax Academy
 
Coursera Cassandra Driver
Coursera Cassandra DriverCoursera Cassandra Driver
Coursera Cassandra Driver
DataStax Academy
 
Production Ready Cassandra
Production Ready CassandraProduction Ready Cassandra
Production Ready Cassandra
DataStax 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 & Python
DataStax 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 1
DataStax 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 2
DataStax Academy
 
Standing Up Your First Cluster
Standing Up Your First ClusterStanding Up Your First Cluster
Standing Up Your First Cluster
DataStax Academy
 
Real Time Analytics with Dse
Real Time Analytics with DseReal Time Analytics with Dse
Real Time Analytics with Dse
DataStax 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 Cassandra
DataStax Academy
 
Cassandra Core Concepts
Cassandra Core ConceptsCassandra Core Concepts
Cassandra Core Concepts
DataStax 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 Enterprise
DataStax Academy
 
Bad Habits Die Hard
Bad Habits Die Hard Bad Habits Die Hard
Bad Habits Die Hard
DataStax Academy
 
Advanced Data Modeling with Apache Cassandra
Advanced Data Modeling with Apache CassandraAdvanced Data Modeling with Apache Cassandra
Advanced Data Modeling with Apache Cassandra
DataStax 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

State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 

Recently uploaded (20)

State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 

DataStax: A deep look at the CQL WHERE clause

  • 1. A deep look at the CQL WHERE clause
  • 2. CQL WHERE clause 2© 2015. All Rights Reserved. Driver The WHERE clause restrictions are dependent on: • The type of statement: SELECT, UPDATE or DELETE • The type of column: partition key, clustering or regular column • If a secondary index is used or not
  • 3. 3© 2015. All Rights Reserved. Driver SELECT statements
  • 4. Partition key restrictions 4© 2015. All Rights Reserved. Driver Cluster Date Time Count ‘cluster 1’ ‘2015-09-21’ ‘12:00’ 251 ‘cluster 1’ ‘2015-09-22’ ‘12:00’ 342 ‘cluster 2’ ‘2015-09-21’ ‘12:00’ 403 ‘cluster 2’ ‘2015-09-22’ ‘12:00’ 451 CREATE TABLE numberOfRequests ( cluster text, date text, time text, count int, PRIMARY KEY ((cluster, date)) ) Partition Key
  • 5. Partition key restrictions 5© 2015. All Rights Reserved. Driver Cluster Date Murmur3 hash ‘cluster 1’ ‘2015-09-21’ -4782752162231423249 ‘cluster 1’ ‘2015-09-22’ 4936127188075462704 ‘cluster 2’ ‘2015-09-21’ 5822105674898716412 ‘cluster 2’ ‘2015-09-22’ 2698159220916609751 A C D B 4611686018427387904 to 9223372036854775807 -9223372036854775808 to -4611686018427387903 -1 to 4611686018427387903 -4611686018427387904 to -1
  • 6. Partition key restrictions 6© 2015. All Rights Reserved. Driver Cluster Date Node ‘cluster 1’ ‘2015-09-21’ A ‘cluster 1’ ‘2015-09-22’ D ‘cluster 2’ ‘2015-09-21’ D ‘cluster 2’ ‘2015-09-22’ C A C D B
  • 7. Partition key restrictions 7© 2015. All Rights Reserved. Driver A C D B SELECT * FROM numberOfRequests; Driver
  • 8. Partition key restrictions 8© 2015. All Rights Reserved. Driver SELECT * FROM numberOfRequests WHERE cluster= ‘cluster 1’; InvalidRequest: code=2200 [Invalid query] message="Partition key parts: date must be restricted as other parts are"
  • 9. Partition key restrictions 9© 2015. All Rights Reserved. Driver A C D B SELECT * FROM numberOfRequests WHERE cluster= ‘cluster 1’ AND date = ‘2015-09-21’; Driver
  • 10. Partition key restrictions 10© 2015. All Rights Reserved. Driver A C D B SELECT * FROM numberOfRequests WHERE cluster= ‘cluster 1’ AND date = ‘2015-09-21’; Driver …with TokenAwarePolicy
  • 11. Partition key restrictions 11© 2015. All Rights Reserved. Driver A C D B SELECT * FROM numberOfRequests WHERE cluster= ‘cluster 2’ AND date IN (‘2015-09-21’, ‘2015-09-22’); Driver
  • 12. Partition key restrictions 12© 2015. All Rights Reserved. Driver A C D B SELECT * FROM numberOfRequests WHERE cluster = ‘cluster 2’ AND date = ‘2015-09-21’; Driver …with TokenAwarePolicy and asynchronous calls SELECT * FROM numberOfRequests WHERE cluster = ‘cluster 2’ AND date = ‘2015-09-22’;
  • 13. Partition key restrictions 13© 2015. All Rights Reserved. Driver SELECT * FROM numberOfRequests WHERE cluster= ‘cluster 1’ AND date >= ‘2015-09-21’; InvalidRequest: code=2200 [Invalid query] message="Only EQ and IN relation are supported on the partition key (unless you use the token() function)"
  • 14. Partition key restrictions 14© 2015. All Rights Reserved. Driver Cluster Date Node ‘cluster 1’ ‘2015-09-21’ A ‘cluster 1’ ‘2015-09-22’ D ‘cluster 2’ ‘2015-09-21’ D ‘cluster 2’ ‘2015-09-22’ C A C D B SELECT * FROM numberOfRequests WHERE cluster= ‘cluster 1’ AND date >= ‘2015-09-21’;
  • 15. Partition key restrictions 15© 2015. All Rights Reserved. Driver • Murmur3Partitioner (default): uniformly distributes data across the cluster based on MurmurHash hash values. • RandomPartitioner: uniformly distributes data across the cluster based on MD5 hash values. • ByteOrderedPartitioner: keeps an ordered distribution of data lexically by key bytes
  • 16. Partition key restrictions 16© 2015. All Rights Reserved. Driver SELECT * FROM numberOfRequests WHERE token(cluster, date) > token(‘cluster 1’, ‘2015-09-21’) AND token(cluster, date) < token(‘cluster 1’, ‘2015-09-23’);
  • 17. Partition key restrictions (SELECT) 17© 2015. All Rights Reserved. • Without secondary index, either all partition key components must be restricted or none of them • = restrictions are allowed on any partition key component • IN restrictions are allowed on any partition key component since 2.2 • Prior to 2.2, IN restrictions were only allowed on the last partition key component • =, >, >=, <= and < restrictions are allowed with the token function
  • 18. Clustering column restrictions 18© 2015. All Rights Reserved. CREATE TABLE numberOfRequests ( cluster text, date text, datacenter text, server inet, time text, count int, PRIMARY KEY((cluster, date), datacenter, server, time)) …
  • 19. Clustering column restrictions 19© 2015. All Rights Reserved. … Datacenter Server Time Count Iowa 196.8.7.134 00:00 130 Iowa 196.8.7.134 00:01 125 Iowa 196.8.7.134 00:02 97 Iowa 196.8.7.135 00:00 178 Iowa 196.8.7.135 00:01 201 [Iowa, 196.8.7.134, 00:02, count] : 97 In the Memtables: [Iowa, 196.8.7.134, 00:00, count] : 130 [Iowa, 196.8.7.134, 00:01, count] : 125 [Iowa, 196.8.7.135, 00:00, count] : 178 [Iowa, 196.8.7.135, 00:01, count] : 201 [Iowa, 196.8.7.134, 00:00, count] : 130 Cell name Cell Column name
  • 20. Clustering column restrictions 20© 2015. All Rights Reserved. … Datacenter Server Time Count Iowa 196.8.7.134 00:00 130 Iowa 196.8.7.134 00:01 125 Iowa 196.8.7.134 00:02 97 Iowa 196.8.7.135 00:00 178 Iowa 196.8.7.135 00:01 201 [Iowa, 196.8.7.134, 00:02, count] : 97 In the SSTables: [Iowa, 196.8.7.134, 00:00, count] : 130 [Iowa, 196.8.7.134, 00:01, count] : 125 [Iowa, 196.8.7.135, 00:00, count] : 178 [Iowa, 196.8.7.135, 00:0 201 [Iowa, 196.8.7.134, 00:00, count] : 130 Cell name Cell Column name
  • 21. Clustering column restrictions 21© 2015. All Rights Reserved. … [Iowa, 196.8.7.134, 00:02, count] : 97 In the Memtables: [Iowa, 196.8.7.134, 00:00, count] : 130 [Iowa, 196.8.7.134, 00:01, count] : 125 [Iowa, 196.8.7.135, 00:00, count] : 178 [Iowa, 196.8.7.135, 00:01, count] : 201 SELECT * FROM numberOfRequests WHERE cluster = ‘cluster1’ AND date =‘2015-09-21’ AND datacenter = ‘Iowa’ AND server = ‘196.8.7.135’ AND time = ‘00:00’; [Iowa,196.8.7.135,00:00]
  • 22. Clustering column restrictions 22© 2015. All Rights Reserved. … SELECT * FROM numberOfRequests WHERE cluster = ‘cluster1’ AND date =‘2015-09-21’ AND datacenter = ‘Iowa’ AND server = ‘196.8.7.135’ AND time = ‘00:00’; [Iowa,196.8.7.135,00:00] … [Iowa, 196.8.7.134, 00:02, count] : 97 In the SSTables: [Iowa, 196.8.7.134, 00:00, count] : 130 [Iowa, 196.8.7.134, 00:01, count] : 125 [Iowa, 196.8.7.135, 00:00, count] : 178 [Iowa, 196.8.7.135, 00:0 201
  • 23. Clustering column restrictions 23© 2015. All Rights Reserved. [Iowa, 196.8.7.134, 00:02, count] : 97 In the Memtables: [Iowa, 196.8.7.134, 00:00, count] : 130 [Iowa, 196.8.7.134, 00:01, count] : 125 [Iowa, 196.8.7.135, 00:00, count] : 178 [Iowa, 196.8.7.135, 00:01, count] : 201 SELECT * FROM numberOfRequests WHERE cluster = ‘cluster1’ AND date =‘2015-09-21’ AND datacenter = ‘Iowa’ AND server = ‘196.8.7.135’; [Iowa,196.8.7.135]
  • 24. Clustering column restrictions 24© 2015. All Rights Reserved. … SELECT * FROM numberOfRequests WHERE cluster = ‘cluster1’ AND date =‘2015-09-21’ AND datacenter = ‘Iowa’ AND server = ‘196.8.7.135’; [Iowa,196.8.7.135] …[Iowa, 196.8.7.134, 00:02, count] : 97 In the SSTables: [Iowa, 196.8.7.134, 00:00, count] : 130 [Iowa, 196.8.7.134, 00:01, count] : 125 [Iowa, 196.8.7.135, 00:00, count] : 178 [Iowa, 196.8.7.135, 00:0 201
  • 25. Clustering column restrictions SELECT * FROM numberOfRequests WHERE cluster = ‘cluster1’ AND date =‘2015-09-21’ AND time = ‘00:00’; [?,?,00:00] InvalidRequest: code=2200 [Invalid query] message="PRIMARY KEY column "time" cannot be restricted as preceding column "datacenter" is not restricted"
  • 26. Clustering column restrictions 26© 2015. All Rights Reserved. … AND datacenter = ‘Iowa’ AND server IN (‘196.8.7.134’, ‘196.8.7.135’) AND time = ‘00:00’; In 2.2: [Iowa,196.8.7.134,00:00] [Iowa,196.8.7.135,00:00] …[Iowa, 196.8.7.134, 00:02, count] : 97 In the SSTables: [Iowa, 196.8.7.134, 00:00, count] : 130 [Iowa, 196.8.7.134, 00:01, count] : 125 [Iowa, 196.8.7.135, 00:00, count] : 178 [Iowa, 196.8.7.135, 00:0 201
  • 27. Clustering column restrictions 27© 2015. All Rights Reserved. … AND datacenter = ‘Iowa’ AND server IN (‘196.8.7.134’, ‘196.8.7.135’) AND time = ‘00:00’; In 2.1: InvalidRequest: code=2200 [Invalid query] message="Clustering column "server" cannot be restricted by an IN relation"
  • 28. Clustering column restrictions 28© 2015. All Rights Reserved. = multi-column restriction: (clustering1, clustering2, clustering3) = (?, ?, ?) IN multi-column restriction: (clustering1, clustering2, clustering3) IN ((?, ?, ?), (?, ?, ?)) Slice multi-column restriction: (clustering1, clustering2, clustering3) > (?, ?, ?) (clustering1, clustering2, clustering3) >= (?, ?, ?) (clustering1, clustering2, clustering3) <= (?, ?, ?) (clustering1, clustering2, clustering3) < (?, ?, ?)
  • 29. Clustering column restrictions 29© 2015. All Rights Reserved. … AND datacenter = ‘Iowa’ AND (server, time) IN ((‘196.8.7.134’, ‘00:00’), (‘196.8.7.135’, ‘00:00’)); In 2.1: [Iowa,196.8.7.134,00:00] [Iowa,196.8.7.135,00:00] …[Iowa, 196.8.7.134, 00:02, count] : 97 In the SSTables: [Iowa, 196.8.7.134, 00:00, count] : 130 [Iowa, 196.8.7.134, 00:01, count] : 125 [Iowa, 196.8.7.135, 00:00, count] : 178 [Iowa, 196.8.7.135, 00:0 201
  • 30. Clustering column restrictions 30© 2015. All Rights Reserved. … AND datacenter = ‘Iowa’ AND server = ‘196.8.7.134’ AND time > ’00:00’; from after [Iowa,196.8.7.134,00:00] to end of [Iowa,196.8.7.134] …[Iowa, 196.8.7.134, 00:02, count] : 97 In the SSTables: [Iowa, 196.8.7.134, 00:00, count] : 130 [Iowa, 196.8.7.134, 00:01, count] : 125 [Iowa, 196.8.7.135, 00:00, count] : 178 [Iowa, 196.8.7.135, 00:0 201
  • 31. Clustering column restrictions (SELECT) 31© 2015. All Rights Reserved. • Without secondary index, a clustering column cannot be restricted if one of the previous ones was not • = restrictions (single and multi) are allowed on any clustering column • IN restrictions (single and multi) are allowed on any clustering column since 2.2 • Prior to 2.2, IN restrictions (single and multi) were only allowed on the last clustering column or set of clustering columns • >, >=, <=, < restrictions (single and multi) are only allowed on the last restricted clustering column or set of clustering columns • CONTAINS and CONTAINS KEY restrictions are only allowed on indexed collections
  • 32. Secondary index queries 32© 2015. All Rights Reserved. CREATE TABLE numberOfRequests ( cluster text, date text, datacenter text, server inet, time text, count int, PRIMARY KEY((cluster, date), datacenter, server, time)); CREATE INDEX ON numberOfRequests (time); …
  • 33. Secondary index queries 33© 2015. All Rights Reserved. CREATE INDEX ON numberOfRequests (time); CREATE LOCAL TABLE numberOfRequests_time_idx ( time text, cluster text, date text, datacenter text, server inet, PRIMARY KEY(time, cluster, date, datacenter, server); … Table Partition Key Table remaining clustering columns
  • 34. IDX-BIDX-D IDX-C IDX-A Secondary index queries 34© 2015. All Rights Reserved. Driver A C D B SELECT * FROM numberOfRequests WHERE time = ‘12:00’; Driver
  • 35. Secondary index queries 35© 2015. All Rights Reserved. Driver SELECT * FROM numberOfRequests WHERE time = ‘12:00’; idx SELECT * FROM numberOfRequests_time_idx WHERE time = ‘12:00’; Results (Primary Keys) table SELECT with full PK; [For each] Add to rows
  • 36. Secondary index queries 36© 2015. All Rights Reserved. Driver SELECT * FROM numberOfRequests WHERE time >= ‘12:00’; InvalidRequest: code=2200 [Invalid query] message="PRIMARY KEY column "time" cannot be restricted as preceding column "datacenter" is not restricted" Direct queries on secondary index support only =, CONTAINS or CONTAINS KEY restrictions.
  • 37. Secondary index queries 37© 2015. All Rights Reserved. Driver SELECT * FROM numberOfRequests WHERE time = ‘12:00’ AND count >= 500 ALLOW FILTERING; idx SELECT * FROM numberOfRequests_time_idx WHERE time = ‘12:00’; Results (Primary Keys) table SELECT with full PK; [For each] Add to rows [if count >= 500]
  • 38. IDX-BIDX-D IDX-C IDX-A Secondary index queries 38© 2015. All Rights Reserved. Driver A C D B SELECT * FROM numberOfRequests WHERE cluster = ‘cluster 1’ AND date = ‘2015-09-21’AND time = ‘12:00’; Driver
  • 39. Secondary index queries 39© 2015. All Rights Reserved. Driver SELECT * FROM numberOfRequests WHERE cluster = ‘cluster 1’ AND date = ‘2015-09-21’ AND time = ‘12:00’; idx SELECT * FROM numberOfRequests_time_idx WHERE time = ‘12:00’ AND cluster = ‘1’ AND date = ‘2015-09-21’; Results (Primary Keys) table SELECT with full PK [For each] Add to rows
  • 40. 40© 2015. All Rights Reserved. Driver UPDATE/DELETE statements
  • 41. UPDATE statements 41© 2015. All Rights Reserved. Driver In the UPDATE statements all the primary key columns must be restricted and the only allowed restrictions are: • Prior to 3.0: • Single column = restriction on any partition key or clustering column • Single column IN restriction on the last partition key column • In 3.0: • = and IN single column restrictions on any partition key column • = and IN single or multi column restrictions on any clustering column
  • 42. DELETE statements 42© 2015. All Rights Reserved. Driver Before 3.0, in the DELETE statements all the primary key columns must be restricted and the only allowed restrictions were: • Single column = restriction on any partition key or clustering column • Single column IN restriction on the last partition key column
  • 43. DELETE statements 43© 2015. All Rights Reserved. Driver Since 3.0: • The partition key columns must be restricted by = or IN restrictions • A clustering column might not be restricted if none of the following is • Clustering columns can be restricted by: • Single or multi column = restriction • Single or multi column IN restriction • Single or multi column >, >=, <=, < restriction
  • 44. © 2015. All Rights Reserved. 44 Design your tables for the queries you want to perform.