# Shared PostgreSQL resource policy. Consumers extend this service under their # existing DB name; do not merge this file as an additional deployed service. # Credentials, data volumes, ports and health bindings belong to the deployment. services: postgres: image: timescale/timescaledb@sha256:22e8a5ae7aef121d1537afe946dd7cc5deeeb63ab36ce19849d671bd3b663509 # Retain connection reserve and diagnostics independently of image autotuning. command: - postgres - -c - shared_preload_libraries=timescaledb,pg_stat_statements - -c - max_parallel_workers_per_gather=0 - -c - max_connections=100 - -c - shared_buffers=${POSTGRES_SHARED_BUFFERS:-128MB} - -c - maintenance_work_mem=${POSTGRES_MAINTENANCE_WORK_MEM:-64MB} - -c - autovacuum_work_mem=${POSTGRES_AUTOVACUUM_WORK_MEM:-16MB} - -c - work_mem=${POSTGRES_WORK_MEM:-4MB} - -c - autovacuum_max_workers=${POSTGRES_AUTOVACUUM_MAX_WORKERS:-4} # Reserve Timescale's launcher, schedulers for retained stores and job slots. - -c - max_worker_processes=${POSTGRES_MAX_WORKER_PROCESSES:-28} - -c - timescaledb.max_background_workers=${POSTGRES_TIMESCALE_BG_WORKERS:-21} - -c - wal_compression=${POSTGRES_WAL_COMPRESSION:-lz4} # Allow bounded read bursts to use spare capacity on the four-CPU DEV VM. cpus: ${POSTGRES_CPUS:-2.5} mem_limit: &postgres-memory 2g memswap_limit: *postgres-memory shm_size: "1g"