简体   繁体   English

人口稀少的 Frozen 用户定义类型对性能有何影响?

[英]What are the performance implications of sparsely populated Frozen User Defined Type?

We have a frozen UDT with ~2000 fields as one of the columns in a table.我们有一个frozen UDT ,其中包含~2000个字段作为表中的列之一。 We use this table to implement append-only writes so that the data is auditable and not overwritten.我们使用这张表来实现 append-only 写,这样数据是可审计的,不会被覆盖。

We are seeing degradation in write performance when only 1 (out of 2000) field in the UDT is populated.UDT中只有 1 个(共 2000 个)字段被填充时,我们看到写入性能下降。

Trying to understand the performance implication of using sparsely populated frozen UDTs.尝试了解使用稀疏填充的冻结 UDT 的性能影响。 How are UDTs serialized/deserialized internally? UDT 如何在内部serialized/deserialized化? Any documentation of this will be highly appreciated.对此的任何文档将不胜感激。

We tried to gather some metrics from cass session, but couldn't get much information.我们试图从 cass session 收集一些指标,但无法获得太多信息。

edit: We are using the C++ cassandra driver.编辑:我们正在使用 C++ cassandra 驱动程序。

What performance are you measuring here?你在这里测量什么性能? Comparing performance to inserting data using non-UDT columns into a table versus inserting data using both non-UDT columns and UDT-type columns?比较使用非 UDT 列将数据插入表与同时使用非 UDT 列和 UDT 类型列插入数据的性能?

a column whose type is a frozen collection (set, map, or list) or UDT can only have its value replaced as a whole.类型为冻结集合(集合、map 或列表)或 UDT 的列只能将其值作为一个整体替换。 In other words, we can't add, update, or delete individual elements from the collection as we can in non-frozen collection types.换句话说,我们不能像在非冻结集合类型中那样从集合中添加、更新或删除单个元素。 So, the frozen keyword can be useful, for example, when we want to protect collections against single-value updates.因此,frozen 关键字很有用,例如,当我们想要保护 collections 免受单值更新时。

For example, in case of the below snippet,例如,对于以下代码段,

CREATE TYPE IF NOT EXISTS race (
race_title text,
race_date date
);

CREATE TABLE IF NOT EXISTS race_data (
id INT PRIMARY KEY,
races frozen<list<race>>
...
);

the UDT nested in the list is frozen, so the entire list will be read when querying the table.嵌套在列表中的 UDT 被冻结,因此在查询表时将读取整个列表。

Since you did not provide "how" you're updating the frozen collection, it is hard to triage why there is a performannce concern here.由于您没有提供更新冻结集合的“方式”,因此很难对此处存在性能问题的原因进行分类。

References for exploration :探索参考

Essentially, you will not be able to do an append-only operation with a frozen type as you will always have to perform read-before-write operation for any upserts.本质上,您将无法对冻结类型执行仅追加操作,因为您始终必须对任何更新插入执行先读后写操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM