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 1qXoqp-0006W3-04 for pgsql-general@arkaria.postgresql.org; Sun, 20 Aug 2023 20:16:43 +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 1qXopo-000NTZ-4B for pgsql-general@arkaria.postgresql.org; Sun, 20 Aug 2023 20:15:39 +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 1qXopn-000NQx-8V for pgsql-general@lists.postgresql.org; Sun, 20 Aug 2023 20:15:39 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qXope-0002Nj-Na for pgsql-general@postgresql.org; Sun, 20 Aug 2023 20:15:38 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 9EDE35C0065; Sun, 20 Aug 2023 16:15:28 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sun, 20 Aug 2023 16:15:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm3; t= 1692562528; x=1692648928; bh=ZPPHl5jkL0PyD0hVTGM6YHppSx5Qo3EAuAR g3i0DtQw=; b=pbBn6Ao5vJ5KQ91WSG6oFsA7NGSWkEZ39H056rcqy9NftbCzR2x hgVSBhghq3PqDX/x1T1jMCucdCjRbYEXw5AMT50NjjlyDXKdgYHXdbgc1fOGd3PH 7OCUdJEsIu6IUUCr4OntRurComs+R9M+TDcNKyQaFNTWQChzMb00Ws9v4sWvPGKX y7E/e3alzsk7icZE4cmuHBuswn4jrKBzFD0KhjQmODzCW8M1i/KTL0b1/Sg36x2f KUZRTHjnW/FbYmp3vcgIn2E8QHvp/VQSK+/lL3SSclS/Ka/RmAibvFaU9TR73RB8 f4sxGDtUQG3LJY7yMb7+Nc26cMvecXjx+sQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1692562528; x= 1692648928; bh=ZPPHl5jkL0PyD0hVTGM6YHppSx5Qo3EAuARg3i0DtQw=; b=V rxuChH5e6CEFggKOZ6CICiSoNpx/WzShJwWet6olfMaaheNaws+4ULgdbXC4LYzB +UUnGrW2R3b1bStCKBHI4ukHkxtp6s9sJTPbwVpEy3ePdjzXKtyUOmBP1AnHREhG hW6s5RgQ788bvXekOt6e4uQSBDM1N5nweuXImRPmgPGJQF2SgtjX6dv8mR24bgw8 hDXzkp9491GzWwBXzRY3SEKH/Yys4TXXX+Hpuy9d5al5IQPc4P79U7yEuaxx/yh3 9emmovJA3usPfa+cNqco7wjrjXvTJ/CfBrycs005Tj7gAUM19lt2tUpL8R9+YyRk w0LXxlmYuxGICnEsmDODQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedruddujedgudeglecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfuvfhfhfgjtgfgsehtkeertddtfeejnecuhfhrohhmpeetughr ihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtg homheqnecuggftrfgrthhtvghrnhepleekgeejhfekteehfeduveetheeivdduheekudel teefvdffueehtddvgedtfeefnecuffhomhgrihhnpehpohhsthhgrhgvshhqlhdrohhrgh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughr ihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhm X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 20 Aug 2023 16:15:28 -0400 (EDT) Message-ID: Date: Sun, 20 Aug 2023 13:15:27 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Subject: Re: Why doesn't autovacuum/analyze run in due time after calling pg_stat_reset? To: Rihad , pgsql-general General References: <69eacc0a-7e9b-4a35-278b-110b93d72882@mail.ru> <18167fbd-815f-9b43-7016-5e5bbb8fb255@gmail.com> <9440ab9c-4ee1-7668-5476-dc28e8086524@aklaver.com> Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 8/20/23 12:10, Rihad wrote: > On 8/20/23 20:22, Adrian Klaver wrote: >> On 8/18/23 22:35, Rihad wrote: >>> On 8/17/23 13:01, rihad wrote: >>>> >>>> Hi, all. After calling pg_stat_reset all statistics used by >>>> autovacuum got zeroed, and started accumulating from scratch. Some >>>> tables get acted upon properly, some don't. >>>> >>>> >>> Self-replying: yup, it seems there's an arbitrary limit of 100K of >>> n_live_tup after which autovac/analyze kicks in, or it seems so. >> >> To know rather then guess read: >> >> https://www.postgresql.org/docs/current/routine-vacuuming.html#AUTOVACUUM > > > Sure, I read it before asking. > > Taking the first table in the list as an example: > > >         relname          | n_live_tup | n_dead_tup |   left   | > n_mod_since_analyze |  left > --------------------------+------------+------------+----------+---------------------+-------- > fooooooooooo             |      32781 |     240663 |  -234057 | >              513265 | -509937 > > > n_dead_tup (not the actual value, but some time after calling > pg_stat_reset) is much larger than 20% of n_live_tup 32781, and > n_mod_since_analyze is much larger than 10% of it. > > Yet it is kept unvacuumed and unanalyzed for a long time. > > autovacuum_(vacuum|analyze)_threshold is 50. > > What am I missing? Hard to say without seeing the actual settings in postgresql.conf that match: https://www.postgresql.org/docs/current/runtime-config-autovacuum.html#GUC-AUTOVACUUM-VACUUM-SCALE-FACTOR Most importantly: autovacuum and track_counts https://www.postgresql.org/docs/current/runtime-config-statistics.html#GUC-TRACK-COUNTS > > >> >>> >>> There are still many tables waiting for their turn, which is long due. >>> >>> Although there are some tables having only 60-70 (not 60-70K) >>> n_live_tup that have had autovacuum run on them. Weird. >>> >>> >>> >> >> > -- Adrian Klaver adrian.klaver@aklaver.com