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

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.

主站蜘蛛池模板: 峨山| 延安市| 泌阳县| 元氏县| 手游| 新闻| 南丹县| 海淀区| 洱源县| 石嘴山市| 土默特左旗| 宜宾市| 通渭县| 六安市| 呼伦贝尔市| 鄂尔多斯市| 育儿| 芦溪县| 上思县| 招远市| 天峨县| 银川市| 平罗县| 兴安县| 铜山县| 平阳县| 革吉县| 霞浦县| 阿合奇县| 石林| 通州区| 乌兰察布市| 南开区| 肥东县| 揭阳市| 黑龙江省| 营山县| 云安县| 永昌县| 乡城县| 交口县|