Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

michael.shatz_192704 avatar image
michael.shatz_192704 asked ·

What are the possible filters that can be used on my table?

The Cassandra DB contains the following table: metric.metric

What are the possible filters that can be used for the following table metric.metric?

cqlsh> SELECT * FROM metric.metric LIMIT 1;
 id                                                                                                                  | time       | point
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
{path: 'first.node.threadpool.CACHE.monitored_idle', resolution: {precision: 3600, period: 31536000}} | 1586700000 | {max: 0, mean: 0, min: 0, sum: 0}
id={path: 'first.node.threadpool.CACHE.monitored_idle', resolution: {precision: 3600, period: 31536000}}
time=1586700000
point={max: 0, mean: 0, min: 0, sum: 0}


Update: detailed schema

cqlsh> DESC SCHEMA
CREATE KEYSPACE metric WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = true;

CREATE TYPE metric.metric_resolution (
   precision int,
   period int
);

CREATE TYPE metric.metric_id (
   path text,
   resolution frozen<metric_resolution>
);

CREATE TYPE metric.metric_point (
   max double,
   mean double,
   min double,
   sum double
);

CREATE TABLE metric.metric (
   id frozen<metric_id>,
   time bigint,
   point frozen<metric_point>,
   PRIMARY KEY (id, time)
) 
WITH CLUSTERING ORDER BY (time ASC)
AND ...

CREATE TABLE metric.segment (
   parent text,
   segment text,
   leaf boolean,
   length int,
   pos int,
   PRIMARY KEY (parent, segment)
) 
WITH CLUSTERING ORDER BY (segment ASC)
AND ...


cassandradata modeling
1 comment
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Hi @michael.shatz_192704,

a quick note that I added your update to the initial question post, as it was too long to be added to the comments.

Cheers!

0 Likes 0 · ·

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered ·

You haven't provided much information and typically you should provide the table schema for us to make a meaningful response. In any case, I'm going to assume that the primary key and partition key are both:

    PRIMARY KEY (id)

On this basis, you can only filter based on id. Cheers!

1 comment Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

@michael.shatz_192704 based on the table schema, you can only filter on the partition key as I stated previously. Cheers!

1 Like 1 · ·