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.96) (envelope-from ) id 1vkFCH-00CPbE-0v for pgsql-admin@arkaria.postgresql.org; Mon, 26 Jan 2026 05:31:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vkFCG-006Qi7-0M for pgsql-admin@arkaria.postgresql.org; Mon, 26 Jan 2026 05:31:32 +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.96) (envelope-from ) id 1vkFCF-006Qhz-1v for pgsql-admin@lists.postgresql.org; Mon, 26 Jan 2026 05:31:32 +0000 Received: from forward103d.mail.yandex.net ([2a02:6b8:c41:1300:1:45:d181:d103]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vkFCD-00000000UNP-1DKm for pgsql-admin@lists.postgresql.org; Mon, 26 Jan 2026 05:31:31 +0000 Received: from mail-nwsmtp-smtp-production-main-88.klg.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-88.klg.yp-c.yandex.net [IPv6:2a02:6b8:c43:84a0:0:640:dfd2:0]) by forward103d.mail.yandex.net (Yandex) with ESMTPS id C7D4EC34FE for ; Mon, 26 Jan 2026 08:31:27 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-88.klg.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id RVYimGcGK4Y0-8Dozgscp; Mon, 26 Jan 2026 08:31:27 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ya.ru; s=mail; t=1769405487; bh=V00jbA0OFQrV3LIiLETHIKCFmZv1KA+ixlOTMfRWVeA=; h=Subject:From:To:Date:Message-ID; b=QBLxS7Le1QnyokUoKi2RvDJf1HNPaehLVjdYVinY9G7Oq//BMvpQZbQ5yIJ34XU9C XFLTAIiXWMI8CvAESAenQmLTyUPhN1zHh1tOU9zxhI/6ntMHNam/3bCZtBLk05xQpY sQrW1dukNU9t1+JX40Nw+3E8VMUQ4oZxERZsUgpk= Authentication-Results: mail-nwsmtp-smtp-production-main-88.klg.yp-c.yandex.net; dkim=pass header.i=@ya.ru Message-ID: <0dce35ca-24fa-4234-99fe-071bd5725a32@ya.ru> Date: Mon, 26 Jan 2026 08:31:24 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Pgsql-admin Content-Language: en-US From: =?UTF-8?B?0J7Qu9C10LMg0KHQsNC80L7QudC70L7Qsg==?= Subject: autoanalyze did not run 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 Hi, all. I try to investigate why autoanalyze did not run in time of our initial loading data. Yes, I know, running analyze manually is highly recommended in such case. But is must run automatically too. Or it us bugged? Initial loading data made by COPY command. After this (and after all autovacuum) I see: select c.relkind, count(*) from pg_stat_user_tables as s join pg_class as c on (s.relid=c.oid) where s.autoanalyze_count=0 and s.n_live_tup>0 group by c.relkind; -[ RECORD 1 ]- relkind | r count   | 1069 More investigation: select relid::regclass, n_live_tup, n_tup_ins, n_tup_upd, n_mod_since_analyze from pg_stat_user_tables as s join pg_class as c on (s.relid=c.oid) where s.autoanalyze_count=0 and relkind='r' and n_live_tup>0 limit 1; -[ RECORD 1 ]-------+---------- relid               | addresses n_live_tup          | 13844405 n_tup_ins           | 0 n_tup_upd           | 0 n_mod_since_analyze | 0 select count(*) from addresses; -[ RECORD 1 ]--- count | 13844347 This is example for only 1 table, but there are one thousand such. What is exact criteria to launch autoanalyze? On columns of pg_stat_user_tables it is based? If only on n_mod_since_analyze, there can be a logical trap (bug), analyze will have always n_mod_since_analyze=0 on tables where it never yet ran, so it will not run. Or may be there is an other reason? I am afraid that this bug can be not only on initial loading, but in normal work too. PostgreSQL 17.7 (Debian 17.7-3.pgdg13+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 14.2.0-19) 14.2.0, 64-bit (from PGDG)