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 1tdxE9-00Ayvw-8h for pgsql-hackers@arkaria.postgresql.org; Fri, 31 Jan 2025 20:02:58 +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 1tdxE5-002LO1-RB for pgsql-hackers@arkaria.postgresql.org; Fri, 31 Jan 2025 20:02:53 +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 1tdxE5-002LNt-GC for pgsql-hackers@lists.postgresql.org; Fri, 31 Jan 2025 20:02:53 +0000 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tdxE2-002W7O-38 for pgsql-hackers@postgresql.org; Fri, 31 Jan 2025 20:02:52 +0000 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-43675b1155bso27536925e9.2 for ; Fri, 31 Jan 2025 12:02:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1738353769; x=1738958569; darn=postgresql.org; h=message-id:date:content-transfer-encoding:content-id:mime-version :comments:references:in-reply-to:subject:cc:to:from:from:to:cc :subject:date:message-id:reply-to; bh=U64TriN13cQQW2Ur7lwoiH2i02dpYYJZkvRT+sUVI7w=; b=AtShV8XFw6S5zaUJ5IIaILpUcf3Es0NWFze2m6HaRd/kRLU1KKxXCZ3hSg2iwayXrc 9yGm68QC3f22HpAqfkXE6ZTFFNcfAU7mzR1G6y7j8309pAVTEvxZU2YjoOwXS0P7Cs6R lUSUpe6bnRBSRWD7gxXQ6z6kE1EoFWbU93OX5fOjczzYB3EmrIfEH/12zsKHFFsjiNZx HuA+kDqQs62slJIA6ullOiHgbSianKNfXlwYmlLuKhqRV8Y5MpKrQVr9EBpbNJTZV9jl dOyalZrqq9Qnu1RaRLpTXCNhbuF1JfbZnPFRGoCvBFEkfNDNgtGCmj5XFnXGbmbLNjXK 8A2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738353769; x=1738958569; h=message-id:date:content-transfer-encoding:content-id:mime-version :comments:references:in-reply-to:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=U64TriN13cQQW2Ur7lwoiH2i02dpYYJZkvRT+sUVI7w=; b=U2QjFKsVuXXKZqed3WbpRRSu9qwVmo2g9jPyWfJN00mlzFuLcLA15fn5pYx6/vMomY d7SgZZxaai5FJTIEwgzFI9d+bA1OI95IWB5zDnCXvhHAWg/AWz24HKtm6I0XfvVRjaEb zlQVmf/Fr5UoXtIsYHXuicruO8ShJt1eI10sEvPs0lzvhl0/au3rAnPMf7ADFwsTxwfJ HZyhkeC+chHrJb7GitCmhsb4QnTHweMspTgNyDAyBvBnJdVdr+B1iMMkKPzE94Gll2rY UCF+2p3dLGhR0gkLv/CsmFi6UGmxd99dbhCLTj7/3FI1OL5WFBlLYk8TXi+hk5ZdhP1W q+Bg== X-Forwarded-Encrypted: i=1; AJvYcCWldwoDK+f4w2OL3pJhdDMqUzkj1ceEv4Yi/aGsTHdu5Z5qsLfDZo0C2/eSwJCKp7ml2woXxIsIN1g//Ya+@postgresql.org X-Gm-Message-State: AOJu0YwgnaAp/j5nGvh/+OAlJsz9QbnRHALZsOgXrkRnQOSQnNiKSLMQ SuEzel7nu6t4EFihmoyPbRHFkpopME+wRuWv+gOpcJBt5ph+zMr8UjKQ2BnHfAQ= X-Gm-Gg: ASbGnctevcvWyhxizupWMfEGVRMfAW8o0Dr3vWEGiuiFije8HXdURgfE1CFpgMkp/N1 IoaefbtgsoFebxdi4QHwzVTqn9i6JIvcBRvXSQjyYApsyuWJAkJGeBkonz9d5dA4rX86Zc+Vrac VvwLTCGbR1K3mkcstYJvTe0fcxKZh52ZVlwlRZMLRS+DGoevLnTZy/4hMEVuyHqSxwAVU+JjRS7 JTDAvwmZwtZ1gQbMb/dIV3QyuKHJ0WlvdopZQs4BShhhoJmQjWyQcmv7Q97o9cDBqO3GI6peMDJ BTkUEjD2Oc5SwVFTOTU= X-Google-Smtp-Source: AGHT+IGCVbIIB73RZe2j6a4OLnxyFNCg4vs0z9VOH8NTRNkJUt4nHdXLo5pyQE42MLdxK9lD2UDrvA== X-Received: by 2002:a05:600c:870a:b0:434:fff1:1ade with SMTP id 5b1f17b1804b1-438dc3cb7c8mr109982305e9.13.1738353768202; Fri, 31 Jan 2025 12:02:48 -0800 (PST) Received: from antos (109-81-174-36.rct.o2.cz. [109.81.174.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438dcc2ede0sm100884065e9.21.2025.01.31.12.02.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jan 2025 12:02:47 -0800 (PST) From: Antonin Houska To: Alvaro Herrera cc: Matthias van de Meent , Michael Banck , Junwang Zhao , Kirill Reshke , Pavel Stehule , Michael Paquier , PostgreSQL Hackers Subject: Re: why there is not VACUUM FULL CONCURRENTLY? In-reply-to: <202501311334.za2d2icg37sr@alvherre.pgsql> References: <202501311334.za2d2icg37sr@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Fri, 31 Jan 2025 14:34:48 +0100." X-Mailer: MH-E 8.6+git; nmh 1.8; GNU Emacs 28.3 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <26883.1738353767.1@antos> Content-Transfer-Encoding: quoted-printable Date: Fri, 31 Jan 2025 21:02:47 +0100 Message-ID: <26884.1738353767@antos> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Alvaro Herrera wrote: > On 2025-Jan-31, Antonin Houska wrote: > = > > Matthias van de Meent wrote: > = > > > First, due to the XLog-based change detection this feature can't wor= k > > > for unlogged tables without first changing them to logged (which > > > implies first writing the whole table to XLog, to not cause issues o= n > > > any replicas). However, documentation for this limitation seems to b= e > > > missing from the patches, and I hope a solution can be found without > > > requiring LOGGED. > > = > > Currently I've got no idea how to handle UNLOGGED table. I'll at least= fix the > > documentation. > = > Yeah, I think it should be possible, but it's going to require > complicated additional changes to support. I suggest that in the first > version we leave this out, and we can implement it afterwards. > = > > > For (2), I think the scan needs a snapshot to guarantee we keep the > > > original tuples of updates around, wich will hold back any other > > > VACUUM activity in the database. > = > > A single snapshot is used because there is a single stream of decoded = data > > changes. Thus a new version of a tuple is either visible to the snapsh= ot or it > > appears in the stream, but not both. > = > I agree with Matthias that this is going to be a problem. In fact, if > we need to keep the snapshot for long enough (depending on how long it > takes to scan the table), then the snapshot that it needs to keep would > disrupt vacuuming on all the other tables, causing more bloat. If it's > bad enough (say because the table is big enough to take hours to repack > and recreate the indexes on), the bloat situation might be worse after > REPACK has completed than it was before. > = > But -- again -- I think we need to limit the complexity of this patch, > or otherwise we're never going to get it done. So I propose that in our > first implementation we continue to use a single snapshot, and we can > try to find ways to grab fresh snapshots from time to time as a later > improvement on the patch. Customers in situations so bad that they > can't use REPACK to fix their bloat in 18, are already unable to fix it > in earlier versions, so this would not be a regression. I thought about it more during the afternoon. I think that in this case (i.e. snapshot created by the logical replication system), the xmin horizo= n is controlled by the xmin of the replication slot rather than that of the snapshot. And I think that the slot we use for REPACK can have xmin set to invalid (unlike catalog_xmin) as long as we ensure that (even "lazy") VACU= UM ignores table that is being processed by REPACK. In other words, REPACK do= es not have to disrupt vacuuming of the other tables. Please correct me if I'= m wrong. Since the current proposal of REPACK already stores the relation OID in th= e shared memory (so that all backends know that they should write enough information to WAL when doing changes in the table), disabling VACUUM for = that table should not be difficult. -- = Antonin Houska Web: https://www.cybertec-postgresql.com