On Wed, Dec 18, 2019 at 12:06 PM Tom Lane <t...@sss.pgh.pa.us> wrote:
> It seems like it'd be worth subdividing "<anonymous>" into the actual
> anonymous allocations and the allocator overhead (which is both
> padding and whatever the shmem allocator itself eats).  Maybe call
> the latter "<overhead>".  After which, I'd be tempted to call the
> free space "<free>" rather than giving it a null name.

Here's a new version that takes a slightly different approach: it adds
an additional column to the view for "allocated_size," so that you can
see both what was requested and what you actually got.  With this
approach, you can do interesting things like:

select *, off - lag(off + allocated_size, 1) over () as hole_size from
(select * from pg_shmem_allocations order by 2) x;

...which didn't work very well with the previous version.

All of this makes me think that we might want to do some followup to
(1) convert anonymous allocations to non-anonymous allocations, for
inspectability, and (2) do some renaming to get better stylistic
agreement between the names of various shared memory chunks. But I
think that work is properly done after this patch is committed, not
before.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Attachment: v3-0001-Add-a-pg_shmem_allocations-view.patch
Description: Binary data

Reply via email to