728x90
728x170
temporary table 사용량을 확인하는 쿼리입니다.
SELECT
a.pid as ProcessID,
a.sess_id as SessionID,
n.nspname as SchemaName,
c.relname as RelationName,
CASE c.relkind
WHEN 'r' THEN 'table'
WHEN 'v' THEN 'view'
WHEN 'i' THEN 'index'
WHEN 'S' THEN 'sequence'
WHEN 's' THEN 'special'
END as RelationType,
pg_catalog.pg_get_userbyid(c.relowner) as RelationOwner,
pg_size_pretty(pg_relation_size(n.nspname ||'.'|| c.relname)) as RelationSize
FROM
pg_catalog.pg_class c
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
LEFT JOIN pg_catalog.pg_stat_activity a ON 'pg_temp_' || a.sess_id::varchar = n.nspname
WHERE c.relkind IN ('r','s')
AND (n.nspname !~ '^pg_toast' and nspname like 'pg_temp%')
ORDER BY pg_relation_size(n.nspname ||'.'|| c.relname) DESC;
728x90
그리드형
'DB' 카테고리의 다른 글
[DB/PostgreSQL] Vacuum (0) | 2023.10.11 |
---|---|
[DB/PostgreSQL] Session Kill (0) | 2023.10.06 |
[DB/PostgreSQL] 지정 시간 동안 수행된 쿼리 확인 (0) | 2023.10.06 |
[DB/PostgreSQL] 시퀀스 (Sequence) 사용하기 - 자동 증가 컬럼 (0) | 2023.10.06 |
[ORACLE] ORA-01861 : literal does not match format string 에러 (0) | 2023.07.17 |