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 1vOhBv-001icl-2o for pgsql-hackers@arkaria.postgresql.org; Thu, 27 Nov 2025 18:58:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vOhBt-007zuJ-0d for pgsql-hackers@arkaria.postgresql.org; Thu, 27 Nov 2025 18:58:05 +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 1vOhBs-007zuB-2t for pgsql-hackers@lists.postgresql.org; Thu, 27 Nov 2025 18:58:05 +0000 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vOhBq-001pmA-2o for pgsql-hackers@postgresql.org; Thu, 27 Nov 2025 18:58:04 +0000 Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-37b9728a353so14889921fa.0 for ; Thu, 27 Nov 2025 10:58:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764269881; x=1764874681; 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=dGQuAAFDmGknqMfdzOvMuUDeGRzr8vsWpIep5kdh4wk=; b=jdMooVc2iiED6E5IwOFFA74UKWzrVSEBNm3eGT2OsEgAJI5GS5kvcOmldzKgredD78 LolU5SuHfwatW8Na3saMElhGUkPKZxcaBDbnXUTsSmawNbk71CbFDl+5VcdaCYJl/4KJ y+LMOKp9mSMgVaJFrFNE3nijy/5XuHNYcBTimeH80rfewOppOB/bUc6SqG7hsv24Q/6o FF+yjReMrVMfNnmhp5wgojq6KXbYGrTP8kqUEvP4OovnJ6eFW+DAashJ+N5eUuo3zL+s pWkDtt4Up210pLH6SrD3Oh4pxZv/SMBcOUa8dvdoerbxAPSkwD1p75sG+3A4UdiWvNnK kpYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764269881; x=1764874681; 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=dGQuAAFDmGknqMfdzOvMuUDeGRzr8vsWpIep5kdh4wk=; b=iiOIXQy8NSenwR72gRHXIFVuwGrAphU9uI3zZfNfF674wIdZYk6mL2u09HTCls9+Xq LeNx6goPNuNTg6jgjUrQHCnZWadi0S4DR1V4jPkPh8vzLfPvt8fECiPR39bTsuBXYTqS p3lG/kK6gzM2pjuSFMSJGknPDWY959UVHzhauukQEefuOv8QM78gagGFFjexgjnghHLE oWdzGrEBs9kxB9w6wGRdYQeRjMg/7sJr3GVIZYedcyQTRYxqyhIMCDlEm4dAK0Go8mDL 7SVHJLgDogmsHXwBQz4GUR2oTyBDIQKtAsD4raIdKP7Xg5gv9ABWoi/IpxSNWpK8FFaU Jlpg== X-Gm-Message-State: AOJu0YzHlt4hannyBjTvCPGPcK1PIdUXTcf484gFuQLscG39ACEjxiTx i9lBpe+udikY+CTT9yFhIOPSRsFIMrqRBR4ZifgLtZ13YlvHcpubWllNAuECytaYfEOGzjo3oGZ /Ed5LSspaFdtx3QHPP3f/srpqfauJg9H37evn X-Gm-Gg: ASbGncsyhd+B6QY5/G+22MITYnp0Z7evpK1QsPjwJUix1oFzQcJjGy9rVkyYM8S6Aev Xs7u6BBzmtBI2WtzZjkNJdBZ8a3DMT+cprZUzjDqPUlJO49/Z9yx02b8SVLtvBh1+KiA7j0u1XE sd5kuN7IIi0Nw8gnt2n59+HFwQB+PCHbInpLCmb7iKv3Etr1HE4oa0SluIkV4euJvIZtc2fpB4Q 790wjFMptRgLuVulrTrVnGHrLzcjGfCn7+ADnTuFWOR3nTGVVxpIXpRfMyIQSEypirudA== X-Google-Smtp-Source: AGHT+IFVeMrNh8gNhtHHpaujKr94yqtrPfSu1npsfmk75Qe1npqGe/vUyDLJ3T3d5VhpkZhz0ukFDbXab/2A8+V7KAA= X-Received: by 2002:a05:6512:ba2:b0:592:f773:3cc2 with SMTP id 2adb3069b0e04-596a3edfafamr7921600e87.43.1764269881269; Thu, 27 Nov 2025 10:58:01 -0800 (PST) MIME-Version: 1.0 References: <17483.1764262585@localhost> In-Reply-To: From: Mihail Nikalayeu Date: Thu, 27 Nov 2025 19:57:23 +0100 X-Gm-Features: AWmQ_blTXYbym0vS92j-osYHrEwfcnNOSnwFk486VbZWxBhv9Uhg4CJybiZtWX4 Message-ID: Subject: Re: Revisiting {CREATE INDEX, REINDEX} CONCURRENTLY improvements To: Antonin Houska Cc: PostgreSQL Hackers , Alvaro Herrera 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 Hi, Antonin! On Thu, Nov 27, 2025 at 6:40=E2=80=AFPM Mihail Nikalayeu wrote: > > 1. Create an empty index. > Yes, patch does exactly the same, introducing special lightweight AM - > STIR (Short Term Index Replacement) to collect new tuples. Initially understood incorrectly - in your solution you propose to use a single index. But STIR is used to collect new coming tuples, while the main index is built using a batched way. > To avoid insertions of tuples that concurrent transactions have just > inserted, we'd need something like index.c:validate_index() (i.e. insert > into the index only the tuples that it does not contain yet), but w/o > snapshot because we already have the heap tuples collected. And later main and STIR are merged. Best regards, Mikhail.