Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t11KH-00EJn7-D3 for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Oct 2024 10:32:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1t11KF-001UzX-3m for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Oct 2024 10:32:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t11KE-001UzN-Ou for pgsql-hackers@lists.postgresql.org; Wed, 16 Oct 2024 10:32:19 +0000 Received: from forward103b.mail.yandex.net ([178.154.239.150]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t11KC-001KxO-65 for pgsql-hackers@postgresql.org; Wed, 16 Oct 2024 10:32:18 +0000 Received: from mail-nwsmtp-smtp-production-main-18.iva.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-18.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:3207:0:640:a766:0]) by forward103b.mail.yandex.net (Yandex) with ESMTPS id 7400A608DC; Wed, 16 Oct 2024 13:32:14 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-18.iva.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id hVJ8tqxZxqM0-7l8Payqp; Wed, 16 Oct 2024 13:32:13 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tantorlabs.com; s=mail; t=1729074733; bh=022zb5EEbR+OM2cTXIe0pQv29QC0Y3vX4POizflbW0E=; h=In-Reply-To:Cc:Date:References:To:Subject:Message-ID:From; b=IISxQ0+JpZml/qHJO1Uo/H59lccQstOKR81gjwJEfEeAbINVH2QtOY5Q2skl0p+H/ fLSq0Om8DXIsw4+r6C3lhuZPymap/HuFXORKTUWGnHKQcWMFH8T4hVqFBRlcYcjGBM mAUhPCvwD2g8wdpSTpC0pqGo0ILFvUP9lkK8bD04= Authentication-Results: mail-nwsmtp-smtp-production-main-18.iva.yp-c.yandex.net; dkim=pass header.i=@tantorlabs.com Content-Type: multipart/alternative; boundary="------------Vi0ZksYr5BFKx0SuxZmgAtS0" Message-ID: <1a960398-d12d-419a-af48-4acfe58d0c3a@tantorlabs.com> Date: Wed, 16 Oct 2024 13:31:43 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Vacuum statistics To: Alena Rybakina , pgsql-hackers Cc: jian he , Alexander Korotkov , Andrei Zubkov , Alena Rybakina , a.lepikhov@postgrespro.ru References: <53c47c2d-72a5-44f2-900c-9973b2af1808@tantorlabs.com> <4a902cea-54fb-41b5-b208-b84731a5f577@postgrespro.ru> <092adec6-4eae-4bd4-bd0d-473a9df1282b@tantorlabs.com> <3deae1bd-ad84-4459-a26e-04c9136b84e9@postgrespro.ru> <9b10c6d3-52c4-4eef-b67c-c33442667729@postgrespro.ru> <30e2e941-b9f6-4ea1-aa3b-f0c406b8797d@postgrespro.ru> Content-Language: en-US From: Ilia Evdokimov In-Reply-To: <30e2e941-b9f6-4ea1-aa3b-f0c406b8797d@postgrespro.ru> X-Yandex-Filter: 1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------Vi0ZksYr5BFKx0SuxZmgAtS0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 08.10.2024 19:18, Alena Rybakina wrote: > Made a rebase on a fresh master branch. > -- > Regards, > Alena Rybakina > Postgres Professional Thank you for rebasing. I have noticed that when I create a table or an index on this table, there is no information about the table or index in pg_stat_vacuum_tables and pg_stat_vacuum_indexes until we perform a VACUUM. Example: CREATE TABLE t (i INT, j INT); INSERT INTO t SELECT i/10, i/100 FROM  GENERATE_SERIES(1,1000000) i; SELECT * FROM pg_stat_vacuum_tables WHERE relname = 't'; .... (0 rows) CREATE INDEX ON t (i); SELECT * FROM pg_stat_vacuum_indexes WHERE relname = 't_i_idx'; ... (0 rows) I can see the entries after running VACUUM or executing autovacuum. or when autovacuum is executed. I would suggest adding a line about the relation even if it has not yet been processed by vacuum. Interestingly, this issue does not occur with pg_stat_vacuum_database: CREATE DATABASE example_db; SELECT * FROM pg_stat_vacuum_database WHERE dbname = 'example_db'; dboid |       dbname | ...  ...      | example_db | ... (1 row) BTW, I recommend renaming the view pg_stat_vacuum_database to pg_stat_vacuum_database_S_  for consistency with pg_stat_vacuum_tables and pg_stat_vacuum_indexes -- Regards, Ilia Evdokimov, Tantor Labs LLC. --------------Vi0ZksYr5BFKx0SuxZmgAtS0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit


On 08.10.2024 19:18, Alena Rybakina wrote:
Made a rebase on a fresh master branch.
-- 
Regards,
Alena Rybakina
Postgres Professional

Thank you for rebasing.

I have noticed that when I create a table or an index on this table, there is no information about the table or index in pg_stat_vacuum_tables and pg_stat_vacuum_indexes until we perform a VACUUM.

Example:

CREATE TABLE t (i INT, j INT);
INSERT INTO t SELECT i/10, i/100 FROM  GENERATE_SERIES(1,1000000) i;
SELECT * FROM pg_stat_vacuum_tables WHERE relname = 't';
....
(0 rows)
CREATE INDEX ON t (i);
SELECT * FROM pg_stat_vacuum_indexes WHERE relname = 't_i_idx';
...
(0 rows)

I can see the entries after running VACUUM or executing autovacuum. or when autovacuum is executed. I would suggest adding a line about the relation even if it has not yet been processed by vacuum. Interestingly, this issue does not occur with pg_stat_vacuum_database:

CREATE DATABASE example_db;
SELECT * FROM pg_stat_vacuum_database WHERE dbname = 'example_db';
dboid |       dbname | ...
 ...      | example_db | ...
(1 row)

BTW, I recommend renaming the view pg_stat_vacuum_database to pg_stat_vacuum_databaseS  for consistency with pg_stat_vacuum_tables and pg_stat_vacuum_indexes

--
Regards,
Ilia Evdokimov,
Tantor Labs LLC.

--------------Vi0ZksYr5BFKx0SuxZmgAtS0--