5

I downloaded the sample code -> "ElasticScaleStarterKit" (in visual studio -> file -> new -> project -> online -> Elastic DB Tools for Azure SQL - getting Started).

the schema defined as follows:

schemaInfo.Add(new ReferenceTableInfo("Regions"));
schemaInfo.Add(new ReferenceTableInfo("Products"));
schemaInfo.Add(new ShardedTableInfo("Customers", "CustomerId"));
schemaInfo.Add(new ShardedTableInfo("Orders", "CustomerId"));

What is the difference between ReferenceTableInfo to ShardedTableInfo?

I understand that the simple difference is between "dry" information that is true for all databases (like status table etc...), and personal information - for a specific customer.

But, what would happen if all the tables was set to be References?? What's the downside to this kind of setting:

schemaInfo.Add(new ReferenceTableInfo("Regions"));
schemaInfo.Add(new ReferenceTableInfo("Products"));
schemaInfo.Add(new ReferenceTableInfo("Customers"));
schemaInfo.Add(new ReferenceTableInfo("Orders"));

hope for any help :)

thank you!

4

1 回答 1

3

引用表是数据被复制的表,这意味着如果引用表有 5 行,那么这 5 行将存在于引用表的所有实例上。

但是,分片表是对数据进行分区的表。例如,如果您在 Sharded 表中有 5 行数据,那么 2 行将存在于一个 Shard(或数据库)上,3 行将存在于另一个上。所以没有两个数据库会有相同的行集。

拆分/合并工具也使用此信息。对于复制表,所有行都从源复制到目标,而对于分片表,行从源移动到目标。

希望这可以帮助!

于 2015-12-09T16:53:31.707 回答