Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jEJQj-0005CC-AE for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Mar 2020 21:07:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jEJQh-0001K2-OY for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Mar 2020 21:07:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jEJQh-0001Jv-BT for pgsql-hackers@lists.postgresql.org; Tue, 17 Mar 2020 21:07:15 +0000 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jEJQZ-0001xd-Tf for pgsql-hackers@lists.postgresql.org; Tue, 17 Mar 2020 21:07:14 +0000 Received: by mail-qt1-x843.google.com with SMTP id d22so18891313qtn.0 for ; Tue, 17 Mar 2020 14:07:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=aRAO0rCJp7CsuQsEN7h7IP2Er8B1T68Rb/bW6DgtoIc=; b=oGpEoR5GmbVvivLVpDp3lFfk16xtiutPOXONJzUx2lbZwwrqVl/CHGPkljN9WfyIbZ tZU2YVZLGcon5FkJcE2fwixef17HrmmkhPXqX4fuCkXEwJ1xQO1PNcT1bqBMs2qUAi4j buUVHGfVfQlBZX5/qoY57oLXQtznGW3ntlCson5T+4JIFkqGzmn96zT6s77+lkC1YfND MqigIRlLunKpHeKM8n2XeB01lEl2PL6Li1T7hd9LDvLTUc5P3J4MDkIzb+XuCr/bwxAF 7/iU8HXspqurQej4KwcOlxz7hxYY9us+aREtY3/z9Eo/LOyMSYdCC6gdOBWXMNtG1oXc iK1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=aRAO0rCJp7CsuQsEN7h7IP2Er8B1T68Rb/bW6DgtoIc=; b=YFELxc9hbEPLfB4j8FL33BDn41iaYW5H94oDQ7g+LkD07OsYUszrtTHYILCuSiP6zh 3t61fgUC9zbe8ddmRLuPiAVWCfdH2EYLneW0OOMBXDEfw44NGoNpDfaAqk6DzKr07ZuQ IAod1cjoF9EyfVtfTxNKX4BFmbQDLMWHhduECrPR00eQQ7o7nMb10tKVEWnAu1YOeYV+ uwr8UnrkqoCvks35Tm3U++JWKSpahZveL1tXKuyPJ700Mzu8fmVUHiUZSE5De0UQhXY/ xOU8v3yZ/xlmEzQ/EIe8TqZTYh7b/rghdYfzb0ISgRuHIh64Zm7ezjtRCJs/rlD7zXYB lI4g== X-Gm-Message-State: ANhLgQ061qbRTrrss5YsBqEFthpmI4WAroUQ1pRZF4+j6PiqrXNpmikK wNpgw+w75OGkPZMxooj5XaijVQ== X-Google-Smtp-Source: ADFU+vtB9KxdcDu1XYoy6y+vMtuzMLyK4hlk5V1PQNUi9fWUSqkLd04OAfeEdZJcr5y5mGxrGxWOZg== X-Received: by 2002:ac8:4cce:: with SMTP id l14mr1152454qtv.383.1584479225967; Tue, 17 Mar 2020 14:07:05 -0700 (PDT) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id h20sm2674245qka.78.2020.03.17.14.07.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Mar 2020 14:07:04 -0700 (PDT) Received: by pryzbyj (Postfix, from userid 1000) id 03F25800CF1; Tue, 17 Mar 2020 16:07:02 -0500 (CDT) Date: Tue, 17 Mar 2020 16:07:02 -0500 From: Justin Pryzby To: Laurenz Albe Cc: Andres Freund , Masahiko Sawada , David Rowley , Tomas Vondra , Amit Kapila , Masahiko Sawada , Darafei =?utf-8?Q?Kom=D1=8Fpa?= Praliaskouski , pgsql-hackers@lists.postgresql.org, Alvaro Herrera , Michael Banck Subject: Re: Berserk Autovacuum (let's save next Mandrill) Message-ID: <20200317210702.GA26184@telsasoft.com> References: <20200316124713.GH26184@telsasoft.com> <9c9b7d19d17ad5e4e0ee10b8426fa1b78dd24c0a.camel@cybertec.at> <20200316201315.dgkeedl6rp2wdjje@alap3.anarazel.de> <19be41199e7b303bbecc1066bd9f011d95882aa8.camel@cybertec.at> <20200316213459.kh6xln3z35hgjodd@alap3.anarazel.de> <7c132215f0e947af7d9ccb7a340ad6e81b369c24.camel@cybertec.at> <20200317152409.GW26184@telsasoft.com> <20200317195616.GZ26184@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, Mar 17, 2020 at 10:01:15PM +0100, Laurenz Albe wrote: > On Tue, 2020-03-17 at 14:56 -0500, Justin Pryzby wrote: > > I still suggest scale_factor maximum of 1e10, like > > 4d54543efa5eb074ead4d0fadb2af4161c943044 > > > > Which alows more effectively disabling it than a factor of 100, which would > > progress like: ~1, 1e2, 1e4, 1e6, 1e8, 1e10, .. > > > > I don't think that 1e4 would be a problem, but 1e6 and 1e8 could be. With > > 1e10, it's first vacuumed when there's 10billion inserts, if we didn't previous > > hit the n_dead threshold. > > > > I think that's ok? If one wanted to disable it up to 1e11 tuples, I think > > they'd disable autovacuum, or preferably just implement an vacuum job. > > Assume a scale factor >= 1, for example 2, and n live tuples. > The table has just been vacuumed. > > Now we insert m number tuples (which are live). > > Then the condition > > threshold + scale_factor * live_tuples < newly_inserted_tuples > > becomes > > 10000000 + 2 * (n + m) < m > > which can never be true for non-negative n and m. > > So a scale factor >= 1 disables the feature. No, this is what we mailed about privately yesterday, and I demonstrated that autovac can still run with factor=100. I said: |It's a multiplier, not a percent out of 100 (fraction is not a great choice of |words). | | &autovacuum_vac_scale, | 0.2, 0.0, 100.0, | |The default is 0.2 (20%), so 100 means after updating/deleting 100*reltuples. live tuples is an estimate, from the most recent vacuum OR analyze. If 1.0 disabled the feature, it wouldn't make much sense to allow factor up to 100. + { + {"autovacuum_vacuum_insert_scale_factor", PGC_SIGHUP, AUTOVACUUM, + gettext_noop("Number of tuple inserts prior to vacuum as a fraction of reltuples."), + NULL + }, + &autovacuum_vac_ins_scale, + 0.0, 0.0, 100.0, + NULL, NULL, NULL + }, -- Justin