Postgresql - changing conf file parameters - postgresql

I am trying to change some parameteres in postgresql.conf file. I changed the parameters to following values
Shared_buffers: 8000MB
work_mem: 3200MB
maintenance_work_mem: 1600MB
I have postgresql installed on 128GB RAM server. After making these changes I restarted postgresql server. After that when I use psql to check these parameters using show (parameter_name) I get the following values.
Shared_buffers: 8000MB
work_mem: 4MB
maintenance_work_mem: 2047MB
Why did the changes reflect correctly only in the shared_buffer parameter but not in the other two?
I changed the max_wal_size to 4GB and min_wal_size to 1000MB but these parameters did not change too and the values shown are 1GB and 80MB. So in conclustion, of all the changes that I made only the changes to shared_buffers parameter got reflected while others did not change.

Some possibilities what might be the problem:
You edited the wrong postgresql.conf.
You restarted the wrong server.
The value was configured with ALTER SYSTEM.
The value was configured with ALTER USER or ALTER DATABASE.
Use the psql command \drds to see such settings.
To figure out from where PostgreSQL takes the setting, use
SELECT * FROM pg_settings WHERE name = 'work_mem';

Related

On Heroku Postgres, how to change full-text search dictionary?

I'm wanting to change the default_text_search_config of my "Hobby Basic Heroku Postgres" database. After running
heroku pg:psql and
\dF,
I can see that Heroku has a preset stop dictionary that I want - Russian (pg_catalog.russian), so there is no need to create a new dictionary (although I see many questions about this as well).
According to the postgres docs, one can change this by altering the postgresql.conf, which is not applicable in this case, or by setting it for an individual session. I've tried setting it through the CLI with
SET default_text_search_config = 'pg_catalog.russian';
However, as soon as I exit the CLI, it reverts to the initial pg_catalog.english.
I'm using Prisma, so I've tried applying a migration of this as well, thinking that the issue was the session not persisting after I closed the CLI. This also was not successful.
Is there a way to do this?
It is also possible to set the default at the database level:
If you are using the same text search configuration for the entire cluster you can use the value in postgresql.conf. To use different configurations throughout the cluster but the same configuration within any one database, use ALTER DATABASE ... SET. Otherwise, you can set default_text_search_config in each session.
Assuming your database is called abcdefg, try the following:
ALTER DATABASE abcdefg SET default_text_search_config TO 'pg_catalog.russian';
I suspect this will work on Heroku's offering, but have not tried it.

Why is postgres not respecting the configs passes via config file?

Im trying to change postgres settings using the /var/lib/pgsql/12/data/postgresql file.
Specifically the settings wal_level to miniaml or max_wal_senders to 10 in order to restart a broken postgres service, however even after changing the config file, it still outputs the same error message : " WAL streaming (max_wal_senders > 0) requires wal_level "replica" or "logical" "
if anyone runs into a similar issue, the problem was that i initially changed the config from logical to minimal, however seems like performing that change doesnt alter the dependency max_wal_senders to minimal. Upon restarting postgres, the wal_level = minimal is set on an autoconfig file that runs upon start up which will conflict with the "max_wal_senders " on the normal config file. In order to run it we changed the autoconfig file to logical and postgres ran again

How to set postgreSQL to use as buffers more RAM than my computer has?

I have a problem. I am learning PostgreSQL and I work with pgAdmin 4v4. At this point, I am trying to set PostgreSQL to use as buffers more RAM than my computer has. I am thinking of using something like SET shared_buffers TO '256MB' but I am not sure if it is correct. Do you have any ideas?
SET shared_buffers TO '256MB'
This will not work because shared_buffers must be set at server start and cannot be changed later, and this is a command you would run after the server is already running. You would have to put the setting in postgresql.conf, or specify it with the -B option to the "postgres" command.
You could also set it through 'alter system' command, and it would take effect at the next restart. However, you could easily make it a setting that will cause your system to fail to start again (indeed, that appears to be your goal...), at which point you can't use 'alter system' to fix it, and will have to dig into the .conf files.

Issue modifying effective_cache_size in postgresql.conf

I am trying to enable and set a value for the effective_cache_size, and issuing a SIGHUP, but the value does not change. Running postgres 9.5.5. Based on the documentation it does not require a restart, merely a reload.
Here is the value I inserted into postgresql.conf
effective_cache_size = 12GB
I am not calling other configuration files from within the postgresql.conf.
When I query pg_settings the source file shows /data1/pgdata/mydb/postgresql.auto.conf rather than /data1/pgdata/mydb/postgresql.conf
This gets a little more bizzare, I used
ALTER system set effective_cache_size = 12 GB
and ran
select pg_reload_conf;
when I run
show effective_cache_size;
it says 12 GB
Any ideas?
pg_settings shows it in blocks, typically 8KB - perhaps that's the problem.
I got the same problem - which actually led me here. I set 6GB and pg_settings showed 786432 and the source was configuration file - confusing. When I changed it to 4GB and restarted, it said 524288 - aha, so it is changing!
Documentation for the variable says: "If this value is specified without units, it is taken as blocks, that is BLCKSZ bytes, typically 8kB."

How to change max_connections for Postgres through SQL command

We have a hosted PostgreSQL, with no access to the system or *.conf files.
I do have a admin access and can connect to it using Oracle SQL developer.
Can I run any command to increase the max_connections. All other parameters seems to be ok shared mem and buffers can hold more connections so there is not problem there.
Changing max_connection parameter needs a Postgres restart
Commands
Check max_connection just to keep current value in mind
SHOW max_connections;
Change max_connection value
ALTER SYSTEM SET max_connections TO '500';
Restart PostgreSQL server
Apparently, the hosted Postgres we are using does not provide this option. (compose.io)
So the work around is to use a pgbouncer to manage you connections better.