diff --git a/postgres/Dockerfile b/postgres/Dockerfile new file mode 100644 index 0000000..db5c836 --- /dev/null +++ b/postgres/Dockerfile @@ -0,0 +1,6 @@ +FROM postgres:15 + +RUN apt-get update && \ + apt-get install curl -y && \ + curl -L -o /tmp/pg_profile.tar.gz https://github.com/zubkov-andrei/pg_profile/releases/download/4.7/pg_profile--4.7.tar.gz && \ + tar -xf /tmp/pg_profile.tar.gz -C $(pg_config --sharedir)/extension \ diff --git a/postgres/docker-compose.yml b/postgres/docker-compose.yml index d5606a2..eb19a12 100644 --- a/postgres/docker-compose.yml +++ b/postgres/docker-compose.yml @@ -1,7 +1,8 @@ version: "3.9" services: postgres: - image: postgres:15 + build: . + image: romanowalex/postgres:15-pg_profile container_name: postgres environment: POSTGRES_USER: postgres diff --git a/postgres/postgres/20-configure-pg-profile.sql b/postgres/postgres/20-configure-pg-profile.sql new file mode 100644 index 0000000..f84222b --- /dev/null +++ b/postgres/postgres/20-configure-pg-profile.sql @@ -0,0 +1,12 @@ +-- file: 20-configure-pg-profile.sql +CREATE EXTENSION dblink; +CREATE EXTENSION pg_stat_statements; +CREATE EXTENSION pg_profile; + +ALTER SYSTEM SET shared_preload_libraries = 'pg_stat_statements'; +ALTER SYSTEM SET track_activities = on; +ALTER SYSTEM SET track_counts = on; +ALTER SYSTEM SET track_io_timing = on; +ALTER SYSTEM SET track_wal_io_timing = on; +ALTER SYSTEM SET track_functions = 'all'; +SELECT PG_RELOAD_CONF();