Vacuum problem due to temp tables

Lists: pgsql-performance
From: Bhakti Ghatkar <bghatkar(at)zedo(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Vacuum problem due to temp tables
Date: 2011-02-26 07:00:58
Message-ID: AANLkTineeujsU3s2Jt+gyp0RviXgpTHBt1A=TaYQDeQW@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-performance

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


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bhakti Ghatkar <bghatkar(at)zedo(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Vacuum problem due to temp tables
Date: 2011-02-26 17:25:32
Message-ID: 20323.1298741132@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-performance

Bhakti Ghatkar <bghatkar(at)zedo(dot)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


From: Bhakti Ghatkar <bghatkar(at)zedo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Vacuum problem due to temp tables
Date: 2011-02-28 05:08:36
Message-ID: AANLkTikONUnz_c3mKXeobh7i3OU-bJjZk+xf1xdwbH4p@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-performance

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

On Sat, Feb 26, 2011 at 10:55 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Bhakti Ghatkar <bghatkar(at)zedo(dot)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
>


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Bhakti Ghatkar <bghatkar(at)zedo(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Vacuum problem due to temp tables
Date: 2011-03-02 15:44:33
Message-ID: AANLkTi=-WPihE+Am7HBomm269Mv+KcV5etGjjstpyphK@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-performance

On Mon, Feb 28, 2011 at 12:08 AM, Bhakti Ghatkar <bghatkar(at)zedo(dot)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


From: Vidhya Bondre <meetvbondre(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Bhakti Ghatkar <bghatkar(at)zedo(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Vacuum problem due to temp tables
Date: 2011-03-04 10:26:02
Message-ID: AANLkTikqmNh3YvGZnGgr_=dsUgJ3Xkgs_o_q28_taWbj@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-performance

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(at)gmail(dot)com> wrote:

> On Mon, Feb 28, 2011 at 12:08 AM, Bhakti Ghatkar <bghatkar(at)zedo(dot)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
>
> --
> Sent via pgsql-performance mailing list (pgsql-performance(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-performance
>


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Vidhya Bondre <meetvbondre(at)gmail(dot)com>
Cc: Bhakti Ghatkar <bghatkar(at)zedo(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Vacuum problem due to temp tables
Date: 2011-03-04 14:14:25
Message-ID: AANLkTimBimwm6upNEhQobfA9rj3ftpKu3uT2M9ifNRrW@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-performance

On Fri, Mar 4, 2011 at 5:26 AM, Vidhya Bondre <meetvbondre(at)gmail(dot)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