Re: Could not use index because of indcheckxmin is true

From: Japin Li <japinli(at)hotmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Could not use index because of indcheckxmin is true
Date: 2023-10-12 15:31:26
Message-ID: MEYP282MB166969CC0F50558A8E4AE486B6D3A@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-sql


On Thu, 12 Oct 2023 at 22:30, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Japin Li <japinli(at)hotmail(dot)com> 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.
>

Thanks for your explanation. After wait a moment, the index can be used.

--
Regrads,
Japin Li

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Shaozhong SHI 2023-10-17 15:52:16 stored procedures
Previous Message Tom Lane 2023-10-12 14:30:02 Re: Could not use index because of indcheckxmin is true