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 1v1ZSH-00A4jB-Mp for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Sep 2025 00:03:25 +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 1v1ZSE-00GalP-Nn for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Sep 2025 00:03:22 +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 1v1ZSE-00GalH-Dm for pgsql-hackers@lists.postgresql.org; Thu, 25 Sep 2025 00:03:22 +0000 Received: from mail-il1-x12b.google.com ([2607:f8b0:4864:20::12b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v1ZSC-002GfK-0M for pgsql-hackers@postgresql.org; Thu, 25 Sep 2025 00:03:21 +0000 Received: by mail-il1-x12b.google.com with SMTP id e9e14a558f8ab-4248b320541so3977255ab.1 for ; Wed, 24 Sep 2025 17:03:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1758758600; x=1759363400; 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=0l+FbaHR6friUA5e/QXosSFIM4jNvPW7ddD4aflGDAs=; b=j2uTHfjeKgVsIamfdDIAjawNy2rdpD0Brx3i8lZeWvQz21HIEMEm0wvpNXz2FSMaVQ 8vtOBP/oih+jqfjvXv6X7CVf5SWTn3aHFs3b7kT+SSw2HNCxC4+VoEg8dIqC0el/L+Lg T6oFsOiJFsjho2TjrN5oFlxdWTWDZrokgCJKDVkAfJzbSnCZjYNadNbhbQ14G1/jqAiq L16KNilg7fgrMGyRBx8sDHg0G8RCCWOXlt42kfDkTEHSkwHAe3KNkJOB2exdr111FXis TaHpLZLdnZrImkhXxFUdp/YmCuVILVXQhcz7JHCuuvQZj9FEydVa+MeRyMT2nA9PkI1G 4a+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758758600; x=1759363400; 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=0l+FbaHR6friUA5e/QXosSFIM4jNvPW7ddD4aflGDAs=; b=MWugM27sn+tHWZTlPgV3sJhCp0cZm4wU715aKu4uSnIVs2sEQ6vsNMHW8CO6AgFX5j T+YOQZcPrYhAtinCNr4VSzgFo0ux9Pi0EPU4RG+X+9HOEdw0VEJr+G7jbBgAoUZprDas 1W7gOm+WhyYotEWkWDJ5lH0ZpjN+qQabF+QDxwyebnbG/aWh1LjUm2VXohHB+Y3INupG vwxuf/6MbrGIvMabxqpUT98fNfR1I8r9LdglU/g9ujwzPAvL5y9Z5Gpvj5vCBndjGhOA Ku9eD8HK0DJjI++7L6DTYKPe+IbJu0s9Wo8Y5ogaoHxwXVx9L2yMawMgzuMscWM7SnXU JFEQ== X-Forwarded-Encrypted: i=1; AJvYcCVKpPqhTesaayNmfCAOiAZ7x7w7RWlxZxVPveUG3pB3LP8gVP7+VjyOOCEGpxUNprUFCDxsjVjkiphxn65e@postgresql.org X-Gm-Message-State: AOJu0YxcgBvEkmSCrXFh8BbETiSvt8H8KzDlD/w/XrZgv3LH+aVvuRXc kp1v8TVA2so/qGla4dIYEt9oTrgMFnk8L2CR8VWnkwJMPfDxeJyxirCfimDdURRzCcEgg0nhmXV wvfLSJQKS8cFy0Z6iMyg9Wsgp2QbWU8Y= X-Gm-Gg: ASbGncv1p3PIBsS3LFqKJ3I7vREqZI2NvDdJaLjCknytJSA2ljBeW055vE6YN8JFOcR oZoS460EEICXAnKQzm+3bIKhrP1cNJ3zhYNUYxmxztiht/egoGPojFPKhWFEhUiKo64km4sSfqb e+yTlLkJv3rQO+8hjyrrOP0TUMrzTa7o/zuAQuaHQropWXVh0+Fl0zQnvH6qvz9hAS+rNV6S/Gh BzMWANc4sah7+gyNLKj+m4AoUELvq97mW+NJxrc9HEOqDU7lxs= X-Google-Smtp-Source: AGHT+IHn19HkgA+Rb/Fa+3J8mpN0yftr05PySfMrXBI2g5h35XG5QCimZw7WetueUHMY+qbku7BxfawcPTijHxkROyY= X-Received: by 2002:a05:6e02:18c5:b0:424:866:ec6d with SMTP id e9e14a558f8ab-425955d4f26mr24626615ab.12.1758758599653; Wed, 24 Sep 2025 17:03:19 -0700 (PDT) MIME-Version: 1.0 References: <86f76aa5-1ab5-4e2e-9b15-405051852a2a@postgrespro.ru> <1e81a0a1-a63b-48fb-905a-d6495f89ab73@postgrespro.ru> <0b4eefc7-4c38-4caa-b2ca-a4c75dd7dd12@postgrespro.ru> <333c2306-c401-4959-9f0c-a44c670a11a9@postgrespro.ru> <513f0188-b093-4cc8-98cf-4c324570d525@postgrespro.ru> <47a7b784-5218-43f2-96e3-65f9a729c5a5@tantorlabs.com> <5583261b-eede-4341-b3b1-91650fefc1cf@postgrespro.ru> <2a04ad18-5572-4633-848b-eb57209e7ac0@postgrespro.ru> In-Reply-To: From: Bharath Rupireddy Date: Wed, 24 Sep 2025 17:03:08 -0700 X-Gm-Features: AS18NWCiz4OuFhNZjyAU_7nhiib3iS2hA2OtYzD6MXP-sA3u0UQRDD2YN5R0lXA Message-ID: Subject: Re: Vacuum statistics To: Amit Kapila Cc: Alena Rybakina , Alexander Korotkov , pgsql-hackers , Jim Nasby , Bertrand Drouvot , Ilia Evdokimov , Kirill Reshke , Andrei Zubkov , Masahiko Sawada , Melanie Plageman , jian he , a.lepikhov@postgrespro.ru, Sami Imseih , vignesh C 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 Hi, On Mon, May 12, 2025 at 5:30=E2=80=AFAM Amit Kapila wrote: > > On Fri, May 9, 2025 at 5:34=E2=80=AFPM Alena Rybakina wrote: > > > > I did a rebase and finished the part with storing statistics separately= from the relation statistics - now it is possible to disable the collectio= n of statistics for relationsh using gucs and > > this allows us to solve the problem with the memory consumed. > > > > I think this patch is trying to collect data similar to what we do for > pg_stat_statements for SQL statements. So, can't we follow a similar > idea such that these additional statistics will be collected once some > external module like pg_stat_statements is enabled? That module should > be responsible for accumulating and resetting the data, so we won't > have this memory consumption issue. > > BTW, how will these new statistics be used to autotune a vacuum? And > do we need all the statistics proposed by this patch? Thanks for working on this. I agree with the general idea of having minimal changes to the core. I think a simple approach would be to have a hook in heap_vacuum_rel at the end, where vacuum stats are prepared in a buffer for emitting LOG messages. External modules can then handle storing, rotating, interpreting, aggregating (per relation/per database), and exposing the stats to end-users via SQL. The core can define a common data structure, fill it, and send it to external modules. I haven't had a chance to read the whole thread or review the patches; I'm sure this has been discussed. --=20 Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com