Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 7039D632820 for ; Sat, 24 Apr 2010 03:42:54 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 02629-09 for ; Sat, 24 Apr 2010 06:42:40 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wy0-f174.google.com (mail-wy0-f174.google.com [74.125.82.174]) by mail.postgresql.org (Postfix) with ESMTP id 82DDF63292B for ; Sat, 24 Apr 2010 03:42:43 -0300 (ADT) Received: by wyg36 with SMTP id 36so292375wyg.19 for ; Fri, 23 Apr 2010 23:42:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=yKfde/ktMSUQY4v2HfNQ67U1OJRcC7Z0s51oIzLmlb0=; b=RQFW5Vy/15Zh+QtB6yFh6Vf1idJjPCSb5S/JaZ/8JY0JFeAlGApwLrSJTYbsObGa1x erKwpk1biRd7qTjb6HyxTYZ1NUTb5q3sdtD4uAz/03ryr8zlgI7mLiwMBl+Q95jhQdVs H5GGtUAmvxqKPncdWnlYM3MQ086+nZFqaDScU= 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=mAF8dH57Umq86D5kDlF4AdvqQWSHtucaPusBOWznEbfyQPVg4O6ZC+eu07Zy8gm2j/ nYNbmrENgeH8P6Dr+DL9wGym6a40TqHfOHkU6uMNWVdVAb+rbpw4xemMPkvt+wwHmLjb 1VZd0zlnVF+Mfn4xZTQK/JnXb2W6yBWJjM8Kc= MIME-Version: 1.0 Received: by 10.216.89.209 with SMTP id c59mr1380542wef.87.1272091362156; Fri, 23 Apr 2010 23:42:42 -0700 (PDT) Received: by 10.216.183.71 with HTTP; Fri, 23 Apr 2010 23:42:42 -0700 (PDT) In-Reply-To: References: Date: Sat, 24 Apr 2010 08:42:42 +0200 Message-ID: Subject: Re: global temporary tables From: Pavel Stehule To: Robert Haas Cc: pgsql-hackers@postgresql.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.094 tagged_above=-10 required=5 tests=AWL=-0.194, BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201004/1105 X-Sequence-Number: 161217 2010/4/24 Robert Haas : > A couple of recent threads made got me thinking again about the idea > of global temporary tables. =C2=A0There seem to be two principal issues: > > 1. What is a global temporary table? > > 2. How could we implement that? > > Despite rereading the "idea: global temp tables" thread from April > 2009 in some detail, I was not able to get a clear understanding of > (1). =C2=A0What I *think* it is supposed to mean is that the table is a > permanent object which is "globally" visible - that is, it's part of > some non-temp schema like public or $user and it's column definitions > etc. are visible to all backends - and it's not automatically removed > on commit, backend exit, etc. - but the *contents* of the table are > temporary and backend-local, so that each new backend initially sees > it as empty and can then insert, update, and delete data independently > of what any other backend does. > > As to (2), my thought is that perhaps we could implement this by > instantiating a separate relfilenode for the relation for each backend > which accesses it. =C2=A0relfilenode would be 0 in pg_class, as it is for > "mapped" relations, but every time a backend touched the rel, we'd > allocate a relfilenode and associated the oid of the temp table to it > using some kind of backend-local storage - actually similar to what > the relmapper code does, except without the complexity of ever > actually having to persist the value; and perhaps using a hash table > rather than an array, since the number of mapped rels that a backend > can need to deal with is rather more limited than the number of temp > tables it might want to use. it is good idea. I missing some ideas about statistics, about indexes. Regards Pavel Stehule > > Thoughts? > > ...Robert > > -- > Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-hackers >