在多个键值范围的父性能中交错

Interleave in parent performance for multiple key-value ranges

我们正在考虑将用户交互与用户 table 交织在一起,唯一的问题是每个用户将有数万次交互,因此 64MB 的一个键值范围将最可能很少适合。

CockroachDB 文档指出:

If the amount of interleaved data stored for any Primary Key value of the root table is larger than a key-value range's maximum size (64MB by default), the interleaved optimizations will be diminished.

用户和交互 tables 会更大一些,我们目前的估计会在 5 到 10TB 左右。将会有繁重的聚合查询,需要在交互和用户之间进行连接 table,然后在某些用户列上进行聚合。

Elasticsearch 已经让我们失望了,因为它糟糕的父子连接性能(并且不要让我开始强制过滤器重新排序......),所以也许有人对这种情况有使用 CockroachDB 的生产经验?

已经为 v2.0 版本制作了一个微基准 https://github.com/cockroachdb/loadgen#interleave for measuring the performance of interleaved vs non-interleaved tables in CockroachDB. Interleaved joins in v1.1.3 are far less than optimal, but significant improvements(如果您只想测试交错 table 并加入查询作为实验,您可以从 master 分支构建一个二进制文件)。

在基准测试中,您可以通过在基准测试中指定 --merchants--products 的行数来模拟父子关系。注意:由于 products 被插入到 merchants 中,它会将 products 行均匀分布到 merchants.

通常,在 CockroachDB v2.0 中,对于父子连接查询,交错 tables 总是优于非交错 tables。如文档中所述,您将牺牲 table 扫描的性能(阅读:需要 table 扫描的查询)交错 tables.