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 1vQOJD-006ecQ-2T for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Dec 2025 11:12:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vQOJB-007MF2-0x for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Dec 2025 11:12:37 +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 1vQOJA-007MEt-2o for pgsql-hackers@lists.postgresql.org; Tue, 02 Dec 2025 11:12:37 +0000 Received: from mail-lj1-x235.google.com ([2a00:1450:4864:20::235]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vQOJ8-002jXe-0C for pgsql-hackers@postgresql.org; Tue, 02 Dec 2025 11:12:36 +0000 Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-37a875e3418so40108761fa.1 for ; Tue, 02 Dec 2025 03:12:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764673953; x=1765278753; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=57FGT9FlJtV/aSQF3pd4HgkNypg1YOXrPYksO6vO1vc=; b=VC5ASbSzZ2QdkbgbyQXVYE6iYxQwtrfaLrjmC99ETZ0Fx27lY73fjs3Zovv9zLtaId 64Q39Zf+VRHVKGO57aV9IXOBrgA1RyBhwIVix9CIYk9VXVF/L4VxZF4+yMYLPapQ4MXe HYHIinrCYBHGXwCiU9q2a0LjPlFld44YtCdtLgU1e4Ia+do3LoiudOG8p1gvRrIh/vWv xqd8Po873TmmSOTnzDCjTbmCrQfA+TBYcLRI1tfujBTLOXUo04MyF9uZy973VVCM17Xt gnNxaUzRnUHwRbC6M0qpd6EfiTVkwj12h4sLKzLmrsipUDwHefC5+47V1ZCeB7rv4AYf ViEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764673953; x=1765278753; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=57FGT9FlJtV/aSQF3pd4HgkNypg1YOXrPYksO6vO1vc=; b=SNvRod2xGPemW/BMG+CTbY3rviyIXQMUF6UnRCyid2UPck/38jQLyEOvqdnG3Vm+8X TJtOYw4GajRFBU7OIDRYw/GRNFbRRJ46gA7+UML7xbPEm8J9TwTyUip2iu/NS78w0zBQ nqyFYeNEFXMytAN3+XXkSpmW9T+MVKXg4EUrwUw1JhERjPjABvcrVaImY2gcXCwIKxzI lP63FxvMMDr9qhCzPnEsnJPzE4pV6RX2wDQJfPpj6rSDkk6k4DgbBc9+UJb72e9tDVf+ +SBpo/gBdzZcERz+NzsMZ9a70tZC0V6iFuJ2T3MOGGQL/0Ik+iZ4t6GYJDXg4qjLe5Vh 5YVg== X-Forwarded-Encrypted: i=1; AJvYcCW+nr7pT+rqgzghrqlzq1YvdClTPIGsn+Kr5iEhqhqyBl23EadJd8erYaWtZ/suynduBqhwNs1vgwIVA9El@postgresql.org X-Gm-Message-State: AOJu0Yy2HonLYPDe+4G8rg4sjNucFl1EtZbthPerdbB02odFrAzunW4B oWmrG92WLGz7dHCvC7jPq5EcfQ40PjrgvTvg0dHujj3VAHrekNNVROBgeDENxXC8DUwXQuqHN23 3RVyKbaVbpgQLLBnv5sgOkA0YfpV62Oc= X-Gm-Gg: ASbGncucgPtSr6hvngwblXvp1SbnNhxerMgd3TvFYhtOnYdMGHYfxWUxlkEVEam7sUQ iIgU0N1M4WPDMOENLAUOOtkg4C+TztAYtMNNrJBvJGMse3yk2DVAEL8ESSOG6Jpt5msgiUI85gw jCJMREP972zh6x9ftEHFR81+jNYqXunihGVJNb93vq0tfGFu25bviqePQ1jwNv3jzo9gaSzRqxV 8Nt/w19SE++SxVq32Y6Hi1VrQWsK1WgilLq+DY1/3qlAWLq6saC3o9zM2LF/9t9mS5ZhlXRrX6m 2CsVRkrLZwrclVi8ZMhHDP1TFxLI/I0zS+0dUvkhHYDcVSradRxTr5PNA99f0sCvmeKw X-Google-Smtp-Source: AGHT+IFL+MxoQSp37m5lw0UPCKEGEDLuj7fSAF0YcTEaST2QCmCDWMnyGOk0zyCO+QQBFoaSOWfXJFrk9AxfrvPgWNs= X-Received: by 2002:a05:651c:305b:b0:37a:2c75:7d83 with SMTP id 38308e7fff4ca-37d077a26cemr76047741fa.13.1764673952823; Tue, 02 Dec 2025 03:12:32 -0800 (PST) MIME-Version: 1.0 References: <202505181556.3n6oiowvntyr@alvherre.pgsql> <8010.1764584989@localhost> <5778.1764660480@localhost> In-Reply-To: From: Matthias van de Meent Date: Tue, 2 Dec 2025 12:12:17 +0100 X-Gm-Features: AWmQ_bnWCugYoE2JCNx5vvMo03bxgBdp5OscHmOEX0zMwXl_mMKRquMH1fPLdKU Message-ID: Subject: Re: Revisiting {CREATE INDEX, REINDEX} CONCURRENTLY improvements To: Mihail Nikalayeu Cc: Antonin Houska , Hannu Krosing , Sergey Sargsyan , alvherre@kurilemu.de, Andres Freund , Michael Paquier , PostgreSQL Hackers , Andrey Borodin , Melanie Plageman Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 2 Dec 2025 at 11:27, Mihail Nikalayeu w= rote: > > Hello, Antonin! > > On Tue, Dec 2, 2025 at 8:28=E2=80=AFAM Antonin Houska wr= ote: > > I suppose you don't want to use logical decoding for CIC, do you? How c= an then > > it be "the same" like in REPACK (CONCURRENTLY)? Or do you propose to re= work > > REPACK (CONCURRENTLY) from scratch so that it does not use logical deco= ding > > either? > > My logic here chain is next: > * looks like we may reuse snapshot reset technique for REPACK, using > LR+some tricks > * if it worked, why should we use reset technique + STIR (not LR too) in = CIC? Because it's more easy to reason about STIR than it is to reason about LR, especially when it concerns things like "overhead in heavily loaded systems". For CIC, you know that the amount of IO required is proportional only to the table's data. With LR, that guarantee is gone; concurrent workloads may bloat the WAL that needs to be scanned to many times the size of the data you didn't have to scan. > * mostly because it is not possible to active LR for some of tables > * but there is (your) patch what aims to add the ability to activate > LR for any table > * if it worked - it feels natural to replace STIR by LR to keep things > looking the same and working the same way > > While STIR may be more efficient and simple for CIC - it is still an > additional entity in the PG domain, so LR may be a better solution > from a system design perspective. LR is a very complicated system that depends on WAL and various other subsystems to work; and has a significant amount of overhead. I disagree with any work to make (concurrent) index creation depend on WAL; it is _not_ the right approach. Don't shoe-horn this into that. > But it is only thought so far, because I have not yet proved reset > snapshot is possible for REPACK (need to do some POC at least). > What do you think? I don't think we should be worrying about REPACK here and now. > Also, I think I'll extract reset-snapshot for CIC in a separate CF > entry, since it still may be used with or without either STIR or LR. Thanks! Kind regards, Matthias van de Meent Databricks (https://www.databricks.com)