전화번호나 계좌정보와 같은 개인정보에 대한 불용화. translate함수 사용.- 임의의 표현식에서 발견되는 모든 지정 문자를 지정한 대체 문자로 변경합니다. TRANSLATE( expression, characters_to_replace, characters_to_substitute ) 이를 응용하여 모든 숫자를 0으로 대체하는 방법입니다. 단점으론 다른 숫자데이터도 모두 0으로 변환이 됩니다. 테스트 테이블 생성 후 테스트 데이터 입력.create table test(review char(500));insert into test(review) values('상품 문제 있습니다. 010-1234-5823로 연락주세요');insert into test(review) values('입금 확인이 안됩니다..
PostgreSQL에서 특정 날짜의 요일을 구하는 방법에는다음과 같은 쿼리를 사용할 수 있습니다. 1. TO_CHAR 사용to_char 함수는 날짜/시간 데이터를 문자열로 변환할 때 사용되며, 'D' 포맷은 일요일부터 토요일까지 1에서 7까지의 숫자로 요일을 나타냅니다.SELECT CASE WHEN to_char(CURRENT_DATE, 'D') = '1' THEN '일요일' WHEN to_char(CURRENT_DATE, 'D') = '2' THEN '월요일' WHEN to_char(CURRENT_DATE, 'D') = '3' THEN '화요일' WHEN to_char(CURRENT_DATE, 'D') = '4' THEN '수요일' WHEN to_char(CURRENT_DA..
운영 중 이력테이블의 사이즈가 커져서 RDS용량 증가 문제 발생.문제해결방안으로 파티션테이블로 만들고 오래된 하위테이블은 S3로 백업 후 삭제. 1. 파티션 테이블 생성CREATE TABLE IF NOT EXISTS change_history_p( history_sn bigint NOT NULL DEFAULT nextval('g1_system.change_history_p_history_sn_seq'::regclass), ... change_dt timestamp with time zone NOT NULL) PARTITION BY RANGE (change_dt);2. 하위테이블 생성CREATE TABLE change_history_p_y202305 PARTITION OF g1_system..
postgresql의 default role. admin 권한이 아닌 role에 grant 하면 됨 pg_read_all_settings Read all configuration variables, even those normally visible only to superusers. pg_read_all_stats Read all pg_stat_* views and use various statistics related extensions, even those normally visible only to superusers. pg_stat_scan_tables Execute monitoring functions that may take ACCESS SHARE locks on tables, potentia..