Hi Junaid,

Given a time range do you want to take all devices or a specific device?

On Jul 26, 2017 3:15 PM, "Junaid Nasir" <jna...@an10.io> wrote:

I have a C* cluster (3 nodes) with some 60gb data (replication factor 2).
when I started using C* coming from SQL background didn't give much thought
about modeling the data correctly. so what I did was

CREATE TABLE data ( deviceId int,
                    time timestamp,
                    field1 text,
                    filed2 text,
                    field3 text,
                    PRIMARY KEY(deviceId, time)) WITH CLUSTERING ORDER
BY (time ASC);

but most of the queries I run (using spark and datastax connector) compares
data of different devices for some time period. for example

SELECT * FROM data WHERE time > '2017-07-01 12:00:00';

from my understanding this runs a full table scan. as shown in spark UI
(from DAG visualization "Scan org.apache.spark.sql.cassandra.
CassandraSourceRelation@32bb7d65") meaning C* will read all the data and
then filter for time. Spark jobs runs for hours even for smaller time
frames.

what is the right approach for data modeling for such queries?. I want to
get a general idea of things to look for when modeling such data.
really appreciate all the help from this community :). if you need any
extra details please ask me here.

Regards,
Junaid

Reply via email to