Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 154411336FA7 for ; Mon, 14 Mar 2011 15:24:53 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 76521-03 for ; Mon, 14 Mar 2011 18:24:45 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-vx0-f174.google.com (mail-vx0-f174.google.com [209.85.220.174]) by mail.postgresql.org (Postfix) with ESMTP id 0345B133616B for ; Mon, 14 Mar 2011 15:24:44 -0300 (ADT) Received: by vxi39 with SMTP id 39so4600923vxi.19 for ; Mon, 14 Mar 2011 11:24:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=3Hc+IRDE1Ship1yBNjF99SUFz4Znnu1ILglavoXKTy8=; b=BKrDYGICN6yZqr5NDyxQnYRgU2v71Hd4Yg5cI1lmINCunXbHwUOQSQ1NT8uY667O3Y 9A/6kw1B8MSLnYn2XbUKpn2i/Jcvw0npuS1XxaY3QSlT60x+tNqhPM15sVs/bdo3uSfF LjHXYo3GceUvTSCvVvjQz6Oo6v9i/4WiXoZrk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=Z2sb06Trfmb5Pe8mswywvhuVP2PaXNdrw/Aha0jDB6hTiD7ngLArqGkbiKBZ0DDBWD bow33ymK1qeVQTxvz9gqiWGaYLWZJfFyabn35xjhSxgx4b/QlCU2krzfO9822hSJl/YK J8WL0DftAz90aRUVrF8pJCh2tMmVQC58X6mnQ= MIME-Version: 1.0 Received: by 10.52.90.172 with SMTP id bx12mr11919451vdb.195.1300127084455; Mon, 14 Mar 2011 11:24:44 -0700 (PDT) Received: by 10.52.162.129 with HTTP; Mon, 14 Mar 2011 11:24:44 -0700 (PDT) In-Reply-To: <006201cbe21c$8a657e20$9f307a60$@com> References: <006d01cbdfd5$f48becb0$dda3c610$@com> <4D79FF3D020000250003B7C6@gw.wicourts.gov> <004f01cbe20c$f2c6a260$d853e720$@com> <006201cbe21c$8a657e20$9f307a60$@com> Date: Mon, 14 Mar 2011 12:24:44 -0600 Message-ID: Subject: Re: PSQLException: ERROR: could not open relation with OID xxxx From: Rosser Schwarz To: gnanam@zoniac.com Cc: pgsql-admin@postgresql.org Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.889 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, T_TO_NO_BRKTS_FREEMAIL=0.01 X-Spam-Level: X-Archive-Number: 201103/161 X-Sequence-Number: 37033 (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 wrote: > Do you think that this "significantly bloated system catalogs" is caused > because of the old version 8.2.3 we're running? =A0Will this be resolved = in > latest PostgreSQL v9.0? =A0BTW, what version of PostgreSQL are you handli= ng? 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 =97 UPDATEs, DELETEs, &c =97=A0will 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 --=20 :wq