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 1vP2qY-001hmM-2g for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Nov 2025 18:05:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vP2qW-00CmEd-0A for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Nov 2025 18:05:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vP2qV-00CmEV-2U for pgsql-hackers@lists.postgresql.org; Fri, 28 Nov 2025 18:05:28 +0000 Received: from mail-qt1-x829.google.com ([2607:f8b0:4864:20::829]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vP2qU-0021pq-0B for pgsql-hackers@postgresql.org; Fri, 28 Nov 2025 18:05:27 +0000 Received: by mail-qt1-x829.google.com with SMTP id d75a77b69052e-4edb8d6e98aso799521cf.0 for ; Fri, 28 Nov 2025 10:05:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1764353124; x=1764957924; 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=lrwKSXNtQ/q6M99Uyo5jF1ESoCfGWTsiS7VUv7dv8uw=; b=vkE4vMnrtJi5jWHzZ3l8A2pcM17Qw5xU1sUVozMezgZBX4EjNbsB++s6cJLdPlX0sW nj8znbhc8dwL/C/5QVU7DagAgMxeqlLLCpCs55PjA21DM+U8n8qKT3K9YNG/VLuo48zz ZcRuyQnrEoWz0NU4ZwRJWen06qbsVYMLMRUtti/R9UTGhEPfzykDIYqVbXEAeB0DEnUu vGPzxvyD/dWMZVkNwrSYTNfyB5tj7wFwyaHCwH/dgclmvZL+AOJRKpBYka+ogs2GgQn0 takFd9cG1iRtDMW5kfiLpc+BxRN6Bug9/IjhsAzaYoO3NVOxYPs3NBcpUmHGxtsH5Dnq qBGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764353124; x=1764957924; 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=lrwKSXNtQ/q6M99Uyo5jF1ESoCfGWTsiS7VUv7dv8uw=; b=lojSfgWhwgHA/WdhtkAKHLoQ63rYBulQVNbMIQ+zcN24A0Levcw9uhJqJye/8WcEhL yOtsJVM0pml+IGE+RFDCe1mh0H0SYxJ1Qn9bgsbtz5PvJwxDnGmohvXb8ClQ3QkFqqeS 0fmNpMUQ0ZXH/jMpq2I1EHzyO45o8iESyAN55iCbK8+nqSh0ypcpODVYr0hH7DONDpUh K7faXa9WrGtFalG5L03U8/3nr71rq4iu8hZQn6J7bzlYc0I0FyjeIdZApI65T0hV4irX izku5Uok9xPPDYcEeTxq+1BiDSfQPILH9s1klN63t3ae6xprYgtoogfyBYS9hE2ChXVH ZCfA== X-Forwarded-Encrypted: i=1; AJvYcCXnU3cKoyb6eL5B9TRig7JV0j1bBdKj1/AYpK59dXw2E7hv07eG5t6j73ZLLDtabaORNQOIr6hmLFBteu6L@postgresql.org X-Gm-Message-State: AOJu0YwbV53VRAd6E4D5zXjrkCSHeflzP+WzPPzgU1EfPcURj5mmzjdt Keu6f06lHY37D88UgOE5EnphDU7LRjB37PTBTIypBi7ozSQY/wA/IqyZOZlLbOlxFgONlD4xnGZ vweFUCIrCqsOhKZy9twQ+1NCbwxMHUWl+AdMQQv3U X-Gm-Gg: ASbGncuXphrjIMW9x6ULhm6vdmcgK6H7saltjpG0oOknpfuEUa+xoZAqN0qzMtp4bvv +hIzAx6iszj9h5C3z8q2XTD8L4bt5/hJ0ggCEBDCF2OAMq8EFgbh9eMniAF8w9kicELQQ6BrczR SOwbhimPQn7VNMwMq+8JlY1Y01v0V9gAkPM9B5cixzXM6sh6aDR9DGfOqCdvEPCuyNNwwnomrr5 TaDqUaAzDjWAahw3Lcndwu7A+lZtD5DWTU4mx4vgWCMo1fuha+Iv04ffACy0MsiDorbifnaBx6+ xHedbklaFEXr8R88mRh4gvzk5cyk X-Google-Smtp-Source: AGHT+IFbcPgaxu79kyN3NMzJyO+fV0p2Gh6hdUP8HxoessAIjrqpHtr17awVN33PZKZMYZUFI7HYGcPIgsxT28d/Wrc= X-Received: by 2002:a05:622a:1ba0:b0:4b7:aa51:116a with SMTP id d75a77b69052e-4efd0c6342cmr8400511cf.4.1764353123757; Fri, 28 Nov 2025 10:05:23 -0800 (PST) MIME-Version: 1.0 References: <202505181556.3n6oiowvntyr@alvherre.pgsql> In-Reply-To: From: Hannu Krosing Date: Fri, 28 Nov 2025 19:05:12 +0100 X-Gm-Features: AWmQ_blp25ryh9eZGcdkseACSufq1NECXHm7IGzIhbmOGzNd9EU8LAYAEMng-cE Message-ID: Subject: Re: Revisiting {CREATE INDEX, REINDEX} CONCURRENTLY improvements To: Matthias van de Meent Cc: Mihail Nikalayeu , Sergey Sargsyan , =?UTF-8?Q?=C3=81lvaro_Herrera?= , 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 Fri, Nov 28, 2025 at 6:58=E2=80=AFPM Hannu Krosing w= rote: > > On Fri, Nov 28, 2025 at 5:58=E2=80=AFPM Matthias van de Meent > wrote: > > > ... > > I'm a bit worried, though, that LR may lose updates due to commit > > order differences between WAL and PGPROC. I don't know how that's > > handled in logical decoding, and can't find much literature about it > > in the repo either. > > Now the reference to logical decoding made me think that maybe to real > fix for CIC would be to leverage logical decoding for the 2nd pass of > CIC and not worry about in-page visibilities at all. And if we are concerned about having possibly to scan more WAL than we would have had to scan the table, we can start a tuple-to-index-collector immediately after starting the CIC. For extra efficiency gains the collector itself should have two phases 1. While the first pass of CIC is collecting the visible tuple for index the logical decoding collector also collects any new tuples added after the CIC start. 2. When the first pass collection finishes, it also gets the indexes collected so far by the logical decoding collectoir and adds them to the first set before the sorting and creating the index. 3. once the initial index is created, the CIC just gets whatever else was collected after 2. and adds these to the index --- Hannu > > --- > Hannu