Re: idea: global temp tables - Mailing list pgsql-hackers

From Kevin Grittner
Subject Re: idea: global temp tables
Date
Msg-id 49F84BAF.EE98.0025.0@wicourts.gov
Whole thread Raw
In response to idea: global temp tables  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: idea: global temp tables  (James Mansion <james@mansionfamily.plus.com>)
Re: idea: global temp tables  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Greg Stark <stark@enterprisedb.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


pgsql-hackers by date:

Previous
From: Greg Stark
Date:
Subject: Re: idea: global temp tables
Next
From: Greg Stark
Date:
Subject: Re: idea: global temp tables