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 1tcLqG-00H37J-Sl for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Jan 2025 09:55:41 +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 1tcLqF-00B9dG-7M for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Jan 2025 09:55:39 +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 1tcLqE-00B9d8-TD for pgsql-hackers@lists.postgresql.org; Mon, 27 Jan 2025 09:55:38 +0000 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tcLqC-001jxh-2A for pgsql-hackers@postgresql.org; Mon, 27 Jan 2025 09:55:37 +0000 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-5d3d143376dso5917761a12.3 for ; Mon, 27 Jan 2025 01:55:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1737971736; x=1738576536; 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=D/Nw58DYC26fbhfMwZY9HSZ6GVCKo3VdZNmxUaFYCvo=; b=LBnodxTFqgx0iSp8ilZvhlcC+UODmuk/UTq/9HCEz5SdH4cga9rvcbnOLf0+qarDUr zYCRg6bPBv36oSAG4SS3I3gRTzf7UfgDwlZOMxBxvUkTMS/yIeuZtMReCxUK0tPDbf0q qiYCASgZb3Ru0UzO1gGnQP8Sz0OO+S1HpbKEiK9+1a28F7RNunmVpfeyLG8zxSMgrgU9 6fCDM7+ePpmvwRWmFzcLwdV0AdZGG62cNaYwEtu296w8XPYjst4ctpWwpSk47CJIu2n8 ywYrfeiD97hlA9K4hlBlk9tAQ5gs3RjSle1JMmupommoHFHfPorcyQMDb+G8hbzkFKla Etaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737971736; x=1738576536; 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=D/Nw58DYC26fbhfMwZY9HSZ6GVCKo3VdZNmxUaFYCvo=; b=BZHCi3I64ve5gqXNtpjgO8IscQJk8wx4b0EDzgaCk21d9IkClT2FV3CfDp5bXB8rOq B3l3KXRXKuCRn8PDHMaa4yKoL/qyya55OOKJENmu4DJjfQ0CKuNtsBu3K/EWo0ON+T/K LxKTS/JmrAbs7gzbOqhzr7Dankt8r5VIX3UxY93Sw1qr0SnMvKmekpOCfMebw2Tnxc9v 6HBUmovscttaEG+1aBHhOTfQnGWXKJRWC1vTmr7EhjFOllpTqsmLPOM8c3OMA86gr6nK 43RAKIAXjDt49E5ouzp5NgIOah+977h7rdNcS9W6BV81hcwGU0uU3OJirrKkd7FVI9kH g+UQ== X-Forwarded-Encrypted: i=1; AJvYcCUataw+RaTPB3EwZVO5j4lWKdfKpB6npzazP1BGQHmFYQvZpDeq4n5c1FWlcUzJr9LG64bRvm4lJRVmMe26@postgresql.org X-Gm-Message-State: AOJu0Yzr3BJTo2guOptg6GeMedG5IVlu0OwZOZzAmJ2Y8jb/VHICvxLa Xl/9GXXJEW2aTYFN2573aNVA3SqOMhQSd1OQE5WhYKvQ15dEUmbe+3MgzG9218GL/U2m7t/lyfm O X-Gm-Gg: ASbGncs2hK1wulNvlUSpP4movvOXKY9moP1jLOqM8BAp38YjLq3KJK5/O0NkaFMsPIy zhX0fwUrOX0EA+GX8AIfgzgdAo1q5dzVqCleC7Ssiy2FTfVJLgjYLyL+SGYjP7j0hNv4jOtEI9N s4inaYeJQNCt+9ROIOuKpJQ3tC8pgPDtTbzE+JlImY7BMpjvaM+zEqnhkReysWtpb1qhEBG9HIk ylVMCG/6l+D3x0akrRbHWIS3wm22GQULe+MVELxAEaxFD55KrcAZovLv+S4E1TQ6CNs5FoMBVyJ Uhkg2vDDmKI/XFKw7qhyhSPe X-Google-Smtp-Source: AGHT+IEI+iH6D9vaMbIAZqrRO+oGPglZSEbY/HNFHaChoiZHcJU8dWkE7tegavEM35FE0pZsxuk4DQ== X-Received: by 2002:a05:6402:5246:b0:5d0:d84c:abb3 with SMTP id 4fb4d7f45d1cf-5db7db0860cmr33991486a12.26.1737971735642; Mon, 27 Jan 2025 01:55:35 -0800 (PST) Received: from localhost.localdomain ([2001:871:5e:d10a:515c:df26:bd3e:3870]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5dc18619319sm5169770a12.6.2025.01.27.01.55.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jan 2025 01:55:35 -0800 (PST) Message-ID: Subject: Re: Disabling vacuum truncate for autovacuum From: Laurenz Albe To: Gurjeet Singh , Postgres Hackers Cc: Will Storey Date: Mon, 27 Jan 2025 10:55:34 +0100 In-Reply-To: References: 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 Thu, 2025-01-23 at 22:33 -0800, Gurjeet Singh wrote: > > > I am also wondering if having an autovacuum setting to control it wou= ld be > > > a good idea for a feature. > >=20 > > I'm all for that. >=20 > Please see attached an initial patch to disable truncation behaviour in > autovacuum. This patch retains the default behavior of autovacuum truncat= ing > relations. The user is allowed to change the behaviour and disable relati= on > truncations system-wide by setting autovacuum_disable_vacuum_truncate =3D= true. > Better parameter names welcome :-) I hope it is possible to override the global setting with the "vacuum_trunc= ate" option on an individual table. My suggestion for the parameter name is "autovacuum_disable_truncate". > One additional improvement I can think of is to emit a WARNING or NOTICE = message > that truncate operation is being skipped, perhaps only if the truncation > would've freed up space over a certain threshold. Interesting idea, but I think it is independent from this patch. > Perhaps there's value in letting this parameter be specified at database = level, > but I'm not able to think of a reason why someone would want to disable t= his > behaviour on just one database. So leaving the parameter context to be th= e same > as most other autovacuum parameters: SIGHUP. I can imagine setting that on only a certain database. Different databases typically have different applications, which have different needs. Eventually, the patch should have documentation and regression tests. Yours, Laurenz Albe