临时表和其他模式 [英] Temporary tables and miscellaneous schemas

查看:49
本文介绍了临时表和其他模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我创建一个临时表时,就像


CREATE TEMPORARY TABLE temptable1 AS SELECT * FROM paid.ad_hoc_query;


新出现模式,名称类似于pg_temp_1。我猜这些模式的外观

带有temp在名称中表明它们是

临时模式并与临时表创建相关,但即使在创建临时

表的会话结束后,

模式仍然存在。


这些杂项架构有什么用?它们实际上与临时表的创建有关吗?当会话结束时,它们是否应该消失,临时表也应该关闭?如果他们在会议结束后继续坚持
,我该如何摆脱它们?


~Berend Tober



---------------------------(播出结束)------------ ---------------

提示5:您查看了我们广泛的常见问题解答吗?

http://www.postgresql.org/docs/faqs/FAQ.html

Whenever I create a temporary table, with something like

CREATE TEMPORARY TABLE temptable1 AS SELECT * FROM paid.ad_hoc_query;

New schemas appear, with names like "pg_temp_1". I guess the appearance
of these schemas with "temp" in the name indicates that they are
"temporary" schemas and related to the temporary table creation, but the
schemas persist even after the end of the session in which the temporary
table was created.

What''s up with these miscellaneous schemas? Are they in fact related to
the creation of temporary tables? Should they disappear when the session
closes, as should the temporary table? If they continue persisting after
the session closes, how do I get rid of them?

~Berend Tober


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

推荐答案

< bt **** @ seaworthysys.com>写道:
<bt****@seaworthysys.com> writes:
这些杂项架构有什么用?它们实际上与创建临时表有关吗?当会议结束时它们是否应该消失,临时表也应该消失吗?如果他们在会议结束后继续坚持,我该如何摆脱它们?
What''s up with these miscellaneous schemas? Are they in fact related to
the creation of temporary tables? Should they disappear when the session
closes, as should the temporary table? If they continue persisting after
the session closes, how do I get rid of them?




他们是实施细节,是的,不,你不要。


问候,汤姆小巷


----------------- ----------(广播结束)---------------------------

提示5:您是否检查过我们广泛的常见问题解答?

http://www.postgresql.org/docs/faqs/FAQ.html



They''re implementation details, yes, no, and you don''t.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


< BT **** @ seaworthysys.com>写道:
<bt****@seaworthysys.com> writes:
这些杂项架构有什么用?它们实际上与创建临时表有关吗?当会议结束时它们是否会消失,临时表也应该消失?如果他们在会议结束后继续坚持,我该如何摆脱它们?
What''s up with these miscellaneous schemas? Are they in fact related
to the creation of temporary tables? Should they disappear when the
session closes, as should the temporary table? If they continue
persisting after the session closes, how do I get rid of them?



他们是实施细节,是的,不,你不要。



They''re implementation details, yes, no, and you don''t.




谢谢。也许我对临时

表的有用性的思考需要调整。我一直在制定一个计划来使用

a临时表,该表将在某些

条件下在运行时创建,具体取决于数据库最终用户所做的选择

申请。


如果要跟进,如果临时架构没有消失,那么随着时间的推移

会发生什么(因为临时表在正常应用程序中被实例化

使用),数据库最终是否有越来越多的这些

临时模式?在我看来,持续不断地发生

并不是一件好事。


~Berend Tober



---------------------------(广播结束)------- --------------------

提示9:如果您的
$ b,计划员将无视您选择索引扫描的愿望$ b加入列的数据类型不匹配



Thanks. Maybe my thinking in regards to the usefulness of temporary
tables needs to be adjusted. I had been formulating a plan to make use of
a temporary table that would be created at run time under certain
conditions depending on selections made by the end-user of a database
application.

To follow-up then, if the temp schemas do not disappear, then over time
what happens (as temp tables are instantiated during normal application
usage), does the database end up with an ever-increasing number of these
temp schemas? It would seem to me that that is not a good thing to have
happening on a permanent, continuing basis.

~Berend Tober


---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column''s datatypes do not match


< bt **** @ seaworthysys.com>写道:
<bt****@seaworthysys.com> writes:
要进行跟进,如果临时模式没有消失,那么随着时间的推移会发生什么(因为临时表在正常应用程序使用期间被实例化),数据库最终会有越来越多的这些临时模式?
To follow-up then, if the temp schemas do not disappear, then over time
what happens (as temp tables are instantiated during normal application
usage), does the database end up with an ever-increasing number of these
temp schemas?




不,你永远不会超过max_connections。


问候,汤姆小巷


------------------------- - (广播结束)---------------------------

提示5:你检查了我们的广泛内容常见问题解答?

http:// www。 postgresql.org/docs/faqs/FAQ.html



No, you will never have more than max_connections of them.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


这篇关于临时表和其他模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