Обсуждение: Vacuum problem due to temp tables
Hi,
We were running full vacuum on DB when we encountered the error below;
INFO: analyzing "public.bkup_access_control"
INFO: "bkup_access_control": scanned 14420 of 14420 pages, containing 1634113 live rows and 0 dead rows; 30000 rows in sample, 1634113 estimated total rows
INFO: vacuuming "pg_catalog.pg_index"
vacuumdb: vacuuming of database "rpt_production" failed: ERROR: duplicate key value violates unique constraint "pg_index_indexrelid_index"
DETAIL: Key (indexrelid)=(2678) already exists.
The above table on which the error occured was actually a backup table of an existing one.
JFI. The backup table was created by
SELECT * into bkup_access_control FROM access_control;
Details :
version
----------------------------------------------------------------------------------------------------------------------------------------
PostgreSQL 9.0.1 on x86_64-unknown-linux-gnu, compiled by GCC gcc (SUSE Linux) 4.5.0 20100604 [gcc-4_5-branch revision 160292], 64-bit
Can you let us know the reason for this error?
Regards,
Bhakti
Bhakti Ghatkar <bghatkar@zedo.com> writes: > We were running full vacuum on DB when we encountered the error below; > INFO: vacuuming "pg_catalog.pg_index" > *vacuumdb: vacuuming of database "rpt_production" failed: ERROR: duplicate > key value violates unique constraint "pg_index_indexrelid_index"* > DETAIL: Key (indexrelid)=(2678) already exists. That's pretty bizarre, but what makes you think it has anything to do with temp tables? OID 2678 is pg_index_indexrelid_index itself. It looks to me like you must have duplicate rows in pg_index for that index (and maybe others?), and the problem is exposed during vacuum full because it tries to rebuild the indexes. Could we see the output of select ctid,xmin,xmax,* from pg_index where indexrelid in (select indexrelid from pg_index group by 1 having count(*)>1); regards, tom lane
Tom,
The query which you gave returns me 0 rows.
select ctid,xmin,xmax,* from pg_index where indexrelid in
(select indexrelid from pg_index group by 1 having count(*)>1);
(select indexrelid from pg_index group by 1 having count(*)>1);
Regards,
Bhakti
On Sat, Feb 26, 2011 at 10:55 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Bhakti Ghatkar <bghatkar@zedo.com> writes:
> We were running full vacuum on DB when we encountered the error below;> INFO: vacuuming "pg_catalog.pg_index"That's pretty bizarre, but what makes you think it has anything to do
> *vacuumdb: vacuuming of database "rpt_production" failed: ERROR: duplicate
> key value violates unique constraint "pg_index_indexrelid_index"*
> DETAIL: Key (indexrelid)=(2678) already exists.
with temp tables? OID 2678 is pg_index_indexrelid_index itself.
It looks to me like you must have duplicate rows in pg_index for that
index (and maybe others?), and the problem is exposed during vacuum full
because it tries to rebuild the indexes.
Could we see the output of
select ctid,xmin,xmax,* from pg_index where indexrelid in
(select indexrelid from pg_index group by 1 having count(*)>1);
regards, tom lane
On Mon, Feb 28, 2011 at 12:08 AM, Bhakti Ghatkar <bghatkar@zedo.com> wrote: > Tom, > The query which you gave returns me 0 rows. > select ctid,xmin,xmax,* from pg_index where indexrelid in > (select indexrelid from pg_index group by 1 having count(*)>1); > Regards, > Bhakti How about just select ctid,xmin,xmax,* from pg_index? -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Robert,
select ctid,xmin,xmax,* from pg_index gives 2074 records.
Regards
Vidhya
On Wed, Mar 2, 2011 at 9:14 PM, Robert Haas <robertmhaas@gmail.com> wrote:
On Mon, Feb 28, 2011 at 12:08 AM, Bhakti Ghatkar <bghatkar@zedo.com> wrote:How about just select ctid,xmin,xmax,* from pg_index?
> Tom,
> The query which you gave returns me 0 rows.
> select ctid,xmin,xmax,* from pg_index where indexrelid in
> (select indexrelid from pg_index group by 1 having count(*)>1);
> Regards,
> Bhakti
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance
On Fri, Mar 4, 2011 at 5:26 AM, Vidhya Bondre <meetvbondre@gmail.com> wrote: > select ctid,xmin,xmax,* from pg_index gives 2074 records. Can you put them in a text file and post them here as an attachment? -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company