
Tablespace는 PostgreSQL에서 데이터베이스 객체(테이블, 인덱스 등)가 저장될 물리적 디렉토리 경로를 의미
pg_stat_io 뷰를 통해 tablespace 단위로 읽기/쓰기 통계를 제공pg_stat_io 제공SELECT *
FROM pg_stat_io
WHERE obj_type = 'tablespace';
| 컬럼명 | 설명 |
|---|---|
tablespace | 대상 tablespace 명 |
reads | 읽기 I/O 요청 횟수 |
writes | 쓰기 I/O 요청 횟수 |
read_time | 읽기 작업에 소요된 총 시간 (밀리초) |
write_time | 쓰기 작업에 소요된 총 시간 (밀리초) |
bytes_read | 읽은 총 바이트 수 |
bytes_written | 기록한 총 바이트 수 |
SELECT
tablespace,
SUM(reads) AS total_reads,
SUM(writes) AS total_writes,
SUM(bytes_read) AS total_bytes_read,
SUM(bytes_written) AS total_bytes_written
FROM pg_stat_io
WHERE obj_type = 'tablespace'
GROUP BY tablespace
ORDER BY total_bytes_written DESC;