作者
digoal
日期
2020-10-10
标签
PostgreSQL , logical_decoding_work_mem
背景
跟踪统计每个replication slot的decode统计信息, 记录超过logical_decoding_work_mem内存从而导致的落盘操作. 如果增长频繁, 可能需要配置更大的logical_decoding_work_mem参数.
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=98681675002d852d926a49d7bc4d4b4856b2fc4a
```
Track statistics for spilling of changes from ReorderBuffer.
author Amit Kapila akapila@postgresql.org
Thu, 8 Oct 2020 11:39:08 +0800 (09:09 +0530)
committer Amit Kapila akapila@postgresql.org
Thu, 8 Oct 2020 11:39:08 +0800 (09:09 +0530)
commit 98681675002d852d926a49d7bc4d4b4856b2fc4a
tree e30f3bd90ae90d11b6a1ac4a7d705f6adfb6dd50 tree | snapshot
parent 8d2a01ae12cd657b33ffd50eace86a341636c586 commit | diff
Track statistics for spilling of changes from ReorderBuffer.
This adds the statistics about transactions spilled to disk from
ReorderBuffer. Users can query the pg_stat_replication_slots view to check
these stats and call pg_stat_reset_replication_slot to reset the stats of
a particular slot. Users can pass NULL in pg_stat_reset_replication_slot
to reset stats of all the slots.
This commit extends the statistics collector to track this information
about slots.
Author: Sawada Masahiko and Amit Kapila
Reviewed-by: Amit Kapila and Dilip Kumar
Discussion: https://postgr.es/m/CA+fd4k5_pPAYRTDrO2PbtTOe0eHQpBvuqmCr8ic39uTNmR49Eg@mail.gmail.com
```
https://www.postgresql.org/docs/devel/monitoring-stats.html#MONITORING-PG-STAT-REPLICATION-SLOTS-VIEW
The pg_stat_replication_slots view will contain one row per logical replication slot, showing statistics about its usage.
- name text
- A unique, cluster-wide identifier for the replication slot
- spill_txns bigint
- Number of transactions spilled to disk after the memory used by logical decoding exceeds logical_decoding_work_mem. The counter gets incremented both for toplevel transactions and subtransactions.
- spill_count bigint
- Number of times transactions were spilled to disk. Transactions may get spilled repeatedly, and this counter gets incremented on every such invocation.
- spill_bytes bigint
- Amount of decoded transaction data spilled to disk.
-
stats_reset timestamp with time zone
- Time at which these statistics were last reset
-
pg_stat_reset_replication_slot ( text ) → void
- Resets statistics to zero for a single replication slot, or for all replication slots in the cluster. The argument can be either the name of the slot to reset the stats or NULL. If the argument is NULL, all counters shown in the pg_stat_replication_slots view for all replication slots are reset.
- This function is restricted to superusers by default, but other users can be granted EXECUTE to run the function.
PostgreSQL 许愿链接
您的愿望将传达给PG kernel hacker、数据库厂商等, 帮助提高数据库产品质量和功能, 说不定下一个PG版本就有您提出的功能点. 针对非常好的提议,奖励限量版PG文化衫、纪念品、贴纸、PG热门书籍等,奖品丰富,快来许愿。开不开森.