Partition By & Clustered & Distributed By in USql - Need to know their meaning and when to use them

白昼怎懂夜的黑 提交于 2019-12-24 03:16:10

问题


I can see that while creating table in USQL we can use Partition By & Clustered & Distributed By clauses.

As per my understanding partition will store data of same key (on which we have partition) together or closer (may be in same structured stream at background), so that our query will be more faster when we use that key in joins, filter.

Clustering is - I guess it stores data of those columns together or closer inside each partition.

And Distribution is some method like Hash or Round Robin - the way of storing data inside each partition. If you have integer column and you frequently query within some range , use range else use hash. If your data is not distributed equally then you may face data skew issue, so in that case use round robin.

Question 2: Please let me know whether my understanding is correct or not?

Question 1: There is INTO clause - I want to know how we should identify value for this INTO clause for DISTRIBUTION?

Question 3: Also want to know that which one is vertical partitioning and which one is horizontal?

Question 4: I don't see any good online document to learn these concepts with examples. If you know please send me links.


回答1:


Peter and Bob have given you links to documentation.

To quickly answer your questions here:

Partitions and distributions both partition the data based on the partitioning scheme and both provide data scale out and partition elimination.

Partitions are optional and individually manageable for data life cycle management (besides giving you the ability to get partition elimination) and currently only support a value-based partition based on the same column values.

Each Partition then gets further partitioned based on the distribution scheme. Here you have different schemes (HASH, RANGE etc). The system decides on the number of distribution buckets based on some heuristic. In the case of HASH partitions, you can also specify the number of buckets with the INTO clause.

The clustering will then specify the order of the rows within a distribution bucket and allows you to further improve query performance (you can to a range scan instead of a full scan for example).

Vertical and horizontal partitioning are terms sometimes used to separate these two levels of partitioning. I try to avoid it, since it can be confusing to remember which one is which.



来源:https://stackoverflow.com/questions/47455169/partition-by-clustered-distributed-by-in-usql-need-to-know-their-meaning-a

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!