临时表在哪里存储在GreenPlum数据库中?

时间:2018-07-05 14:01:03

标签: temp-tables greenplum

在MS SQL Server中,临时表存储在tempdb Database中。

GreenPlum中是否有用于临时表的类似特殊位置?还是临时表只是存储在当前数据库和架构中,我可以在该数据库和架构下进行正常交易?

1 个答案:

答案 0 :(得分:3)

Greenplum中的临时表存储在创建它们的数据库中,但是存储在一个临时模式中,该模式在创建该表的会话期间有效。

[gpadmin@mdw:~] $ createdb temp
[gpadmin@mdw:~] $ psql temp
temp=# create temporary table test_temp(a int) distributed by (a);
CREATE TABLE
    Time: 50.516 ms
    temp=# \d
                     List of relations
       Schema   |   Name    | Type  |  Owner  | Storage
    ------------+-----------+-------+---------+---------
     pg_temp_11 | test_temp | table | gpadmin | heap
    (1 row)

temp=# \dn
       List of schemas
        Name        |  Owner
--------------------+---------
 gp_toolkit         | gpadmin
 information_schema | gpadmin
 pg_aoseg           | gpadmin
 pg_bitmapindex     | gpadmin
 pg_catalog         | gpadmin
 pg_temp_11         | gpadmin
 pg_toast           | gpadmin
 pg_toast_temp_11   | gpadmin
 public             | gpadmin
(9 rows)

temp=#

temp=# \q

[gpadmin@mdw:~] $ psql temp
Timing is on.
psql (8.3.23)
Type "help" for help.

temp=# \d
No relations found.
temp=# \dn
       List of schemas
        Name        |  Owner
--------------------+---------
 gp_toolkit         | gpadmin
 information_schema | gpadmin
 pg_aoseg           | gpadmin
 pg_bitmapindex     | gpadmin
 pg_catalog         | gpadmin
 pg_toast           | gpadmin
 public             | gpadmin
(7 rows)

temp=#

这能回答您的问题吗?