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 1w9vSi-001tZy-2i for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Apr 2026 01:42: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 1w9vSe-00DGZ8-31 for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Apr 2026 01:42: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 1w9vSe-00DGZ0-1D for pgsql-hackers@lists.postgresql.org; Tue, 07 Apr 2026 01:42:36 +0000 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w9vSc-00000000wwv-2pOG for pgsql-hackers@postgresql.org; Tue, 07 Apr 2026 01:42:35 +0000 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-b9910707d82so575251866b.1 for ; Mon, 06 Apr 2026 18:42:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1775526152; cv=none; d=google.com; s=arc-20240605; b=dftU5fOJ2P+xedNb5cX75ALnTYn33abB/AozTo3hwvD4WlHBUDZyKzW+uvAF0ZH39/ +fCU3UIarDgoSGh9+vc3RaLqBIHWqBj71q1f8IwNDad+1An68gWKjpDVnwS2vWNQiwfr 1ypL5fy4vB3CDshiKYJKhITIEImpQbSuo02BxTtpt0icXXwPYvBbWEuBkMuQSkzw5dN3 VBRI/pbPnr5uWnDZApXfCS39wrDAtcP+1kzkOfFF6vGYSe4gyr0zjiFP7uTxMKJI6RyQ dx6fewIV8OqMumVk3jaPUsKfIniogEK9Ik/Ww6lYbmbRdihxf4zm0ZBBaNNc5T31qwJO qAzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=MJE20gjOE+LJ/Q7cCt1+VmJN/JhN8TTT7AtMs1Y21KM=; fh=2ZQqWzSRav/S1AKLt2JAz6zKfs62skxc5WBmloW0rRM=; b=DZL/U7OpHT4WXRWFggh0hnZFYGEE7Mp020zucru5f7XuOGzh+Q/k9WADg+Y82xUi+3 CSr2o8BubgW1vq9pG8COAhHizfqVisOdOiKTNzOJszxjLivAD27V8yEPSlIUW70kL9Ij Dpq+YpnZwz5fg4LvHmXp0zWbPEV/yGnEJIg9M7DsQGhaFfXpffJgPzXoDiWKWkF3egBn apyD8j0BPdF5lEPyam7hlo2F9hWy9ubBnuR5Dt6PbUHsZAzkBeHWI8BikWhaMsjnrZQv MVR4H6Eipoj6fkQHNjw0OIj+RG9itLkCWmNITUNLmQYrdDsX0kRoqx8Y2rnhCOdrxGtM s2dw==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775526152; x=1776130952; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=MJE20gjOE+LJ/Q7cCt1+VmJN/JhN8TTT7AtMs1Y21KM=; b=EQvRkc7aM9hnwbjqt4AyAV5Rx6BT/Bt56+irYooNWT328NGPQ4E5sw6W1yJfFXkSEz cXFjvP0Oc4L3AkhLZNid07/LsqnQAVJo6jThK2Vfg4A7+KeS+TwL3dVjuIW+pAOafgsP N/3uQvY5ZcsV4r7HJpW5XFyFZ+i9ir99+enjuPOoa7gyeWUq94rMr6BXNGWn9AjfXe5F i7x47/QJBdHhMBCwopyvLSzXsJtpzLONXuvgQiowXsvIy7rBQatBxM7F6ItKSjwJwiBT tIl6PIfBWncZpWBdc/9zIYwojbC8gcP1aVToK1/zry5Ch2mIyJZpRNCZ4YnrXfXj6LLm 5k+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775526152; x=1776130952; h=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=MJE20gjOE+LJ/Q7cCt1+VmJN/JhN8TTT7AtMs1Y21KM=; b=ms8J3NRh6xC9pngL8maAKyKdpt2PD89udMWqwSW/xeKloK37kxhUFACpyWBIUYfzkr +kFPy2cFrcmooN+zEgIoB+XX0f3VGJFmKhmA+252JtZf5P5MCsk/1q4OoyyRP/Q4K3I1 PiYyILnhu5/os/6x46eIUe/8ZzhjcSY2+FaYiQ04N1H3svrqoyutfLssOzuO77bUMyan 5U+X3vL4IDYSV+sEJXXxIJaWpvKtEyHIwe98srx2LxWCZhTixeVGaJUjq5IfCfDj19ot E21huTihQIehxmrUorRzHCYOk3iS1M8GNIkJKTz0tQtbWGiUonALDwoXDiGl+DwD4G6z r3kw== X-Forwarded-Encrypted: i=1; AJvYcCU1XvM50VKMxkvVLV05LoXrwprvjyJR2M3OuhDWfxt3999rNep67QBao/cnoxV4fbWMxfE6PVoIP02a7TZZ@postgresql.org X-Gm-Message-State: AOJu0YwbaBmxr0mzeuTDPHV80mtA1/waPbBQS3bkhEHSR3MNCwWZ4Gzt rKi7mN52zUdKYblS/mDQOMzrzCVlr864A6NsxEt7ZiYrKyWk95Iy40gHN3uZj1NiWlexmbmn8pm +u67pc+BvhhLqQk5rD4qIj4apiYPtVKM= X-Gm-Gg: AeBDievQIH9molS2iqvzG67No9bNHHjQrLqwTozGWTsNOOogQVlPGdqO4BE0OP6Y3jl ac7/MuJavTBzcWcK48B5dKcdr0GLJWpIvxodbEw1V00cQcpEh3U2Or7ZRcj3y+rTMz3AyaTMQMf 8EMd+bYz+6IAx/ovnf/Z+xGl8FeYgI3pV1qlVtT2N2ymJJ5GtwEjwcGM/jj10RDyKsYVsYocGUo 2n+6cTq60oOx2x7HCZbMoflo4RotPXxeSvI4KPcksgWzA55wtENX+U88HVl4UsdfVQZQFZ+KGNU MRVLc8dat4wcZVaSygbFICH6I94BcLJN1utAGA== X-Received: by 2002:a17:907:6d1f:b0:b93:5385:327e with SMTP id a640c23a62f3a-b9c6744539bmr709346966b.21.1775526151474; Mon, 06 Apr 2026 18:42:31 -0700 (PDT) MIME-Version: 1.0 References: <202505181556.3n6oiowvntyr@alvherre.pgsql> <8010.1764584989@localhost> <5778.1764660480@localhost> In-Reply-To: From: Josh Kupershmidt Date: Mon, 6 Apr 2026 21:42:17 -0400 X-Gm-Features: AQROBzBtkHy9yg_F09j_yBZO9_KpjXbWM8DoaLyjrAwfoFYOvD1JQ9mIwbSmBMM Message-ID: Subject: Re: Revisiting {CREATE INDEX, REINDEX} CONCURRENTLY improvements To: Mihail Nikalayeu Cc: Matthias van de Meent , Antonin Houska , Hannu Krosing , Sergey Sargsyan , =?UTF-8?Q?=C3=81lvaro_Herrera?= , Andres Freund , Michael Paquier , PostgreSQL Hackers , Andrey Borodin , Melanie Plageman Content-Type: multipart/alternative; boundary="0000000000008c517a064ed4e57e" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000008c517a064ed4e57e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, I was interested in this feature, and took an initial look through the patch. Sorry in advance that I'm missing some previous context from the thread's history, I'm starting fresh here. A few initial notes from looking at the v34 patches: Usability and docs: * We're leaving behind two invalid indexes now that the user has to figure out how to drop in case of an error - that seems like it could be confusing for the user. Could we have some better way (error handler, background worker) try to perform this cleanup automatically? If not, we should at least tell the user clearly in the error message that both invalid indexes are left behind (i.e. "idx" and "idx_ccaux" in the example) * Docs are inconsistent or confusing about whether there's one or two indexes left behind in case of error - e.g. "command will fail but leave behind *an* invalid index and its associated auxiliary index" - somewhat implying there is only one invalid index, and somehow the auxiliary index is valid? * Similarly, when the doc mentions e.g. "drop the index" - it's not necessarily clear which index we're talking about when there are two invalid indexes left behind that the user will see with `\d` * It would be nice to guard against users trying arbitrary CREATE INDEX ... USING stir(...) with a clear error Few behavior notes and questions: * One of the testcases (line 2478 of patch 0004) does `DELETE FROM concur_reindex_tab4 WHERE c1 =3D 1;` but the table `concur_reindex_tab4` looks like it has been dropped a few lines above that? * The StirPageGetFreeSpace macro from patch 0002 reads `StirPageGetMaxOffset(page)` which seems like it could cause an unsafe read of opaque->maxoff if used on the metapage * A comment explains "No predicate evaluation is needed here" , i.e. we are skipping predicate evaluation in the validation scan step, assuming that the auxiliary index contains only qualifying TIDs. Is this really bulletproof for e.g. partial indexes which may no longer satisfy the predicate at the time of the validation scan due to conflicting HOT updates= ? Thanks Josh On Mon, Apr 6, 2026 at 2:22=E2=80=AFPM Mihail Nikalayeu wrote: > Rebased once again. > --0000000000008c517a064ed4e57e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

