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 1tHFPN-0056CF-DU for pgsql-hackers@arkaria.postgresql.org; Sat, 30 Nov 2024 04:48:41 +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 1tHFPJ-00DLPK-DY for pgsql-hackers@arkaria.postgresql.org; Sat, 30 Nov 2024 04:48:38 +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 1tHFPI-00DLPC-Sd for pgsql-hackers@lists.postgresql.org; Sat, 30 Nov 2024 04:48:38 +0000 Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tHFPH-000Gzv-G1 for pgsql-hackers@postgresql.org; Sat, 30 Nov 2024 04:48:36 +0000 Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2ffc7a2c5d5so24912581fa.1 for ; Fri, 29 Nov 2024 20:48:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732942114; x=1733546914; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=4D5xGVxl7oILlgkTfETtTnWD/tDDGXN2hZt1K1/KfPQ=; b=gWnaeoA6o5ghTdlIaRRn6euR9gCZe9jhdeqX3r+daOeuBiL2QzkytDVS1wOs3AgA6L EM6NHUcUyphojRGjv5sLm8RQTtLyF2RkdHSHCWWBxctZ0ITKM2KOMQBTqDQTrnxYMbmj xm7FtqvDTlPQArzC05TLihguo30NtxSebjt8QcQD62QoKaN6k0OTBE2aY2/u2h8Cd52q xZ4XmGTov4qIvpLgrvv/jt/Ule1Ucy2kz/X1CU9YMmORoOMxjlxaw9+r3wVzCLZNoYI0 ddMY1LcShbe8WuM0uEwFsOaTpjHDFXwayiCDVSRUsfnBVkgLHfA6H4YAxZYpSVdSCeQP T4pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732942114; x=1733546914; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4D5xGVxl7oILlgkTfETtTnWD/tDDGXN2hZt1K1/KfPQ=; b=RLEnCAegeALa01AweWjyuYuhY/Csoier1I5jGsbe1gYNgnytKmNy12F88MF/B6a2/x gV7yMHrpleueEa7i5lOUsXzsqBsC9F/Te3l/an5sgzVH5lXktB6RzgqCcEBBLRLminCu QlP8c/nJHJtmodQgkVLmyJC0yls+t/CpMXY35Caf2jPGMGWSiyBWD2b6PX3ar+D1sAih 2UzzJFTjBGeXeWwMSZoG6/QS12YTsMiqXwK4vHu0EJqPuIflCwZVFKy0SiaN0kvzKAkZ 8oCi8agl9ZCDeC/s6h12Vc/0aBglWfQ1MNs4jyBDvGiqP40qWGcAjyxo4BZo111XmuBW 9JdA== X-Forwarded-Encrypted: i=1; AJvYcCXdsuqsatuApF/38xdbVv8tBFeyrj4cIJr2ZnNaylkxab8m73SBNYVdjyaoK6OJ14PpOr8gq2PPhS3VT72x@postgresql.org X-Gm-Message-State: AOJu0YxLx9Xc0pYsszmpkpaDj8d2wnYgJfcx6S13kU5c6QhhurSemw9L 6ixY0gmtuRKrWvfh3/xV6kKq9wv373f9xAPaUVurKJ8N5KscckrC5Edsuuf8QEw8sryp+QO1Pf0 GfEEiWny3tqX2lNWmtJt/YyuceVqutXBkXKo= X-Gm-Gg: ASbGncv1aPFUyyyRmSVHOC5nx43hreH6e/oP8tynhO4278xBWsx7WFMJqmpaPYQec2l ehe8gmC9MkuV6PjTlmHXRDUJQ/uey X-Google-Smtp-Source: AGHT+IHb6EajXzPvjn//ntU2HWw4lBiNEkazR+IbLCQTtn3fXi3GjQMa0YF+dKbnR2kYXGxKowuGRfD4OfMcY3UBC00= X-Received: by 2002:a2e:be24:0:b0:2fb:58b1:3731 with SMTP id 38308e7fff4ca-2ffd5fcc293mr54443651fa.6.1732942113507; Fri, 29 Nov 2024 20:48:33 -0800 (PST) MIME-Version: 1.0 References: <9b10c6d3-52c4-4eef-b67c-c33442667729@postgrespro.ru> <9485d892-fd04-4e3a-ac24-7dd767cb7333@postgrespro.ru> <0B6CBF4C-CC2A-4200-9126-CE3A390D938B@upgrade.com> <6732acf8ce0f31025b535ae1a64568750924a887.camel@moonset.ru> <5AA8FFD5-6DE2-4A31-8E00-AE98F738F5D1@upgrade.com> <85b963fe-5977-43aa-9241-75b862abcc69@postgrespro.ru> <9C7A167C-DCDE-4A17-9ABE-6276723FEC50@upgrade.com> <2d493cf9-9ba7-4cc1-a3f2-67afd7c163ee@postgrespro.ru> In-Reply-To: <2d493cf9-9ba7-4cc1-a3f2-67afd7c163ee@postgrespro.ru> From: Kirill Reshke Date: Sat, 30 Nov 2024 09:48:22 +0500 Message-ID: Subject: Re: Vacuum statistics To: Alena Rybakina Cc: Jim Nasby , Andrei Zubkov , Alexander Korotkov , Masahiko Sawada , Melanie Plageman , jian he , pgsql-hackers , a.lepikhov@postgrespro.ru Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 13 Nov 2024 at 21:21, Alena Rybakina wr= ote: > > Hi! Thank you for your contribution to this thread! > > On 13.11.2024 03:24, Jim Nasby wrote: > > On Nov 10, 2024, at 2:09=E2=80=AFPM, Alena Rybakina wrote: > > > On 08.11.2024 22:34, Jim Nasby wrote: > > > On Nov 2, 2024, at 7:22=E2=80=AFAM, Alena Rybakina wrote: > > The second is the interrupts field. It is needed for monitoring to know > do we have them or not, so tracking them on the database level will do > the trick. Interrupt is quite rare event, so once the monitoring system > will catch one the DBA can go to the server log for the details. > > Just to confirm=E2=80=A6 by =E2=80=9Cinterrupt=E2=80=9D you mean vacuum e= ncountered an error? > > Yes it is. > > In that case I feel rather strongly that we should label that as =E2=80= =9Cerrors=E2=80=9D. =E2=80=9CInterrupt=E2=80=9D could mean a few different = things, but =E2=80=9Cerror=E2=80=9D is very clear. > > I updated patches. I excluded system and user time statistics and save nu= mber of interrupts only for database. I removed the ability to get statisti= cs for all tables, now they can only be obtained for an oid table [0], as s= uggested here. I also renamed the statistics from pg_stat_vacuum_tables to = pg_stat_get_vacuum_tables and similarly for indexes and databases. I notice= d that that=E2=80=99s what they=E2=80=99re mostly called. Ready for discuss= ion. > > I think it=E2=80=99s better that the views follow the existing naming con= ventions (which don=E2=80=99t include =E2=80=9C_get_=E2=80=9D; only the fun= ctions have that in their names). Assuming that, the only question becomes = pg_stat_vacuum_* vs pg_stat_*_vacuum. Given the existing precedent of pg_st= atio_*, I=E2=80=99m inclined to go with pg_stat_vacuum_*. > > I have fixed it. > > > I=E2=80=99ve reviewed and made some cosmetic changes to patch 1, though o= f note it looks like an effort has been made to keep stat_reset_timestamp a= t the end of PgStat_StatDBEntry, so I re-arranged that. I also removed some= obviously dead code. It appears that pgstat_update_snapshot(), InitSnapsho= tIterator() and ScanStatSnapshot() are also dead, but I=E2=80=99ve left it = in incase I=E2=80=99m missing something. The tests are also failing for me = because a number of psql variables aren=E2=80=99t set. > > Thank you! Yes, I have deleted them. > > > I do think we should separate out the counts for deleted but still visibl= e tuples vs tuples where we couldn=E2=80=99t get a cleanup lock (in other w= ords, recently_dead_tuples and missed_dead_tuples from LVRelState). I reali= ze that=E2=80=99s a departure from how some of the existing reporting works= , but IMO combining them together isn=E2=80=99t a pattern we should be repe= ating since they mean completely different things. Towards that end I did r= emove missed_dead_tuples from the reporting, and renamed ExtVacReport.dead_= tuples to recently_dead_tuples, but I stopped short of creating a separate = entry for missed_dead_tuples. Note that while recently_dead_tuples is reall= y a global thing (so only needs to be reported at a global (or at most per-= database) level, but missed_dead_tuples should really be at a per-table lev= el. > > I am willing to agree with your idea. But we need to think about how clea= rly describe them in the documentation. > > > Updated 0001-v13 attached, as well as the diff between v12 and v13. > > Thank you) > > And I agree with your changes. And included them in patches. > > --- > Regards, > Alena Rybakina > Postgres Professional Hello! After a brief glance, I think this patch set is good. But there isn't any more time in the current CF to commit this :(. So I moved to the next CF. I also like the 0001 commit message. This commit message is quite large and easy to understand. Actually, it might be too big. Perhaps rather of being a commit message, the final paragraph (pages_frozen - number of pages that..) need to be a part of the document. Perhaps delete the explanation on pages_frozen that we have in 0004? --=20 Best regards, Kirill Reshke