Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nf8kn-0004rZ-3f for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Apr 2022 23:19:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nf8kk-0007WR-Me for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Apr 2022 23:19:54 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nf8kj-0007WI-Tv for pgsql-hackers@lists.postgresql.org; Thu, 14 Apr 2022 23:19:54 +0000 Received: from smtp-fw-9102.amazon.com ([207.171.184.29]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nf8kc-0007Yj-6o for pgsql-hackers@lists.postgresql.org; Thu, 14 Apr 2022 23:19:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1649978386; x=1681514386; h=message-id:date:mime-version:to:cc:references:from: in-reply-to:content-transfer-encoding:subject; bh=nPd2w1ZK86KEiOUNzZ0Taj1cnfo9g89qbQ+UDxeszR8=; b=ETG7QS9S3LDDYTHjp3sNtRT3R+qunLitPUXy+EBv4ReUU4iugupkK1mC qlRyedtVT0ZJu0+Gi8VfayJ3DUoOPIhnM1G77X/BVJQugPma2Vt7FsdNo KuIlB8rFbXDYuahth9xw+VaBSfxegN3NacjapC/BC9eI9piLKKaXGqb5g s=; X-IronPort-AV: E=Sophos;i="5.90,261,1643673600"; d="scan'208";a="211055382" Subject: Re: Removing more vacuumlazy.c special cases, relfrozenxid optimizations Received: from pdx4-co-svc-p1-lb2-vlan3.amazon.com (HELO email-inbound-relay-pdx-2b-28a78e3f.us-west-2.amazon.com) ([10.25.36.214]) by smtp-border-fw-9102.sea19.amazon.com with ESMTP; 14 Apr 2022 23:19:29 +0000 Received: from EX13MTAUWB001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-pdx-2b-28a78e3f.us-west-2.amazon.com (Postfix) with ESMTPS id ADC48A26DD; Thu, 14 Apr 2022 23:19:28 +0000 (UTC) Received: from EX13D22UWC002.ant.amazon.com (10.43.162.29) by EX13MTAUWB001.ant.amazon.com (10.43.161.207) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Thu, 14 Apr 2022 23:19:27 +0000 Received: from [10.94.63.119] (10.43.161.163) by EX13D22UWC002.ant.amazon.com (10.43.162.29) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Thu, 14 Apr 2022 23:19:26 +0000 Message-ID: <3b8edd50-6062-b3b8-4001-4f41c35e665f@amazon.com> Date: Thu, 14 Apr 2022 18:19:24 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Content-Language: en-US To: Andres Freund , Peter Geoghegan CC: Justin Pryzby , Robert Haas , Thomas Munro , Masahiko Sawada , PostgreSQL Hackers References: <20220331032844.j7wu5ijjpx3qay5c@alap3.anarazel.de> <20220331040407.ole7orep6sj4iore@alap3.anarazel.de> <20220331042038.udnydrj4x45i4khb@alap3.anarazel.de> <20220331045915.srhbzkajlmptclhz@alap3.anarazel.de> <20220331175007.lgx3huuc5gyjgk3e@alap3.anarazel.de> <20220403190532.qp5flagk5pyyhw4y@alap3.anarazel.de> From: Jim Nasby In-Reply-To: <20220403190532.qp5flagk5pyyhw4y@alap3.anarazel.de> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.43.161.163] X-ClientProxiedBy: EX13D11UWB004.ant.amazon.com (10.43.161.90) To EX13D22UWC002.ant.amazon.com (10.43.162.29) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 4/3/22 12:05 PM, Andres Freund wrote: > While I was writing the above I, again, realized that it'd be awfully nice to > have some accumulated stats about (auto-)vacuum's effectiveness. For us to get > feedback about improvements more easily and for users to know what aspects > they need to tune. > > Knowing how many times a table was vacuumed doesn't really tell that much, and > requiring to enable log_autovacuum_min_duration and then aggregating those > results is pretty painful (and version dependent). > > If we just collected something like: > - number of heap passes > - time spent heap vacuuming > - number of index scans > - time spent index vacuuming > - time spent delaying The number of passes would let you know if maintenance_work_mem is too small (or to stop killing 187M+ tuples in one go). The timing info would give you an idea of the impact of throttling. > - percentage of non-yet-removable vs removable tuples This'd give you an idea how bad your long-running-transaction problem is. Another metric I think would be useful is the average utilization of your autovac workers. No spare workers means you almost certainly have tables that need vacuuming but have to wait. As a single number, it'd also be much easier for users to understand. I'm no stats expert, but one way to handle that cheaply would be to maintain an engineering-weighted-mean of the percentage of autovac workers that are in use at the end of each autovac launcher cycle (though that would probably not work great for people that have extreme values for launcher delay, or constantly muck with launcher_delay). > > it'd start to be a heck of a lot easier to judge how well autovacuum is > coping. > > If we tracked the related pieces above in the index stats (or perhaps > additionally there), it'd also make it easier to judge the cost of different > indexes. > > - Andres > >