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.94.2) (envelope-from ) id 1ttgYy-00G7j1-1i for pgsql-hackers@arkaria.postgresql.org; Sun, 16 Mar 2025 05:29:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ttgYt-008rtz-Lo for pgsql-hackers@arkaria.postgresql.org; Sun, 16 Mar 2025 05:29:23 +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.94.2) (envelope-from ) id 1ttgYt-008rtr-B6 for pgsql-hackers@lists.postgresql.org; Sun, 16 Mar 2025 05:29:23 +0000 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1ttgYr-0035bo-0K for pgsql-hackers@postgresql.org; Sun, 16 Mar 2025 05:29:22 +0000 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-5e5e8274a74so5407998a12.1 for ; Sat, 15 Mar 2025 22:29:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1742102959; x=1742707759; darn=postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=evnInRta9V9/ogR+TL3WU2bLBblal+cDGPYWe45bq5c=; b=mUP6UVl24PAb5U4cofUeKmsDl/MGZtgJeErpAGDilvciWMnaH7I1wZn2ncOL/cG32f nP263lCktxzgnJAtmWIykcsGyTuNT6UGyl23/bC2KlbkzHOEYCB1dhtTsyGxQmX9LU/r FqdZ5nG87DcGmiaPf0tHrkL5eR7TTJZdz9OK3pMdfD0Mrp2qXygL6v/eFZkaqBMuAmV0 94HcS6xGRjEbStxr/bzXYVP0XamLNnf/R+XWHo6P1wxF47EzbCYYi0EmGVa54fWzCLCl u3M7/PGH/hwJZW5DVk0tt7RcMJB58TJhYty3b6otMSXjZgIkdGqbKirl9A6aytfHkp4m SK1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742102959; x=1742707759; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=evnInRta9V9/ogR+TL3WU2bLBblal+cDGPYWe45bq5c=; b=XoTzGW4r0kS2o1QfeJEzY0tUL1lp0zrqAK2Dcm2M77An7hx+16harrKZWh9al6PE4h rLLpphRgwGC0nEFiS8sg/81DRkHxsiqr4E4uAAJHweURexuqfDkBY2IZt29vey4t3eQq LhuBV8cHDiS3qZaJhjdODm9K6lzkswP/PffQp/a5NRDaxKSeuVCcPWuMHWi2bKxWnRAp g5RerGwn/mA01pzW/qqR7GDC3fs5CRDNit0/DT8aUzkzhaRof7pYlMC8rWKennK8H4cX rRA2MdVomgnaVmjUvuPAR3J5tMqYv2vO8ZQIdXgFxr0aIKPs4qRGklPotlvpnXmjmOOY 3yXg== X-Forwarded-Encrypted: i=1; AJvYcCV47CzFA5Sw8C2miDnQKI8hoR944mUphuBoR3vK8dznWuUSFRXTEYoXUY83RtP8S/4bkANvGOhhiXBWjTEk@postgresql.org X-Gm-Message-State: AOJu0YzraQnN0WMMm4wd319AUG/zNGipYbMj0ACjGFPko+3csZkbHIJ9 6ZrINuJPDNftxqfzs1JBWL8ANyDmoy2rI9Gdna3ugC4wLx1jiqsCgVHGoXLMq5g= X-Gm-Gg: ASbGncvzCiqQKKz4YTDsML16HOCta7HKO4l8owLlR4QuJZrO3reKq2X1ic1elDZMUnd Z3P/3APN5qInCF3ac2dWECQUi+twrfuOvaU6/n389gdPL26m67xP+c7nuIEMRILm56WbL5iPjEX ngzuzjtwl1w6rRtqo0GpMjjgGeKNAzcQnR0oar/MEoihFiJXv8PZat+jJ9aahfVB8BJ3XMwGf79 hV1QbgxMT9bP5zdxAyFdf9dYJD8+wrxlZ3RhemuA9FAgDFfbqeunjaiMI1ytHa/TXxZxMq33R39 Wthknq2Ovw3l+AzgS46qXlM0rOh0jqHP2Ko6FTyCBZS656JkzuCyYX3ZTwsDHlTLdRaejTr/afL mGn2sHxfTxN8= X-Google-Smtp-Source: AGHT+IHmxjY7ryPcPmmwrg3tY/jvfgx8Y+NsscYj/AUjaD/GlsE/DYKA+aNRRnmEqanzyd2L0yc9CA== X-Received: by 2002:a05:6402:4405:b0:5df:6a:54ea with SMTP id 4fb4d7f45d1cf-5e89f24b392mr9415975a12.11.1742102958874; Sat, 15 Mar 2025 22:29:18 -0700 (PDT) Received: from localhost.localdomain (17-14-81.cgnat.fonira.net. [185.17.14.81]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5e81692e5cbsm3991814a12.6.2025.03.15.22.29.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Mar 2025 22:29:18 -0700 (PDT) Message-ID: <6f2f2167f4be09e6ca9251c8f69dfe01809d68be.camel@cybertec.at> Subject: Re: Disabling vacuum truncate for autovacuum From: Laurenz Albe To: Gurjeet Singh , Nathan Bossart , Andres Freund , Will Storey Cc: Fujii Masao , Robert Haas , Postgres Hackers Date: Sun, 16 Mar 2025 06:29:17 +0100 In-Reply-To: References: <28773a66-fb88-41cf-a7ec-4216e6c91c94@oss.nttdata.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.54.3 (3.54.3-1.fc41) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, 2025-03-15 at 17:14 -0700, Gurjeet Singh wrote: > > One other difference in my version of the patch [0] is to call this GUC > > vacuum_truncate and have it apply to both autovacuum and VACUUM. I did > > this for the following reasons: >=20 > +1 for the GUC name for the reasons you identified. But -1 for the behavi= our > where the reloption and vacuum command's options overrides GUC. >=20 > I'd like to bring our attention back to how this thread started. Will sta= rted > the discussion by asking for a way to disable autovacuum's truncate behav= iour. > Even though the production outage he faced was due to manual vacuum, he w= as > worried about the same behaviour that autovacuum may cause, especially si= nce the > parameter old_snapshot_threshold is no longer available; old_snapshot_thr= eshold > allowed sysadmins like Will to disable the truncation behaviour globally.= I > provided an anecdote where autovacuum's truncation behaviour had in fact = caused > a replication outage as well as the consequent application outage. >=20 > The behaviour that is being proposed here does not prevent that situation= from > arising again. A sysadmin who's trying to prevent replication outage and > a consequent application outage won't benefit from tuning vacuum_truncate= GUC, > because a reloption or VACUUM (TRUNCATE) command will override its behavi= our, > and lead to an outage. >=20 > We want this new GUC to give the sysadmin the power to override the per-r= elation > and per-command settings. >=20 >=20 > I guess what I'm looking for is a global switch that guarantees no relati= on > truncation will take place on the instance, so that the relevant replicat= ion > record is never emitted, and hence will never lead to a blocked replicati= on on > the replica and never cause a consequent outage of applications connected= to the > replica(s). Essentially, you are looking for something that reinstates the unintended s= ide effect of "old_snapshot_threshold" that some people relied on. I understand your reasoning. What I am worried about, and why I am against that, is the POLA violation t= his constitutes. I PostgreSQL, there usually are global settings that can be overridden by per-relation settings. Doing it differently here would surpr= ise and confuse many users. This is not the only way a user can do damage to the system by overriding t= he administrator's settings. Users can override all autovacuum settings and e= ven disable autovacuum on a table. I don't think these settings are less dange= rous than VACUUM truncation. Yours, Laurenz Albe