PostgreSQL 14对监控有所增强,包括内存上下文的使用监控和WAL活动监控
内存上下文监控
查询数据字典
pg_backend_memory_contexts可查看数据库的内存上下文使用情况
[local]:5014 pg14@testdb=#* select * from pg_backend_memory_contexts ORDER BY level asc,used_bytes desc limit 5;
name | ident | parent | level | total_bytes | total_nblocks | free_bytes | free_chunks | used_bytes
-------------------------+-------+------------------+-------+-------------+---------------+------------+-------------+------------
TopMemoryContext | | | 0 | 80800 | 6 | 13096 | 7 | 67704
CacheMemoryContext | | TopMemoryContext | 1 | 1048576 | 8 | 360880 | 1 | 687696
Timezones | | TopMemoryContext | 1 | 104128 | 2 | 2584 | 0 | 101544
MessageContext | | TopMemoryContext | 1 | 65536 | 4 | 17600 | 0 | 47936
WAL record construction | | TopMemoryContext | 1 | 49776 | 2 | 6344 | 0 | 43432
(5 rows)
Time: 2.054 ms
[local]:5014 pg14@testdb=#* select count(*) from t_node_ip;
count
--------
178182
(1 row)
Time: 100.878 ms
[local]:5014 pg14@testdb=#* select * from pg_backend_memory_contexts ORDER BY level asc,used_bytes desc limit 5;
name | ident | parent | level | total_bytes | total_nblocks | free_bytes | free_chunks | used_bytes
-------------------------+-------+------------------+-------+-------------+---------------+------------+-------------+------------
TopMemoryContext | | | 0 | 80800 | 6 | 12944 | 6 | 67856
CacheMemoryContext | | TopMemoryContext | 1 | 1048576 | 8 | 358160 | 0 | 690416
Timezones | | TopMemoryContext | 1 | 104128 | 2 | 2584 | 0 | 101544
MessageContext | | TopMemoryContext | 1 | 65536 | 4 | 17600 | 0 | 47936
WAL record construction | | TopMemoryContext | 1 | 49776 | 2 | 6344 | 0 | 43432
(5 rows)
Time: 0.504 ms
[local]:5014 pg14@testdb=#* select pg_backend_pid();
pg_backend_pid
----------------
3181
(1 row)
Time: 2.558 ms
使用 pg_log_backend_memory_contexts可查询某个进程使用内存的全过程日志。
[local]:5014 pg14@testdb=#* SELECT pg_log_backend_memory_contexts(3181);
2022-03-21 17:00:54.846 CST [3181] LOG: logging memory contexts of PID 3181
2022-03-21 17:00:54.846 CST [3181] LOG: level: 0; TopMemoryContext: 80800 total in 6 blocks; 13096 free (7 chunks); 67704 used
2022-03-21 17:00:54.846 CST [3181] LOG: level: 1; TableSpace cache: 8192 total in 1 blocks; 2048 free (0 chunks); 6144 used
2022-03-21 17:00:54.846 CST [3181] LOG: level: 1; pgstat TabStatusArray lookup hash table: 8192 total in 1 blocks; 360 free (0 chunks); 7832 used
2022-03-21 17:00:54.846 CST [3181] LOG: level: 1; TopTransactionContext: 8192 total in 1 blocks; 7720 free (2 chunks); 472 used
2022-03-21 17:00:54.846 CST [3181] LOG: level: 1; Record information cache: 8192 total in 1 blocks; 1536 free (0 chunks); 6656 used
2022-03-21 17:00:54.846 CST [3181] LOG: level: 1; Type information cache: 24384 total in 2 blocks; 2584 free (0 chunks); 21800 used
2022-03-21 17:00:54.846 CST [3181] LOG: level: 1; RowDescriptionContext: 8192 total in 1 blocks; 6880 free (0 chunks); 1312 used
2022-03-21 17:00:54.846 CST [3181] LOG: level: 1; MessageContext: 16384 total in 2 blocks; 5504 free (0 chunks); 10880 used
2022-03-21 17:00:54.846 CST [3181] LOG: level: 1; Operator class cache: 8192 total in 1 blocks; 512 free (0 chunks); 7680 used
2022-03-21 17:00:54.846 CST [3181] LOG: level: 1; smgr relation table: 32768 total in 3 blocks; 16768 free (8 chunks); 16000 used
2022-03-21 17:00:54.846 CST [3181] LOG: level: 1; TransactionAbortContext: 32768 total in 1 blocks; 32504 free (0 chunks); 264 used
2022-03-21 17:00:54.846 CST [3181] LOG: level: 1; Portal hash: 8192 total in 1 blocks; 512 free (0 chunks); 7680 used
2022-03-21 17:00:54.846 CST [3181] LOG: level: 1; TopPortalContext: 8192 total in 1 blocks; 7648 free (0 chunks); 544 used
2022-03-21 17:00:54.846 CST [3181] LOG: level: 2; PortalContext: 1024 total in 1 blocks; 576 free (0 chunks); 448 used:
2022-03-21 17:00:54.846 CST [3181] LOG: level: 3; ExecutorState: 8192 total in 1 blocks; 2784 free (0 chunks); 5408 used
2022-03-21 17:00:54.846 CST [3181] LOG: level: 4; printtup: 8192 total in 1 blocks; 7928 free (0 chunks); 264 used
2022-03-21 17:00:54.846 CST [3181] LOG: level: 4; ExprContext: 8192 total in 1 blocks; 7928 free (0 chunks); 264 used
2022-03-21 17:00:54.846 CST [3181] LOG: level: 1; Relcache by OID: 16384 total in 2 blocks; 3424 free (3 chunks); 12960 used
2022-03-21 17:00:54.846 CST [3181] LOG: level: 1; CacheMemoryContext: 1048576 total in 8 blocks; 355000 free (0 chunks); 693576 used
2022-03-21 17:00:54.846 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 440 free (1 chunks); 1608 used: pg_toast_2619_index
2022-03-21 17:00:54.846 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 736 free (0 chunks); 1312 used: pg_index_indrelid_index
2022-03-21 17:00:54.846 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 824 free (0 chunks); 1224 used: pg_statistic_ext_relid_index
2022-03-21 17:00:54.846 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 440 free (1 chunks); 1608 used: pg_attrdef_adrelid_adnum_index
2022-03-21 17:00:54.846 CST [3181] LOG: level: 2; relation rules: 8192 total in 4 blocks; 464 free (0 chunks); 7728 used: pg_backend_memory_contexts
2022-03-21 17:00:54.846 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 408 free (1 chunks); 1640 used: pg_db_role_setting_databaseid_rol_index
2022-03-21 17:00:54.846 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 584 free (2 chunks); 1464 used: pg_user_mapping_user_server_index
2022-03-21 17:00:54.846 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_user_mapping_oid_index
2022-03-21 17:00:54.846 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 736 free (0 chunks); 1312 used: pg_type_oid_index
2022-03-21 17:00:54.846 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 616 free (2 chunks); 1432 used: pg_type_typname_nsp_index
2022-03-21 17:00:54.846 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_ts_template_oid_index
2022-03-21 17:00:54.846 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 616 free (2 chunks); 1432 used: pg_ts_template_tmplname_index
2022-03-21 17:00:54.846 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_ts_parser_oid_index
2022-03-21 17:00:54.846 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 616 free (2 chunks); 1432 used: pg_ts_parser_prsname_index
2022-03-21 17:00:54.846 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_ts_dict_oid_index
2022-03-21 17:00:54.846 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 616 free (2 chunks); 1432 used: pg_ts_dict_dictname_index
2022-03-21 17:00:54.846 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_ts_config_oid_index
2022-03-21 17:00:54.847 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 616 free (2 chunks); 1432 used: pg_ts_config_cfgname_index
2022-03-21 17:00:54.847 CST [3181] LOG: level: 2; index info: 3072 total in 2 blocks; 1088 free (2 chunks); 1984 used: pg_ts_config_map_index
2022-03-21 17:00:54.847 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 616 free (2 chunks); 1432 used: pg_transform_type_lang_index
2022-03-21 17:00:54.847 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_transform_oid_index
2022-03-21 17:00:54.847 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 736 free (0 chunks); 1312 used: pg_tablespace_oid_index
2022-03-21 17:00:54.847 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 584 free (2 chunks); 1464 used: pg_subscription_rel_srrelid_srsubid_index
2022-03-21 17:00:54.847 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_subscription_oid_index
2022-03-21 17:00:54.847 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 616 free (2 chunks); 1432 used: pg_subscription_subname_index
2022-03-21 17:00:54.847 CST [3181] LOG: level: 2; index info: 3072 total in 2 blocks; 704 free (1 chunks); 2368 used: pg_statistic_relid_att_inh_index
2022-03-21 17:00:54.847 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_statistic_ext_oid_index
2022-03-21 17:00:54.847 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 616 free (2 chunks); 1432 used: pg_statistic_ext_name_index
2022-03-21 17:00:54.847 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 880 free (2 chunks); 1168 used: pg_statistic_ext_data_stxoid_index
2022-03-21 17:00:54.847 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_sequence_seqrelid_index
2022-03-21 17:00:54.847 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 880 free (2 chunks); 1168 used: pg_replication_origin_roname_index
2022-03-21 17:00:54.847 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 880 free (2 chunks); 1168 used: pg_replication_origin_roiident_index
2022-03-21 17:00:54.847 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 352 free (1 chunks); 1696 used: pg_class_relname_nsp_index
2022-03-21 17:00:54.847 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_range_rngtypid_index
2022-03-21 17:00:54.847 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_range_rngmultitypid_index
2022-03-21 17:00:54.847 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 584 free (2 chunks); 1464 used: pg_publication_rel_prrelid_prpubid_index
2022-03-21 17:00:54.847 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_publication_rel_oid_index
2022-03-21 17:00:54.847 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_publication_oid_index
2022-03-21 17:00:54.847 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_publication_pubname_index
2022-03-21 17:00:54.847 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 736 free (0 chunks); 1312 used: pg_proc_oid_index
2022-03-21 17:00:54.847 CST [3181] LOG: level: 2; index info: 3072 total in 2 blocks; 912 free (1 chunks); 2160 used: pg_proc_proname_args_nsp_index
2022-03-21 17:00:54.847 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 880 free (2 chunks); 1168 used: pg_partitioned_table_partrelid_index
2022-03-21 17:00:54.850 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_opfamily_oid_index
2022-03-21 17:00:54.850 CST [3181] LOG: level: 2; index info: 3072 total in 2 blocks; 1088 free (2 chunks); 1984 used: pg_opfamily_am_name_nsp_index
2022-03-21 17:00:54.850 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_operator_oid_index
2022-03-21 17:00:54.850 CST [3181] LOG: level: 2; index info: 3072 total in 2 blocks; 1024 free (1 chunks); 2048 used: pg_operator_oprname_l_r_n_index
2022-03-21 17:00:54.850 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_namespace_oid_index
2022-03-21 17:00:54.850 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 736 free (0 chunks); 1312 used: pg_namespace_nspname_index
2022-03-21 17:00:54.850 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_language_oid_index
2022-03-21 17:00:54.850 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_language_name_index
2022-03-21 17:00:54.850 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_foreign_table_relid_index
2022-03-21 17:00:54.850 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_foreign_server_oid_index
2022-03-21 17:00:54.850 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_foreign_server_name_index
2022-03-21 17:00:54.850 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 880 free (2 chunks); 1168 used: pg_foreign_data_wrapper_oid_index
2022-03-21 17:00:54.850 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 880 free (2 chunks); 1168 used: pg_foreign_data_wrapper_name_index
2022-03-21 17:00:54.850 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_event_trigger_oid_index
2022-03-21 17:00:54.850 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_event_trigger_evtname_index
2022-03-21 17:00:54.850 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 616 free (2 chunks); 1432 used: pg_enum_typid_label_index
2022-03-21 17:00:54.850 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_enum_oid_index
2022-03-21 17:00:54.850 CST [3181] LOG: level: 2; index info: 3072 total in 2 blocks; 1056 free (1 chunks); 2016 used: pg_default_acl_role_nsp_obj_index
2022-03-21 17:00:54.850 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_conversion_oid_index
2022-03-21 17:00:54.850 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_constraint_oid_index
2022-03-21 17:00:54.850 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 616 free (2 chunks); 1432 used: pg_conversion_name_nsp_index
2022-03-21 17:00:54.850 CST [3181] LOG: level: 2; index info: 3072 total in 2 blocks; 1024 free (1 chunks); 2048 used: pg_conversion_default_index
2022-03-21 17:00:54.850 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_collation_oid_index
2022-03-21 17:00:54.850 CST [3181] LOG: level: 2; index info: 3072 total in 2 blocks; 1088 free (2 chunks); 1984 used: pg_collation_name_enc_nsp_index
2022-03-21 17:00:54.850 CST [3181] LOG: level: 2; index info: 3072 total in 2 blocks; 912 free (1 chunks); 2160 used: pg_opclass_am_name_nsp_index
2022-03-21 17:00:54.850 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 352 free (1 chunks); 1696 used: pg_cast_source_target_index
2022-03-21 17:00:54.850 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 584 free (2 chunks); 1464 used: pg_auth_members_role_member_index
2022-03-21 17:00:54.850 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 616 free (2 chunks); 1432 used: pg_attribute_relid_attnam_index
2022-03-21 17:00:54.851 CST [3181] LOG: level: 2; index info: 3072 total in 2 blocks; 584 free (1 chunks); 2488 used: pg_amop_fam_strat_index
2022-03-21 17:00:54.851 CST [3181] LOG: level: 2; index info: 3072 total in 2 blocks; 912 free (1 chunks); 2160 used: pg_amop_opr_fam_index
2022-03-21 17:00:54.851 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 736 free (0 chunks); 1312 used: pg_aggregate_fnoid_index
2022-03-21 17:00:54.851 CST [3181] LOG: level: 2; index info: 3072 total in 2 blocks; 1088 free (2 chunks); 1984 used: pg_shseclabel_object_index
2022-03-21 17:00:54.851 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 584 free (2 chunks); 1464 used: pg_auth_members_member_role_index
2022-03-21 17:00:54.851 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_authid_oid_index
2022-03-21 17:00:54.851 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_authid_rolname_index
2022-03-21 17:00:54.851 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 736 free (0 chunks); 1312 used: pg_database_oid_index
2022-03-21 17:00:54.851 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 912 free (0 chunks); 1136 used: pg_database_datname_index
2022-03-21 17:00:54.851 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 616 free (2 chunks); 1432 used: pg_trigger_tgrelid_tgname_index
2022-03-21 17:00:54.851 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 440 free (1 chunks); 1608 used: pg_rewrite_rel_rulename_index
2022-03-21 17:00:54.851 CST [3181] LOG: level: 2; index info: 3072 total in 2 blocks; 584 free (1 chunks); 2488 used: pg_amproc_fam_proc_index
2022-03-21 17:00:54.851 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 736 free (0 chunks); 1312 used: pg_opclass_oid_index
2022-03-21 17:00:54.851 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 736 free (0 chunks); 1312 used: pg_index_indexrelid_index
2022-03-21 17:00:54.851 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 352 free (1 chunks); 1696 used: pg_attribute_relid_attnum_index
2022-03-21 17:00:54.851 CST [3181] LOG: level: 2; index info: 2048 total in 2 blocks; 736 free (0 chunks); 1312 used: pg_class_oid_index
2022-03-21 17:00:54.851 CST [3181] LOG: level: 1; WAL record construction: 49776 total in 2 blocks; 6344 free (0 chunks); 43432 used
2022-03-21 17:00:54.851 CST [3181] LOG: level: 1; PrivateRefCount: 8192 total in 1 blocks; 2584 free (0 chunks); 5608 used
2022-03-21 17:00:54.851 CST [3181] LOG: level: 1; MdSmgr: 8192 total in 1 blocks; 6744 free (0 chunks); 1448 used
2022-03-21 17:00:54.851 CST [3181] LOG: level: 1; LOCALLOCK hash: 8192 total in 1 blocks; 512 free (0 chunks); 7680 used
2022-03-21 17:00:54.851 CST [3181] LOG: level: 1; Timezones: 104128 total in 2 blocks; 2584 free (0 chunks); 101544 used
2022-03-21 17:00:54.851 CST [3181] LOG: level: 1; ErrorContext: 8192 total in 1 blocks; 7928 free (3 chunks); 264 used
2022-03-21 17:00:54.851 CST [3181] LOG: Grand total: 1725456 bytes in 218 blocks; 569368 free (93 chunks); 1156088 used
pg_log_backend_memory_contexts
--------------------------------
t
(1 row)
Time: 6.360 ms
[local]:5014 pg14@testdb=#*
WAL活动监控
使用视图pg_stat_wal可跟踪WAL的相关活动
[local]:5014 pg14@testdb=#* create table a as select * from t_node_ip;
SELECT 178182
Time: 541.900 ms
[local]:5014 pg14@testdb=#* SELECT * FROM pg_stat_wal;
wal_records | wal_fpi | wal_bytes | wal_buffers_full | wal_write | wal_sync | wal_write_time | wal_sync_time | stats_reset
-------------+---------+-----------+------------------+-----------+----------+----------------+---------------+-------------------------------
0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2022-03-21 16:53:58.488321+08
(1 row)
Time: 1.022 ms
[local]:5014 pg14@testdb=# create table b as select * from t_node_ip;
SELECT 178182
Time: 595.625 ms
[local]:5014 pg14@testdb=#* create table c as select * from t_node_ip;
SELECT 178182
Time: 577.467 ms
[local]:5014 pg14@testdb=#* SELECT * FROM pg_stat_wal;
wal_records | wal_fpi | wal_bytes | wal_buffers_full | wal_write | wal_sync | wal_write_time | wal_sync_time | stats_reset
-------------+---------+-----------+------------------+-----------+----------+----------------+---------------+-------------------------------
178226 | 18 | 22005810 | 0 | 14 | 14 | 0 | 0 | 2022-03-21 16:53:58.488321+08
(1 row)
Time: 16.371 ms
[local]:5014 pg14@testdb=#* checkpoint;
CHECKPOINT
Time: 814.862 ms
[local]:5014 pg14@testdb=#* create table d as select * from t_node_ip;
SELECT 178182
Time: 535.339 ms
[local]:5014 pg14@testdb=#* checkpoint;
CHECKPOINT
Time: 227.352 ms
[local]:5014 pg14@testdb=#* SELECT * FROM pg_stat_wal;
wal_records | wal_fpi | wal_bytes | wal_buffers_full | wal_write | wal_sync | wal_write_time | wal_sync_time | stats_reset
-------------+---------+-----------+------------------+-----------+----------+----------------+---------------+-------------------------------
178226 | 18 | 22005810 | 0 | 14 | 14 | 0 | 0 | 2022-03-21 16:53:58.488321+08
(1 row)
Time: 0.533 ms
[local]:5014 pg14@testdb=#*
参考资料
An early look at Postgres 14: Performance and Monitoring Improvements