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 1w6AMY-0041Gk-1r for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Mar 2026 16:48:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w6AMU-00AmI5-2L for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Mar 2026 16:48:43 +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 1w6AMU-00AmHv-13 for pgsql-hackers@lists.postgresql.org; Fri, 27 Mar 2026 16:48:42 +0000 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w6AMR-00000001VoF-2nm2 for pgsql-hackers@postgresql.org; Fri, 27 Mar 2026 16:48:42 +0000 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-66ad907833dso4062183a12.3 for ; Fri, 27 Mar 2026 09:48:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774630119; cv=none; d=google.com; s=arc-20240605; b=KHlAraOQ5uog/kqM3j5toL54s2CVi9JVb6004Rp0hB0WnW6YJrvS7ejEWLEfwU6g5N 3cA8sCfr3/om1pZ8UuMkVDKf43nlgagJM56KsLciOc6YU1PyjlH3qG+GZxSLT56DSxqA dPpTeTgOY7YcHAeQQW5oBTuWsrOmJ5g+ADFL3FGIg28SSa1NkLRDEyF6vjVbZ63/M061 0LWFkPSxSNTMwoD8qnyiyr3DrmUlB8I/ux4ILnPDPGab0CHJwnEhMhmLMnd5rTRG9/Ej 45ipEmCRQnZZb1i9YQ+4vnUob2ZITGmm+JIQNuM9faSH5woXkkgRFbCSeRoXxzHRvqjh KQdQ== 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=VONVRViVRK5qQJX/xdNLccAVVcGbF8NL0K9X1zPf2G4=; fh=l4Ota1PeqJ27cb2ZPIabAlxTpUX+1/wG2+DrvNpU80I=; b=lxNCgz4PNWmuyYyyfIVlDA9S6J6Qke3QzcK5mmaMxzrE3JAosKfRy54dKCW7EQcqem 6KPn0s16oV1PeHQctpzcJ4GIMQk967Z0gcroPXYwdWqWqZweB6ykvPWWYPYHBBMPM9RQ 6KZcuTPzpMbvuQcb0zLlCBmzTahCZzWou86HC9CkZ2vtjBqaf12oM8rbmGzbijKZ1/fr OcP7Tm8dIIuJVSYwYZ5d1T+weN2R0egeH+r5WFCVk4ZQSlMsfR3W5Ts0qQR3+cE0GYhT XnlhTCpR78u70o7iyAcgm4g0bzAoGa1e5BIyARnopdCrlXwPmoKL738xuWtc/vBqISk7 81pw==; 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=1774630119; x=1775234919; 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=VONVRViVRK5qQJX/xdNLccAVVcGbF8NL0K9X1zPf2G4=; b=ftH8wflslG5YL3ujP8IH/YMH0HlPop0bKLkhWbqKurTkUs+vdTYughqkCwhTE7fKTL j6L0SE9NH8RhrGTH2O445qiyWBffvHv3hDxPV1Lh9axRmPEL7l7lc8PkULKyzFWL1Z7/ /6Kdm4dyrlv3bdCr337Us6dQOH+KuFs60tnDvkNo/VQ0SSJpL8dMLXz0RPXIIMa/fKqP CFrjp11lIyK3REbpQjUsQl5WVW/busIdEpEAGdAGl9g5TiOIaMLHG4OHKggSFjEJE8rO X5bb3RE0eSyTrKtBFSOpyGeK/UiF+LfsHN3pw3q2WsBR81JnWbKo8pBGsdkgT+WhdC3C wtxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774630119; x=1775234919; 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=VONVRViVRK5qQJX/xdNLccAVVcGbF8NL0K9X1zPf2G4=; b=Cw/99aJjnzZ11qgydZuTcupD15W9e1ZEbqBItsOg4N85bMjThurZm/RFym5ltHE59c 5Is2qzgXeYMoaLfqqnhBLe/l3Kg9D/XFlzOOGOk6HD0jmahSYyvrYnujIqJ1t2C5zhxi ULjKncnPjvHo98KmZLuF5euLCcnAVQSki0LoxHaYXVuCgYVO4kIm8TfHeBSKSLvhcES8 i32j+p39PTlHSY09EeLenDyWgCUO7kAatkZ4iolQTCaIuTOFXV22Ec6egUVwp6tDEpxX bfBcb8hojd4expN3S8Iw3sAWpb1F9CEFGj4dPZZJ6OgDAb7w6absuySkcXYH4QWKu9dJ TWSA== X-Forwarded-Encrypted: i=1; AJvYcCVgiK7oA2an/eD3Op26rJEGqJ5HuSH2kW3u7h7GZt5B+vW1VeutxsOj/wXHdV+23xmp91dAzo1ZTPCm8dOO@postgresql.org X-Gm-Message-State: AOJu0YzOeuBGMViaD4QBWGSz6Nhm7+CeC4IBZJyG5KCTUH7SzwekiJqA oLH7BUe4ATU5BLL5FBLFX00GLSMgboQWueRvDLQgVx2nBgJ/ZF0uo895cmJ8r8ZYth9gvicbSda N7bsAEp1WpX0l2PnJ1jf4GnpheeYpXo0= X-Gm-Gg: ATEYQzzyp4LdTj3VAYtYdI9ZBsK+SjPZQD+HttTywdvOHxEWGJzLImVRDINsuFju6GF voLlc5MuOzffRBEBxVMrsVwSIDk4PZZILqNXiJRKD4q6JoUbYHLGRajxKszHQapAvEfFaxOo88B mpxpfXm7VhvVtxN5Y8poul9XcLxa4KuIh0SUb2kiCso1/QYLmjdkonL4N55c/bvH3xAPR04vi1/ 1kKvcFz9lBnXJPUkSiCfOnmjjUXy+BlgpRnHNuHj49f942sDRRrgMNsIeUUzJOzTp45UqCaszLA 7YxoFQ== X-Received: by 2002:a05:6402:35c7:b0:668:732a:edb8 with SMTP id 4fb4d7f45d1cf-66b28a5d2f5mr1802093a12.16.1774630118794; Fri, 27 Mar 2026 09:48:38 -0700 (PDT) MIME-Version: 1.0 References: <20260324151133.7940a5c1f2ebd594d54da481@sraoss.co.jp> <20260325012847.e026ba1860c07288efe3e97d@sraoss.co.jp> <20260326192203.e6dbb8d80f8d27dc15ceee59@sraoss.co.jp> <20260327163549.b5df519c0099970ddbb3412d@sraoss.co.jp> In-Reply-To: <20260327163549.b5df519c0099970ddbb3412d@sraoss.co.jp> From: Sami Imseih Date: Fri, 27 Mar 2026 11:48:27 -0500 X-Gm-Features: AQROBzC3vnV1HRtVaNodyKj9EA1m35hYXbQ2v17AqBzf5PsKDMjATI0BEiTrups Message-ID: Subject: Re: Track skipped tables during autovacuum and autoanalyze To: Yugo Nagata Cc: Michael Paquier , 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 > I've attached a revised patch reflecting this change, and it also includes > the documentation. Thanks fo the update! I have some comments: 1/ +pgstat_report_skipped_vacuum_analyze(Oid relid, bits8 flags) using bit8 is fine here, but I would have just used int. For this case, it's just a matter of prefernace. 2/ +/* flags for pgstat_flush_backend() */ +#define PGSTAT_REPORT_SKIPPED_VACUUM (1 << 0) /* vacuum is skipped */ +#define PGSTAT_REPORT_SKIPPED_ANALYZE (1 << 1) /* analyze is skipped */ +#define PGSTAT_REPORT_SKIPPED_AUTOVAC (1 << 2) /* skipped during autovacuum/autoanalyze */ +#define PGSTAT_REPORT_SKIPPED_ANY (PGSTAT_REPORT_SKIPPED_VACUUM | PGSTAT_REPORT_SKIPPED_ANALYZE) can we just have 4 flags, SKIPPED_VACUUM, SKIPPED_ANALYZE, SKIPPED_AUTOVACUUM, SKIPPED_AUTOANALYZE, which can then remove the nested if/else and makes the mapping more obvious + if (flags & PGSTAT_REPORT_SKIPPED_AUTOVAC) + { + if (flags & PGSTAT_REPORT_SKIPPED_VACUUM) + { + tabentry->last_skipped_autovacuum_time = ts; + tabentry->skipped_autovacuum_count++; + } + if (flags & PGSTAT_REPORT_SKIPPED_ANALYZE) + { + tabentry->last_skipped_autoanalyze_time = ts; + tabentry->skipped_autoanalyze_count++; + } + } + else + { + if (flags & PGSTAT_REPORT_SKIPPED_VACUUM) + { + tabentry->last_skipped_vacuum_time = ts; + tabentry->skipped_vacuum_count++; + } + if (flags & PGSTAT_REPORT_SKIPPED_ANALYZE) + { + tabentry->last_skipped_analyze_time = ts; + tabentry->skipped_analyze_count++; + } + } 3/ For the sake of consistency, can we rename the fields from skipped_vacuum_count to vacuum_skipped_count, etc. ? to be similar to fields like vacuum_count 4/ field documentation could be a bit better to match existing phrasing For example, the timestamp fields: - Last time a manual vacuum on this table was attempted but skipped due to - lock unavailability (not counting VACUUM FULL) + The time of the last manual vacuum on this table that was skipped + due to lock unavailability (not counting VACUUM FULL) and the counter fields - Number of times vacuums on this table have been attempted but skipped + Number of times a manual vacuum on this table has been skipped 5/ Partitioned table asymmetry between vacuum_count and vacuum_skipped_count. vacuum_count never increments on a the parenttable, because the parent is never pocessed. On the other hand, if the manual VACUUM/ANALYZE is on the parent table, then we will skip all the children. So, we should still report the skip on the parent table, but we should add a Notes section in the docs perhaps to document this caveat? 6/ It would be nice to add a test for this, but this requires concurrency and I'm not sure it's woth it. Also, can you create a CF entry in https://commitfest.postgresql.org/59/, please. Thanks! -- Sami Imseih Amazon Web Services (AWS)