PostgreSQL server parameter files are located under $PGDATA, usually in the data directory. The file follows the following rules: Specify one parameter per line. This means that the following cannot happen:
listen_addresses = '*' log_destination = 'csvlog'
Copy the code
The equal sign is optional and the whitespace is meaningless, which means that the following is also true:
log_rotation_age'2d'
log_rotation_size = '0'
Copy the code
The pound sign (#) indicates that the rest of the line is a comment.
If you want to embed single quotes in a parameter value, write two single quotes, or put a backslash before the quotes, the former is recommended.
In addition to postgresql.conf, the PostgresQL data directory contains a file, postgresql.auto-. conf, which has the same format as postgresql.conf, but should not be edited manually. This file holds the Settings provided through the ALTER SYSTEM command. This file is automatically read every time postgresql.conf is read, and its Settings take effect the same way. Settings in postgresql.auto-. conf override those in postgresql.conf.
If the parameters displayed in show are inconsistent with those in postgresql.conf, check whether they are set in postgresql.auto-. If not, there may be set parameter values in alter user and ALTER DATABASE.
If it is not clear which parameter file takes effect, you can check the system table PG_FILe_Settings. The pg_FILe_settings table shows the parameters and parameter files that take effect.
postgres=# select * from pg_file_settings ; sourcefile | sourceline | seqno | name | setting | applied | error ---------------------------------+------------+-------+----------------------------+--------------------+---------+----- -- /pg13/data/postgresql.conf | 64 | 1 | max_connections | 100 | t | /pg13/data/postgresql.conf | 121 | 2 | shared_buffers | 128MB | t | /pg13/data/postgresql.conf | 142 | 3 | dynamic_shared_memory_type | posix | t | /pg13/data/postgresql.conf | 228 | 4 | max_wal_size | 1GB | t | /pg13/data/postgresql.conf | 229 | 5 | min_wal_size | 80MB | t | /pg13/data/postgresql.conf | 425 | 6 | log_destination | csvlog | t | /pg13/data/postgresql.conf | 563 | 7 | log_timezone | PRC | f | /pg13/data/postgresql.conf | 678 | 8 | datestyle | iso, mdy | t | /pg13/data/postgresql.conf | 680 | 9 | timezone | PRC | t | /pg13/data/postgresql.conf | 694 | 10 | lc_messages | en_US.UTF-8 | t | /pg13/data/postgresql.conf | 696 | 11 | lc_monetary | en_US.UTF-8 | t | /pg13/data/postgresql.conf | 697 | 12 | lc_numeric | en_US.UTF-8 | t | /pg13/data/postgresql.conf | 698 | 13 | lc_time | en_US.UTF-8 | t | /pg13/data/postgresql.conf | 701 | 14 | default_text_search_config | pg_catalog.english | t | /pg13/data/postgresql.conf | 705 | 15 | shared_preload_libraries | test_decoding | t | /pg13/data/postgresql.conf | 708 | 16 | jit_provider | llvmjit | t | /pg13/data/postgresql.auto.conf | 3 | 17 | wal_level | logical | t | /pg13/data/postgresql.auto.conf | 4 | 18 | logging_collector | on | t | /pg13/data/postgresql.auto.conf | 5 | 19 | log_timezone | Etc/GMT-8 | t | /pg13/data/postgresql.auto.conf | 6 | 20 | listen_addresses | * | t | /pg13/data/postgresql.auto.conf | 7 | 21 | synchronous_standby_names | | t | /pg13/data/postgresql.auto.conf | 8 | 22 | synchronous_commit | remote_apply | t | /pg13/data/postgresql.auto.conf | 9 | 23 | recovery_min_apply_delay | 1d | t | (23 rows)Copy the code
Or directly query the PG_Settings table to list the setting values and effective sources of all parameters.