You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by web master <so...@gmail.com> on 2017/06/21 06:41:45 UTC
Question about 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
Re: Question about materialized view
Posted by Michael Mior <mm...@uwaterloo.ca>.
This is handled by updateAffectsView in org.apache.cassandra.db.view.View.
It will scan over each row to be updated in the base table and see that the
column is not included in the view definition and skip the update.
--
Michael Mior
mmior@apache.org
2017-06-21 2:41 GMT-04:00 web master <so...@gmail.com>:
> 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
>