On 8th of April 2025, Daniel Gustafsson committed patch:
Add function to get memory context stats for processes This adds a function for retrieving memory context statistics and information from backends as well as auxiliary processes. The intended usecase is cluster debugging when under memory pressure or unanticipated memory usage characteristics. When calling the function it sends a signal to the specified process to submit statistics regarding its memory contexts into dynamic shared memory. Each memory context is returned in detail, followed by a cumulative total in case the number of contexts exceed the max allocated amount of shared memory. Each process is limited to use at most 1Mb memory for this. A summary can also be explicitly requested by the user, this will return the TopMemoryContext and a cumulative total of all lower contexts. In order to not block on busy processes the caller specifies the number of seconds during which to retry before timing out. In the case where no statistics are published within the set timeout, the last known statistics are returned, or NULL if no previously published statistics exist. This allows dash- board type queries to continually publish even if the target process is temporarily congested. Context records contain a timestamp to indicate when they were submitted. Author: Rahila Syed <rahilasyed90@gmail.com> Reviewed-by: Daniel Gustafsson <daniel@yesql.se> Reviewed-by: Andres Freund <andres@anarazel.de> Reviewed-by: Tomas Vondra <tomas@vondra.me> Reviewed-by: Atsushi Torikoshi <torikoshia@oss.nttdata.com> Reviewed-by: Fujii Masao <masao.fujii@oss.nttdata.com> Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com> Discussion: https://postgr.es/m/CAH2L28v8mc9HDt8QoSJ8TRmKau_8FM_HKS41NeO9-6ZAkuZKXw@mail.gmail.com
This is something that I don't really think will be useful for many people, but it will definitely help some.
Ever since PostgreSQL 14 we have pg_backend_memory_contexts view, that shows memory usage information for current backend. It looks like this:
=$ select * from pg_backend_memory_contexts order by path limit 5; name │ ident │ type │ level │ path │ total_bytes │ total_nblocks │ free_bytes │ free_chunks │ used_bytes ──────────────────────────┼──────────────┼──────────┼───────┼──────────┼─────────────┼───────────────┼────────────┼─────────────┼──────────── TopMemoryContext │ [null] │ AllocSet │ 1 │ {1} │ 140544 │ 6 │ 3088 │ 14 │ 137456 collation cache │ [null] │ AllocSet │ 2 │ {1,2} │ 8192 │ 1 │ 6784 │ 0 │ 1408 TableSpace cache │ [null] │ AllocSet │ 2 │ {1,3} │ 8192 │ 1 │ 2112 │ 0 │ 6080 RegexpCacheMemoryContext │ [null] │ AllocSet │ 2 │ {1,4} │ 1024 │ 1 │ 784 │ 0 │ 240 RegexpMemoryContext │ ^(.*cont.*)$ │ AllocSet │ 3 │ {1,4,30} │ 13376 │ 5 │ 6992 │ 10 │ 6384 (5 rows)
Now, we can also get such information for other Pg processes, including non-backend ones (like wal writer):
=$ \! ps -u pgdba u | grep walwriter pgdba 1420 0.0 0.0 225636 9536 ? Ss May01 0:05 postgres: walwriter =$ select * from pg_get_process_memory_contexts( 1253, false, 1 ) order by path limit 5^J; name │ ident │ type │ path │ level │ total_bytes │ total_nblocks │ free_bytes │ free_chunks │ used_bytes │ num_agg_contexts │ stats_timestamp ───────────────────────────────────────┼────────┼──────────┼──────────┼───────┼─────────────┼───────────────┼────────────┼─────────────┼────────────┼──────────────────┼─────────────────────────────── TopMemoryContext │ [null] │ AllocSet │ {1} │ 1 │ 102664 │ 4 │ 2784 │ 0 │ 99880 │ 1 │ 2025-05-05 15:02:59.764672+02 smgr relation table │ [null] │ AllocSet │ {1,2} │ 2 │ 32768 │ 3 │ 16848 │ 8 │ 15920 │ 1 │ 2025-05-05 15:02:59.764672+02 Background Writer │ [null] │ AllocSet │ {1,3} │ 2 │ 24576 │ 2 │ 22648 │ 8 │ 1928 │ 1 │ 2025-05-05 15:02:59.764672+02 pg_get_remote_backend_memory_contexts │ [null] │ AllocSet │ {1,3,11} │ 3 │ 8192 │ 1 │ 1472 │ 0 │ 6720 │ 1 │ 2025-05-05 15:02:59.764672+02 LOCALLOCK hash │ [null] │ AllocSet │ {1,4} │ 2 │ 8192 │ 1 │ 576 │ 0 │ 7616 │ 1 │ 2025-05-05 15:02:59.764672+02 (5 rows)
First argument is pid of process.
Second argument, if it's true – it will just show contexts that are directly below TopMemoryContext. If it's false, it generates much more data, because it shows data about everything that is there (will show example at the end).
Third argument is timeout in seconds. If getting data from backend takes longer than this, previous data will be returned, or NULL if there is no previous data.
So this means we can easily build some kind of “show-memory-usage-in-time" dashboards/graphs/tables, without overwhelming server.
Very, very nice. Not really for everyday use, but if you'll see Pg process that eats surprising amount of memory, you can at least see why, and what is it using it for.
Thanks a lot, to everyone involved.
And this is promised example of how it looks for backend. It wasn't doing much, but still something (pgbench):
=$ select * from pg_get_process_memory_contexts( 649620, false, 100 ) order by path ; name │ ident │ type │ path │ level │ total_bytes │ total_nblocks │ free_bytes │ free_chunks │ used_bytes │ num_agg_contexts │ stats_timestamp ───────────────────────────────────────┼────────────────────────────────────────────────┼──────────┼────────────┼───────┼─────────────┼───────────────┼────────────┼─────────────┼────────────┼──────────────────┼─────────────────────────────── TopMemoryContext │ [null] │ AllocSet │ {1} │ 1 │ 152904 │ 7 │ 3144 │ 11 │ 149760 │ 1 │ 2025-05-05 15:09:57.330051+02 TableSpace cache │ [null] │ AllocSet │ {1,2} │ 2 │ 8192 │ 1 │ 2112 │ 0 │ 6080 │ 1 │ 2025-05-05 15:09:57.330051+02 Operator lookup cache │ [null] │ AllocSet │ {1,3} │ 2 │ 24576 │ 2 │ 10776 │ 3 │ 13800 │ 1 │ 2025-05-05 15:09:57.330051+02 search_path processing cache │ [null] │ AllocSet │ {1,4} │ 2 │ 8192 │ 1 │ 5616 │ 8 │ 2576 │ 1 │ 2025-05-05 15:09:57.330051+02 RowDescriptionContext │ [null] │ AllocSet │ {1,5} │ 2 │ 8192 │ 1 │ 6912 │ 0 │ 1280 │ 1 │ 2025-05-05 15:09:57.330051+02 MessageContext │ [null] │ AllocSet │ {1,6} │ 2 │ 32768 │ 3 │ 13736 │ 3 │ 19032 │ 1 │ 2025-05-05 15:09:57.330051+02 Operator class cache │ [null] │ AllocSet │ {1,7} │ 2 │ 8192 │ 1 │ 576 │ 0 │ 7616 │ 1 │ 2025-05-05 15:09:57.330051+02 smgr relation table │ [null] │ AllocSet │ {1,8} │ 2 │ 32768 │ 3 │ 16848 │ 8 │ 15920 │ 1 │ 2025-05-05 15:09:57.330051+02 PgStat Shared Ref Hash │ [null] │ AllocSet │ {1,9} │ 2 │ 9280 │ 2 │ 704 │ 0 │ 8576 │ 1 │ 2025-05-05 15:09:57.330051+02 PgStat Shared Ref │ [null] │ AllocSet │ {1,10} │ 2 │ 8192 │ 4 │ 3512 │ 2 │ 4680 │ 1 │ 2025-05-05 15:09:57.330051+02 PgStat Pending │ [null] │ AllocSet │ {1,11} │ 2 │ 16384 │ 5 │ 14352 │ 46 │ 2032 │ 1 │ 2025-05-05 15:09:57.330051+02 TopTransactionContext │ [null] │ AllocSet │ {1,12} │ 2 │ 8192 │ 1 │ 5648 │ 4 │ 2544 │ 1 │ 2025-05-05 15:09:57.330051+02 pg_get_remote_backend_memory_contexts │ [null] │ AllocSet │ {1,12,25} │ 3 │ 16384 │ 2 │ 6504 │ 2 │ 9880 │ 1 │ 2025-05-05 15:09:57.330051+02 TransactionAbortContext │ [null] │ AllocSet │ {1,13} │ 2 │ 32768 │ 1 │ 32528 │ 0 │ 240 │ 1 │ 2025-05-05 15:09:57.330051+02 Portal hash │ [null] │ AllocSet │ {1,14} │ 2 │ 8192 │ 1 │ 576 │ 0 │ 7616 │ 1 │ 2025-05-05 15:09:57.330051+02 TopPortalContext │ [null] │ AllocSet │ {1,15} │ 2 │ 8192 │ 1 │ 7952 │ 1 │ 240 │ 1 │ 2025-05-05 15:09:57.330051+02 Relcache by OID │ [null] │ AllocSet │ {1,16} │ 2 │ 16384 │ 2 │ 3528 │ 2 │ 12856 │ 1 │ 2025-05-05 15:09:57.330051+02 CacheMemoryContext │ [null] │ AllocSet │ {1,17} │ 2 │ 524288 │ 7 │ 34344 │ 0 │ 489944 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pgbench_branches_pkey │ AllocSet │ {1,17,26} │ 3 │ 2048 │ 2 │ 672 │ 1 │ 1376 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pgbench_tellers_pkey │ AllocSet │ {1,17,27} │ 3 │ 2048 │ 2 │ 592 │ 1 │ 1456 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_statistic_ext_relid_index │ AllocSet │ {1,17,28} │ 3 │ 2048 │ 2 │ 672 │ 1 │ 1376 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pgbench_accounts_pkey │ AllocSet │ {1,17,29} │ 3 │ 2048 │ 2 │ 592 │ 1 │ 1456 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_index_indrelid_index │ AllocSet │ {1,17,30} │ 3 │ 2048 │ 2 │ 592 │ 1 │ 1456 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_constraint_conrelid_contypid_conname_index │ AllocSet │ {1,17,31} │ 3 │ 3072 │ 2 │ 928 │ 1 │ 2144 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_db_role_setting_databaseid_rol_index │ AllocSet │ {1,17,32} │ 3 │ 3072 │ 2 │ 1032 │ 1 │ 2040 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_opclass_am_name_nsp_index │ AllocSet │ {1,17,33} │ 3 │ 3072 │ 2 │ 1120 │ 1 │ 1952 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_foreign_data_wrapper_name_index │ AllocSet │ {1,17,34} │ 3 │ 2048 │ 2 │ 720 │ 3 │ 1328 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_enum_oid_index │ AllocSet │ {1,17,35} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_class_relname_nsp_index │ AllocSet │ {1,17,36} │ 3 │ 3072 │ 2 │ 984 │ 2 │ 2088 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_foreign_server_oid_index │ AllocSet │ {1,17,37} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_publication_pubname_index │ AllocSet │ {1,17,38} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_statistic_relid_att_inh_index │ AllocSet │ {1,17,39} │ 3 │ 3072 │ 2 │ 768 │ 1 │ 2304 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_cast_source_target_index │ AllocSet │ {1,17,40} │ 3 │ 3072 │ 2 │ 984 │ 2 │ 2088 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_language_name_index │ AllocSet │ {1,17,41} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_transform_oid_index │ AllocSet │ {1,17,42} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_collation_oid_index │ AllocSet │ {1,17,43} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_amop_fam_strat_index │ AllocSet │ {1,17,44} │ 3 │ 3264 │ 3 │ 736 │ 2 │ 2528 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_index_indexrelid_index │ AllocSet │ {1,17,45} │ 3 │ 2048 │ 2 │ 592 │ 2 │ 1456 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_ts_template_tmplname_index │ AllocSet │ {1,17,46} │ 3 │ 3072 │ 2 │ 1224 │ 3 │ 1848 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_ts_config_map_index │ AllocSet │ {1,17,47} │ 3 │ 3072 │ 2 │ 1120 │ 1 │ 1952 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_opclass_oid_index │ AllocSet │ {1,17,48} │ 3 │ 2048 │ 2 │ 592 │ 2 │ 1456 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_foreign_data_wrapper_oid_index │ AllocSet │ {1,17,49} │ 3 │ 2048 │ 2 │ 720 │ 3 │ 1328 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_publication_namespace_oid_index │ AllocSet │ {1,17,50} │ 3 │ 2048 │ 2 │ 720 │ 3 │ 1328 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_event_trigger_evtname_index │ AllocSet │ {1,17,51} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_statistic_ext_name_index │ AllocSet │ {1,17,52} │ 3 │ 3072 │ 2 │ 1224 │ 3 │ 1848 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_publication_oid_index │ AllocSet │ {1,17,53} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_ts_dict_oid_index │ AllocSet │ {1,17,54} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_event_trigger_oid_index │ AllocSet │ {1,17,55} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_conversion_default_index │ AllocSet │ {1,17,56} │ 3 │ 2240 │ 2 │ 152 │ 0 │ 2088 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_operator_oprname_l_r_n_index │ AllocSet │ {1,17,57} │ 3 │ 3264 │ 3 │ 816 │ 2 │ 2448 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_trigger_tgrelid_tgname_index │ AllocSet │ {1,17,58} │ 3 │ 3072 │ 2 │ 1224 │ 3 │ 1848 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_extension_oid_index │ AllocSet │ {1,17,59} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_enum_typid_label_index │ AllocSet │ {1,17,60} │ 3 │ 3072 │ 2 │ 1224 │ 3 │ 1848 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_ts_config_oid_index │ AllocSet │ {1,17,61} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_user_mapping_oid_index │ AllocSet │ {1,17,62} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_opfamily_am_name_nsp_index │ AllocSet │ {1,17,63} │ 3 │ 3072 │ 2 │ 1120 │ 1 │ 1952 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_foreign_table_relid_index │ AllocSet │ {1,17,64} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_type_oid_index │ AllocSet │ {1,17,65} │ 3 │ 2048 │ 2 │ 592 │ 2 │ 1456 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_aggregate_fnoid_index │ AllocSet │ {1,17,66} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_constraint_oid_index │ AllocSet │ {1,17,67} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_rewrite_rel_rulename_index │ AllocSet │ {1,17,68} │ 3 │ 3072 │ 2 │ 1224 │ 3 │ 1848 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_ts_parser_prsname_index │ AllocSet │ {1,17,69} │ 3 │ 3072 │ 2 │ 1224 │ 3 │ 1848 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_ts_config_cfgname_index │ AllocSet │ {1,17,70} │ 3 │ 3072 │ 2 │ 1224 │ 3 │ 1848 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_ts_parser_oid_index │ AllocSet │ {1,17,71} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_publication_rel_prrelid_prpubid_index │ AllocSet │ {1,17,72} │ 3 │ 3072 │ 2 │ 1112 │ 1 │ 1960 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_operator_oid_index │ AllocSet │ {1,17,73} │ 3 │ 2048 │ 2 │ 592 │ 2 │ 1456 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_namespace_nspname_index │ AllocSet │ {1,17,74} │ 3 │ 2048 │ 2 │ 592 │ 2 │ 1456 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_ts_template_oid_index │ AllocSet │ {1,17,75} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_amop_opr_fam_index │ AllocSet │ {1,17,76} │ 3 │ 3072 │ 2 │ 960 │ 1 │ 2112 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_default_acl_role_nsp_obj_index │ AllocSet │ {1,17,77} │ 3 │ 3072 │ 2 │ 1088 │ 2 │ 1984 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_collation_name_enc_nsp_index │ AllocSet │ {1,17,78} │ 3 │ 3072 │ 2 │ 1120 │ 1 │ 1952 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_publication_rel_oid_index │ AllocSet │ {1,17,79} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_range_rngtypid_index │ AllocSet │ {1,17,80} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_ts_dict_dictname_index │ AllocSet │ {1,17,81} │ 3 │ 3072 │ 2 │ 1224 │ 3 │ 1848 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_type_typname_nsp_index │ AllocSet │ {1,17,82} │ 3 │ 3072 │ 2 │ 1224 │ 3 │ 1848 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_opfamily_oid_index │ AllocSet │ {1,17,83} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_statistic_ext_oid_index │ AllocSet │ {1,17,84} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_statistic_ext_data_stxoid_inh_index │ AllocSet │ {1,17,85} │ 3 │ 3072 │ 2 │ 1192 │ 2 │ 1880 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_class_oid_index │ AllocSet │ {1,17,86} │ 3 │ 2048 │ 2 │ 592 │ 2 │ 1456 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_proc_proname_args_nsp_index │ AllocSet │ {1,17,87} │ 3 │ 3072 │ 2 │ 1120 │ 1 │ 1952 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_partitioned_table_partrelid_index │ AllocSet │ {1,17,88} │ 3 │ 2048 │ 2 │ 720 │ 3 │ 1328 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_range_rngmultitypid_index │ AllocSet │ {1,17,89} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_transform_type_lang_index │ AllocSet │ {1,17,90} │ 3 │ 3072 │ 2 │ 1224 │ 3 │ 1848 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_attribute_relid_attnum_index │ AllocSet │ {1,17,91} │ 3 │ 3072 │ 2 │ 984 │ 2 │ 2088 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_proc_oid_index │ AllocSet │ {1,17,92} │ 3 │ 2048 │ 2 │ 592 │ 2 │ 1456 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_language_oid_index │ AllocSet │ {1,17,93} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_namespace_oid_index │ AllocSet │ {1,17,94} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_amproc_fam_proc_index │ AllocSet │ {1,17,95} │ 3 │ 3264 │ 3 │ 816 │ 2 │ 2448 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_foreign_server_name_index │ AllocSet │ {1,17,96} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_attribute_relid_attnam_index │ AllocSet │ {1,17,97} │ 3 │ 3072 │ 2 │ 1224 │ 3 │ 1848 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_publication_namespace_pnnspid_pnpubid_index │ AllocSet │ {1,17,98} │ 3 │ 3072 │ 2 │ 1112 │ 1 │ 1960 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_conversion_oid_index │ AllocSet │ {1,17,99} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_user_mapping_user_server_index │ AllocSet │ {1,17,100} │ 3 │ 3072 │ 2 │ 1192 │ 2 │ 1880 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_subscription_rel_srrelid_srsubid_index │ AllocSet │ {1,17,101} │ 3 │ 3072 │ 2 │ 1192 │ 2 │ 1880 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_sequence_seqrelid_index │ AllocSet │ {1,17,102} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_extension_name_index │ AllocSet │ {1,17,103} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_conversion_name_nsp_index │ AllocSet │ {1,17,104} │ 3 │ 3072 │ 2 │ 1224 │ 3 │ 1848 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_authid_oid_index │ AllocSet │ {1,17,105} │ 3 │ 2048 │ 2 │ 592 │ 2 │ 1456 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_auth_members_member_role_index │ AllocSet │ {1,17,106} │ 3 │ 3072 │ 2 │ 1088 │ 2 │ 1984 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_subscription_oid_index │ AllocSet │ {1,17,107} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_parameter_acl_oid_index │ AllocSet │ {1,17,108} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_tablespace_oid_index │ AllocSet │ {1,17,109} │ 3 │ 2048 │ 2 │ 592 │ 2 │ 1456 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_parameter_acl_parname_index │ AllocSet │ {1,17,110} │ 3 │ 2048 │ 2 │ 752 │ 2 │ 1296 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_shseclabel_object_index │ AllocSet │ {1,17,111} │ 3 │ 3072 │ 2 │ 1120 │ 1 │ 1952 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_replication_origin_roname_index │ AllocSet │ {1,17,112} │ 3 │ 2048 │ 2 │ 720 │ 3 │ 1328 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_database_datname_index │ AllocSet │ {1,17,113} │ 3 │ 2048 │ 2 │ 592 │ 2 │ 1456 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_subscription_subname_index │ AllocSet │ {1,17,114} │ 3 │ 3072 │ 2 │ 1224 │ 3 │ 1848 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_replication_origin_roiident_index │ AllocSet │ {1,17,115} │ 3 │ 2048 │ 2 │ 720 │ 3 │ 1328 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_auth_members_role_member_index │ AllocSet │ {1,17,116} │ 3 │ 3072 │ 2 │ 1088 │ 2 │ 1984 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_database_oid_index │ AllocSet │ {1,17,117} │ 3 │ 2048 │ 2 │ 592 │ 2 │ 1456 │ 1 │ 2025-05-05 15:09:57.330051+02 index info │ pg_authid_rolname_index │ AllocSet │ {1,17,118} │ 3 │ 2048 │ 2 │ 592 │ 2 │ 1456 │ 1 │ 2025-05-05 15:09:57.330051+02 LOCALLOCK hash │ [null] │ AllocSet │ {1,18} │ 2 │ 8192 │ 1 │ 576 │ 0 │ 7616 │ 1 │ 2025-05-05 15:09:57.330051+02 WAL record construction │ [null] │ AllocSet │ {1,19} │ 2 │ 50216 │ 2 │ 6384 │ 0 │ 43832 │ 1 │ 2025-05-05 15:09:57.330051+02 PrivateRefCount │ [null] │ AllocSet │ {1,20} │ 2 │ 8192 │ 1 │ 2640 │ 0 │ 5552 │ 1 │ 2025-05-05 15:09:57.330051+02 MdSmgr │ [null] │ AllocSet │ {1,21} │ 2 │ 8192 │ 1 │ 7440 │ 0 │ 752 │ 1 │ 2025-05-05 15:09:57.330051+02 GUCMemoryContext │ [null] │ AllocSet │ {1,22} │ 2 │ 24576 │ 2 │ 8448 │ 1 │ 16128 │ 1 │ 2025-05-05 15:09:57.330051+02 GUC hash table │ [null] │ AllocSet │ {1,22,119} │ 3 │ 32768 │ 3 │ 11552 │ 6 │ 21216 │ 1 │ 2025-05-05 15:09:57.330051+02 Timezones │ [null] │ AllocSet │ {1,23} │ 2 │ 104128 │ 2 │ 2640 │ 0 │ 101488 │ 1 │ 2025-05-05 15:09:57.330051+02 ErrorContext │ [null] │ AllocSet │ {1,24} │ 2 │ 8192 │ 1 │ 7952 │ 5 │ 240 │ 1 │ 2025-05-05 15:09:57.330051+02 (119 rows)
I am really, really excited about this. I think it will actually be extremely useful for getting better visibility into postgres memory usage – and hopefully help us continue to find and fix more code paths in postgres that allocate big chunks of memory without spilling to temp.