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 1vL456-002dGH-11 for pgsql-hackers@arkaria.postgresql.org; Mon, 17 Nov 2025 18:36:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vL454-001TcS-30 for pgsql-hackers@arkaria.postgresql.org; Mon, 17 Nov 2025 18:36:03 +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 1vL454-001TcI-22 for pgsql-hackers@lists.postgresql.org; Mon, 17 Nov 2025 18:36:02 +0000 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vL452-00028t-03 for pgsql-hackers@lists.postgresql.org; Mon, 17 Nov 2025 18:36:01 +0000 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-b7277324054so640876366b.0 for ; Mon, 17 Nov 2025 10:36:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763404558; x=1764009358; darn=lists.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=w7nH7pGy8vxlnZUT4NgvZMvoiqmCmv0tgWwKw4VTWPk=; b=KrY0BhF5/VqWGxlBmQrvEd5QNl0VfAiA6NiNtFbsnKgGRiO2Vhpsnat5cMJIOmyt4P nC9fpkBMJYTGS/i6HQli7K+xdns/drWt+fFZNQsOICFd34AedfY4Fo32jkfiW6jP03iJ nyJbw+u7BQo/5+1r4Qkfkoa08ezvV0ptz8GOgdx+w9+oxCm0/JnBoz91C89UFnU+yEuF gWSbW1xUursdH1BKlTV8nBM97RiXInLbyaUR3BW5o+i+vJHM+54w5SudPgvNjtbKYfFb /cIzOLD7SRYKnqM6q6oVofTy4ACJN0dkhIpN/9/0GaE7sPsKYyEUyopXp6sBoGY0PDQA fEYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763404558; x=1764009358; 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=w7nH7pGy8vxlnZUT4NgvZMvoiqmCmv0tgWwKw4VTWPk=; b=pk/cHAoG9JRWO0TksMVj01N63TFlufM2dbg3e1GMFNhXA6lmoCvzlVGE8gD03lyqeT XleHmdfuUG7WO+FDmBxylaW6ZgWlyovSibuRVD/brucEymw6W7XUBFHTYZmXrYmRs1sy Ob19NiJUUHD9tzUciNol4K5s6h3gwWM2wh9Up2G39Ck+esWfCw+phoENUHnW4Zh7479k EpWFBE4lcXZNUTbWFFRqgd42jdSvkbIwOc1cyJO0Rts4gqA5eyN4cwlt0mkccpjLATOy W2+kFPQYFBfwruOMEpSpCSlb6ih/3CyFjjSoQiW+itQWzbJV287wdiKOTd/Vkae07OKa WVBQ== X-Forwarded-Encrypted: i=1; AJvYcCXKByuvhyCiqo/uIJXCXoP6MSiHpB0KFReiLQqUqSDymnUeNPifxz3Ge/oQALE4k0Nk6bjAEpdOrX3H+xkE@lists.postgresql.org X-Gm-Message-State: AOJu0YzZVqvXZSyY4AZNxCXJUHRXfV0dOSRABdUGy2xG3jAX1PtGzJCu eqfMUAfiq1DzlXayvWRy5qBPgdqtGn1PUMA77Tf4Xc3zQ2u3ePX1gQgxhwJG2WzylT+PCs6k6eB ivkqXtLmHiu9sXnOLLS0TlrGS4FoyiAk= X-Gm-Gg: ASbGncun9j6GGXmSCsrNRAlYhEe0WMNCbD7P6kqyTjBaVZLilTylZhQS2qmib300DR8 Q+1fckryth8jU6u9gpbpGJV6eT4lZVJIYn7rscWgLX5LLxmSfc0IgKYncmodSgmGnEfPohlgmJ7 Vmm2q4qsjq/Ne8pHB8NvxM0ks7jMQ98vK1GS84ksARApCifRsDOlFp5ayEubXbWG0msWMMQN00Y kOEb+vRCqGTqbtIzU86KVcUqr5faq2tY31VnHpUjLKQd5uMp+RQTLMN X-Google-Smtp-Source: AGHT+IGu3wPkCL5i2yAObyZtelo6axgmSqyaW7/fGPMLOz59g0GwXM/4mjazWT8EK8P8ACM+doJ9oh4QsvGExzEadpM= X-Received: by 2002:a17:907:869e:b0:b73:7158:d9cd with SMTP id a640c23a62f3a-b737158e1admr1174885666b.52.1763404557989; Mon, 17 Nov 2025 10:35:57 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Sami Imseih Date: Mon, 17 Nov 2025 12:35:46 -0600 X-Gm-Features: AWmQ_bkiUx-t4BfWYSHUsJp6I5wJJPbbUuWNO6HRxxZ53E0JPl6f_7gioD3iwqc Message-ID: Subject: Re: Report oldest xmin source when autovacuum cannot remove tuples To: Dilip Kumar Cc: wenhui qiu , Shinya Kato , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > > Thanks for starting this thread! This is a very useful > > feature that users will find beneficial to easily narrow > > down the reason the xmin horizon is being held back, > > and take action. > > +1 for the idea. In BackendXidFindCutOffReason() you have directly > reported using NOTICE I believe that is just to show the idea and you > are planning to append this to the main message? Yes, the NOTICE is just for demonstration. Some more work is needed to integrate the output into the vacuum log. > Apart from that we are looping the whole pgprocarray, however it is > only done when we are vacuuming with verbose mode so might not > be that bad. The extra procarray loop will occur during VACUUM VERBOSE or when a vacuum exceeds log_autovacuum_min_duration, 10 minutes by default. I do think however, we should be more selective when to do this work. We should only care about emitting this information in autovacuum logging if the cutoffs->OldestXmid did not advance between consecutive vacuums. This will mean we we will need to track the last cutoff value in relation stats (pg_stat_user_tables), but I think having this value in stats will be useful on its own actually, as users can use it to track tables with stalled cutoffs even if they don't have sufficient autovacuum logging. What do you think? -- Sami Imseih Amazon Web Services (AWS)