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

From Alvaro Herrera
Subject Re: idea: global temp tables
Date
Msg-id 20090428145926.GK10358@alvh.no-ip.org
Whole thread Raw
In response to idea: global temp tables  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: idea: global temp tables
Re: idea: global temp tables
List pgsql-hackers
Pavel Stehule escribió:
> Hello
> 
> I am thinking about global temp tables. One possible solution is
> creating global temporary table like normal table and in planner stage
> check using this table. When some global temporary table is detected,
> then real temporary table is created and used in execution plan. It's
> like:
> 
> CREATE GLOBAL TEMP TABLE foo(a varchar); -- create global empty table foo
> SELECT * FROM foo;
>   a) is relevant temp table for foo, use it
>   a) when not, then CREATE TEMP TABLE pg_temp_1.foo(LIKE foo INCLUDING
> DEFAULTS INCLUDING CONSTRAINTS INCLUDING INDEXES);
>   b) transform origin query to SELECT * FROM pg_temp_1.foo;
> 
> Ideas? Notes? Objections?

Maybe we could make this work by fiddling with a different smgr -- on
it, smgr_sync would be a noop, as would smgr_immedsync, and we could
kludge something up to truncate relations during recovery.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


pgsql-hackers by date:

Previous
From: Greg Stark
Date:
Subject: Re: Extra cost of "lossy mode" Bitmap Scan plan
Next
From: Andreas Pflug
Date:
Subject: Re: Clean shutdown and warm standby