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.96) (envelope-from ) id 1vQKq3-005hWw-1h for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Dec 2025 07:30:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vQKq2-006Ng4-28 for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Dec 2025 07:30:18 +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.96) (envelope-from ) id 1vQKns-006Kpa-29 for pgsql-hackers@lists.postgresql.org; Tue, 02 Dec 2025 07:28:05 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vQKnq-002hrl-0J for pgsql-hackers@postgresql.org; Tue, 02 Dec 2025 07:28:04 +0000 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4779aa4f928so42763295e9.1 for ; Mon, 01 Dec 2025 23:28:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1764660481; x=1765265281; darn=postgresql.org; h=message-id:date:content-transfer-encoding:mime-version:comments :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=N40C/EFCEWbhnR8gx11gPFxARtAOx0vRjAE65r3mXKg=; b=Q4bxlwyCAGpwe9pygBg6QN/asMs2eq2ZymdNaYdKt4BsS5RNBZt1ky0W3a3BqF18X0 Ly80n5HjRG2iXUNIwgytFREb1RJML4FS+zYl/al5ZzxqyBcjmGGJv2PfoFs9z/DkC3oi K07QhQFarNyg97jLVCwf6KrfuONm4Y012pRaTJR91qx1wHQlg5idQNdD63BL8s+tHK6i YkzmvgQEpnwbtpPlNzukrGl3b49AwMOCYfoRRY7BiLezIk0YRrJ32LIzu69IWwymxTbw H+o7YhV8DmcD70fRqB8IJ5CuDuOD+gXkZpWQZ4w32ygArXNTRLp4PEf1S1e0ETqiNO7z ebLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764660481; x=1765265281; h=message-id:date:content-transfer-encoding:mime-version:comments :references:in-reply-to:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=N40C/EFCEWbhnR8gx11gPFxARtAOx0vRjAE65r3mXKg=; b=kN03V9ph9SNewm6PtQtP6djz5dwJyzQjwNZmPCA20top5lA49ky5LVFCuWjvSUxJrV HONodDOnHogOWisC/n4GrB9AmQVqByf3Vp4mCeCYeM5RuyutTJ0oHY1s+8rm3zkHQvZS 2Uuw0/0yWugf/sGFD0Vk+ig54sPAyh79z/u5TQuO3ZvcHCGJvwhxR9cNSwqnDyt3gVQt 3GCJbXCC0KlawC2IzYrAhR7OeN6mwcLMjd5fU05Js/4ZKZP8Hp5DgBPkWXJJb2U/QaJ4 Sl+7/NJQ4bHzA8A7YUM5dAy2HwAHkKcddjI1DBr6UNPI/abeU9ucUFfM20ASkbBi9WOY V/LA== X-Forwarded-Encrypted: i=1; AJvYcCUdNeB+Umc7xMgR4MFYyopF2YFLFM1Cdd+gzx4i5cKbS54ujnWGoFC9wG/E2CtPBcMTDhJGW8V4sANfgIbq@postgresql.org X-Gm-Message-State: AOJu0YyEaO/Rc/mzdl2HDFuBHnPnxLdTTNE043CDnYi7YECAy/IdjnC/ vON2FN9FLJpbPHCYdlLYDom6COlsIJOmhY1eX/llAG61Zkk1h0Qbbesn0vXsJanEQSs= X-Gm-Gg: ASbGncvoZvn4LCGQDWLCyiMScPxzmO7ziNxNhMRsdajZdhlfWrarnCjU32fyHbrp2TW 0IBPO4FMUZdv/d5dyvIVtZiVk9OA4usKUw+NE32q4GiYzV/r/qesFwaqhIC9Ox3CeEqAvjEcLIW ErckyFkItcl+f6c7xlDKBp2NPrrj7sHsZscr4c7e11vDAuh8vVDnUpupj9t9swLHdLpLnKHVHaY QDxLm2VbvrmLw7Rh5M4aIEk5/O/YBYSjJHBXDmWo2dn+Em8I/4kQAZolrID0HCNGsxCE90WeY15 Gf9Nukw3zm0EDjRV5sinNNiCtDGBoUViCljJz2J1xteFSjeRLOCI9zWL4S7FedLReym/zdcDPIM p5dhacEJUxO1xXzuPj+R9PgZzrUbQveRmu6UsJsSDH+MRZkeNAsWAlBsP0r0weHde6vqz2rZNMK w7aycyx0AJyXERYrwj7Iu0qnzP X-Google-Smtp-Source: AGHT+IG6zNXmgJ++XWncEUDxKfUNR730sAS0+Z/X6T9n5KKkokee3r13kEaMvXDmaOBVGkT/8HPOAw== X-Received: by 2002:a05:600c:1c24:b0:477:aed0:f40a with SMTP id 5b1f17b1804b1-47904b1af90mr346395315e9.19.1764660481451; Mon, 01 Dec 2025 23:28:01 -0800 (PST) Received: from localhost (109-81-168-246.rct.o2.cz. [109.81.168.246]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47927a008bdsm7565295e9.15.2025.12.01.23.28.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Dec 2025 23:28:01 -0800 (PST) From: Antonin Houska To: Mihail Nikalayeu cc: Hannu Krosing , Matthias van de Meent , Sergey Sargsyan , alvherre@kurilemu.de, Andres Freund , Michael Paquier , PostgreSQL Hackers , Andrey Borodin , Melanie Plageman Subject: Re: Revisiting {CREATE INDEX, REINDEX} CONCURRENTLY improvements In-reply-to: References: <202505181556.3n6oiowvntyr@alvherre.pgsql> <8010.1764584989@localhost> Comments: In-reply-to Mihail Nikalayeu message dated "Mon, 01 Dec 2025 11:49:37 +0100." X-Mailer: MH-E 8.6+git; nmh 1.8; GNU Emacs 28.3 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 02 Dec 2025 08:28:00 +0100 Message-ID: <5778.1764660480@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Mihail Nikalayeu wrote: > Hello, Antonin! >=20 > On Mon, Dec 1, 2025 at 11:29=E2=80=AFAM Antonin Houska w= rote: > > With logical replication, we cannot really use multiple snapshots as Mi= hail is > > proposing elsewhere in the thread, because the logical decoding system = only > > generates the snapshot for non-catalog tables once (LR uses that snapsh= ot for > > the initial table synchronization). Only snapshots for system catalog t= ables > > are then built as the WAL decoding progresses. It can be worked around = by > > considering regular table as catalog during the processing, but it curr= ently > > introduces quite some overhead: >=20 > My idea related to REPACK is a little bit different. I am not talking > about snapshots generated by LR - just GetLatestSnapshot. >=20 > > The core problem here is that the snapshot you need for the first pass > > restricts VACUUM on all tables in the database >=20 > We might use it only for a few seconds - it is required only to > *start* the scan (to ensure we will not miss anything in the table). > After we may throw it away and ask GetLatestSnapshot a fresh one for > next N pages. We just need to synchronize scan position in the table > and logical decoding. >=20 > The same is possible for CIC too. In that case we should do the same > and just store all incoming tuples the same way as STIR does it. I suppose you don't want to use logical decoding for CIC, do you? How can t= hen it be "the same" like in REPACK (CONCURRENTLY)? Or do you propose to rework REPACK (CONCURRENTLY) from scratch so that it does not use logical decoding either? --=20 Antonin Houska Web: https://www.cybertec-postgresql.com