首页 > 应用开发 > IT综合 > PostgreSQL 常用维护操作(三)
PostgreSQL配置文件的修改方法:
1. 配置文件所在路径:
2. SQL方式修改,可以在运行时设置,当然只有于部分选项,使用方法如下:
恢复默认设置的方法:
3.查看配置项的值,当然你可以看接查看postgre.conf文件的内容,不过最好使用SQL方法查看和修改,更为快速,当然你要先知道要查看的选项的名称。
补充一下,如果确实不知道选项的名了,可以先查一下,这些均存储在pg_settings表中,呵呵,PostgreSQL的一个特点就在这,所有数据均由数据库自己维护。
4.记住选项值的改动并不一定对整个数据库生效,有时仅对当前session在效,在执行SET语句时,可通过LOCAL选项明确指定。
5.查看系统中哪些选项被修改过。
db117=# SELECT name, source, setting FROM pg_settings
db117-# ;
name | source | setting
-------------------------------------+----------------------+---------------------------------------
allow_system_table_mods | default | off
application_name | default |
archive_command | default | (disabled)
archive_mode | default | off
archive_timeout | default | 0
array_nulls | default | on
authentication_timeout | default | 60
autovacuum | default | on
autovacuum_analyze_scale_factor | default | 0.1
autovacuum_analyze_threshold | default | 50
autovacuum_freeze_max_age | default | 200000000
autovacuum_max_workers | default | 3
autovacuum_multixact_freeze_max_age | default | 400000000
autovacuum_naptime | default | 60
autovacuum_vacuum_cost_delay | default | 20
autovacuum_vacuum_cost_limit | default | -1
autovacuum_vacuum_scale_factor | default | 0.2
autovacuum_vacuum_threshold | default | 50
backslash_quote | default | safe_encoding
bgwriter_delay | default | 200
bgwriter_lru_maxpages | default | 100
bgwriter_lru_multiplier | default | 2
block_size | default | 8192
bonjour | default | off
bonjour_name | default |
bytea_output | default | hex
check_function_bodies | default | on
checkpoint_completion_target | default | 0.5
checkpoint_segments | default | 3
checkpoint_timeout | default | 300
checkpoint_warning | default | 30
client_encoding | default | UTF8
client_min_messages | default | notice
commit_delay | default | 0
commit_siblings | default | 5
config_file | override | /usr/local/pgsql/data/postgresql.conf
constraint_exclusion | default | partition
cpu_index_tuple_cost | default | 0.005
cpu_operator_cost | default | 0.0025
cpu_tuple_cost | default | 0.01
cursor_tuple_fraction | default | 0.1
data_checksums | override | off
data_directory | override | /usr/local/pgsql/data
DateStyle | configuration file | ISO, MDY
db_user_namespace | default | off
deadlock_timeout | default | 1000
debug_assertions | default | off
debug_pretty_print | default | on
debug_print_parse | default | off
debug_print_plan | default | off
debug_print_rewritten | default | off
default_statistics_target | default | 100
default_tablespace | default |
default_text_search_config | configuration file | pg_catalog.english
default_transaction_deferrable | default | off
default_transaction_isolation | default | read committed
default_transaction_read_only | default | off
default_with_oids | default | off
dynamic_library_path | default | $libdir
effective_cache_size | default | 16384
effective_io_concurrency | default | 1
enable_bitmapscan | default | on
enable_hashagg | default | on
enable_hashjoin | default | on
enable_indexonlyscan | default | on
enable_indexscan | default | on
enable_material | default | on
enable_mergejoin | default | on
enable_nestloop | default | on
enable_seqscan | default | on
enable_sort | default | on
enable_tidscan | default | on
escape_string_warning | default | on
event_source | default | PostgreSQL
exit_on_error | default | off
external_pid_file | default |
extra_float_digits | default | 0
from_collapse_limit | default | 8
fsync | default | on
full_page_writes | default | on
geqo | default | on
geqo_effort | default | 5
geqo_generations | default | 0
geqo_pool_size | default | 0
geqo_seed | default | 0
geqo_selection_bias | default | 2
geqo_threshold | default | 12
gin_fuzzy_search_limit | default | 0
hba_file | override | /usr/local/pgsql/data/pg_hba.conf
hot_standby | default | off
hot_standby_feedback | default | off
ident_file | override | /usr/local/pgsql/data/pg_ident.conf
ignore_checksum_failure | default | off
ignore_system_indexes | default | off
integer_datetimes | default | on
IntervalStyle | default | postgres
join_collapse_limit | default | 8
krb_caseins_users | default | off
krb_server_keyfile | default |
krb_srvname | default | postgres
lc_collate | override | en_US.UTF-8
lc_ctype | override | en_US.UTF-8
lc_messages | configuration file | en_US.UTF-8
lc_monetary | configuration file | en_US.UTF-8
lc_numeric | configuration file | en_US.UTF-8
lc_time | configuration file | en_US.UTF-8
listen_addresses | default | localhost
lo_compat_privileges | default | off
local_preload_libraries | default |
lock_timeout | default | 0
log_autovacuum_min_duration | default | -1
log_checkpoints | default | off
log_connections | default | off
log_destination | default | stderr
log_directory | default | pg_log
log_disconnections | default | off
log_duration | default | off
log_error_verbosity | default | default
log_executor_stats | default | off
log_file_mode | default | 0600
log_filename | default | postgresql-%Y-%m-%d_%H%M%S.log
log_hostname | default | off
log_line_prefix | default |
log_lock_waits | default | off
log_min_duration_statement | default | -1
log_min_error_statement | default | error
log_min_messages | default | warning
log_parser_stats | default | off
log_planner_stats | default | off
log_rotation_age | default | 1440
log_rotation_size | default | 10240
log_statement | default | none
log_statement_stats | default | off
log_temp_files | default | -1
log_timezone | configuration file | PRC
log_truncate_on_rotation | default | off
logging_collector | default | off
maintenance_work_mem | default | 16384
max_connections | configuration file | 100
max_files_per_process | default | 1000
max_function_args | default | 100
max_identifier_length | default | 63
max_index_keys | default | 32
max_locks_per_transaction | default | 64
max_pred_locks_per_transaction | default | 64
max_prepared_transactions | default | 0
max_stack_depth | environment variable | 2048
max_standby_archive_delay | default | 30000
max_standby_streaming_delay | default | 30000
max_wal_senders | default | 0
password_encryption | default | on
port | default | 5432
post_auth_delay | default | 0
pre_auth_delay | default | 0
quote_all_identifiers | default | off
random_page_cost | default | 4
restart_after_crash | default | on
search_path | default | "$user",public
segment_size | default | 131072
seq_page_cost | default | 1
server_encoding | override | UTF8
server_version | default | 9.3.5
server_version_num | default | 90305
session_replication_role | default | origin
shared_buffers | configuration file | 16384
shared_preload_libraries | default |
sql_inheritance | default | on
ssl | default | off
ssl_ca_file | default |
ssl_cert_file | default | server.crt
ssl_ciphers | default | none
ssl_crl_file | default |
ssl_key_file | default | server.key
ssl_renegotiation_limit | default | 524288
standard_conforming_strings | default | on
statement_timeout | default | 0
stats_temp_directory | default | pg_stat_tmp
superuser_reserved_connections | default | 3
synchronize_seqscans | default | on
synchronous_commit | default | on
synchronous_standby_names | default |
syslog_facility | default | local0
syslog_ident | default | postgres
tcp_keepalives_count | default | 0
tcp_keepalives_idle | default | 0
tcp_keepalives_interval | default | 0
temp_buffers | default | 1024
temp_file_limit | default | -1
temp_tablespaces | default |
TimeZone | configuration file | PRC
timezone_abbreviations | default | Default
trace_notify | default | off
trace_recovery_messages | default | log
trace_sort | default | off
track_activities | default | on
track_activity_query_size | default | 1024
track_counts | default | on
track_functions | default | none
track_io_timing | default | off
transaction_deferrable | override | off
transaction_isolation | override | read committed
transaction_read_only | override | off
transform_null_equals | default | off
unix_socket_directories | default | /tmp
unix_socket_group | default |
unix_socket_permissions | default | 0777
update_process_title | default | on
vacuum_cost_delay | default | 0
vacuum_cost_limit | default | 200
vacuum_cost_page_dirty | default | 20
vacuum_cost_page_hit | default | 1
vacuum_cost_page_miss | default | 10
vacuum_defer_cleanup_age | default | 0
vacuum_freeze_min_age | default | 50000000
vacuum_freeze_table_age | default | 150000000
vacuum_multixact_freeze_min_age | default | 5000000
vacuum_multixact_freeze_table_age | default | 150000000
wal_block_size | default | 8192
wal_buffers | override | 512
wal_keep_segments | default | 0
wal_level | default | minimal
wal_receiver_status_interval | default | 10
wal_receiver_timeout | default | 60000
wal_segment_size | default | 2048
wal_sender_timeout | default | 60000
wal_sync_method | default | fdatasync
wal_writer_delay | default | 200
work_mem | default | 1024
xmlbinary | default | base64
xmloption | default | content
zero_damaged_pages | default | off
(231 rows)
db117=#
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/8102208/viewspace-1337714/ ,如需转载,请注明出处,否则将追究法律责任。