{"Entry":{"collection":"func","key":"pg-wal-lsn-diff","name":"pg_wal_lsn_diff","aliases":[],"metadata":{"changed_in":[],"changes":[{"descriptions_changed":false,"doc_overhaul":false,"from":"9.6","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"added","to":"10"},{"descriptions_changed":false,"doc_overhaul":true,"from":"12","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"13"},{"descriptions_changed":true,"doc_overhaul":false,"from":"13","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"14"},{"descriptions_changed":true,"doc_overhaul":false,"from":"14","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"15"},{"descriptions_changed":true,"doc_overhaul":false,"from":"15","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"16"},{"descriptions_changed":true,"doc_overhaul":false,"from":"16","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"17"},{"descriptions_changed":true,"doc_overhaul":false,"from":"17","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"18"},{"descriptions_changed":true,"doc_overhaul":false,"from":"18","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"19"},{"descriptions_changed":true,"doc_overhaul":false,"from":"19","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"20"}],"content_hash":"17702c28dd195ff2a7f963e5ff2bc083c353c542133c81ccbaba958189919c17","first_version":"10","group":"admin","group_label":"System Administration Functions","groups":["admin"],"imported_at":"2026-09-27T17:57:29.706653+08:00","last_version":"20","name":"pg_wal_lsn_diff","name_key":"pg_wal_lsn_diff","position":29113,"present_in":["10","11","12","13","14","15","16","17","18","19","20"],"signature":"pg_wal_lsn_diff ( lsn1 pg_lsn, lsn2 pg_lsn ) → numeric","signature_count":1,"slug":"pg-wal-lsn-diff","source_rev":"b7bd9cda","summary":"Calculates the difference in bytes (lsn1 - lsn2) between two write-ahead log locations.","summary_zh":""}},"Definition":{"Collection":"func","Key":"pg-wal-lsn-diff","SourceDatabase":"center","Version":"18","SourceTable":"func","SourceKey":"pg-wal-lsn-diff","SourceRevision":"b7bd9cda","Facts":{"description":"Calculates the difference in bytes (lsn1 - lsn2) between two write-ahead log locations. This can be used with pg_stat_replication or some of the functions shown in Table 9.97 to get the replication lag.","description_html":"Calculates the difference in bytes (\u003cem class=\"parameter\"\u003e\u003ccode\u003elsn1\u003c/code\u003e\u003c/em\u003e - \u003cem class=\"parameter\"\u003e\u003ccode\u003elsn2\u003c/code\u003e\u003c/em\u003e) between two write-ahead log locations. This can be used with \u003ccode class=\"structname\"\u003epg_stat_replication\u003c/code\u003e or some of the functions shown in \u003ca href=\"/docs/18/functions-admin.html#FUNCTIONS-ADMIN-BACKUP-TABLE\" title=\"Table 9.97. Backup Control Functions\"\u003eTable 9.97\u003c/a\u003e to get the replication lag.","description_zh":"","description_zh_html":"","doc":{"anchor":"FUNCTIONS-ADMIN-BACKUP-TABLE","file":"functions-admin.html","slug":"18"},"group":"admin","group_label":"System Administration Functions","lang":"en","layout":"table-new","pages":["functions-admin.html"],"prose_only":false,"signatures":[{"description":"Calculates the difference in bytes (lsn1 - lsn2) between two write-ahead log locations. This can be used with pg_stat_replication or some of the functions shown in Table 9.97 to get the replication lag.","description_html":"Calculates the difference in bytes (\u003cem class=\"parameter\"\u003e\u003ccode\u003elsn1\u003c/code\u003e\u003c/em\u003e - \u003cem class=\"parameter\"\u003e\u003ccode\u003elsn2\u003c/code\u003e\u003c/em\u003e) between two write-ahead log locations. This can be used with \u003ccode class=\"structname\"\u003epg_stat_replication\u003c/code\u003e or some of the functions shown in \u003ca href=\"/docs/18/functions-admin.html#FUNCTIONS-ADMIN-BACKUP-TABLE\" title=\"Table 9.97. Backup Control Functions\"\u003eTable 9.97\u003c/a\u003e to get the replication lag.","description_zh":"","description_zh_html":"","examples":[],"html":"\u003ccode class=\"function\"\u003epg_wal_lsn_diff\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003elsn1\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003epg_lsn\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003elsn2\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003epg_lsn\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003enumeric\u003c/code\u003e","returns":"numeric","text":"pg_wal_lsn_diff ( lsn1 pg_lsn, lsn2 pg_lsn ) → numeric","zh_from":""}],"zh_from":""},"ManualEvidence":{"doc":{"anchor":"FUNCTIONS-ADMIN-BACKUP-TABLE","file":"functions-admin.html","slug":"18"}},"MeasuredEvidence":{}},"Text":{"Collection":"func","Key":"pg-wal-lsn-diff","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"pg_wal_lsn_diff","Summary":"计算两个预写式日志位置之间的字节差（lsn1 - lsn2）。可以将它与pg_stat_replication或表 9.97中的某些函数配合使用，以获取复制延迟。","BodyHTML":"计算两个预写式日志位置之间的字节差（\u003cem\u003e\u003ccode\u003elsn1\u003c/code\u003e\u003c/em\u003e - \u003cem\u003e\u003ccode\u003elsn2\u003c/code\u003e\u003c/em\u003e）。可以将它与\u003ccode\u003epg_stat_replication\u003c/code\u003e或\u003ca href=\"/docs/18/functions-admin.html#FUNCTIONS-ADMIN-BACKUP-TABLE\" rel=\"nofollow\"\u003e表 9.97\u003c/a\u003e中的某些函数配合使用，以获取复制延迟。\u003cpre\u003epg_wal_lsn_diff ( lsn1 pg_lsn, lsn2 pg_lsn ) → numeric\u003c/pre\u003e计算两个预写式日志位置之间的字节差（\u003cem\u003e\u003ccode\u003elsn1\u003c/code\u003e\u003c/em\u003e - \u003cem\u003e\u003ccode\u003elsn2\u003c/code\u003e\u003c/em\u003e）。可以将它与\u003ccode\u003epg_stat_replication\u003c/code\u003e或\u003ca href=\"/docs/18/functions-admin.html#FUNCTIONS-ADMIN-BACKUP-TABLE\" rel=\"nofollow\"\u003e表 9.97\u003c/a\u003e中的某些函数配合使用，以获取复制延迟。","SourceRevision":"ca936764","ContentHash":"14ad0a6f58d59b878e9ef5effea1bf850074065a085bda05da6b03956a83d3af","Payload":{"description_zh":"计算两个预写式日志位置之间的字节差（lsn1 - lsn2）。可以将它与pg_stat_replication或表 9.97中的某些函数配合使用，以获取复制延迟。","description_zh_html":"计算两个预写式日志位置之间的字节差（\u003cem class=\"parameter\"\u003e\u003ccode\u003elsn1\u003c/code\u003e\u003c/em\u003e - \u003cem class=\"parameter\"\u003e\u003ccode\u003elsn2\u003c/code\u003e\u003c/em\u003e）。可以将它与\u003ccode class=\"structname\"\u003epg_stat_replication\u003c/code\u003e或\u003ca href=\"/docs/18/functions-admin.html#FUNCTIONS-ADMIN-BACKUP-TABLE\" title=\"表 9.97. 备份控制函数\"\u003e表 9.97\u003c/a\u003e中的某些函数配合使用，以获取复制延迟。","signatures":[{"description_zh":"计算两个预写式日志位置之间的字节差（lsn1 - lsn2）。可以将它与pg_stat_replication或表 9.97中的某些函数配合使用，以获取复制延迟。","description_zh_html":"计算两个预写式日志位置之间的字节差（\u003cem class=\"parameter\"\u003e\u003ccode\u003elsn1\u003c/code\u003e\u003c/em\u003e - \u003cem class=\"parameter\"\u003e\u003ccode\u003elsn2\u003c/code\u003e\u003c/em\u003e）。可以将它与\u003ccode class=\"structname\"\u003epg_stat_replication\u003c/code\u003e或\u003ca href=\"/docs/18/functions-admin.html#FUNCTIONS-ADMIN-BACKUP-TABLE\" title=\"表 9.97. 备份控制函数\"\u003e表 9.97\u003c/a\u003e中的某些函数配合使用，以获取复制延迟。","returns":"numeric","text":"pg_wal_lsn_diff ( lsn1 pg_lsn, lsn2 pg_lsn ) → numeric","zh_from":"doc"}],"zh_from":"doc"}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":[{"Version":"18","Ordinal":0,"Hash":"c9c2216ee48a7ded6a3556aad302d1b6b51c96093a74c4e121a9741c763452be","Text":"pg_wal_lsn_diff ( lsn1 pg_lsn, lsn2 pg_lsn ) → numeric","Returns":"numeric","Payload":{"description":"Calculates the difference in bytes (lsn1 - lsn2) between two write-ahead log locations. This can be used with pg_stat_replication or some of the functions shown in Table 9.97 to get the replication lag.","description_html":"Calculates the difference in bytes (\u003cem class=\"parameter\"\u003e\u003ccode\u003elsn1\u003c/code\u003e\u003c/em\u003e - \u003cem class=\"parameter\"\u003e\u003ccode\u003elsn2\u003c/code\u003e\u003c/em\u003e) between two write-ahead log locations. This can be used with \u003ccode class=\"structname\"\u003epg_stat_replication\u003c/code\u003e or some of the functions shown in \u003ca href=\"/docs/18/functions-admin.html#FUNCTIONS-ADMIN-BACKUP-TABLE\" title=\"Table 9.97. Backup Control Functions\"\u003eTable 9.97\u003c/a\u003e to get the replication lag.","description_zh":"","description_zh_html":"","examples":[],"html":"\u003ccode class=\"function\"\u003epg_wal_lsn_diff\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003elsn1\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003epg_lsn\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003elsn2\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003epg_lsn\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003enumeric\u003c/code\u003e","returns":"numeric","text":"pg_wal_lsn_diff ( lsn1 pg_lsn, lsn2 pg_lsn ) → numeric","zh_from":""}}],"Spellings":null,"SQLState":null,"Evidence":null}
