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 1sdrQS-001e7C-AN for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Aug 2024 13:19:00 +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 1sdrQQ-003uhj-Ue for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Aug 2024 13:18:58 +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 1sdrQQ-003uhP-Jj for pgsql-hackers@lists.postgresql.org; Tue, 13 Aug 2024 13:18:58 +0000 Received: from forward100d.mail.yandex.net ([178.154.239.211]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sdrQK-004edv-0z for pgsql-hackers@postgresql.org; Tue, 13 Aug 2024 13:18:57 +0000 Received: from mail-nwsmtp-smtp-production-main-38.myt.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-38.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:2f05:0:640:8b61:0]) by forward100d.mail.yandex.net (Yandex) with ESMTPS id 3600860967; Tue, 13 Aug 2024 16:18:50 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-38.myt.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id mIjAV2upJiE0-hiy0IQWZ; Tue, 13 Aug 2024 16:18:49 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tantorlabs.com; s=mail; t=1723555129; bh=oIGLHinoOIby4WqHSzwOgL2/4fDM0FRQJ4+1qwl8xPI=; h=In-Reply-To:Cc:Date:References:To:Subject:Message-ID:From; b=wX2KI7iZptR82r9hwVbLkPcBSMqzJkA1T8mB8ZEyw94YwKtKVYH8In2s9RNLmWJlN Cxyh6L5RCH95Ah/5AKeyMkHYOxdlTqvpH00ogGoCTo5q2/KO4nagNM+4K8LIex+KZH ZH31DoDKYKJ6yFvPMbJQLOVox4Xt7Q0S1TlwKZ0s= Authentication-Results: mail-nwsmtp-smtp-production-main-38.myt.yp-c.yandex.net; dkim=pass header.i=@tantorlabs.com Content-Type: multipart/alternative; boundary="------------WCtZjXIpzJpXYWv0PIJeg2cK" Message-ID: <53c47c2d-72a5-44f2-900c-9973b2af1808@tantorlabs.com> Date: Tue, 13 Aug 2024 16:18:48 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Vacuum statistics To: Andrei Zubkov , Alena Rybakina Cc: pgsql-hackers , a.lepikhov@postgrespro.ru References: Content-Language: en-US From: Ilia Evdokimov In-Reply-To: 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. --------------WCtZjXIpzJpXYWv0PIJeg2cK Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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. 2. These functions are almost the same and I would think of writing one function depending of type 'ExtVacReportType' --------------WCtZjXIpzJpXYWv0PIJeg2cK Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

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.
  2. These functions are almost the same and I would think of writing one function depending of type 'ExtVacReportType'
--------------WCtZjXIpzJpXYWv0PIJeg2cK--