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 1jEJr9-0006jT-9T for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Mar 2020 21:34:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jEJr7-00049r-Q6 for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Mar 2020 21:34:33 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jEJr7-00049j-DR for pgsql-hackers@lists.postgresql.org; Tue, 17 Mar 2020 21:34:33 +0000 Received: from mail-qk1-x735.google.com ([2607:f8b0:4864:20::735]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jEJr4-0006xZ-3K for pgsql-hackers@lists.postgresql.org; Tue, 17 Mar 2020 21:34:31 +0000 Received: by mail-qk1-x735.google.com with SMTP id u25so35321500qkk.3 for ; Tue, 17 Mar 2020 14:34:29 -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=6KwS5HNJarHlTVJQI3ioHLMhxlJESVWWhD+SbNO7aK0=; b=kQDFbvYUwXH3KwDJrmIISHffHmKcoilghQQ1J4ErIVnTUHzFld7ew60r9hl2nh3680 spBTG4fTMwq+E4dg7DSZx+3J7Iu7BVW51nRa2cutwKmlkXlJWzZm71ysomw4X7jfGf6R 3QkPHzVRSnVA9+7+KwuL2V/4ZgxRP9QEwdt88lH8xw/W5nbHGHMF1Geb3IT8+UC4LQo7 Re4eVi6gCAHPsrGbpBnJxc1oPhxRgJOynz3X4rSL3x1iNz6SQE7NzcDReWqV1JlijTvF oDJ1PzXfBReIST1cOHAzlRpAPwjTpzyfepG396cRu232HytuQF0lt8PW23g92kvpqJcx OR8g== 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=6KwS5HNJarHlTVJQI3ioHLMhxlJESVWWhD+SbNO7aK0=; b=TRNeqRjyI1jhXHNDPajKHxj0JhlryqL3Won11r3LPFXa9wJH6YXmeqaRMkwn8emRv/ DuWZOv2wa9oqFK1CBvzDnxrvMXEN9KhuQYciqN4KOY6ezqg3lo/UIu1x8mMwG8/bRWxf UFW7i4dJdvh8A3CLE5Fp/w7jSD3R5p8t4LRJZtarY1S0VyjGA9sK0RC8cgnSMTSAIKtV xZdgX+kugSiltygULpKLCbsr8wBSnq8JS6GoTwky12y5G34QErvb5R7VX4cQvYTNwUBq EyOejuTHIVCjzZ8YYiyFknvzNYjPZfTFe9Ap1EKq8YK39HSKrUMRf0adWh/sSHJtxb4t mEAg== X-Gm-Message-State: ANhLgQ1Ioi3+H/pNMXib9Ob5s3zKxswY5uYa1xaI2ZUQqRZR3qweEQf6 z/2+Kywfdto541tdcHl77vd+rQ== X-Google-Smtp-Source: ADFU+vu7dKe/5uqv251j5OPnNvhggQ0NMmysRa+UzjEB3SU7GluYEpOhhKrY7l4GmjHQJ6LxopAO9w== X-Received: by 2002:a37:6ca:: with SMTP id 193mr965387qkg.415.1584480869096; Tue, 17 Mar 2020 14:34:29 -0700 (PDT) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id p35sm3264381qtk.2.2020.03.17.14.34.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Mar 2020 14:34:28 -0700 (PDT) Received: by pryzbyj (Postfix, from userid 1000) id 799F6800F5B; Tue, 17 Mar 2020 16:34:26 -0500 (CDT) Date: Tue, 17 Mar 2020 16:34:26 -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: <20200317213426.GB26184@telsasoft.com> References: <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> <20200317210702.GA26184@telsasoft.com> <8b67057b658638936abc125382398c143da4397c.camel@cybertec.at> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8b67057b658638936abc125382398c143da4397c.camel@cybertec.at> 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:22:44PM +0100, Laurenz Albe wrote: > On Tue, 2020-03-17 at 16:07 -0500, Justin Pryzby wrote: > > > 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). .. but not yet counted in reltuples. On Tue, Mar 17, 2020 at 10:22:44PM +0100, Laurenz Albe wrote: > Note that this is different from autovacuum_vacuum_scale_factor, > because inserted tuples are live, while dead tuples are not. But they're not counted in reltuples until after the next vacuum (or analyze), which is circular, since it's exactly what we're trying to schedule. reltuples = classForm->reltuples; vactuples = tabentry->n_dead_tuples; + instuples = tabentry->inserts_since_vacuum; anltuples = tabentry->changes_since_analyze; vacthresh = (float4) vac_base_thresh + vac_scale_factor * reltuples; + vacinsthresh = (float4) vac_ins_base_thresh + vac_ins_scale_factor * reltuples; -- Justin