pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Vacuum problem due to temp tables
6+ messages / 4 participants
[nested] [flat]

* Vacuum problem due to temp tables
@ 2011-02-26 07:00  Bhakti Ghatkar <bghatkar@zedo.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Bhakti Ghatkar @ 2011-02-26 07:00 UTC (permalink / raw)
  To: 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

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Vacuum problem due to temp tables
@ 2011-02-26 17:25  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Bhakti Ghatkar <bghatkar@zedo.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Tom Lane @ 2011-02-26 17:25 UTC (permalink / raw)
  To: Bhakti Ghatkar <bghatkar@zedo.com>; +Cc: pgsql-performance

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



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Vacuum problem due to temp tables
@ 2011-02-28 05:08  Bhakti Ghatkar <bghatkar@zedo.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 6+ messages in thread

From: Bhakti Ghatkar @ 2011-02-28 05:08 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: 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@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"
> > *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
>

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Vacuum problem due to temp tables
@ 2011-03-02 15:44  Robert Haas <robertmhaas@gmail.com>
  parent: Bhakti Ghatkar <bghatkar@zedo.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Robert Haas @ 2011-03-02 15:44 UTC (permalink / raw)
  To: Bhakti Ghatkar <bghatkar@zedo.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-performance

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



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Vacuum problem due to temp tables
@ 2011-03-04 10:26  Vidhya Bondre <meetvbondre@gmail.com>
  parent: Robert Haas <robertmhaas@gmail.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Vidhya Bondre @ 2011-03-04 10:26 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Bhakti Ghatkar <bghatkar@zedo.com>; Tom Lane <tgl@sss.pgh.pa.us>; 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@gmail.com> wrote:

> 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
>
> --
> Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-performance
>

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Vacuum problem due to temp tables
@ 2011-03-04 14:14  Robert Haas <robertmhaas@gmail.com>
  parent: Vidhya Bondre <meetvbondre@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Robert Haas @ 2011-03-04 14:14 UTC (permalink / raw)
  To: Vidhya Bondre <meetvbondre@gmail.com>; +Cc: Bhakti Ghatkar <bghatkar@zedo.com>; Tom Lane <tgl@sss.pgh.pa.us>; 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



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2011-03-04 14:14 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-02-26 07:00 Vacuum problem due to temp tables Bhakti Ghatkar <bghatkar@zedo.com>
2011-02-26 17:25 ` Tom Lane <tgl@sss.pgh.pa.us>
2011-02-28 05:08   ` Bhakti Ghatkar <bghatkar@zedo.com>
2011-03-02 15:44     ` Robert Haas <robertmhaas@gmail.com>
2011-03-04 10:26       ` Vidhya Bondre <meetvbondre@gmail.com>
2011-03-04 14:14         ` Robert Haas <robertmhaas@gmail.com>

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