Query: SELECT name, "type", count(*), sum(total_bytes) total_bytes, sum(total_nblocks) total_nblocks, sum(free_bytes) free_bytes, sum(free_chunks) free_chunks, sum(used_bytes) used_bytes, sum(used_bytes) / sum(total_nblocks) AS hinky_chunk_size FROM pg_backend_memory_contexts WHERE path @> (SELECT path FROM pg_backend_memory_contexts WHERE name = 'CacheMemoryContext') GROUP BY GROUPING SETS ((name, "type"), ()); Master name | type | count | total_bytes | total_nblocks | free_bytes | free_chunks | used_bytes | hinky_chunk_size --------------------+----------+-------+-------------+---------------+------------+-------------+------------+----------------------- CacheMemoryContext | AllocSet | 1 | 2097152 | 9 | 172904 | 1 | 1924248 | 213805.333333333333 CachedPlan | AllocSet | 3 | 32768 | 13 | 12712 | 2 | 20056 | 1542.7692307692307692 CachedPlanQuery | AllocSet | 4 | 36864 | 16 | 15072 | 1 | 21792 | 1362.0000000000000000 CachedPlanSource | AllocSet | 4 | 28672 | 14 | 9104 | 5 | 19568 | 1397.7142857142857143 SPI Plan | AllocSet | 2 | 2048 | 2 | 1200 | 0 | 848 | 424.0000000000000000 SQL function | AllocSet | 2 | 2048 | 2 | 976 | 0 | 1072 | 536.0000000000000000 index info | AllocSet | 138 | 287872 | 225 | 102272 | 118 | 185600 | 824.8888888888888889 relation rules | AllocSet | 88 | 2119680 | 516 | 303736 | 65 | 1815944 | 3519.2713178294573643 | | 242 | 4607104 | 797 | 617976 | 192 | 3989128 | 5005.1794228356336261 (9 rows) +0001-0003 name | type | count | total_bytes | total_nblocks | free_bytes | free_chunks | used_bytes | hinky_chunk_size ----------------------+----------+-------+-------------+---------------+------------+-------------+------------+----------------------- CacheMemoryContext | AllocSet | 1 | 2097152 | 9 | 135952 | 1 | 1961200 | 217911.111111111111 CachedPlan | AllocSet | 3 | 32768 | 13 | 12712 | 2 | 20056 | 1542.7692307692307692 CachedPlanQuery | AllocSet | 4 | 36864 | 16 | 15072 | 1 | 21792 | 1362.0000000000000000 CachedPlanSource | AllocSet | 4 | 28672 | 14 | 9104 | 5 | 19568 | 1397.7142857142857143 Relation shape cache | AllocSet | 1 | 16384 | 2 | 4616 | 2 | 11768 | 5884.0000000000000000 SPI Plan | AllocSet | 2 | 2048 | 2 | 1200 | 0 | 848 | 424.0000000000000000 SQL function | AllocSet | 2 | 2048 | 2 | 976 | 0 | 1072 | 536.0000000000000000 index info | AllocSet | 138 | 141312 | 138 | 90176 | 0 | 51136 | 370.5507246376811594 relation rules | AllocSet | 88 | 2119680 | 516 | 303736 | 65 | 1815944 | 3519.2713178294573643 | | 243 | 4476928 | 712 | 573544 | 76 | 3903384 | 5482.2808988764044944 (10 rows) +0004, 0005: name | type | count | total_bytes | total_nblocks | free_bytes | free_chunks | used_bytes | hinky_chunk_size ----------------------+----------+-------+-------------+---------------+------------+-------------+------------+----------------------- CacheMemoryContext | AllocSet | 1 | 2097152 | 9 | 135952 | 1 | 1961200 | 217911.111111111111 CachedPlan | AllocSet | 3 | 32768 | 13 | 12712 | 2 | 20056 | 1542.7692307692307692 CachedPlanQuery | AllocSet | 4 | 36864 | 16 | 15072 | 1 | 21792 | 1362.0000000000000000 CachedPlanSource | AllocSet | 4 | 28672 | 14 | 9104 | 5 | 19568 | 1397.7142857142857143 Relation shape cache | AllocSet | 1 | 16384 | 2 | 4616 | 2 | 11768 | 5884.0000000000000000 SPI Plan | AllocSet | 2 | 2048 | 2 | 1200 | 0 | 848 | 424.0000000000000000 SQL function | AllocSet | 2 | 2048 | 2 | 976 | 0 | 1072 | 536.0000000000000000 index info | Proxy | 138 | 45392 | 460 | 0 | 0 | 45392 | 98.6782608695652174 relation rules | AllocSet | 88 | 2119680 | 516 | 303736 | 65 | 1815944 | 3519.2713178294573643 | | 243 | 4381008 | 1034 | 483368 | 76 | 3897640 | 3769.4777562862669246 (10 rows)