Re: Vacuum statistics

From: Alena Rybakina <a(dot)rybakina(at)postgrespro(dot)ru>
To: Ilia Evdokimov <ilya(dot)evdokimov(at)tantorlabs(dot)com>, Andrei Zubkov <zubkov(at)moonset(dot)ru>, Alena Rybakina <lena(dot)ribackina(at)yandex(dot)ru>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, a(dot)lepikhov(at)postgrespro(dot)ru
Subject: Re: Vacuum statistics
Date: 2024-08-15 08:49:36
Message-ID: 4a902cea-54fb-41b5-b208-b84731a5f577@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi!

On 13.08.2024 16:18, Ilia Evdokimov wrote:
>
> On 10.8.24 22:37, Andrei Zubkov wrote:
>
>> Hi, Ilia!
>>
>>> Do you consider not to create new table in pg_catalog but to save
>>> statistics in existing table? I mean pg_class or
>>> pg_stat_progress_analyze, pg_stat_progress_vacuum?
>>>
>> Thank you for your interest on our patch!
>>
>> *_progress views is not our case. They hold online statistics while
>> vacuum is in progress. Once work is done on a table the entry is gone
>> from those views. Idea of this patch is the opposite - it doesn't
>> provide online statistics but it accumulates statistics about rosources
>> consumed by all vacuum passes over all relations. It's much closer to
>> the pg_stat_all_tables than pg_stat_progress_vacuum.
>>
>> It seems pg_class is not the right place because it is not a statistic
>> view - it holds the current relation state and haven't anything about
>> the relation workload.
>>
>> Maybe the pg_stat_all_tables is the right place but I have several
>> thoughts about why it is not:
>> - Some statistics provided by this patch is really vacuum specific. I
>> don't think we want them in the relation statistics view.
>> - Postgres is extreamly extensible. I'm sure someday there will be
>> table AMs that does not need the vacuum at all.
>>
>> Right now vacuum specific workload views seems optimal choice to me.
>>
>> Regards,
>
>
> Agreed. They are not god places to store such statistics.
>
>
> I have some suggestions:
>
> 1. pgstatfuncs.c in functions tuplestore_put_for_database() and
> tuplestore_put_for_relation you can remove 'nulls' array if you're
> sure that columns cannot be NULL.
>
We need to use this for tuplestore_putvalues function. With this
function, we fill the table with the values of the statistics.
>
> 1.
>
>
> 2. These functions are almost the same and I would think of writing
> one function depending of type 'ExtVacReportType'
>
I'm not sure that I fully understand what you mean. Can you explain it
more clearly, please?

On 13.08.2024 16:37, Ilia Evdokimov wrote:
> And I have one suggestion for pg_stat_vacuum_database: I suppose we
> should add database's name column after 'dboid' column because it is
> difficult to read statistics without database's name. We could call it
> 'datname' just like in 'pg_stat_database' view.
>
Thank you. Fixed.

--
Regards,
Alena Rybakina
Postgres Professional:http://www.postgrespro.com
The Russian Postgres Company

Attachment Content-Type Size
v5-0001-Machinery-for-grabbing-an-extended-vacuum-statistics.patch text/x-patch 66.1 KB
v5-0002-Machinery-for-grabbing-an-extended-vacuum-statistics.patch text/x-patch 41.4 KB
v5-0003-Machinery-for-grabbing-an-extended-vacuum-statistics.patch text/x-patch 18.9 KB
v5-0004-Add-documentation-about-the-system-views-that-are-us.patch text/x-patch 24.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2024-08-15 08:57:03 Re: Statistics Import and Export
Previous Message Thomas Munro 2024-08-15 08:49:11 Re: On non-Windows, hard depend on uselocale(3)