I was interested in this feature, a= nd took an initial look through the patch. Sorry in advance that I'm mi= ssing some previous context from the thread's history, I'm starting= fresh here.

A few initial notes from looking at t= he v34 patches:

Usability and docs:
=C2=A0* We= 're leaving behind two invalid indexes now that the user has to figure = out how to drop in case of an error - that seems like it could be confusing= for the user. Could we have some better way (error handler, background=C2= =A0worker) try to perform this cleanup automatically? If not, we should at = least tell the user clearly in the error message that both invalid indexes = are left behind (i.e. "idx" and "idx_ccaux" in the exam= ple)
=C2=A0* Docs are inconsistent or confusing about whether the= re's one or two indexes left behind in case of error - e.g. "comma= nd will fail but leave behind *an* invalid index and its associated auxilia= ry index" - somewhat implying there is only one invalid index, and som= ehow the auxiliary index is valid?
=C2=A0* Similarly, when the do= c mentions e.g. "drop the index" - it's not necessarily clear= which index we're talking about when there are two invalid indexes lef= t behind that the user will see with `\d`=C2=A0
=C2=A0* It would = be nice to guard against users trying arbitrary CREATE INDEX ... USING stir= (...) with a clear error

Few behavior notes = and questions:
=C2=A0* One of the testcases=C2=A0(line 2478 of pa= tch 0004) does `DELETE FROM concur_reindex_tab4 WHERE c1 =3D 1;` but the ta= ble `concur_reindex_tab4` looks like it has been dropped a few lines above = that?
=C2=A0* The=C2=A0StirPageGetFreeSpace macro from patch 0002= reads `StirPageGetMaxOffset(page)` which seems like it could cause an unsa= fe read of opaque->maxoff if used on the metapage
=C2=A0* A co= mment explains "No predicate evaluation is needed here" , i.e. we= are skipping predicate evaluation in the validation scan step, assuming th= at the auxiliary index contains only qualifying TIDs. Is this really bullet= proof for e.g. partial indexes which may no longer satisfy the predicate at= the time of the validation scan due to conflicting HOT updates?
=
Thanks
Josh

On Mon, Apr= 6, 2026 at 2:22=E2=80=AFPM Mihail Nikalayeu <mihailnikalayeu@gmail.com> wrote:
Rebased once again.
--0000000000008c517a064ed4e57e--