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 1qY6BY-000mMM-6Q for pgsql-general@arkaria.postgresql.org; Mon, 21 Aug 2023 14:47:16 +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 1qY6BV-0074tm-40 for pgsql-general@arkaria.postgresql.org; Mon, 21 Aug 2023 14:47:12 +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 1qY6BU-0074te-Lp for pgsql-general@lists.postgresql.org; Mon, 21 Aug 2023 14:47:12 +0000 Received: from mail-yw1-x112e.google.com ([2607:f8b0:4864:20::112e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qY6BQ-000BfH-QY for pgsql-general@lists.postgresql.org; Mon, 21 Aug 2023 14:47:11 +0000 Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-58ca499456dso38456837b3.1 for ; Mon, 21 Aug 2023 07:47:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692629226; x=1693234026; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=aNKsf++Yh1wcl4htABtSFcuPvICYAzaiVy4fQO+46QQ=; b=lHBy2KJIayx7uvpGuQShfNbqKGjnxklG9lUFM+eSvHR4sJHMYAfNo1a+B4OadLV5cm UWqcJM1J73ocJG3DYy7TkZdbMJ1URfaPWt4HJ0IyzyuKYGDBZU2UzV/HxKjMZMFsDom1 KcEwd9IhUwFpLMUXhr/Q1ymvqB3zaU6JzRjo24FvK3cz3Zl/EFtXQBs49LGhCqmD7CjF Ntl5QNkjSDCYgjELdHS/LNl5VvZe4PLzZdS6mpvxR6AAuuAlh2b9pYGMJOWviqVZqABI HPv234jhKbc4AHPC5R7Nmh9w72/0ve3q1rZipbT/T6NZbUC7DK3O0t5NrlNDFDCUbDYM IHYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692629226; x=1693234026; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=aNKsf++Yh1wcl4htABtSFcuPvICYAzaiVy4fQO+46QQ=; b=SmeyKsdKFhuuwqoXLk9KdJ+Uh9R4HuMJbBt6RvedLMm2jXkRjcYvtLhuj/wozNmuOq 5+Hx5nU8kdYHDxbygChKjHeW8cdJpkO1SeSkO1p4+UBCdoTJRVAMhFPId9bvONYmnsFe u7VNLzQJYRmDPdimvKrEiaLPpzTcnvA4MR3hGOmI5oKjJ+MzO8VD+NoAe3Xz7oOUYrwv JCYrLMFuGPUGgelGZkY1soKuDWK2YaV9N8sEXow4GsqacHnSpxBwFfzFuedGOAwLhRpC 1b7GQpzLGvD8k77FTs2v77CmXM9PUnwtGvIlWAQGDzjjL26TGi8P7ht4eKgxTIrYcYc3 CCGw== X-Gm-Message-State: AOJu0Yzj1wOwYRKBGNNLpxi2+mhMKcb/EuZnysoUBMLxFxXANaCEtzQd vNrB6tQ141CXPHK6Dsz1D4jWIwLV1DU= X-Google-Smtp-Source: AGHT+IFuPFPgL2H6CJSfZT0gf2bQ7vKHRNJFSkBwyGKJUcXu6OXYCfQ+UtwDgRyZH2YePrPVzgk0AQ== X-Received: by 2002:a81:6d53:0:b0:583:9018:6fbb with SMTP id i80-20020a816d53000000b0058390186fbbmr8198254ywc.37.1692629226492; Mon, 21 Aug 2023 07:47:06 -0700 (PDT) Received: from ?IPV6:2600:1700:bd2c:b810:6806:eeb6:3a6:c040? ([2600:1700:bd2c:b810:6806:eeb6:3a6:c040]) by smtp.googlemail.com with ESMTPSA id m9-20020a817109000000b00590f25ef8afsm1142110ywc.43.2023.08.21.07.47.06 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Aug 2023 07:47:06 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------Fg1YSj5buawUznOE5RGCC00C" Message-ID: <0e2c7bb6-1d9e-200d-d68a-a5a6e1047cab@gmail.com> Date: Mon, 21 Aug 2023 09:47:05 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: Why doesn't autovacuum/analyze run in due time after calling pg_stat_reset? Content-Language: en-US To: pgsql-general@lists.postgresql.org References: <69eacc0a-7e9b-4a35-278b-110b93d72882@mail.ru> <18167fbd-815f-9b43-7016-5e5bbb8fb255@gmail.com> <9440ab9c-4ee1-7668-5476-dc28e8086524@aklaver.com> From: Ron In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------Fg1YSj5buawUznOE5RGCC00C Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 8/20/23 14: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? > What are your autovacuum_(vacuum|analyze_*scale_factor* values? -- Born in Arizona, moved to Babylonia. --------------Fg1YSj5buawUznOE5RGCC00C Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit On 8/20/23 14: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?


What are your autovacuum_(vacuum|analyze_scale_factor values?

--
Born in Arizona, moved to Babylonia.
--------------Fg1YSj5buawUznOE5RGCC00C--