You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
select S_NATIONKEY as s,
count(S_SUPPKEY),
count(distinct S_NAME)
from supplier
group by s;
If the group key is highly skewed and the distinct key has large number of distinct values (a.k.a. high cardinality), the query execution will be slow.
We should be able to rewrite the above query to the following query to avoid skew:
select S_NATIONKEY as s,
sum(cnt_suppkey),
count(S_NAME)
from (
select S_NATIONKEY, S_NAME, count(S_SUPPKEY) as cnt_suppkey
from supplier
group by S_NATIONKEY, S_NAME
) as T
group by s;
The text was updated successfully, but these errors were encountered:
Enhancement
For the following kind of query:
If the group key is highly skewed and the distinct key has large number of distinct values (a.k.a. high cardinality), the query execution will be slow.
We should be able to rewrite the above query to the following query to avoid skew:
The text was updated successfully, but these errors were encountered: