On Aug 28, hvjunk wrote:
I’m currently looking at the PostgreSQL_server role, and are in need
to
tune/tweak the various parallel worker, WAL, shared memory configurations,
and tune them differently for the environments, ie. Dev vs QA vs Prod vs
Test.
I’m especially looking for adding 9.6 (and I assume 10.x will also have)
changed/only/new settings (Like parallel_workers). Also, in some cases
I don’t want the normal % calculations for shared/cache memory, but rather
a specific hard value.
Before I’m going to re-invent yet another wheel, I was wondering about the
advised ways of doing this that i might’ve missed in the
docs.debops.org
site?
Hello,
I guess it currently might not be documented clearly enough. The
'debops.postgresql_server' role has the 'postgresql_server__clusters'
variable
which defines what clusters are present on a given server - there can be more
than one, for different PostgreSQL versions as well. The default cluster
that's set up by the role is defined in the 'postgresql_server__cluster_main'
variable.
The cluster configuration is defined as YAML dictionary, required
configuration parameters are 'name' and 'port', the rest is inferred
automatically. You can specify any values defined in the 'postgresql.conf'
configuration file, as well as some additional ones described in the role
documentation.
For your example, you could redefine the default PostgreSQL cluster like this:
postgresql_server__cluster_main:
name: 'main'
port: '5432'
shared_buffers: '32M'
max_connections: '100'
It looks like 'parallel_workers' and other configuration introduced in
PostgreSQL 9.6 is not yet accounted for in the configuration template, so you
could add that and post a PR for the role. You can use version_compare()
filter in the template to restrict these variables to specific PostgreSQL
versions, examples are in the templates.
Cheers,
Maciej