A.A
A.A

Reputation: 4101

Cassandra Materialized view

Assume this schema

CREATE TABLE t(
        a int,
        b int,
        c int,
        d int,
        e text,
        f date,
        g int,
        PRIMARY KEY (a,b)
)

I we create following mv

CREATE MATERIALIZED VIEW t_mv as
        select a,b,c,d from t where c is not null and d is not null
         PRIMARY KEY (c,d,a,b);

What happens if we run this query

UPDATE t SET g=1 WHERE a=10 AND b = 20

As you can see "g" is excluded in "t_mv" , I want to know what cassandra doing internaly?

Is there any overhead for t_mv , or cassandra smartly detect there is no changes for t_mv and no-operation

for example If we have 10 materialized view like above-mentioned , is Update that excluded in mv impact performance? or the performance in equal to when there is no mv

Upvotes: 0

Views: 96

Answers (1)

undefined_variable
undefined_variable

Reputation: 6218

Cassandra does not send mutation to materialized view in above condition.

Did a quick demo on local system with your table structure and below is TRACE output.enter image description here

While updating columns which is present in Materialized view gives below TRACE: enter image description here

I hope this answers your question.

Upvotes: 1

Related Questions