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 1wAFiQ-002Cq1-1z for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Apr 2026 23:20:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wAFiP-0034C0-09 for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Apr 2026 23:20:13 +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 1wAFiO-0034Bs-21 for pgsql-hackers@lists.postgresql.org; Tue, 07 Apr 2026 23:20:13 +0000 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wAFiN-000000017Mu-0NT5 for pgsql-hackers@postgresql.org; Tue, 07 Apr 2026 23:20:12 +0000 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-5a2a70bb66aso5377114e87.0 for ; Tue, 07 Apr 2026 16:20:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1775604010; cv=none; d=google.com; s=arc-20240605; b=cElcFR1QQZJDxtuQMtWkHy6sLMKIIPt829OGREvHLEPPFzCrfkXAyyihMBV0rYTgzJ TMVOcaIqqmzFSbLVUeRklTTqHAz5/hnh72K2N6xHUmajvs0r3Bjjwvj0ZS8MICE3hC+u q6GHKbIRW55cOS3j55ZJTLi+hhAS8f5SjzMuHAhux8rcjWLKb4sqgAg8odRWtLHxHJdU OgPK372HIcnl87FgUre2pNYdF/02E9vV24F/Jxphn9tezMR/UxCveHGPW1TtkC2jcR6W THe1vNPsCEwPbaauPbv1P8t8gB6j7VQs6G4UQizxDJqSxDhvWZ5sAvEQw4uB4eVjNSG4 bdHA== 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=6TGICietCdCXI2DO5CeDPf04ZyAT1bgDMNI67MAziWI=; fh=ee0cpCqePae1MRpBL5xwBT4pg1iT39X+Tp8ncPEreOQ=; b=QucrbUJ7+HdU8FFvXjo5W7QfdDVSDCVEq5pBrs2c6KCi6p4isQLXvZDZkEx7Pizo7H xgP2rHyOetvIac/lHJm0lzLS5+HieBA/JHUMrbTmLFYuVFMJHctC0ydR03Buow9kRzaw Aiod6kxNxMTd+a3VPWxK+jIz1SeOhtakV4CrD7/OH5y5/3NsooTsaUNrxpSLs6X1b6rm jKWxFxXb8za2hnXSmNtIFJKlzXMrKabcvboK8urpo2X+qEg8gSq28/EHICDtkYt1KyzX ayonTi9wrROXsVTs7pLkqT3HjMaMeJO790EZv/170drplE3/Vg+DeQvWbE4e3IVr2ahJ 4+GQ==; 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=1775604010; x=1776208810; 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=6TGICietCdCXI2DO5CeDPf04ZyAT1bgDMNI67MAziWI=; b=s4sdUgq769R00QZP4tL5wFhYPBdURo1lRbgbZddqOHXRMgKUURLXQrVGOVgS8EE7Xl MP1Kvu7FkIAQJxz57TF52ml8ZgrAANh+5IB88CJUprIQfrx7kdcHhlx9duXVOOHwP0PF b94KtY/71vHDz/LZ70oiqlZdggKLhXjfRWCjoc5Bf7NAY/qP27etxMBnzTrHpnkhh9dE QK4j3DCB02ZsGomXnzCW4MFUl7m+u1tKOkKOZkjRoiupnPvdrLlnOCnFlpinhiYVwhxK bGV+GSLcJZHbgPkn+oWcMCLpAllBI9L2kUpxkR59iYmlAGMyEk5DIfdGxTolgKK6i21a PG0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775604010; x=1776208810; 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=6TGICietCdCXI2DO5CeDPf04ZyAT1bgDMNI67MAziWI=; b=Mbm0esim53TysTPcjJlgOJqmAskxal+Pg7e0Q3nHtXl8hd/aL6pjKznbijUF4b10Ng fivRFaJBauslKJb72sk6s8PawqC2aJSofONf6Nx27a9udbNthfLTiso7Q81aQRLvlmGj vlxASSXXSFPog9kHQTPtNDpTLSetutDnyb5g5I9Ta4MDwlLl6RjMe1jYhPIvxxuGjdvX FrC2dXFrHux1GXTmoRen2AnGsZwgBR974y31RJ8UqFs4JEHb3EIY8uylbIXCN+HT5/fD KgG9bKutQZSx+SaIqVjS8MqYYjjjNGzW0Idgasbqqi+o2U/OModHy7jhoN5+8zdGIFoR OZdw== X-Forwarded-Encrypted: i=1; AJvYcCWDjeqlgs6wv7oWYJRcltYOQ513mAu4LwDox0OLpTekZwdRM4X17DyLLLdTxSiulRk78PcyNC+aO4V6lgeX@postgresql.org X-Gm-Message-State: AOJu0Yyif3BeTVGEsPaPYef3gwy/wwyl8Zb8qI0zg9xV8Sc+BJsyBiNM V+4Qu1/rrhNIo8Dv1D/RG/2EsPFgXOMSnIOLv5PxCkkrk7AlJHuELPH4U6MCQB1Id7cfNTmxmuk DU/Iskp9lChhhu0ZhPzFbN6GNBO3mqns= X-Gm-Gg: AeBDietpXGO0W82cxeEToMPDm1K2XZM18K2vOVTG8Qj1fcFSqDIbF3RU7k8P9SlcKYt 4J6wObG9+LeOZoVOMxalYhJMi6AasGfG6WqSpoLDVEeKzXm98qD/TUhQIPrOM1q8Q8ZM1xZ7RSS df6BRmq0TZ2lotnrxFPGn0TWskpL1PmZ1KHnp7bIqAhBNJhKwU83jywuXgud60dI9+sqPLCs+CG NS67KlBGzXmqp5Q746JNq1Ne5Tzd9QgoeKKv1j0HxGw2V9Usmj3aCgPaDgeU/WtGVTrsk/+tJTW /hokfCR8i5/I0awDMuQ+IySFXarRgkfvr/CmPqf0pQ2uWNB7tXS4RJdZtoJgRSdsMnT8 X-Received: by 2002:a05:6512:1193:b0:5a2:babe:3da0 with SMTP id 2adb3069b0e04-5a33754edecmr5291267e87.9.1775604009317; Tue, 07 Apr 2026 16:20:09 -0700 (PDT) MIME-Version: 1.0 References: <202505181556.3n6oiowvntyr@alvherre.pgsql> <8010.1764584989@localhost> <5778.1764660480@localhost> In-Reply-To: From: Mihail Nikalayeu Date: Wed, 8 Apr 2026 01:19:00 +0200 X-Gm-Features: AQROBzCl6KaI0HBxvlA9-LVYg2fc8E3r9jEk-vJwWMkylJqXKX2R_fSZGAYa_QA Message-ID: Subject: Re: Revisiting {CREATE INDEX, REINDEX} CONCURRENTLY improvements To: Josh Kupershmidt 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: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello, Josh! Your review looks a bit LLM-generated, but anyway - thanks for review! :) Especially because at least one point seems to be valid. > 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) Commit 0005 adds automatic dropping of auxiliary indexes when the original index is reindexed or dropped. Also, documentation reflects the ccaux index (similar to ccnew). > 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? Auxiliary index is never marked as valid; I'm not sure we need to highlight it here. Or do you have an idea how to rephrase? > 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` In one commit it says: "method in such cases is to drop these indexes and try again to perform". After 0005 "The auxiliary index (suffixed with _ccaux) will be automatically dropped when the main index is dropped". It seems clear to me, but feel free to provide your variant. > * It would be nice to guard against users trying arbitrary CREATE INDEX ... USING stir(...) with a clear error It will fail with "Building STIR indexes is not supported". > One of the testcases (line 2478 of patch 0004) does `DELETE FROM concur_reindex_tab4 WHERE c1 = 1;` > but the table `concur_reindex_tab4` looks like it has been dropped a few lines above that? Hm, yep, I'll fix it. > 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 But it was never used for 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? Conflicting HOT updates are not possible because the catalog contains the new index definition from the start of the process. Or do you mean a different scenario? Best regards, Mikhail.