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 1tNS2G-00B72N-3h for pgsql-general@arkaria.postgresql.org; Tue, 17 Dec 2024 07:30: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 1tNS2C-00G1KA-KX for pgsql-general@arkaria.postgresql.org; Tue, 17 Dec 2024 07:30:25 +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 1tNS2C-00G1IY-8K for pgsql-general@lists.postgresql.org; Tue, 17 Dec 2024 07:30:25 +0000 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tNS2A-003Flf-QS for pgsql-general@lists.postgresql.org; Tue, 17 Dec 2024 07:30:24 +0000 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-5d3d0205bd5so7028358a12.3 for ; Mon, 16 Dec 2024 23:30:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1734420621; x=1735025421; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=KiSqhm1sER4A/fx9yfQNPnV8yuFeYcjYi1SDYPNB9QA=; b=QYASpgEFq1Y3MFOYOXAQx53Am9CL5ncqtsRoBl6Vu3cqVhF1KZWrkZyuSZV/7FtfVb Bj/l3DFQuPZqeHLAGaI8GvfzzWJN+eIHQpjOkSbAoNHb/2ExDf5bDPd8tYgZrUzufoyS yhCrwV89MmAjWMaxmtjzICBIusLgbhR8oXuIoBCwTKwkJU9vpzYAsXRimbJgEmglDGIa Ey4pOL+lyyWpI+bdJjHD1zYQFGPr3DJL0b6cUZ6lk8oGf9wPPsaFbAkKCDYF2ZiMU4Bo 5u5JcBppL5WpJl2OSDc+qYmSP5OwtLPyhXofxtFeMUG+wNHR2xolaGpRAKI+MzHSf6hj XCIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734420621; x=1735025421; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=KiSqhm1sER4A/fx9yfQNPnV8yuFeYcjYi1SDYPNB9QA=; b=qT8T6axmwouLC9NDV7vbcZmyWrNPZB0iLlGaQfHI1xu2z/gKzkEwgTOAbiVRqGiq9J o9iPJ7O06FBJynxhMLGpuLoDtZc6RyA4rXGtuhQbJpQzN6ohrSBQ5RAxQlsIuq5Iuma2 7ByExBEYxBpZTzX23SxsQAfumgFxedf8aA2Q+KLVikIN7tSA9IqIEZ+oXUK7hb0dNgVo IXJZdBEH4+STCLX+BgA2vm6smacku7c0m29s4RjZBcCBPnt3RFUaNXVHsaqINDowbN1N elnaDpK3MeKlJn8ivVM6xJdnGKBjatsd3s95K2TAUNa9J3372unC8IwBS8jeQ4QzwiAZ 9QVw== X-Forwarded-Encrypted: i=1; AJvYcCVSt27ngCS3iEQvdKCKl4WggDIPpZfsHLMqvo59gf5G2RzwgBbVpPFoRWRlz+horMWpURXqSbYEyTWV5odh@lists.postgresql.org X-Gm-Message-State: AOJu0YyNz5/09nuE673n7ChQ3xLs8PhjgqqSC2sEbYD2QvvlVrHQDSMu fRFzpXmAGRmHbySiIRVq3ttoubQCnyV/0QOht8uXQCWRF4dLskFgGKTn9JhDJdY= X-Gm-Gg: ASbGncvmekVoRXys/d5egiCwO/0wtKId0Nyc9D5QNpSLBIOcglmNgiVbE5/NJ1dk7zO 0tzZ4k4SjkMw+Nrn9Pm/FyavxAMxuqhS2VSbB78qtt1kLXmpfYE8n4gP9qgNAR5JDHdF4mnqzeM 4ZKrzp/+1/K+twe6vVWfWUJaEdpNk7F9uDzCVBUrJ1KFaF/2iYrTVUvvsfi0HP6M9R0QaI2Geav cat433ekuziOWhgGd5Y+/KScq4E6PuHIg9CybX5rMwmsww4rxIAMA4JjPBiVSyRg9hO/1a+vnVQ X-Google-Smtp-Source: AGHT+IEigM02VFAFxvmE2jA7fyZOMMUCd7yKvZc1usmtK9IKxPSSnP6Mldpnq0XjBDFVfVwUh0bmng== X-Received: by 2002:a05:6402:50d0:b0:5d1:2534:57bf with SMTP id 4fb4d7f45d1cf-5d63c3bc37dmr12326438a12.32.1734420620428; Mon, 16 Dec 2024 23:30:20 -0800 (PST) Received: from localhost.localdomain ([2001:871:5e:99b8:29b3:8412:65e7:2204]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5d652ad17fasm3961417a12.22.2024.12.16.23.30.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Dec 2024 23:30:20 -0800 (PST) Message-ID: Subject: Re: Disabling vacuum truncate for autovacuum From: Laurenz Albe To: Will Storey , pgsql-general@lists.postgresql.org Date: Tue, 17 Dec 2024 08:30:19 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.54.2 (3.54.2-1.fc41) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 2024-12-16 at 16:25 -0800, Will Storey wrote: > I would like to disable vacuum's truncate behaviour for autovacuum. > Previously I had an outage due to its access exclusive lock when it was > replicated to a hot standby. >=20 > When that outage happened it was from a VACUUM call in a cronjob rather > than autovacuum. I now run such VACUUMs with TRUNCATE false which avoids > the issue for these. However I've realized that autovacuum could cause th= is > as well. > > I believe the only way to disable this for autovacuum is by changing the > vacuum_truncate storage parameters on tables. (Ignoring the now removed > old_snapshot_threshold option). Yes, you can only do that table by table. > I'm thinking of altering all my tables to > turn it off. Is this a horrible idea? I expect I would need to monitor > tables for problematic growth, but that might be better than a surprise > outage. I suppose the growth could cause an outage too, but I'm thinking = it > would be more controllable. I don't see a problem with disabling VACUUM truncation for normal workloads= . Some applications, like volatile queue tables, might need the feature, but I'd assume that to be the exception. > Would I need to disable the settings on catalog tables too? (To rule out > any possibility of it happening). Are there any other things I might be > missing? Potentially yes. But unless you are using temporary tables or create, alter and drop lots of objects, that shouldn't be necessary. > I am also wondering if having an autovacuum setting to control it would b= e > a good idea for a feature. I'm all for that. Yours, Laurenz Albe