Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in PostgreSQL: right sibling's left-link doesn't match: block 5 links to 8 instead of expected 2 in index "pg_toast_2619_index"

We are facing the below error in a PostgreSQL 9.2 production database. Please help us to resolve it. Why are we facing this issue? What is the impact of this issue?

ERROR:  right sibling's left-link doesn't match: block 5 links to 8 instead of expected 2 in index "pg_toast_2619_index"
CONTEXT:  automatic vacuum of table "qovr.pg_toast.pg_toast_2619"
like image 926
Raghavendra Avatar asked Mar 15 '18 18:03

Raghavendra


1 Answers

To solve the problem at hand:

First, find out the name of the table to which the TOAST index belongs:

SELECT r.oid::regclass
FROM pg_class r
   JOIN pg_class t ON r.reltoastrelid = t.oid
   JOIN pg_index i ON t.oid = i.indrelid
   JOIN pg_class ti ON i.indexrelid = ti.oid
WHERE ti.relname = 'pg_toast_2619_index'
  AND ti.relnamespace = 'pg_toast'::regnamespace;

The answer should be pg_statistic, the system catalog that stores table statistics.

Then, as superuser, reindex the table:

REINDEX TABLE pg_statistic;

To solve the bigger problem:

Find out what caused the index corruption:

  • Test your hardware, particularly storage and RAM.

  • Test if your storage processes a sync request correctly by writing the information to persistent storage rather than caching it where it can get lost.

  • Check if you had any crashes lately.

  • Move to a recent supported version of PostgreSQL and always apply bugfixes.

like image 135
Laurenz Albe Avatar answered Sep 27 '22 20:09

Laurenz Albe