Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@narate
Created November 22, 2022 09:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save narate/a50467636d24c1aa963c07de79b2d747 to your computer and use it in GitHub Desktop.
Save narate/a50467636d24c1aa963c07de79b2d747 to your computer and use it in GitHub Desktop.
Docker compose file for PostgreSQL with tuning config example
version: '3'
services:
db:
restart: always
image: postgres:14-alpine
shm_size: 256mb
healthcheck:
test: ['CMD', 'pg_isready', '-U', 'postgres']
volumes:
- ./postgres14:/var/lib/postgresql/data
environment:
- 'POSTGRES_HOST_AUTH_METHOD=trust'
command: |
postgres
-c shared_preload_libraries=pg_stat_statements
-c pg_stat_statements.track=all
-c max_connections=200
-c shared_buffers=256MB
-c effective_cache_size=8GB
-c work_mem=16MB
-c maintenance_work_mem=128MB
-c min_wal_size=128MB
-c max_wal_size=2GB
-c checkpoint_completion_target=0.9
-c wal_buffers=16MB
-c default_statistics_target=100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment