全球临时表 [英] Global Temporary Table

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

问题描述

帮助我了解全局临时表的工作原理

Help me understand how Global temporary table works

我有要线程化的进程,并且需要仅对该线程会话可见的数据.因此,我们选择了全球临时表".

I have process which is going to be threaded and requires data visible only to that thread session. So we opted for Global Temporary Table.

在所有线程完成之后最好不要保留全局临时表,还是删除该表是明智的选择?每天可能会调用此过程一次或两次.

Is it better to leave global temporary table not being dropped after all threads are completed or is it wise to drop the table. Call to this process can happen once or twice in a day.

大约需要4张桌子

推荐答案

Oracle临时表与SQL Server #temp表不同.我看不出有任何理由要不断删除/创建表.一旦事务或会话完成,数据将基于每个会话转移(取决于表创建选项).如果您有多个线程使用同一个数据库会话,则它们将看到彼此的数据.如果每个线程有一个会话,那么数据将受到您所提到的范围的限制.参见示例此处.

Oracle Temp tables are NOT like SQL Server #temp tables. I can't see any reason to continuously drop/create the tables. The data is gone on a per session basis anyways once the transaction or session is completed (depends on table creation options). If you have multiple threads using the same db session, they will see each other's data. If you have one session per thread, then the data is limited in scope as you mentioned. See example here.

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

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