ablog

不器用で落着きのない技術者のメモ

2023-04-06から1日間の記事一覧

Amazon Redshift で2列で内部結合しているクエリで分散キー指定列の違いによる比較

AWS

Amazon Redshift で2列で内部結合しているクエリで、分散キーが2列のうち偏りのある列にした場合と偏りのない列にした場合の比較。 検証結果 偏りのある列(l_shipdate)が分散キー select sum(a.l_quantity), count(a.l_orderkey), min(a.l_shipdate), max(…

Amazon Redshift で結合キーに関数を使うとソートマージ結合にならないパターン

AWS

Amazon Redshift で結合キーに関数を使うとソートマージ結合にならないパターン。 検証結果 結合キーに collate 関数を使用 クライアントからみた実行時間は25分47秒。 select a.l_linenumber, avg(a.l_quantity) from lineitem a, lineitem b where collate…

Amazon Redshift のソートマージ結合とハッシュ結合を比較する

AWS

ソートマージ結合になる条件 両テーブルの結合キーが分散キーとソートキーに指定されている 結合対象表の未ソート率が20%未満 Merge Join Typically the fastest join, a merge join is used for inner joins and outer joins. The merge join is not used f…