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 1t11n7-00EMfr-CV for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Oct 2024 11:02:10 +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 1t11n5-001mBn-03 for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Oct 2024 11:02:07 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t11n4-001mBR-DD for pgsql-hackers@lists.postgresql.org; Wed, 16 Oct 2024 11:02:07 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t11mx-001ASc-1H for pgsql-hackers@postgresql.org; Wed, 16 Oct 2024 11:02:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1729076515; bh=A/ZJ32a90NxQJViD2/CFEahSJDJUakcWD7y7qGI8A98=; h=Message-ID:Date:User-Agent:Subject:To:Cc:References:From: In-Reply-To:From; b=gw066rmjy3zu673TjyFMbdOY+j3sytHOq8aq/SwchCcx5RI3u0+QzCGZPKHig0GBq A/o7/cE7/vAH+Yce7GQD+qsRjzhPK5UXfYxcFqcRzTLy9Bc2NF7W2OQVVjgwTrEE3E OYdaXfrq96NZN2y37Q1H1wZOIdEFLgowEl2QFXIb+GuLX9kRqBJ9n3SAoU6/mmNBef IJ+erks5j+KDhon1hcRSSzEP88proWvVSuM5SlYM2JdD89RSNa8xbfPG/yDDI0JDz+ gFa2tY+IXX6yZ33K9uhSk/SbJzaKhjfaXebaeTtZdmri7gRAq7jhSdxeSr0vQbPZoW ZCB8bUQDK5MMA== Received: from [172.30.33.154] (unknown [172.30.33.154]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: a.rybakina@postgrespro.ru) by mail.postgrespro.ru (Postfix/587) with ESMTPSA id 9CF2C601EF; Wed, 16 Oct 2024 14:01:55 +0300 (MSK) Content-Type: multipart/alternative; boundary="------------CHJRVcuGBYvHSDnaPi2ngz16" Message-ID: <8b2f3c20-02ac-4658-b78f-e9d7590f893b@postgrespro.ru> Date: Wed, 16 Oct 2024 14:01:55 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Vacuum statistics To: Ilia Evdokimov , 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> <1a960398-d12d-419a-af48-4acfe58d0c3a@tantorlabs.com> Content-Language: en-US From: Alena Rybakina In-Reply-To: <1a960398-d12d-419a-af48-4acfe58d0c3a@tantorlabs.com> X-KSMG-AntiPhishing: NotDetected X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.1.0.7854, bases: 2024/10/16 08:47:00 #26761570 X-KSMG-AntiVirus-Status: NotDetected, skipped X-KSMG-LinksScanning: not scanned, disabled by settings X-KSMG-Message-Action: skipped X-KSMG-Rule-ID: 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. --------------CHJRVcuGBYvHSDnaPi2ngz16 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi! On 16.10.2024 13:31, Ilia Evdokimov wrote: > > > 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 > Thanks for the review. I'm investigating this. I agree with the renaming, I will do it in the next version of the patch. -- Regards, Alena Rybakina Postgres Professional --------------CHJRVcuGBYvHSDnaPi2ngz16 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Hi!

On 16.10.2024 13:31, Ilia Evdokimov wrote:


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

Thanks for the review. I'm investigating this. I agree with the renaming, I will do it in the next version of the patch.

-- 
Regards,
Alena Rybakina
Postgres Professional
--------------CHJRVcuGBYvHSDnaPi2ngz16--