-
Vertica table row count프로그램밍 2023. 1. 25. 17:03
Vertica 테이블 건수 조회
-- 전체 테이블 건수
with num_rows as (
select schema_name,
anchor_table_name as table_name,
sum(total_row_count) as rows
from v_monitor.storage_containers sc
join v_catalog.projections p
on sc.projection_id = p.projection_id
and p.is_super_projection = true
and schema_name = 'DW' -- 포함 스키마
and (anchor_table_name like 'DG%' or -- 포함 테이블
anchor_table_name like 'GC%' or
anchor_table_name like 'HC%' or
anchor_table_name like 'MR%' or
anchor_table_name like 'PI%' or
anchor_table_name like 'PI%' or
anchor_table_name like 'RG%')
group by schema_name,
table_name,
sc.projection_id
)
select schema_name,
table_name,
max(rows) as rows
from num_rows
where table_name not like '%LDNG' and table_name not like '%INIT' -- 제외 테이블
group by schema_name,
table_name
order by rows desc;'프로그램밍' 카테고리의 다른 글
Python PyPDF2 사용 페이지 분할 (1) 2023.12.07 PostgreSQL System SQL (2) 2023.11.27 OHDSI WebAPI 2.11.0 배포 (0) 2022.06.23 R library 설치 오류 (0) 2020.10.29 Postgresql dump restore 백업 복구 (0) 2020.07.03