调优PostgreSQL 14和更早版本的统计信息收集器

PostgreSQL 15:PostgreSQL 15:

stats collector

PostgreSQL 14

stats(stats_temp_directory)RAMFSTEMPFS(RAM)IO使stats collector

PostgreSQL

stats_temp_directoryRAMI/Opg_stat便

:PostgreSQL

statsstats_temp_directory

Red Hat

postgres=# show stats_temp_directory ;
 stats_temp_directory 
----------------------
 pg_stat_tmp

Debian/Ubuntu/var/run/postgresql:

postgres=# show stats_temp_directory ;
          stats_temp_directory           
-----------------------------------------
 /var/run/postgresql/14-main.pg_stat_tmp

statMB()制 track_activities , track_activity_query_size , track_commit_timestamp , track_counts , track_functions  and track_io_timing  as mentioned in PostgreSQL Documentation.

Ramfs or tempfs?

RAM:ramfs和tempfs。

ramfs使/etc/fstab

ramfs /var/lib/pgsql_stats_ram ramfs size=1G,uid=postgres,gid=postgres 0 0

 

使uid and gid,ramfsroot:(PostgreSQLpostgres

ramfs使df:ramfsramfs使swap

ramfstempfs

 tempfs  /etc/fstab :

tmpfs /var/lib/pgsql_stats_tmp tmpfs size=1G,uid=postgres,gid=postgres 0 0

 

ramfs:

$ df -h| grep -E "(tmpfs|ramfs)"
Filesystem Size Used Avail Use% Mounted on
...
tmpfs 1.0G 0 1.0G 0% /var/lib/pgsql_stats_tmp

PostgreSQL使stats_temp_directoryPostgreSQL

ALTER SYSTEM SET stats_temp_directory = '/var/lib/pgsql_stats_tmp';

PostgreSQL(SIGHUP)

select pg_reload_conf();

https://www.percona.com/blog/dont-forget-to-tune-stats-collector-for-postgresql-14-and-older/

https://www.postgresql.org/docs/14/monitoring-stats.html#MONITORING-STATS-SETUP

https://www.percona.com/blog/postgresql-15-stats-collector-gone-whats-new/

posted on   张冲andy  阅读(24)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
· 三行代码完成国际化适配,妙~啊~
历史上的今天:
2017-05-11 oracle 12c 多租户 pdb 恢复(单个pdb数据文件、非系统pdb表空间、整个pdb数据库)

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示