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 1tQuMA-005xpA-UH for pgsql-general@arkaria.postgresql.org; Thu, 26 Dec 2024 20:21:19 +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 1tQuM9-004Vb9-DS for pgsql-general@arkaria.postgresql.org; Thu, 26 Dec 2024 20:21:17 +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 1tQuM8-004Vb1-UU for pgsql-general@lists.postgresql.org; Thu, 26 Dec 2024 20:21:16 +0000 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tQuM6-000hJz-0r for pgsql-general@lists.postgresql.org; Thu, 26 Dec 2024 20:21:15 +0000 Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-2ee67e9287fso7963367a91.0 for ; Thu, 26 Dec 2024 12:21:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ardentperf-com.20230601.gappssmtp.com; s=20230601; t=1735244473; x=1735849273; darn=lists.postgresql.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:to:from:date:from:to:cc:subject:date:message-id :reply-to; bh=QvVwPDjTFB3hEGxNsaJf8lkgG4Dq1Sp+J7phOipL1Ko=; b=SEalVjCDpihw26oaS4C3f85rW5v7MsSqKkbhgxYdtNFo5O7PA1U7S79BSwTJQFnKKU S1cO1EZ2IYnUMYlUYHnNpawFzzhjvhYV1tHSiPry481sTUmhkORYUn2XqdJUtg7LLAw9 D6YuRzoYTTeRTEG1PXyYU2Kw6nNCY2V4X/399fdze9rNLFh32i1w+2XqsWqoYu0e4pgD Ez8G6Pl7ctnj543vbkLr8UhM9EfiHXio54sbXiWxhqyKQXi5fuQvfWxwLRGHz1EH0g/b HKgE1OjWLJoWxyZJRwNPlub5sEU5SO/r48no1c0TEj5gkpf/oec/gjCYdmbt0fA4TLC5 TDpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735244473; x=1735849273; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QvVwPDjTFB3hEGxNsaJf8lkgG4Dq1Sp+J7phOipL1Ko=; b=Vqlc2rJeAnYUrZA2GTbu4M78svdKb+2/INU3NWL5CNWGFjMyDv2W67FXp8KAcPXM3+ OHn8HZH5VUT6u55vmtBDQjQfEZznoXWyABZ2QGlRqxVM4bvmcP39NBF6YxLtgVLfqupR 8N6hO8A7rD8jeArEmD8G1ko6Bh8nnNqSD03XjWiSLHGuvsMT9XGz1bzsj47zuplCkTdK HNjhTMNa4vXZ61tr/w4NebGAh9HPf7GA4RocQfy8KTwCG35ARG4BbByWDA9iEFRVQxqg jqu/kAKXKsZ1ioCZj2lbfgC0EX9Ctyo5X+0pEJcrYNins0LQaIIM/6Wva+/5IPZSKZdI UZjQ== X-Forwarded-Encrypted: i=1; AJvYcCW677T2SBIA8dGKLpDVPcSFqBdwb0+/Kg4KZ+pTekVU1eOyzF+PqHBrgZlSXnt6Vo2WF6XMg4ITgjsY5Mr5@lists.postgresql.org X-Gm-Message-State: AOJu0Yxb29uGXTVUnrBjavdJ5cTN4Zyvk3bECVQjEzgl+iKQWAmdE/o+ D64+sAfXfrQDpj0LkRiI4Bxok7YVdimPMChISEOzci7fhtdDF1YrVnnANamy2w== X-Gm-Gg: ASbGncuzPkPrKz1cEz+5u2kd2fPnZkE33h1bNkeewTTgN7QlRIVE6zBiZXmYqCL6mUT 8rg/gluzdkj7HLnXPPjvKjS+IIMYoTXryGKbhdixPKAry0J5+1TKQChQkxWwDhbiumsTX9IfPof haYb6Ui9mGZw1OXW+OOBSMGJmr6nF3SQTYNykVuetE/eLMWLbePZJoL6HojHkLf+ZpTGRaifENA Lqh24zF3PJS0m5qFDvqs+BWf7PD99u0ooQ6fgBAc4FHjRUWBIixL01ge6uDXT1Um8Yqtq6bwFc9 NiRM1wJ0tSD2MS6u1Jq9OD4Eog== X-Google-Smtp-Source: AGHT+IEfUO9LFhJ+1lETrS/w1Ce5u7FPPpGxUFST/3iVOdzBXC0R+SBrBRzjgJAhfPAlAPCCDfPsDQ== X-Received: by 2002:a05:6a00:3cc1:b0:726:41e:b32e with SMTP id d2e1a72fcca58-72abdd3ced1mr30550710b3a.4.1735244473184; Thu, 26 Dec 2024 12:21:13 -0800 (PST) Received: from jeremy-ThinkPad-T430s (97-113-75-71.tukw.qwest.net. [97.113.75.71]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-842bdfb5759sm10381505a12.51.2024.12.26.12.21.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Dec 2024 12:21:12 -0800 (PST) Date: Thu, 26 Dec 2024 12:21:08 -0800 From: Jeremy Schneider To: Will Storey , pgsql-general@lists.postgresql.org Subject: Re: Disabling vacuum truncate for autovacuum Message-ID: <20241226122108.33e906a3@jeremy-ThinkPad-T430s> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 16 Dec 2024 16:25:06 -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. > > 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 this as well. This is of interest to me > because I'm looking at tuning autovacuum and getting rid of the > cronjob, but I've realized relying on autovacuum could be dangerous > because of the truncates. Can you tell us a little bit more about the outage? Autovacuum is designed to quickly relinquish this lock if there is any contention, and the dangers of disabling autovacuum are significant, so your statement about autovac being "dangerous" will raise a lot of eyebrows. Did your outage involve hot standbys serving read-only traffic, or did it only involve a read-write database? What was the exact nature of the outage and how did you narrow down the cause to the exclusive lock held specifically during an autovacuum truncation? -Jeremy