Set Postgres shared_buffers in docker-compose 31/137531/1
authordanielhanrahan <daniel.hanrahan@est.tech>
Thu, 14 Mar 2024 18:02:09 +0000 (18:02 +0000)
committerdanielhanrahan <daniel.hanrahan@est.tech>
Tue, 19 Mar 2024 11:40:09 +0000 (11:40 +0000)
By default, Postgres uses value of 128MB for shared_buffers,
regardless of available memory. It is recommended to use
between 25% and 40% of memory for shared_buffers in Postgres.
Current value can be checked in SQL using 'SHOW shared_buffers'.

Issue-ID: CPS-2156
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
Change-Id: Ib20502f159f005ba941f39758555551f447d2b67

docker-compose/docker-compose.yml
docker-compose/postgres-init.sql [new file with mode: 0644]

index de427af..a604b06 100644 (file)
@@ -31,6 +31,8 @@ services:
       POSTGRES_DB: cpsdb
       POSTGRES_USER: ${DB_USERNAME:-cps}
       POSTGRES_PASSWORD: ${DB_PASSWORD:-cps}
+    volumes:
+      - ./postgres-init.sql:/docker-entrypoint-initdb.d/postgres-init.sql
     deploy:
       resources:
         reservations:
diff --git a/docker-compose/postgres-init.sql b/docker-compose/postgres-init.sql
new file mode 100644 (file)
index 0000000..0c96de5
--- /dev/null
@@ -0,0 +1 @@
+ALTER SYSTEM SET shared_buffers = '512MB';