Re: orphan records in pg_class - Mailing list pgsql-general

From Michael Paquier
Subject Re: orphan records in pg_class
Date
Msg-id CAB7nPqSPZjdy4oDEDUgsk4JoRs9P6zsD3-R0a_phCFMMXYZSKA@mail.gmail.com
Whole thread Raw
In response to orphan records in pg_class  (Andrzej Pilacik <cypisek77@gmail.com>)
List pgsql-general
On Tue, Sep 16, 2014 at 1:46 PM, Andrzej Pilacik <cypisek77@gmail.com> wrote:
> I inherited a  8.4.9 500gb database. After doing some analysis on it I found
> two issues that I am not sure how to handle.
You should target a dump for an upgrade to a newer version, 8.4 has
been EOL'd recently. And this version is missing a couple of years
worth of bug fixes.

> 1. There is an object in pg_class that I can only query by oid or by using
> ilike instead of = .  That objects also only exists in pg_class, it does not
> exist in pg_depend nor does it show up in any other system tables. Of
> course, it does not show up in the database through pg_admin.  This object
> is a sequence.   It is preventing me from taking a pg_dump of that schema
> because it is telling me that the object does not exist.   Can I just remove
> this object from the pg_class table.
> 2. Same story for a pg_toast_xxxxxxxx table. It has a very high age of
> relfrozenxid and I worry that soon, this will become an issue. Vacuum full
> on all databases on this cluster does not help since the toast table does
> not really belong to any real table.  Can I remove this row from pg_class or
> would it cause an issue? Do I have any other options to remove this object?
Maybe, or not. You can always try, just be sure to have a backup of
the existing PGDATA.

Looking at the release notes of 8.4, you may be facing an issue that
has been fixed in 8.4.19 related to relfrozenxid (see the top entry)
for pg_class:
http://www.postgresql.org/docs/devel/static/release-8-4-19.html
Be careful that there may be some other corruptions elsewhere...

Regards,
--
Michael


pgsql-general by date:

Previous
From: Michael Paquier
Date:
Subject: Re: PostgreSQL service account on Windows 7: Use a virtual account
Next
From: "Huang, Suya"
Date:
Subject: Re: (Solved) Decreasing performance in table partitioning