본문 바로가기

PostgreSQL7

Postgresql. DataBase / Table size 확인 Postgresql DataBase size 확인 SELECT datname, pg_size_pretty(pg_database_size('DB명')) from pg_database; Postgresql Table size 확인 SELECT tablename pg_size_pretty(pg_relation_size('테이블명')) from pg_table; 2021. 10. 14.
PostgreSQL 테이블 & 컬럼 & INDEX 정보 한번에 조회 ------------------------------------------------- ---.PostgreSQL 테이블 & 컬럼 & INDEX 정보 한번에 조회 -------------------------------------------------- SELECT tbl.schemaname 스키마명 , tbl.relname 테이블id , tbl_dec.description 테이블명 , col.attname 컬럼명 , col.attnum 컬럼순서 , col_dec.description 컬럼설명 , col_att.data_type data_type , col_att.character_maximum_length max_len , col_att.is_nullable null여부 , col_att.column.. 2021. 8. 23.
PostgreSQL. 테이블 및 컬럼 정보 조회 ------------------------------------------------- ---.PostgreSQL. 테이블 및 컬럼정보 조회 -------------------------------------------------- SELECT tbl.schemaname 스키마명 , tbl.relname 테이블id , tbl_dec.description 테이블명 , col.attname 컬럼명 , col.attnum 컬럼순서 , col_dec.description 컬럼설명 , col_att.data_type data_type , col_att.character_maximum_length max_len , col_att.is_nullable null여부 , col_att.column_default def.. 2021. 8. 20.
PostgreSQL 에러코드 PostgreSQL error code 클래스 00 — 성공적인 완료 00000 성공적인_완료 클래스 01 — 경고 01000 경고 0100C dynamic_result_sets_returned 01008 implicit_zero_bit_padding 01003 null_value_eliminated_in_set_function 01007 Privilege_not_granted 01006 Privilege_not_취소 01004 string_data_right_truncation 01P01 deprecated_feature 클래스 02 - 데이터 없음(SQL 표준에 따른 경고 클래스이기도 함) 02000 no_data 02001 no_additional_dynamic_result_sets_returned.. 2021. 8. 18.
PostgreSQL_사용자 테이블 정보 조회 #-- 사용자 테이블 정보 조회 SELECT schemaname, relname, n_tup_ins,last_autovacum FROM pg_stat_user_tables ORDER BY schemaname, relname; pg_stat_all_tables 현재 데이터베이스의 각 테이블에 대해 순차 및 인덱스 스캔의 총 수, 각 스캔 유형에서 반환된 총 행 수, 행 삽입, 업데이트 및 삭제의 총계. pg_stat_sys_tables 시스템 테이블 정보 pg_stat_user_tables 사용자 테이블 정보 relid 테이블의 OID schemaname 이 테이블이 있는 스키마의 이름 relname 이 테이블의 이름 seq_scan 이 테이블에서 시작된 순차 스캔 수 seq_tup_read 순차 스캔에서.. 2021. 8. 18.
PostgreSQL_System Views, System Catalogs Table System Views pg_indexes pg_locks pg_rules pg_settings pg_stats pg_tables pg_user pg_views https://www.postgresql.org/docs/8.0/views-overview.html#VIEW-TABLE System Catalogs Table pg_aggregate 집계 함수 pg_am 인덱스 액세스 방법 pg_amop 접근 방법 연산자 pg_amproc 접근 방식 지원 절차 pg_attrdef 열 기본값 pg_attribute 테이블 열( "속성" ) pg_cast 캐스트(데이터 유형 변환) pg_class 테이블, 인덱스, 시퀀스, 뷰( "관계" ) pg_constraint 확인 제약 조건, 고유 제약 조건, 기본 키 제약 .. 2021. 8. 18.
PostgreSQL 스키마, 테이블 정보 조회 #-- PostgreSQL 스키마, 테이블 정보 조회 SELECT * FROM pg_catalog.pg_tables; SELECT * FROM pg_catalog.pg_tables WHERE tableowner IN ('aaa','bbb')ORDER BY tableowner, tablename; schemaname 스키마의 이름 tablename 테이블 이름 tableowner 테이블 소유자의 이름 tablespace 테이블을 포함하는 테이블스페이스의 이름. (default : NULL) hasindexes 테이블에 인덱스 여부 hasrules 테이블에 규칙 여부 hastriggers 테이블에 트리거 여부 https://www.postgresql.org/docs/8.0/view-pg-tables.html 2021. 8. 18.