Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 9411A9FB46B; Fri, 12 Jan 2007 13:33:32 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 59981-01; Fri, 12 Jan 2007 13:33:15 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 972539FB442; Fri, 12 Jan 2007 13:33:14 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 78A9156440; Fri, 12 Jan 2007 11:33:13 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Fri, 12 Jan 2007 11:33:06 -0600 Date: Fri, 12 Jan 2007 11:33:06 -0600 From: "Jim C. Nasby" To: Tom Lane Cc: Alvaro Herrera , Simon Riggs , Kim , pgsql-performance@postgresql.org, pgsql-hackers@postgresql.org Subject: Re: [PERFORM] unusual performance for vac following 8.2upgrade Message-ID: <20070112173306.GA70584@nasby.net> References: <45A671CD.1050706@myemma.com> <27939.1168539652@sss.pgh.pa.us> <45A68C74.4080405@myemma.com> <28949.1168544710@sss.pgh.pa.us> <1168548006.3951.564.camel@silverbirch.site> <5414.1168549900@sss.pgh.pa.us> <1168557275.3990.49.camel@silverbirch.site> <20070112010918.GM10464@alvh.no-ip.org> <29730.1168570299@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <29730.1168570299@sss.pgh.pa.us> X-Operating-System: FreeBSD 6.1-RELEASE-p10 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.13 (2006-08-11) X-Hashcash: 1:20:070112:tgl@sss.pgh.pa.us::BvwCN/v9jzPElGfM:00000000000000000000 00000000000000000000000022IE X-Hashcash: 1:20:070112:alvherre@commandprompt.com::8cAuPwM44k8hiBIb:00000000000 0000000000000000000000006OgR X-Hashcash: 1:20:070112:simon@2ndquadrant.com::LT9Wyje0GIMAooBv:0000000000000000 0000000000000000000000001opx X-Hashcash: 1:20:070112:kim@myemma.com::+iKTUh/QaTKO+0sJ:0002rwU X-Hashcash: 1:20:070112:pgsql-performance@postgresql.org::F3xD6GX6JSlJjfXe:00000 000000000000000000000000Aaik X-Hashcash: 1:20:070112:pgsql-hackers@postgresql.org::sy/J9NaywEgITEpw:000000000 0000000000000000000000002Gxu X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/673 X-Sequence-Number: 96574 On Thu, Jan 11, 2007 at 09:51:39PM -0500, Tom Lane wrote: > Alvaro Herrera writes: > > Can we actually get rid of pg_class entries for temp tables. Maybe > > creating a "temp pg_class" which would be local to each session? Heck, > > it doesn't even have to be an actual table -- it just needs to be > > somewhere from where we can load entries into the relcache. > > A few things to think about: > > 1. You'll break a whole lotta client-side code if temp tables disappear > from pg_class. This is probably solvable --- one thought is to give > pg_class an inheritance child that is a view on a SRF that reads out the > stored-in-memory rows for temp pg_class entries. Likewise for > pg_attribute and everything else related to a table definition. > > 2. How do you keep the OIDs for temp tables (and their associated > rowtypes) from conflicting with OIDs for real tables? Given the way > that OID generation works, there wouldn't be any real problem unless a > temp table survived for as long as it takes the OID counter to wrap all > the way around --- but in a database that has WITH OIDS user tables, > that might not be impossibly long ... > > 3. What about dependencies on user-defined types, functions, etc? > How will you get things to behave sanely if one backend tries to drop a > type that some other backend is using in a column of a temp table? Even > if you put entries into pg_depend, which would kind of defeat the point > of not having on-disk catalog entries for temp tables, I don't see how > the other backend figures out what the referencing object is. > > I don't really see any solution to that last point :-( Perhaps it would be better to partition pg_class and _attributes based on whether an object is temporary or not. Granted, that still means vacuuming is a consideration, but at least it wouldn't be affecting pg_class itself. Separating temp objects out would also make it more reasonable to have the system automatically vacuum those tables after every X number of dropped objects. Unfortunately, that still wouldn't help with the OID issue. :( Unless there was a SERIAL column in pg_class_temp and other parts of the system could differentiate between temp and non-temp objects. -- Jim Nasby jim@nasby.net EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)