Re: Query returns no results until REINDEX - Mailing list pgsql-general

From Peter Geoghegan
Subject Re: Query returns no results until REINDEX
Date
Msg-id CAH2-WznsT7hdWtSxSp5t20ZZQynVoLCDZgN6044h9zw20VYJ7w@mail.gmail.com
Whole thread Raw
In response to Query returns no results until REINDEX  (Colin Adler <colin@coder.com>)
Responses Re: Query returns no results until REINDEX  (Colin Adler <colin@coder.com>)
List pgsql-general
On Fri, Feb 7, 2020 at 3:52 PM Colin Adler <colin@coder.com> wrote:
> Seems to work now. My question is, is this something I should report to the
> maintainers?

I am one of the people that maintains the B-Tree code.

You didn't mention what version of Postgres you're using here. That
could be important. Please let us know. Mention the minor component of
the release version, too (i.e. say 12.2, not just 12).

> I took a snapshot of the data folder before the reindex in case it
> would be helpful. Is index corruption something that should be actively looked
> out for?

Yes -- look for corruption. If I had to guess, I'd say that this has
something to do with upgrading the operating system to use a
different, incompatible glibc. Or perhaps it has something to do with
streaming replication between machines with different glibc version.

You should try running contrib/amcheck, which should be able to isolate
index corruption, and give you a specific complaint. You may then be
able to inspect the exact index page with the problem using
contrib/pageinspect. Something like this ought to do it on Postgres
11 or 12:

CREATE EXTENSION IF NOT EXISTS amcheck
SELECT bt_index_check('my_index', true);

If that doesn't show any errors, then perhaps try this:

SELECT bt_index_parent_check('my_index', true);

If you're on Postgres 10, then you should leave out the second
argument, "true", since that version doesn't have the extra
heapallindexed check.

Let us know what you see.

--
Peter Geoghegan



pgsql-general by date:

Previous
From: Colin Adler
Date:
Subject: Query returns no results until REINDEX
Next
From: "Nick Renders"
Date:
Subject: Postgres 12.1 : UPPER() in WHERE clause restarts server