Re: Thinko in pgstat_build_snapshot()

From: Gurjeet Singh <gurjeet(at)singh(dot)im>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Thinko in pgstat_build_snapshot()
Date: 2025-03-30 20:46:48
Message-ID: CABwTF4WZxGN=1m6RGS2-G+pMXY-Ny02vmEG4u-1ua+z0oQ9O8A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Mar 30, 2025 at 4:31 AM Heikki Linnakangas <hlinnaka(at)iki(dot)fi> wrote:
>
> On 30/03/2025 13:23, Etsuro Fujita wrote:
> > While working on something else I noticed $SUBJECT: we are allocating
> > more memory than necessary and copying more data than necessary
> > because we specify the wrong PgStat_KindInfo member as the size
> > argument for MemoryContextAlloc and memcpy. This could become
> > problematic if snapshotting a very large number of variables stats, so
> > I fixed it. Attached is a patch for that.
>
> Good catch. Patch looks good to me at quick glance.

+1 on both counts.

Best regards,
Gurjeet
http://Gurje.et

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-03-30 21:58:11 Re: general purpose array_sort
Previous Message Pavel Stehule 2025-03-30 18:53:02 Re: SQLFunctionCache and generic plans