Is it safe to change Postgresql settings in production?

200 Views Asked by At

I started a project that is already in production and we have a few clients already registered and paid for the service (SaaS business).

We use an Ubuntu VPS with Postgresql with default postgresql.conf settings.

Based on PGtune, to optimize the database, I should set these settings in postgresql.conf:

# DB Version: 10
# OS Type: linux
# DB Type: web
# Total Memory (RAM): 1 GB
# CPUs num: 1
# Data Storage: ssd

max_connections = 200
shared_buffers = 256MB
effective_cache_size = 768MB
maintenance_work_mem = 64MB
checkpoint_completion_target = 0.7
wal_buffers = 7864kB
default_statistics_target = 100
random_page_cost = 1.1
effective_io_concurrency = 200
work_mem = 655kB
min_wal_size = 1GB
max_wal_size = 4GB

At the moment I have the following settings:

max_connections = 100
shared_buffers = 128MB

And all other settings recommended by PGTune are commented out.

Is it safe to change/adust these settings while the Database is in production and up and running?

1

There are 1 best solutions below

0
On

You cannot change max_connections and shared_buffers without restarting PostgreSQL, so you will need a short down time.

Raising max_connections above 100 is a bad idea. If you need many client connections, use pgBouncer.