select schemaname ,relname as "Table" ,pg_size_pretty(pg_total_relation_size(relid)) as "size" ,pg_size_pretty(pg_total_relation_size(relid) - pg_relation_size(relid)) as "external size" ,now() from pg_catalog.pg_statio_user_tables where 1=1 order by schemaname,pg_total_relation_size(relid) desc;
대량 이관 작업시 대상 테이블 autovacuum 끄기 select 'alter table '||table_schema||'.'||table_name||' set (autovacuum_enabled=false);' from information_schema.tables where table_schema = '스키마명' and table_name = '테이블명' ; 다시 켜는건 select 'alter table '||table_schema||'.'||table_name||' set (autovacuum_enabled=true);' from information_schema.tables where table_schema = '스키마명' and table_name = '테이블명' ;
한글이름 가운데 마스킹 영문이름 5자 초과 기준으로 마스킹 with name_masking as ( SELECT '홍길동' AS name_1 union all select 'HongGilDong' union all select 'Mark' ) select name_1 ,case when name_1 ~E'[A-Z|a-z]' then case when length(name_1) >5 then rpad(left(name_1,5),length(name_1),'*') else rpad(left(name_1,2),length(name_1),'*') end else left(name_1,1)||'*'||substring(name_1,3,length(name_1)) end "마스킹" from name_masking;