cassandra materialized view And index
来源:互联网 发布:js圆形进度条插件 编辑:程序博客网 时间:2024/05/19 12:36
CREATE TABLE mytest1.wordstest (
word text PRIMARY KEY,
c1 int,
count int
)
-. index
1. 不指定partition, 普通查询
select * from mytest1.wordstest where count = 40 ALLOW FILTERING
2. 个人理解: 二级索引很耗 性能:表太大,还是不要建立
Secondary indexes are tricky to use and can impact performance greatly. The index table is stored on each node in a cluster, so a query involving a secondary index can rapidly become a performance nightmare if multiple nodes are accessed
CREATE INDEX c1_index ON mytest1.wordstest (c1);
select * from mytest1.wordstest where c1 = 1;
二. materialized view 物化视图
A materialized view is a table that is built from another table's data with a new primary key and new properties
CREATE MATERIALIZED VIEW wordstest_mv
AS SELECT count, word, c1
FROM mytest1.wordstest
WHERE count IS NOT NULL AND word IS NOT NULL
PRIMARY KEY (count, word);
Nee to know: The columns of the source table's primary key must be part of the materialized view's primary key.
select * from mytest1.wordstest_mv where c1 = 1;
Cassandra can only write data directly to source tables, not to materialized views. Cassandra updates a materialized view asynchronously after inserting data into the source table, so the update of materialized view is delayed. Cassandra performs a read repair to a materialized view only after updating the source table.
源表和物化视图的数据更新不是同步的,数据插入源表后,不会同步更新物化视图。通过执行repair 操作更新物化视图的数据
https://docs.datastax.com/en/cql/3.3/cql/cql_using/useCreateMV.html
word text PRIMARY KEY,
c1 int,
count int
)
-. index
1. 不指定partition, 普通查询
select * from mytest1.wordstest where count = 40 ALLOW FILTERING
2. 个人理解: 二级索引很耗 性能:表太大,还是不要建立
Secondary indexes are tricky to use and can impact performance greatly. The index table is stored on each node in a cluster, so a query involving a secondary index can rapidly become a performance nightmare if multiple nodes are accessed
CREATE INDEX c1_index ON mytest1.wordstest (c1);
select * from mytest1.wordstest where c1 = 1;
二. materialized view 物化视图
A materialized view is a table that is built from another table's data with a new primary key and new properties
https://docs.datastax.com/en/cql/3.3/cql/cql_using/useCreateMV.html
https://www.datastax.com/dev/blog/new-in-cassandra-3-0-materialized-views
CREATE MATERIALIZED VIEW wordstest_mv
AS SELECT count, word, c1
FROM mytest1.wordstest
WHERE count IS NOT NULL AND word IS NOT NULL
PRIMARY KEY (count, word);
Nee to know: The columns of the source table's primary key must be part of the materialized view's primary key.
select * from mytest1.wordstest_mv where c1 = 1;
Cassandra can only write data directly to source tables, not to materialized views. Cassandra updates a materialized view asynchronously after inserting data into the source table, so the update of materialized view is delayed. Cassandra performs a read repair to a materialized view only after updating the source table.
源表和物化视图的数据更新不是同步的,数据插入源表后,不会同步更新物化视图。通过执行repair 操作更新物化视图的数据
https://docs.datastax.com/en/cql/3.3/cql/cql_using/useCreateMV.html
阅读全文
0 0
- cassandra materialized view And index
- cassandra实战--物化视图(Materialized View)
- Materialized View in Oracle - Concepts and Architecture
- ORA-02243: ALTER INDEX 或 ALTER MATERIALIZED VIEW 选项无效
- materialized view
- materialized view
- MATERIALIZED VIEW
- materialized view
- materialized view
- MATERIALIZED VIEW
- Materialized View
- 解剖Cassandra 【3】Index and Search
- table被drop之后,关联的index和materialized view log是否进入回收站
- MATERIALIZED VIEW 的Refresh
- materialized view(1)
- oracle materialized view
- Oracle中Materialized View
- Analyzing Materialized View Capabilities
- Exclusive Access 2 UVA
- js 实现打印的分页功能
- 拼图软件——texturepacker
- nginx服务器隐藏版本号
- linux 编译 依赖静态库的静态库问题
- cassandra materialized view And index
- nginx开始
- Mian加载spring容器
- android开发-Service的生命周期
- 身份证工具类
- MapReduce中job参数及设置map和reduce的个数
- 农业农村经济发展势头向好 呈现“六个新”
- java中String、StringBuffer、StringBuilder的区别
- 理解Javascript_07_理解instanceof实现原理