pgstattuple() should not be used on hash indexes

From: PG Doc comments form <noreply(at)postgresql(dot)org>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Cc: chris+postgresql(at)qwirx(dot)com
Subject: pgstattuple() should not be used on hash indexes
Date: 2021-02-08 16:08:16
Message-ID: 161280049644.664.3414087059452030397@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/13/pgstattuple.html
Description:

pgstattuple works on some non-table relations, such as indexes. However it
does not work reliably on hash indexes. It works on some, but on others it
reports a scary warning: "index contains unexpected zero page at block,
Hint: Please REINDEX it."

The REINDEX works (makes it possible to use pgstattuple again), but as more
records are added to the index, the same error will eventually reoccur. The
problem is not with the index, but that pgstattuple doesn't support it
properly. You should use pgstathashindex instead.

See this post for more information:
https://www.postgresql.org/message-id/CAE9k0Pm8NWvPF2KCGVCpb6OivE%3DGdg-eQ_cLz7UMhxuDOq_1YQ%40mail.gmail.com

Browse pgsql-docs by date

  From Date Subject
Next Message PG Doc comments form 2021-02-13 09:37:19 Documentation on Hash and btree Indexes on jsonb
Previous Message Tom Lane 2021-02-07 16:25:34 Re: Small correction in chown command to set the owner of the pgsql data dir correctly