gpt4 book ai didi

google-cloud-spanner - INTERLEAVE 是否支持传递属性?

转载 作者:行者123 更新时间:2023-12-02 00:50:26 25 4
gpt4 key购买 nike

假设我有三个表,FooBarBaz

CREATE TABLE Foo (
FooId BYTES(MAX)
) PRIMARY KEY (FooId);
CREATE TABLE Bar (
FooId BYTES(MAX),
BarId BYTES(MAX)
) PRIMARY KEY (FooId, BarId),
INTERLEAVE IN PARENT Foo on DELETE CASCADE;
CREATE TABLE Baz (
FooId BYTES(MAX),
BazId BYTES(MAX)
) PRIMARY KEY (FooId, BazId),
INTERLEAVE IN PARENT Foo on DELETE CASCADE;

此图演示了 INTERLEAVE 层次结构:

+-----+   +-----+
| | | |
| Foo <---+ Bar |
| | | |
+--^--+ +-----+
|
+--+--+
| |
| Baz |
| |
+-----+

Cloud Spanner's documentationINTERLEAVE 描述为

You can define hierarchies of parent-child relationships between tables up to seven layers deep, which means you can co-locate rows of seven logically independent tables.

由于我们在 BarFoo 之间使用了 INTERLEAVE,我相信我们可以保证它们位于同一位置,具有相同的键.就像我们如何 INTERLEAVE BazBar 一样,它们也应该放在一起,使用相同的键。

如果这是真的,那么我们是否可以保证 BarBaz 位于同一位置,也具有相同的键?

最佳答案

在所描述的场景中,Bar 和 Baz 在给定 FooId key 的情况下并置(或在同一拆分中)。在拆分中,每个表中的行组合在一起。

关于google-cloud-spanner - INTERLEAVE 是否支持传递属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58019259/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com