Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 8197C9FA162 for ; Wed, 13 Dec 2006 13:29:37 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 26583-07 for ; Wed, 13 Dec 2006 13:29:32 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id CDB469F9B05 for ; Wed, 13 Dec 2006 13:29:19 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id kBDHTIsh009316; Wed, 13 Dec 2006 12:29:18 -0500 (EST) To: "Steven Flatt" cc: pgsql-performance@postgresql.org Subject: Re: Insertion to temp table deteriorating over time In-reply-to: <357fa7590612130844q58ef3ca5q31e164f9b006e0fc@mail.gmail.com> References: <357fa7590612130844q58ef3ca5q31e164f9b006e0fc@mail.gmail.com> Comments: In-reply-to "Steven Flatt" message dated "Wed, 13 Dec 2006 11:44:19 -0500" Date: Wed, 13 Dec 2006 12:29:18 -0500 Message-ID: <9315.1166030958@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/328 X-Sequence-Number: 22384 "Steven Flatt" writes: > Any idea where the bloat is happening? I believe that if we were dropping > and re-creating the temp table over and over, that could result in pg_class > bloat (among other catalog tables), but what is going wrong if we use the > same table over and over and truncate it? That seems very strange --- I too would have expected a TRUNCATE to bring you back to ground zero performance-wise. I wonder whether the issue is not directly related to the temp table but is just some generic resource leakage problem in a very long-running backend. Have you checked to see if the backend process bloats memory-wise, or perhaps has a huge number of files open (I wonder if it could be leaking open file handles to the successive generations of the temp table)? Are you sure that the slowdown is specific to inserts into the temp table, as opposed to generic SQL activity? Also, which PG version is this exactly ("7.4" is not specific enough)? On what platform? Can you show us the full schema definition for the temp table and any indexes on it? regards, tom lane