Re: Vacuum statistics

From: Alena Rybakina <a(dot)rybakina(at)postgrespro(dot)ru>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, Jim Nasby <jnasby(at)upgrade(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>
Cc: Ilia Evdokimov <ilya(dot)evdokimov(at)tantorlabs(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Alexander Korotkov <aekorotkov(at)gmail(dot)com>, Kirill Reshke <reshkekirill(at)gmail(dot)com>, Andrei Zubkov <zubkov(at)moonset(dot)ru>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Melanie Plageman <melanieplageman(at)gmail(dot)com>, jian he <jian(dot)universality(at)gmail(dot)com>, a(dot)lepikhov(at)postgrespro(dot)ru, Sami Imseih <samimseih(at)gmail(dot)com>
Subject: Re: Vacuum statistics
Date: 2025-03-25 06:12:57
Message-ID: 5583261b-eede-4341-b3b1-91650fefc1cf@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi! I rebased the patches again - PGSTAT_FILE_FORMAT_ID needed to be fixed.

On 21.03.2025 22:42, Alena Rybakina wrote:
>
> I will add it and fix the tests but later and I'll explain why.
>
> I'm working on this issue [0] and try have already created new
> statistics in Statistics Collector to store database and relation
> vacuum statistics: PGSTAT_KIND_VACUUM_DB and PGSTAT_KIND_VACUUM_RELATION.
>
> Vacuum statistics are saved there instead of relation's and database's
> statistic structure, but for some reason it is not possible to find
> them in the hash table when building a snapshot and display them
> accordingly.
> I have not yet figured out where the error is.
>
> Without solving this problem, committing vacuum statistics is not yet
> possible. An alternative way for us was to refuse some statistics for
> now for relations,
> but we could not agree on which statistics should not be displayed yet
> and for now we are only adding them :).
>
> I understand why this is important to display more vacuum information
> about vacuum statistics - it will allow us to better understand the
> problems of incorrect vacuum settings or, for example, notice a bug in
> its operation.
>
> In order to reduce the memory consumption for storing them for those
> who are not going to use them, I just realized that we need to create
> a separate space for storing the statistics
> I mentioned above (PGSTAT_KIND_VACUUM_DB and
> PGSTAT_KIND_VACUUM_RELATION), there is no other way to do this and I
> am still trying to complete this functionality.
>
> I doubt that I will have time for this by code freeze date and even if
> I do, I will hardly have time for a normal review. There's really a
> lot more to learn related to the stat collector, so
> I'm postponing it to the next commitfest.
>
> Sorry. I'll fix the tests as soon as I finish this part, since they'll
> most likely either break the same way or in some new way.
>
> Tomorrow or the day after tomorrow I will send a diff patch with what
> I have already managed to demonstrate the problem, since I need to
> bring the code to a normal form.
> Maybe someone who worked with the stat collector will suddenly tell me
> where and what I have implemented incorrectly.
>
I attached also diff version that contains what I was talking about. The
test case:

create table t (x int);

insert into t select id from generate_series(1,1000) id;

delete from t where id > 900;

vacuum;

select * from pg_stat_vacuum_tables where relname = 't';

--
Regards,
Alena Rybakina
Postgres Professional

Attachment Content-Type Size
v21-0004-Add-documentation-about-the-system-views-that-are-us.patch text/x-patch 24.5 KB
v21-0003-Machinery-for-grabbing-an-extended-vacuum-statistics.patch text/x-patch 31.1 KB
v21-0002-Machinery-for-grabbing-an-extended-vacuum-statistics.patch text/x-patch 58.0 KB
v21-0001-Machinery-for-grabbing-an-extended-vacuum-statistics.patch text/x-patch 71.1 KB
vacuum_moved_new_entry.diff.no-cfbot text/plain 29.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2025-03-25 06:14:43 Re: Reduce TupleHashEntryData struct size by half
Previous Message Lukas Fittl 2025-03-25 06:09:06 Re: query_id: jumble names of temp tables for better pg_stat_statement UX