728x90
728x170
실행 중인 쿼리 조회 및 실행 취소하는 방법입니다.
* 샐행중인 쿼리 조회하기
SELECT * FROM pg_stat_activity ORDER BY query_start ASC;
SELECT
current_timestamp - query_start AS runtime, -- 수행시간
datname, usename, query
FROM pg_stat_activity
WHERE state = 'active' ORDER BY 1 DESC;
* 실행중인 쿼리 중 실행 취소하기
위 실해중인 쿼리 조회 결과의 pid (pg_stat_activity.pid) 값 기준으로 실행을 취소합니다.
SELECT pg_cancel_backend(pid int);
참고
https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-ACTIVITY-VIEW
28.2. The Cumulative Statistics System
28.2. The Cumulative Statistics System # 28.2.1. Statistics Collection Configuration 28.2.2. Viewing Statistics 28.2.3. pg_stat_activity 28.2.4. pg_stat_replication 28.2.5. pg_stat_replication_slots 28.2.6. pg_stat_wal_receiver …
www.postgresql.org
https://www.postgresql.kr/docs/9.3/monitoring-stats.html
통계 수집기
PostgreSQL 통계 수집기 statistics collector는 서버 운영 상태에 대한 정보를 수집하거나 보고하기 위한 작업을 하는 백그라운드 시스템이다. 현재, 이 수집기는 테이블이나 인덱스의 디스크 블록 단위
www.postgresql.kr
728x90
그리드형
'DB' 카테고리의 다른 글
[DB/PostgreSQL] temporary table 사용량 확인 (0) | 2023.10.06 |
---|---|
[DB/PostgreSQL] 지정 시간 동안 수행된 쿼리 확인 (0) | 2023.10.06 |
[DB/PostgreSQL] 시퀀스 (Sequence) 사용하기 - 자동 증가 컬럼 (0) | 2023.10.06 |
[DB/PostgreSQL] 시간 데이터 처리하기 (날짜 데이터, 날짜 함수) (0) | 2023.10.06 |
[DB/PostgreSQL] Index 정보 얻기 (0) | 2023.09.19 |