以下の内容はhttps://yohei-a.hatenablog.jp/entry/20260203/1770089819より取得しました。


Redshift で disk spill したサイズを調べるクエリ

Redshift で disk spill したサイズを調べるクエリ(Serverless、Multi-AZ など、SYS 系のシステムテーブルしか参照できないケースで)

select 
any_value(h.user_id) user_id,
any_value(h.username) username,
any_value(h.generic_query_hash) generic_query_hash,
any_value(h.user_query_hash) user_query_hash,
any_value(h.query_id) query_id,
any_value(h.compute_type) compute_type,
any_value(h.query_type) query_type,
any_value(h.execution_time) execution_time,
sum(d.spilled_block_local_disk) spilled_block_local_disk,
sum(d.spilled_block_remote_disk) spilled_block_remote_disk,
sum(spilled_block_local_disk) + sum(spilled_block_remote_disk) spilled_blocks,  -- disk spill したサイズ(単位は MB)
any_value(h.query_text) query_tex
from sys_query_history h, sys_query_detail d
where h.query_id = d.query_id
group by h.query_id
having spilled_blocks > 10000 -- 1TB以上で絞る
order by spilled_blocks desc;

一時領域を使用するクエリ例

CREATE TEMP TABLE lineorder_temp
DISTSTYLE EVEN 
SORTKEY(lo_orderkey)
AS
SELECT *
FROM lineorder;



以上の内容はhttps://yohei-a.hatenablog.jp/entry/20260203/1770089819より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14