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.94.2) (envelope-from ) id 1qqwhX-001ok8-4d for pgsql-sql@arkaria.postgresql.org; Thu, 12 Oct 2023 14:30:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qqwhU-007mK8-MV for pgsql-sql@arkaria.postgresql.org; Thu, 12 Oct 2023 14:30:09 +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.94.2) (envelope-from ) id 1qqwhU-007mJ1-Dp for pgsql-sql@lists.postgresql.org; Thu, 12 Oct 2023 14:30:09 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qqwhS-0008ld-Nf for pgsql-sql@postgresql.org; Thu, 12 Oct 2023 14:30:07 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 39CEU2i21025276; Thu, 12 Oct 2023 10:30:02 -0400 From: Tom Lane To: Japin Li cc: pgsql-sql@postgresql.org Subject: Re: Could not use index because of indcheckxmin is true In-reply-to: References: Comments: In-reply-to Japin Li message dated "Thu, 12 Oct 2023 15:06:17 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1025274.1697121002.1@sss.pgh.pa.us> Date: Thu, 12 Oct 2023 10:30:02 -0400 Message-ID: <1025275.1697121002@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Japin Li writes: > When I create an index using CREATE INDEX (without concurrently), I get > an index which indcheckxmin is true. According to the docs[1], it cannot > be used with indcheckxmin is ture, how can I fix this? There is nothing to fix; you just wait a little bit. >> indcheckxmin bool >> If true, queries must not use the index until the xmin of this pg_index >> row is below their TransactionXmin event horizon, because the table may >> contain broken HOT chains with incompatible rows that they can see Note the "until" clause. Once transactions that ran concurrently with the CREATE INDEX are done, the index is available for use. There is no need for anyone to clear the indcheckxmin flag, and AFAIR there is no code that does so. regards, tom lane