官术网_书友最值得收藏!

Materialized views

Data modeling principles in Cassandra compel us to denormalize data as much as possible. Prior to Cassandra 3.0, the only way to query on a non-primary key column was to create a secondary index and query on it. However, secondary indexes have a performance trade-off if they contain high cardinality data. Often, high cardinality secondary indexes have to scan data on all the nodes and aggregate them to return the query results. This defeats the purpose of having a distributed system.

To avoid secondary indexes and client-side denormalization, Cassandra introduced the feature of materialized views, which does server side denormalization. You can create views for a base table and Cassandra ensures eventual consistency between the base and view. This lets us do very fast lookups on each view following the normal Cassandra read path. Materialized views maintain a correspondence of one CQL row each in the base and the view, so we need to ensure that each CQL row that is required for the views will be reflected in the base table's primary keys. Although a materialized view allows for fast lookups on non-primary key indexes, this comes at a performance hit to writes. Also, using secondary indexes and materialized views increases the disk usage by a considerable margin. Thus, it is important to take this into consideration when sizing your cluster.

主站蜘蛛池模板: 顺义区| 图木舒克市| 尚志市| 江川县| 辉南县| 石泉县| 临邑县| 黄山市| 龙陵县| 临湘市| 正镶白旗| 仪陇县| SHOW| 论坛| 逊克县| 中方县| 巴南区| 潢川县| 壤塘县| 高台县| 内丘县| 灯塔市| 社会| 金塔县| 灵寿县| 石首市| 盐城市| 华蓥市| 阜新| 山西省| 荆门市| 榆树市| 集贤县| 昆山市| 新和县| 五大连池市| 花垣县| 汉源县| 五华县| 茂名市| 涡阳县|