Re: idea: global temp tables

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Greg Stark" <stark(at)enterprisedb(dot)com>
Cc: "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>, "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>, "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: idea: global temp tables
Date: 2009-04-29 17:44:31
Message-ID: 49F84BAF.EE98.0025.0@wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greg Stark <stark(at)enterprisedb(dot)com> wrote:

> I've been thinking about Alvaro's idea of a separate smgr. If you
> had a single pg_class entry for all sessions but the smgr knew to
> store the actual data for it in a session-local file, either in a
> session-specific tablespace or using the same mechanism the
> temporary files use to direct data then the backend would basically
> never know it wasn't a regular table.
>
> It could still use local buffers but it could use the global
> relcache, invalidation, locks, etc. I think we would have to take a
> session-level access lock as soon as we put any data in our local
> store. And each DDL operation would have to be visited to see
> whether it needs special behaviour for locally stored tables. I
> suspect most of them will only be able to be handled if there are no
> active sessions using the table so they'll basically be no-ops
> except for the catalog changes.

Any chance that some of these improvements could be applied to temp
tables created with the PostgreSQL-specific syntax while we're at it?
The need for several tables to be created on disk to materialize a
single temp table currently causes performance problems in some
contexts. I don't think the updates to the system tables have the
same magnitude of performance hit as creating these tables, especially
if write barriers are on.

-Kevin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-04-29 17:52:10 Re: idea: global temp tables
Previous Message Tom Lane 2009-04-29 17:42:49 Re: idea: global temp tables