postgresql_hacks/change_settings.md

53 lines
1.1 KiB
Markdown
Raw Normal View History

2022-07-07 10:45:03 +02:00
## How to reload config changes during the runtime (SIGHUP)?
2022-07-07 10:44:11 +02:00
```
select pg_reload_conf();
```
2022-07-07 10:45:03 +02:00
## Does changing a config setting require a restart of postgresql or just a reload (SIGHUP)?
2022-07-07 10:41:37 +02:00
This can be archived by simply selecting the setting from pg_settings.
```
select context from pg_settings where name='max_wal_size';
```
2022-07-07 10:45:03 +02:00
## Is a restart of postgresql required?
2022-07-07 10:41:37 +02:00
```
select pending_restart from pg_settings where name='max_wal_size';
```
This will tell you if a restart is pending for a setting.
2022-08-18 09:41:52 +02:00
## How to check configuration (postgresql.conf) for configuration errors
```
select sourcefile, name,sourceline,error from pg_file_settings where error is not null;
```
## How to check pg_hba.conf for configuration errors
```
select pg_hba_file_rules();
2024-08-08 10:41:20 +02:00
```
## Check vacuuming and autovacuuming date for tables per database
Switch to the desired database and then you run this query to see the vaccum status.
```
SELECT
schemaname,
relname,
last_vacuum,
last_autovacuum,
n_dead_tup
FROM
pg_stat_all_tables
WHERE
schemaname NOT IN ('pg_catalog', 'information_schema')
ORDER BY
n_dead_tup DESC;
```