问题描述
- 想知道mv对基本表的影响.它会减慢基表速度吗?它何时开始写入mv,就像它同时写入基表和mv?
- 如果我有local_quorum的CL且RF = 3,那么客户端是否必须等待它写入mv才能获得确认.
- 基表和mv中涉及哪种锁会影响基表的延迟
推荐答案
材料化视图被视为实验.下一个3.0、3.11和4.0修补程序版本将包括CASSANDRA-13959,它将在创建实例化视图时记录警告,并引入yaml设置,允许操作员禁用其创建.因此最好避免使用它们.
Materialized Views are considered experimental. The next patch releases of 3.0, 3.11, and 4.0 will include CASSANDRA-13959, which will log warnings when materialized views are created, and introduce a yaml setting that will allow operators to disable their creation. So better avoid using them.
如原始建模课程所述,将数据复制到另一个表中,以通过不同的分区键进行查询.
As the original modeling lessons says, duplicate the data into a different table for querying by a different partition key.
但是无论如何要回答您的原始问题
But anyways to answer your original questions
1.想知道MV对基本表的影响.它会减慢基表速度吗?它何时开始写入mv,就像它同时写入基表和mv?
对于物化视图,在写之前需要进行读操作.对基表的每次写入都涉及从基表中读取有关MV中相应分区键的信息.然后,它进一步使用基于日志的方法写入MV,以确保将应用于基表的写入也提交到MV中.因此,对于带有MV的表,写入将变慢.
With a materialized view, there is an overhead of read before write. Every write to the base table, involves a read from base table about the corresponding partition key in MV. Then further it writes to the MV with a log based approach, as to make sure the write when applied to base table gets committed in MV as well. So writes will be slower for a table with MV.
2)如果我具有local_quorum的CL且RF = 3,则客户端必须等到它写入mv才能获得确认.
客户端将不等待MV写入,因为Cassandra会通过从基表对MV进行基于日志的写入来分别处理客户端.一致性保证仍然仅适用于基表.
The client will not wait for MV writes, as its handled separately by Cassandra with a log based write to MV from the base table. The consistency guarantee is still applicable only for the base table.
3)基表和mv涉及哪种锁会影响基表的延迟
Cassandra而不是锁定,而是使用batchlog来确保对基表中的MV进行写操作.
Instead of locking, Cassandra uses batchlog to guarantee the writes happen to MV from base table.
有关参考性能对MV的影响.
For further reference on performance impacts on MV.
这篇关于Cassandra物化视图的影响的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!