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 1qY0Gq-000XFt-ED for pgsql-general@arkaria.postgresql.org; Mon, 21 Aug 2023 08:28:20 +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 1qY0Gp-0048UH-1q for pgsql-general@arkaria.postgresql.org; Mon, 21 Aug 2023 08:28:18 +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 1qXnp1-000FnZ-5O for pgsql-general@lists.postgresql.org; Sun, 20 Aug 2023 19:10:47 +0000 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qXnot-0001p8-33 for pgsql-general@postgresql.org; Sun, 20 Aug 2023 19:10:46 +0000 Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-4ff882397ecso3820028e87.3 for ; Sun, 20 Aug 2023 12:10:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692558636; x=1693163436; h=in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=5WsiRT6/WgUB1YSMKh/TQr9QOEk6Ys3k8PgSOa+Ctq4=; b=Y62pfZHxkMEjk5YhTTcWcnxPuEMmaORTKnZ/5B5nBZUhHMkWlLLaK/mBn+dfpAbasG zQowat+7wEqKoxyiAI/9l2ItZUyr8YRrE98Q0l3ojEthQ1DBkngNWNP2uo+qImvfqHqT FdufOIa45SvTwYGftNZHUSNa6aCxkIp5AjXdwKuS5GubkaQ+LuzmmUSY1/Dhs7MlwLtx aM3b2ZDIn51njMDME1PRhMY1Y7Fktejoewca7VeJGfVEET5IDKaHRDyqWbdlHq9fKWik ulCpxiR/jm/qpO2oUFmTtripKQa6fPtaMHLaUE6Nkon7Faapd+TAILX/wAlDfJc9vBk/ AR5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692558636; x=1693163436; h=in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=5WsiRT6/WgUB1YSMKh/TQr9QOEk6Ys3k8PgSOa+Ctq4=; b=V/Vib7pDqGe3FXBmlNxuyaTRXB7F2yYL9e2ioj2mW7DoNZsEZ90iYRLhEIn3Xy47p7 jMzcK17/VeSDJZo1+Rw16pGYaUCgqfreiX76qWyC/PwnKWaAbk+lPEHKxflXzbSfJoge tpz24tzozr7kn17Bz7PUKGdMAKp1dpEHcBopR1n9XyX4qssi1oLJuhCLX1xwleFnaprk z3ZKspsQf3UUaYcXVEAwVaZ7cI5UlTKsLQA+nmO597pT3zA6tfehRaVcx9g4LP9t/nyC ZGeapipFN29prt637N+hbP49dWQAtBBejYGU3YrFWnHRpJU7gGZfYQVtHIp1dP/v34L0 ZR2w== X-Gm-Message-State: AOJu0YxM87cqM6jXf0i79knJYcz3CGafzWtS9jZx3sCCa2YGzJ0N2XSe vYtWDBPVmCLTv6uFNvyFnS+AXVkcPhrZjQ== X-Google-Smtp-Source: AGHT+IEZ+31Gxh/2LXEENM1/hx0BrVricE5GhbDGYxhPMuqoLGV4lYIoby11xo5iuhZSY7+1eyJg/Q== X-Received: by 2002:a19:6705:0:b0:4fd:d002:ddad with SMTP id b5-20020a196705000000b004fdd002ddadmr3111935lfc.12.1692558636116; Sun, 20 Aug 2023 12:10:36 -0700 (PDT) Received: from [192.168.0.254] ([5.134.58.210]) by smtp.gmail.com with ESMTPSA id ep8-20020a056512484800b004fe48a27fa1sm1369052lfb.114.2023.08.20.12.10.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 20 Aug 2023 12:10:35 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------HnEs0kKYkJJwK9hv9MJi047m" Message-ID: Date: Sun, 20 Aug 2023 23:10:33 +0400 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: Adrian Klaver , 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: Rihad In-Reply-To: <9440ab9c-4ee1-7668-5476-dc28e8086524@aklaver.com> 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. --------------HnEs0kKYkJJwK9hv9MJi047m Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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? > >> >> 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. >> >> >> > > --------------HnEs0kKYkJJwK9hv9MJi047m Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
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?




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.






--------------HnEs0kKYkJJwK9hv9MJi047m--