From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Raghavendra Rao J S V <raghavendrajsv@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: duplicate key value violates unique constraint "pg_statistic_relid_att_inh_index" while performing full vacuum on the database
Date: Wed, 09 May 2018 21:41:36 +0200
Message-ID: <1525894896.2269.7.camel@cybertec.at> (raw)
In-Reply-To: <CAEHH7R5+HRWpOsz99-WQNGPR7NH-AELV5Q63WtWnb38MM9tG9w@mail.gmail.com>
References: <CAEHH7R5+HRWpOsz99-WQNGPR7NH-AELV5Q63WtWnb38MM9tG9w@mail.gmail.com>
Raghavendra Rao J S V wrote:
> While performing vacuum full, I have received the below highlighted error. Please guide me how to resolve this issue.
>
>
> /opt/postgres/9.2/bin/psql -p 5433 --username=cmuser cpcm -c "VACUUM FULL ANALYZE;"
>
>
> ERROR: duplicate key value violates unique constraint "pg_statistic_relid_att_inh_index"
> DETAIL: Key (starelid, staattnum, stainherit)=(18915, 6, f) already exists.
>
> ' pg_statistic ' is a meta data table. Is it ok if I remove one duplicated record from ' pg_statistic' table?.
That is data corruption.
Do you have any idea how you got there?
Any crashes, any unsafe settings? Unreliable hardware?
Fortunately it is only the pg_statistic table.
You can stop the server, start it with
pg_ctl start -o -O
Then connect as superuser and run
TRUNCATE pg_statistic;
ANALYZE;
That should take care of the problem.
It would be a good idea to pg_dumpall the cluster, remove it,
recreate it and load the dump so that you are sure to have
no data corruption.
Yours,
Laurenz Albe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: laurenz.albe@cybertec.at, raghavendrajsv@gmail.com
Subject: Re: duplicate key value violates unique constraint "pg_statistic_relid_att_inh_index" while performing full vacuum on the database
In-Reply-To: <1525894896.2269.7.camel@cybertec.at>
References: <CAEHH7R5+HRWpOsz99-WQNGPR7NH-AELV5Q63WtWnb38MM9tG9w@mail.gmail.com> <1525894896.2269.7.camel@cybertec.at>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox