pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rosser Schwarz <rosser.schwarz@gmail.com>
To: gnanam@zoniac.com
Cc: pgsql-admin@postgresql.org
Subject: Re: PSQLException: ERROR: could not open relation with OID xxxx
Date: Mon, 14 Mar 2011 12:24:44 -0600
Message-ID: <AANLkTimxMm_PcachrqvOBeWwh_c7_CLJd2qhBj3t_7vx@mail.gmail.com> (raw)
In-Reply-To: <006201cbe21c$8a657e20$9f307a60$@com>
References: <006d01cbdfd5$f48becb0$dda3c610$@com>
	<4D79FF3D020000250003B7C6@gw.wicourts.gov>
	<004f01cbe20c$f2c6a260$d853e720$@com>
	<AANLkTikOgLeit=eTEtin-+XX8Rb9rKbwahuUy62q3TBf@mail.gmail.com>
	<006201cbe21c$8a657e20$9f307a60$@com>

(Apologies for thread-jacking; I saw something similar in the OP's
description of his setup that I thought warranted a word of advice.)

On Mon, Mar 14, 2011 at 1:50 AM, Gnanakumar <gnanam@zoniac.com> wrote:
> Do you think that this "significantly bloated system catalogs" is caused
> because of the old version 8.2.3 we're running?  Will this be resolved in
> latest PostgreSQL v9.0?  BTW, what version of PostgreSQL are you handling?

This isn't a version-specific issue; it's a consequence of MVCC.  (See
below for more details.)  We're using 8.3 for this application, but
we'd encounter the problem whatever version we were using.  I'm
working on getting it migrated to 8.4, but it's a multi-tbyte
database, and we don't currently have space available on the SAN for
an upgrade.

9.0 has a new VACUUM FULL which behaves more like CLUSTER.  That may
help to shorten the downtime windows we need to take, but it won't
eliminate them.  The only thing that will is changing the application
to make less pathological use of temporary tables.

> If temporary tables and its indexes are automatically dropped at the end of
> the session, why would it cause bloat in system catalogs?

The key to understanding the problem is to realize that system
catalogs are pretty much regular tables in PostgreSQL, with some
additional special rules (no triggers, can't be CLUSTERed or ALTERed,
&c).  Anything you'd do in a regular table that would create a dead
tuple — UPDATEs, DELETEs, &c — will have the same effect on a catalog.

A CREATE TABLE is an INSERT into pg_class for the table, plus one for
each of any indexes you may create, and so on.  It's also an INSERT
into pg_attribute for each column the table has, including the
"housekeeping" columns postgres uses, mostly to manage MVCC.  DROPping
a table is a DELETE from those catalogs, creating the corresponding
number of dead tuples.  Implicitly dropped temp tables still cause
dead tuples in the catalogs; it's just postgres dropping them for you
at commit time, rather than you issuing the DROP command explicitly.

If you're just using a few temp tables, you shouldn't be experiencing
the kinds of problems we are, particularly if you have autovacuum
enabled.  You'll have dead tuples, but they should quickly reach a
steady-state, where the space consumed by them is re-used by a later
creation of those temp tables.  Our situation is probably somewhat
unique, because of the sheer number of temp tables the application
uses.

I hope that helps you understand better.

rls

-- 
:wq



view thread (11+ messages)  latest in thread

Message-ID: <AANLkTimxMm_PcachrqvOBeWwh_c7_CLJd2qhBj3t_7vx@mail.gmail.com>
Permalink:  ../AANLkTimxMm_PcachrqvOBeWwh_c7_CLJd2qhBj3t_7vx@mail.gmail.com/
Also on:    postgresql.org/message-id/AANLkTimxMm_PcachrqvOBeWwh_c7_CLJd2qhBj3t_7vx@mail.gmail.com

 · 

reply

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-admin@postgresql.org
  Cc: rosser.schwarz@gmail.com, gnanam@zoniac.com
  Subject: Re: PSQLException: ERROR: could not open relation with OID xxxx
  In-Reply-To: <AANLkTimxMm_PcachrqvOBeWwh_c7_CLJd2qhBj3t_7vx@mail.gmail.com>
  References: <006d01cbdfd5$f48becb0$dda3c610$@com> <4D79FF3D020000250003B7C6@gw.wicourts.gov> <004f01cbe20c$f2c6a260$d853e720$@com> <AANLkTikOgLeit=eTEtin-+XX8Rb9rKbwahuUy62q3TBf@mail.gmail.com> <006201cbe21c$8a657e20$9f307a60$@com> <AANLkTimxMm_PcachrqvOBeWwh_c7_CLJd2qhBj3t_7vx@mail.gmail.com>

* 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