Hi Jakub,

On Wed, Apr 02, 2025 at 04:45:53PM +0200, Jakub Wartak wrote:
> On Tue, Apr 1, 2025 at 5:13 PM Bertrand Drouvot
> <bertranddrouvot...@gmail.com> wrote:
> >
> > === 4
> >
> > +               for (i = 0; i < NBuffers; i++)
> > +               {
> > +                       int                     blk2page = (int) i * 
> > pages_per_blk;
> > +
> >
> > I think that should be:
> >
> > int blk2page = (int) (i * pages_per_blk);
> 
> OK, but I still fail to grasp why pg_indent doesnt fix this stuff on
> it's own... I believe orginal ident, would fix this on it's own?

My comment was not about indention but about the fact that I think that the
casting is not a the right place. I think that's the result of the 
multiplication
that we want to be casted (cast operator has higher precedence than 
Multiplication
operator).

> >
> > select c.name, c.size as num_size, s.size as shmem_size
> > from (select n.name as name, sum(n.size) as size from 
> > pg_shmem_numa_allocations n group by n.name) c, pg_shmem_allocations s
> > where c.name = s.name;
> >
> > I can see:
> >
> > - pg_shmem_numa_allocations reporting a lot of times the same size
> > - pg_shmem_numa_allocations and pg_shmem_allocations not reporting the same 
> > size
> >
> > Do you observe the same?
> >
> 
> Yes, it is actually by design: the pg_shmem_allocations.size is sum of
> page sizes not size of struct,

Ok, but then does it make sense to see some num_size < shmem_size?

postgres=# select c.name, c.size as num_size, s.size as shmem_size
 from (select n.name as name, sum(n.size) as size from 
pg_shmem_numa_allocations n group by n.name) c, pg_shmem_allocations s
 where c.name = s.name and s.size > c.size;
     name      | num_size  | shmem_size
---------------+-----------+------------
 XLOG Ctl      |   4194304 |    4208200
 Buffer Blocks | 134217728 |  134221824
 AioHandleIOV  |   2097152 |    2850816
(3 rows)

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com


Reply via email to