暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

PostgreSQL 统计信息(dbms_stats)导出,导入,锁定,替换

digoal 2019-03-18
1731

作者

digoal

日期

2019-03-18

标签

PostgreSQL , 统计信息 , 优化器 , dbms_stats , stats , 锁定


背景

PostgreSQL 插件pg_dbms_stats插件,可以将统计信息导出,导入(锁定到内存),并且修改PLANNER的行为(从元数据pg_stats中读取改成从dbms_stats中读取统计信息)。从而达到统计信息的导出,锁定目的。

pg_dbms_stats govern to hold and provide statistical information to generate execution plan, instead of statistic generated by ANALYZE. To use statistical information can be done by either of following ways.

Lock the current statistic.

Restore from backup.

Use save in exported file.

pg_dbms_stats manages its own statistics in some table/file groups.

Currently valid statistics

Statistics planner looking via pg_dbms_stats currently. It can be edit and turned back in production static information, also can be included in OS file backup.

Backup statistic

Statistical information can be backup any point of time and hold multiple version of statistics. Backup history is maintained in the history table. In restore feature uses to replaces with valid statistics.

Statistic that have been exported

This can be used to export Statistical information to save on OS file system. By changing name of file can be hold the multiple version of Statistics. Same import feature used to load valid statistical information.

pg_dbms_stats provide its own function, it does not change original PostgreSQL statistics(pg_catalog.pg_class and pg_catalog.pg_statistic).

pic

https://github.com/ossc-db/pg_dbms_stats

参考

http://pgdbmsstats.osdn.jp/pg_dbms_stats-en.html

https://github.com/ossc-db

《PostgreSQL 统计信息pg_statistic格式及导入导出dump_stat - 兼容Oracle》

《PostgreSQL pg_stat_ pg_statio_ 统计信息(scan,read,fetch,hit)源码解读》

PostgreSQL 许愿链接

您的愿望将传达给PG kernel hacker、数据库厂商等, 帮助提高数据库产品质量和功能, 说不定下一个PG版本就有您提出的功能点. 针对非常好的提议,奖励限量版PG文化衫、纪念品、贴纸、PG热门书籍等,奖品丰富,快来许愿。开不开森.

9.9元购买3个月阿里云RDS PostgreSQL实例

PostgreSQL 解决方案集合

德哥 / digoal's github - 公益是一辈子的事.

digoal's wechat

文章转载自digoal,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论