Re: PoC: history of recent vacuum/checkpoint runs (using new hooks)

From: Tomas Vondra <tomas(at)vondra(dot)me>
To: wenhui qiu <qiuwenhuifx(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PoC: history of recent vacuum/checkpoint runs (using new hooks)
Date: 2024-12-25 17:25:50
Message-ID: 8df7cee1-31aa-4db3-bbb7-83157ca139da@vondra.me
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 12/23/24 07:35, wenhui qiu wrote:
> Hi Tomas 
>      This is a great feature.  
> + /*
> + * Define (or redefine) custom GUC variables.
> + */
> + DefineCustomIntVariable("stats_history.size",
> + "Sets the amount of memory available for past events.",
> + NULL,
> + &statsHistorySizeMB,
> + 1,
> + 1,
> + 128,
> + PGC_POSTMASTER,
> + GUC_UNIT_MB,
> + NULL,
> + NULL,
> + NULL);
> +
> RAM is in terabytes now, the statsHistorySize is 128MB ,I think can
> increase to store more history record ?
>

Maybe, the 128MB is an arbitrary (and conservative) limit - it's enough
for ~500k events, which seems good enough for most systems. Of course,
on systems with many relations might need more space, not sure.

I was thinking about specifying the space in more natural terms, either
as amount of time ("keep 1 day of history") or number of entries ("10k
entries"). That would probably mean the memory can't be allocated as
fixed size.

But maybe it'd be possible to just write the entries to a file. We don't
need random access to past entries (unlike e.g. pg_stat_statements), and
people won't query that very often either.

regards

--
Tomas Vondra

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2024-12-25 19:49:50 Connection limits/permissions, slotsync workers, etc
Previous Message Heikki Linnakangas 2024-12-25 17:25:18 Re: Exporting float_to_shortest_decimal_buf(n) with Postgres 17 on Windows