Re: [GENERAL] Means to emulate global temporary table

Поиск
Список
Период
Сортировка
Искать
От
Steve Atkins
Тема
Re: [GENERAL] Means to emulate global temporary table
Дата
Msg-id
E153C0AA-A9BB-4097-B45E-2EC90B979A9B@blighty.com
Ответ на
Список
Дерево обсуждения
[GENERAL] Means to emulate global temporary table Ian Lewis <ilewismsl@gmail.com>
Re: [GENERAL] Means to emulate global temporary table Adrian Klaver <adrian.klaver@aklaver.com>
Re: [GENERAL] Means to emulate global temporary table "David G. Johnston" <david.g.johnston@gmail.com>
Re: [GENERAL] Means to emulate global temporary table Karsten Hilbert <Karsten.Hilbert@gmx.net>
Re: [GENERAL] Means to emulate global temporary table Berend Tober <btober@computer.org>
Re: [GENERAL] Means to emulate global temporary table Pavel Stehule <pavel.stehule@gmail.com>
Re: [GENERAL] Means to emulate global temporary table Ian Lewis <ilewis@mstarlabs.com>
Re: [GENERAL] Means to emulate global temporary table Ian Lewis <ilewis@mstarlabs.com>
Re: [GENERAL] Means to emulate global temporary table John R Pierce <pierce@hogranch.com>
Re: [GENERAL] Means to emulate global temporary table "David G. Johnston" <david.g.johnston@gmail.com>
Re: [GENERAL] Means to emulate global temporary table Steve Atkins <steve@blighty.com>
Re: [GENERAL] Means to emulate global temporary table "David G. Johnston" <david.g.johnston@gmail.com>
Re: [GENERAL] Means to emulate global temporary table John R Pierce <pierce@hogranch.com>

> On Jan 11, 2017, at 7:02 PM, David G. Johnston  wrote:
> 
> ​"throughout" mustn't mean "by other sessions" or this becomes unwieldy.
> 
> Here's a mock-up:
> 
> CREATE TABLE template_table ();
> CREATE VIEW view_over_my_template_instance AS SELECT * FROM my_instance_of_template_table; --fails if done here without the desired feature
> 
> In a given session:
> 
> CREATE TEMP TABLE my_instance_of_template_table LIKE template_table;
> SELECT * FROM view_over_my_template_table; -- returns only this session's temp table data
> 
> Other sessions can simultaneously execute the same SELECT * FROM view_over_* and get their own results.
> 
> The goal is to avoid having to CREATE TEMP TABLE within the session but instead be able to do:
> 
> CREATE GLOBAL TEMP TABLE my_instance_of_template_table LIKE template_table;
> 
> And have the CREATE VIEW not fail and the session behavior as described.

Would this differ in any user-visible way from what you'd have if you executed at the start of each session:

CREATE TEMPORARY TABLE my_instance_of_template_table LIKE template_table;
CREATE TEMPORARY VIEW view_over_my_template_instance AS SELECT * FROM my_instance_of_template_table;

There'd be a small amount of session startup overhead, but that could be handled at the pooler level and amortized down to zero.

Cheers,
  Steve


В списке pgsql-general по дате отправления
От: Ian Lewis
Дата:
От: Andreas Joseph Krogh
Дата:
FAQ