postgres=# set search_path="$user",public,profile;
SET
postgres=# show search_path;
search_path
--------------------------
"$user", public, profile
(1 row)
postgres=# alter user postgres set search_path to "$user", public,profile;
ALTER ROLE
/pgdb/data/postgres.conf#
增加track相关参数
track_activities = on #默认on
track_counts = on #默认打开
track_io_timing = on #默认off 跟踪IO消耗的时间
track_functions = all # none, pl, all default none none:不收集 pl:只收集过程语言函数 all:收集所有的函数
#加载动态库
shared_preload_libraries = 'pg_stat_statements' #修改后需重启生效
#增加pg_stat_statements相关参数
pg_stat_statements.max = 10000 #最多保留多少条统计信息,通过LRU算法,覆盖老的记录(即pg_stat_statements视图中行的最大数量)
pg_stat_statements.track = all #跟踪顶层语句(直接由客户端发出的语句)
pg_stat_statements.track_utility = on 是否跟踪非DML语句 (例如DDL,DCL),on表示跟踪, off表示不跟踪
pg_stat_statements.save = on 重启后是否保留统计信息