pgadmin4로 튜닝하는 방법이다.

여기 row 19,233의 duration 15secs 짜리 쿼리가 있다.

작성한 쿼리를 돌려볼때는 흔히 

쿼리 에디터에서 F5할것이다.

pgadmin은 Explain Analyze 기능을 제공하는데 이 기능은 쿼리의 어느부분이 느린건지 설명해주는 거라 보면 된다.

위에 색칠된 가로 화살표는 쿼리를 실행하는 버튼이고 네모난 아이콘은 분석하는 버튼이다.

분석버튼의 옆 아래화살표를 클릭하면 어떤 항목을 분석할건지 선택 가능하다.

보통 전부 체크하는편이다.

 

F7로 실행을 해보면 pgadmin 밑부분에 쿼리에 대한 설명이 나온다.

Grphical은 옵티마이저가 어떤 내비게이션 경로를 선택했는지 이미지로 보여준다.

 

Statistics는 쿼리의 어떤 부분이 얼마나 쿼리의 비중을 차지하는지 통계해준다.

왼쪽의 Statistics per Node Type은 Sort나 Join 등 Table 스캔 외적인 부분이고

오른쪽의 Statistics Per Table은 Table 스캔에 들어가는 비용이라 할수있다.

 

Statistics per Node Type 부분을 보면 메모리 튜닝으로 설정의 어떤 설정값을 수정해야 할지 대략적으로 알게되고,

(혹은 HW 업그레이드)

Statistics Per Table 부분을 보면 Index 튜닝을 어떤 테이블에 해야할지 대략적으로 알게된다.

(혹은 정규화, 비정규화 등 table 튜닝)

 

마지막으로 Analysis는 쿼리의 실행 부분들을 단편적으로 쪼개서 분석해논 것이다.

화면에 대한 설명은 아래 링크를 타고 들어가서 확인하면 된다.

https://explain.depesz.com/help

 

Help | explain.depesz.com

explain.depesz.com PostgreSQL's explain analyze made readable new explain history help about contact Help explain.depesz.com is a tool for finding real causes for slow queries. Generally, one would use the EXPLAIN ANALYZE query; and read the output. The pr

explain.depesz.com

보통 우리가 보는 부분은 Exclusive가 배경색이 있는 행들이다.

해당 행이 Scan 부분이 아니면 상위행의 Buckets, Batches, Memory Usage 부분을 보고

Memory 튜닝, Table 튜닝을 하면 되고,

테이블 Scan 부분이면 Filter, Rows Removed by Filter 부분을 보고 Index 튜닝을 하면 된다.

 

'PostgreSQL' 카테고리의 다른 글

PostgreSQL 메모리 설정을 쉽게  (0) 2021.10.23
pgAdmin (PostgreSQL Management Tool)  (0) 2021.02.14
PostgreSQL Downloads (DB 다운로드)  (0) 2021.02.14

https://pgtune.leopard.in.ua/#/

 

PGTune - calculate configuration for PostgreSQL based on the maximum performance for a given hardware configuration

 

pgtune.leopard.in.ua

 

위 사이트 들어가서 DB Server의 HW 스펙을 기입하면...

요런식으로 나온다...

우측 설정값들을 postgresql.conf 파일에서 찾아 변경해주자..

conf파일은 설치폴더의 data폴더에 있다...

보통 C:\Program Files\PostgreSQL\12\data

변경 후 재시작 하면 적용 완료...

 

이렇게 하면 간단하게 메모리 튜닝을 할수있다.

'PostgreSQL' 카테고리의 다른 글

postgreSQL 튜닝 기초  (0) 2021.10.23
pgAdmin (PostgreSQL Management Tool)  (0) 2021.02.14
PostgreSQL Downloads (DB 다운로드)  (0) 2021.02.14

 

 

 

DB 관리 툴이다...

아주 가볍고 쓰기 쉽다.

오라클의 SQL Developer라고 보면 된다.

 

설치는 

www.pgadmin.org/

 

pgAdmin - PostgreSQL Tools

News 2021-01-28 - pgAdmin 4 v4.30 Released The pgAdmin Development Team are pleased to announce pgAdmin 4 version 4.30. This release of pgAdmin 4 includes 38 bug fixes and new features. For more details please see the release notes. Notable changes in this

www.pgadmin.org

여기서 다운로드하고 

.exe 파일을 실행하면 된다.

next만 눌러도 쉽게 설치 가능하다.

웹브라우저로 실행한다.

 

password 넣고 OK 누르고...

DB세팅 끝!

'PostgreSQL' 카테고리의 다른 글

postgreSQL 튜닝 기초  (0) 2021.10.23
PostgreSQL 메모리 설정을 쉽게  (0) 2021.10.23
PostgreSQL Downloads (DB 다운로드)  (0) 2021.02.14

 

 

 

관리툴이 아주 가벼운 Postgresql... 공부할때 좋다..

 

다운로드는

www.enterprisedb.com/downloads/postgres-postgresql-downloads

 

Download PostgreSQL Database for Windows, Linux and MacOS & 32-bit or 64-bit Versions | EDB

Download PostgreSQL packages or installers free from EDB. Get PostgreSQL for Windows, Linux and MacOS platforms. Download 32-bit or 64-bit versions. Download open-source PostgreSQL now.

www.enterprisedb.com

여기서 하면된다.

 

다운받은 .exe 파일을 선택후... 잘 보고 설치하면 된다.

 

중간에 password 설정하고...

next 길만 걷는다...

 

제일 마지막에 

 

이것만 체크해제하자...

Finish를 누르면 설치가 완료된다.

 

설치가 잘 되었는지 불안하다면 

SQL Shell에서 확인해보면 된다.

 

'PostgreSQL' 카테고리의 다른 글

postgreSQL 튜닝 기초  (0) 2021.10.23
PostgreSQL 메모리 설정을 쉽게  (0) 2021.10.23
pgAdmin (PostgreSQL Management Tool)  (0) 2021.02.14

+ Recent posts