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 1w7xAB-0004GT-1K for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Apr 2026 15:07:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w7xAA-000uTn-0a for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Apr 2026 15:07:22 +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 1w7xA9-000uTe-2s for pgsql-hackers@lists.postgresql.org; Wed, 01 Apr 2026 15:07:22 +0000 Received: from mail-oa1-x35.google.com ([2001:4860:4864:20::35]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w7xA7-0000000024X-1v6t for pgsql-hackers@postgresql.org; Wed, 01 Apr 2026 15:07:21 +0000 Received: by mail-oa1-x35.google.com with SMTP id 586e51a60fabf-40ede943bf0so4336087fac.2 for ; Wed, 01 Apr 2026 08:07:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775056037; x=1775660837; darn=postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Tsb1My44BzTlyx0prKG/4qhhUKa9vEL4VSPzBvyM6Mo=; b=FXXP37VeoXTHd5p8l+9tBy8roYL+TSZn73lxrsWs5sMpFZUKJxRD8IOJ2lE6oCN72L Hr+FXH777ZQWXpHAXna7mszsV101PQiCy6Kj4JYy+oNcNPcl6xTU7ytkHCZa0ID4pyPj ZYGCQFGeeI1oDT4dz37Xg6ahyaMnkJoNbnW8LZqdMBiHo13qkJj2Llef/WoaoWaG52t8 OCH1GoQskUDljNHdD8dV/T/L0IwnxU7T2FSt5kaFAtsfzrdstqLU5gQJ11Djae6hZ/Dy bCDmMiQaHJAgmOfDRYGn10cNsaIhW9hoo2nWVZbbtDruWeht4MJ9ChVfewqYfIqlz0Y+ Qz/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775056037; x=1775660837; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Tsb1My44BzTlyx0prKG/4qhhUKa9vEL4VSPzBvyM6Mo=; b=Vt/mpuIRQ5gj9XPK5XV3HLbJFg1yeXCV+TmU5CnwWyWP54uA+ZXT1chCGubAsMS/dn rBnhTTobjLYZ8wiV2+OlP6qXEcPejyaGDpMo07vSMWilere5AQW+HwPaSXGEx4FgCffv UW1pAgQW4qsFRBMCzshSPyo35IrUo7oOYEDzbA3we1ST743JD6/ytTAt2cLOiUATG1VB cfpJwcgosurVCMiByYEREm7tnk87hs7f2UuU5a9qcrnIpZp77w/TkrmOINToOzIxxc5f 5qMROKVNW7ektBcfUTP0vtcNvftdrDx0x9HjgBjggBiSlcSqVCFjSZA8FUYGq0gQekk3 k/Sg== X-Forwarded-Encrypted: i=1; AJvYcCVDadUljX62MNeCskAAPhUSnGOGoGHrEKmM72eZEkvqyrWQOzwnUapqdEqXUlYXB5aYT0W+cTayiRRJk/2J@postgresql.org X-Gm-Message-State: AOJu0YyxqfH55k0NlZJ2Pn3WwvErMJ4j0wi7B7YJOEA8tczzT4NsU9qp OMG4SWbha8sLM8mV0jIdKqhFFfV8zCMUJp1YDtqpNRlcvnXPG6UYQMXw X-Gm-Gg: ATEYQzwQhA/TBkGn9K1uFkdMiMnz/GRsNZE2RSW/AOFHsugztqQY+C7d2X3JJFlNRi8 5NfkOmjyPUBqp1TR9cwRbpNQKBOqPRQyER1y+O1hv6KClU20Hx5gwSkdl/kfFZFjqV86F+wwJMm bA1bmYb4JqHB1WD05OIRufJ+WS6sNaxbzj4+JgOlmwAVafEt5Yzb3XKolcZW4itnt/M0UNQKfEU QsFVXPgvt4HBBjQ3a8/36UJt0F87+e2Y2CIe08J5yK4s0Vunzlg7wm3SPRDWGt3AFo3+fVmF5E3 Vyujh9jMlxF+VfF7xuwxjZTawqIpnNsVl0o2XvZRpXijqLNrBSuGp8Nblcoh/e5IdpedpR6O6Eo mwvOBA/D9uIjog45MM0oxF5QLk+ARra3M+9We4ap9qwRkadLGT+mttfSLQwSFA7wM19+ewx9YO2 xpuCfC5hlJeFqGI1T8zhBzPy1sqsJkWzlmBTMOn76nv9dpGaVuvKG+ejGzbn9u4hqp1XdYpEY2M CDFO+D3cSNi3EFww8Af4w== X-Received: by 2002:a05:6871:7a8:b0:41c:4e6b:368b with SMTP id 586e51a60fabf-422cfc2e3e5mr2336134fac.2.1775056036891; Wed, 01 Apr 2026 08:07:16 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-422eb25c447sm50311fac.9.2026.04.01.08.07.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Apr 2026 08:07:15 -0700 (PDT) Date: Wed, 1 Apr 2026 10:07:14 -0500 From: Nathan Bossart To: Sami Imseih Cc: Bharath Rupireddy , Robert Treat , satyanarlapuram@gmail.com, pgsql-hackers Subject: Re: Add pg_stat_autovacuum_priority Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 0001: - AutoVacuumScores *scores); + AutoVacuumPriority *priority); IMHO we need to minimize these kinds of extraneous changes in this patch set. AutoVacuumScores still seems accurate enough, even when the struct contains some extra bool members. - * A table whose autovacuum_enabled option is false is - * automatically skipped (unless we have to vacuum it due to freeze_max_age). - * Thus autovacuum can be disabled for specific tables. Also, when the cumulative - * stats system does not have data about a table, it will be skipped. + * A table whose autovacuum_enabled option is false is automatically skipped + * by autovacuum (unless we have to vacuum it due to freeze_max_age), + * but scores are still computed. Also, when the cumulative stats system does + * not have data about a table, threshold-based scores will be zero. I don't think we need to update this comment. - * One exception to the previous paragraph is for tables nearing wraparound, - * i.e., those that have surpassed the effective failsafe ages. In that case, - * the relfrozen/relminmxid-based score is scaled aggressively so that the - * table has a decent chance of sorting to the front of the list. + * Furthermore, for tables nearing wraparound, i.e., those that have surpassed + * the effective failsafe ages, the relfrozen/relminmxid-based score is scaled + * aggressively so that the table has a decent chance of sorting to the front + * of the list. Or this one. + * Priority scores are always computed. dovacuum and doanalyze are only set when + * autovacuum is active and enabled for the relation. I think we should more explicitly state that while scores->needs_vacuum and friends are always set regardless of whether autovacuum is enabled, the return parameters dovacuum, etc., are not. Or perhaps we should return whether autovacuum is enabled in the struct and consolidate the return parameters and the struct members. WDYT? 0002: Seems fine. 0003: Seems fine. 0004: + FROM pg_stat_get_autovacuum_priority() S + JOIN pg_class C ON C.oid = S.relid + LEFT JOIN pg_namespace N ON N.oid = C.relnamespace; What do you think about ordering by score so this view automatically shows the tables most in need of vacuuming/analyzing first? -- nathan