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 1w5VWi-003JsA-2e for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Mar 2026 21:12:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w5VWh-00GV5C-02 for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Mar 2026 21:12:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w5VWg-00GV54-28 for pgsql-hackers@lists.postgresql.org; Wed, 25 Mar 2026 21:12:31 +0000 Received: from mail-oo1-xc34.google.com ([2607:f8b0:4864:20::c34]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w5VWf-00000001213-1Fq4 for pgsql-hackers@postgresql.org; Wed, 25 Mar 2026 21:12:30 +0000 Received: by mail-oo1-xc34.google.com with SMTP id 006d021491bc7-67bb04151dcso238728eaf.0 for ; Wed, 25 Mar 2026 14:12:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774473149; cv=none; d=google.com; s=arc-20240605; b=Ea+vAwuuOUOpOTzCm6wqASdH4aoIJbrWs1TtGB/AZgCHY11aP3ctXKkG6o+w3SgT9B MQVmVsoRxy5rZlIapkuqCGiiS5QQ1i+6EsFVp1jzFHucykSeIworV32nhQ2M7ipcx3i5 4m/0ClHjjPKMN7HI+9Emh/YORXVL9jZKhVn1wVlz+A8xFpJWpB7KF4wf+F6VkYEYbWk6 LRklu9VKJ1D0iljyDvTo2abGyYzunc8USiXLSJVksT2cSMlAZUw3+bbrXJB0eRuVhoPO OwkdPdm680g1mZ5ipTBEJ/NJ6IcEj1PnAga5VbPtrJisQ7r3PR2cHUdcND0FysrJ5Ih2 QicA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=JkgVqVuENCTl54hJpx/YPqsGmTMQawp2ynmBUqiCOnI=; fh=WTPpLrgT6tR4IE8rU8MEnUI8y7SI8zYsPbExAZx1wLM=; b=NkkMd5HlkBqbftqOrMMO4HEL7GC4fB+FIDDPA/mGPG8UaakXDMroIrh5IgkVMGAQCr /nqb/FXRptRSrHxhHAiWAdTn6vvOjfsuIai6aQDfgsr2srGRRSjEXFAbhUbMCbt05SOE O3VcKtD1NoXYkzRfweyPGMR418Q7/L8LmL0UGj54vMwRUmzrjXTXer2bGFJJuURFutdK 6tu9yJrT19LVmTfDwtfsl0oVauLTHkWCACc7rRwYPc5XG9WLT+Bfui9uFDLByFEG3N4Q m3mK3lzAYK+CG1cOhTLYrOaJ7ktJJo32pB13PtOlHCHrjvIMJbNt+r3mK2loWbGVTnEP NVSw==; 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=1774473149; x=1775077949; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=JkgVqVuENCTl54hJpx/YPqsGmTMQawp2ynmBUqiCOnI=; b=KXtZl4HRBvVHFnX206P8ygYRXTTTGnaVmSFc6++sEFO6/RzlftTJjKYDjxpuXrDC1R hbzliHwhYNxtrkS5ujm14hhcORJFg/C3iAN7evqPAdrWrbA6z+RSDVFL4ygF/UB9iE1D zy84qwq514wbQq3k62YojtF0jEfUctMA1IdExkbVcE8NzCCYN4JtWrAHpNMXfklbioAr tk/NtPbepkv9YF72RSMzXFpL2nKtJnF3TQ/Dlq91O/p6O37qjY9WUAgJLZzu/cyDk9ch My3jtOfO0v3vJ++QLYqEFcGYcs+5/KRiQp2gsuRgM5Dbn7z5qxzAF967CvI6LhxCTEKV YhlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774473149; x=1775077949; h=content-transfer-encoding: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=JkgVqVuENCTl54hJpx/YPqsGmTMQawp2ynmBUqiCOnI=; b=DZStGWmPSQ7wwJliGzSgDOT23nJTeyOqcofAi7iNSShhoaanh6Kb5JiqHPvteWTm0B cj4WEaGN1Xp+OtK2/JNlyGf6dtA0EeKgRLi1sxazZanp0WztHc2sJdWlAony2CW3Jjpb EC0AyqH1DCOTpnNn5sjdHDmJkZC5AA3t1LRz3IktPWHJ8sxc3lu/zEX/uXR9BB+aH6A9 vvHaAdYMbPXC8szXNNxlclpB6Uflx5CVGcPS1I15U5KAIiB8NRuaEBsEzTNmka6WDDcl KSK6CpZdg5IximS9fHHGfnE+U53CgGV1IiA1vqYcsiAMN32fgCX5u10fvgpE74sVCtW2 uZzg== X-Forwarded-Encrypted: i=1; AJvYcCUl2EKqdi+A1YjgSS7hrIs7AGKJLEW+qA/L2iEiDR/lhzgUuHBSYd5GNOsxKa0ww/55msv6xAzc2PtKg34w@postgresql.org X-Gm-Message-State: AOJu0YwYyuY09c/kuPMRT3jNBrjK173hJS9hJH78jdJNVmaz7WgoyYqW CR9+C552OGHJkLFdcAArsExk+Z6yo8frFsriw9LMkTyRCtuNHEyO775RX1GQF+qKocIEYBLCfI0 /mRzw9rtwxMOJp0wQm2wRlMh3DQ0H9AE= X-Gm-Gg: ATEYQzw7DJoa1kFegVGJmf/NeBbrq6VMlsQcNuAhISagIv+8mkSP8aFqAdWsQB6HC1E VUXoSQ1BW3X7xI5tMDrcjdd9ytrw9ONZp390vRe4UIGQWMJl/mrt9OcR4IT8NHp7NK4VIgke7N+ JY/fTMPkLSue793PXc21qJfb7JHCgcAL8vkmr3XFy0MzOFt9bLcdxfxNIf/puWkbTdJoHJYzLQX g2E6nh2CyCnHT0Ex06zxYXDHTQ/GeMHmQDLUFQ9ZgqocEut3QIFjE+hM/rEb10Z+lypjVCTGfrR 4om+Ag== X-Received: by 2002:a05:6820:4c84:b0:67c:6412:64e0 with SMTP id 006d021491bc7-67dff3cd8e0mr2463505eaf.15.1774473148635; Wed, 25 Mar 2026 14:12:28 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Bharath Rupireddy Date: Wed, 25 Mar 2026 14:12:16 -0700 X-Gm-Features: AQROBzDbQdxzisFTmeP0YWrMoAM45HaSMEeS9iBhNbZ5HIs6tzuAUC_PMh_3OqQ Message-ID: Subject: Re: another autovacuum scheduling thread To: Nathan Bossart Cc: David Rowley , Jim Nasby , Sami Imseih , Greg Burd , Robert Haas , Robert Treat , Jeremy Schneider , pgsql-hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Tue, Mar 24, 2026 at 10:15=E2=80=AFAM Nathan Bossart wrote: > > Agreed. Here's a first try at that. I also updated the DEBUG3 at the en= d > of relation_needs_vacanalyze() to show the individual scores. The commen= t > above that function might need some work, and we might need a bit of > additional commentary elsewhere. Sorry for the late response. Thank you for sending the latest patch. +1 for getting the main patch in first and then the scoring stats view. I looked closely at the v15 patch today and it LGTM. A couple of thoughts (I don't intend to block the main patch from getting in :)): 1/ If a large bloated table scores highest and takes hours to vacuum, other tables' XID ages keep advancing (not to the failsafe limits yet, but approaching close to them). By the time the autovacuum worker finishes, a table that now needs freezing is still stuck at its old position in the sorted table list. Would it make sense to recompute scores and re-sort the remaining table list after each table is processed in do_autovacuum()'s main loop - say, after a certain amount of time spent vacuuming the large table(s)? This would catch the above scenarios. I see that the scores per table are being calculated in relation_needs_vacanalyze, but they are ignored in the recheck path (table_recheck_autovac -> recheck_relation_needs_vacanalyze -> relation_needs_vacanalyze). IMHO, this could be a useful future addition. 2/ Nit: IIUC, autovacuum_vacuum_score_weight and other existing vacuum thresholds and scale factor GUCs are the ones to tune to make the tables prioritized first. I still think it would be nice to have a document explaining these scenarios - maybe after the main patch gets in. -- Bharath Rupireddy Amazon Web Services: https://aws.amazon.com