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 1w53Dn-002qRU-1T for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Mar 2026 14:59:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w53Dk-007OWZ-3B for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Mar 2026 14:59:05 +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 1w53Dk-007OWR-24 for pgsql-hackers@lists.postgresql.org; Tue, 24 Mar 2026 14:59:05 +0000 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w53Di-00000000tUt-0DlU for pgsql-hackers@postgresql.org; Tue, 24 Mar 2026 14:59:04 +0000 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-b97bca3797dso178656866b.0 for ; Tue, 24 Mar 2026 07:59:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774364341; cv=none; d=google.com; s=arc-20240605; b=RI3iT/orRajK0qucGpWoLlreXzSTQEX1u5a7/fTuEuQJJAqx+feH8z6cYLVBFESlUO 3YW5hXLXIYKfzE2PYz0iryz9SQUoxa+vs21t6I2cJdXl7cUumDQHm8DLVwgbh2wl9hp7 PNTHnvcNgIScJjplaXSTlWogd69jgP5bwV5XfWLzbPFhYRIaQ72B8YFbpCOX4B1c0QbK cZwDZTjrAtjZRGTomvyHuRZXMbY37oQBm5IvMy67qX9MlmThcXgslA/w4iCbjktkfg9Q Tm077gB8ePAfev+tbj5sTqE8x4Ii75Xxxv18twYsMatp/GA/RgK7R3UUfiqG05CCgjC7 EQfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=9JF+VJBM/Mm0fROxUfW90pNMCZvHj284d6M58yZfhlk=; fh=wG2O5chZ56JwlKs5fklU8DQUUSn850XLtBx+Fp5dUQ8=; b=CTZCUsCxD/D+DHh9/dOEVqV5cRTeM7fUk+u4RDBjpY1s1tIbYmH8lkfQJUPrAUc9MB fSXC4wOV0XIs4Q/HQGrN3eewCFNJh9vLKTWIY7E4EB8Szj+FnJ8K63TFg7ysCRtaL/j7 xe1tp1A9o35jKed6XExX8F+x+woFdcrrcU0iYy6fv6cbiIotE9aHZLCxD++ju+Ny7T0S rbzJAotQmkhaJ6xUlpACqF2t3rarsBsFVB3O/80/6o6D29bYoNeCFo8/QvAnGa1qYEAD ciiBrQ0tHXo2Gaf/rG1RO8q2NZgzYfmfYTg6dzWI2oSqoarQc8MrfvfZUgTaazYLIQmL DiXQ==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774364341; x=1774969141; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=9JF+VJBM/Mm0fROxUfW90pNMCZvHj284d6M58yZfhlk=; b=AWg3R1teNzVXsqMH0ArB1kEleuLLi1jR4O5iy9lPP+WKurFcPQlHtuoiwWX1rqmad/ urn5AerDJvsd2GWlQ7fakK0WzDhh3chD/EUU4JBUh4mxOdXp95cfdrX07QTEAkATic2W 6VNyDfwt0YHO2vCTOwsaBgp2apwI9PZ54hnak4f+ASK8vgqUhzm494ISGj6RgXzPPrwd l60n98OLCyn/h8gviWlIY2D7U8DypwXXKU1zwBn7B9AyVnls2RiA4AQd8W5grluU7pow YETZNU7nFFOxsreZ/VnjFetit040rfvfSAqQOADt+SGCgQBBd5Jawh2Ijvb3Ij+W7EDR 6xcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774364341; x=1774969141; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=9JF+VJBM/Mm0fROxUfW90pNMCZvHj284d6M58yZfhlk=; b=QCACfchDkkbHi1ant6VWXaOTkZEWXDnorZWLBCV0olm7MB8CrqP6sbjbXnjCOGulc7 DoWDn8xxuwbIDqah/Ai2P6kcTna/nuIfwd0Qnh30QGjlfD5j3gGw3/twwUYr+Qyj8NN+ 4LHH2aaj6HANB+LIRmo6Uvby/Zg5CqNZ47pa8TTzog+xuJPV8SwquIsnLMCvZkcpirGg eKdLU+UfVzTMXgkRPxi5zzOeHYKfqZfu5moP/khNATPTt0rAzDA7PkMoFr8w56E/suKg s5SvwCeWTPrSZXjU4JpKR2rqcnMOqpQNiWT2UgGbMkdUpuMg+5ypWtEymNEj1nV5zBpw AU/A== X-Gm-Message-State: AOJu0YzUK0jwOPPzo4g0KWdQH4XFdLCmsDG0vAhMmXqKh4RVGGwjPRkS nCEGqqCGiQBOUpLu5wVWKFU7aXTqoFIbIJ3oWKGVx+jBpOdvMD8pTIGJClydt0fvmZ2sWcnC//N GdPNCz49Bo47qQ2VGbHNwxSN8bGf+BaLpkLGbGQlFJQ== X-Gm-Gg: ATEYQzxwRjPbk6KBfiVJ74T3xDYmcR4awEptekRmBhTp3Q67R74p7ECRcVeI2bhVlZp M8bD6ELyVHIif1m16sn++gEQExhwCRUaXicftmaCujKToQCxecURb28U8n7/oayRValZ7uRg/XJ 3VMa4Hc1Lh6I0QyV6U02pPIcPXGcet+MO5uG2WSOjB8U4RkQRUA36X5ZIit/ibp5Q1//KrNJ+zs /4rZg7ceC5Ukc8BueKjcERPMY5c66hnygM0q+OY86kNstRoDucOS9mkX9vo2kjxNYnRDo39WXPg +pkGzw== X-Received: by 2002:a17:906:68d9:b0:b87:1fe8:9534 with SMTP id a640c23a62f3a-b982f396fd0mr943332766b.48.1774364340715; Tue, 24 Mar 2026 07:59:00 -0700 (PDT) MIME-Version: 1.0 References: <20260324151133.7940a5c1f2ebd594d54da481@sraoss.co.jp> In-Reply-To: <20260324151133.7940a5c1f2ebd594d54da481@sraoss.co.jp> From: Sami Imseih Date: Tue, 24 Mar 2026 09:58:48 -0500 X-Gm-Features: AQROBzDHWYxXH6HHffKmSmfz0doSfkUgLXJZQ6qAIy3-PA_OSEGunMynZtB4U3Y Message-ID: Subject: Re: Track skipped tables during autovacuum and autoanalyze To: Yugo Nagata Cc: Pgsql Hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, Thanks for the patch! > The attached patch add the following fields to pg_stat_all_tables: > - last_skipped_autovacuum > - last_skipped_autoanalyze > - skipped_autovacuum_count > - skipped_autoanalyze_count > > Are there any concerns about exposing this in pg_stat_all_tables, or suggestions > for a better approach? I am not sure about the timestamp columns. I am not saying they will not be useful, but I think it will be better to just start with counters for this. The way the views get used, a dashboard built for tracking the deltas of the counters can easily spot when there is a spike of skipped autovacuum/autoanalyze count. Also, for tables that are being autovacuumed and skipped quickly, the timestamps will just be overwritten. So, I am +1 on the counters, -1 on the timestamps. Out of scope for this patch, but I also wonder if we should add another counter, autovacuum_started_count. If there are other types of failure scenarios such as corrupt indexes, checksum failures, etc. which terminate the autovacuum in flight, we would be able to catch this by looking at the number of autovacuums started vs completed. The skipped counters in this patch and a started counter would capture different stages of the autovacuum lifecycle; skipped means "never started" (lock contention), while a started-minus-completed delta means "started but failed." Both are useful signals, but for different reasons. In terms of the patch: 1/ + if (AmAutoVacuumWorkerProcess()) + pgstat_report_skipped_vacuum(relid); Any reason why this should not also include manual vacuum/analyze? If someone has a vacuum/analyze script that uses SKIP_LOCKED, and the operation gets skipped, this should be included in the counter. this can be done with separate counter fields for autovacuum/autoanalyze and vacuum/analyze 2/ + pg_stat_get_skipped_autovacuum_count(C.oid) AS skipped_autovacuum_count, How about a name like "autovacuum_lock_skip_count"? -- Sami Imseih Amazon Web Services (AWS)