Temporary Table Segment Allocation (168)

Temporary tables use temporary segments. Unlike permanent tables, temporary tables
and their indexes do not automatically allocate a segment when they are created.
Instead, segments are allocated when the first INSERT (or CREATE TABLE AS
SELECT) is performed. This means that if a SELECT, UPDATE, or DELETE is performed
before the first INSERT, then the table appears to be empty.

You can perform DDL statements (ALTER TABLE, DROP TABLE, CREATE INDEX, and
so on) on a temporary table only when no session is currently bound to it. A session
gets bound to a temporary table when an INSERT is performed on it. The session gets
unbound by a TRUNCATE, at session termination, or by doing a COMMIT or ROLLBACK
for a transaction-specific temporary table.

Temporary segments are deallocated at the end of the transaction for
transaction-specific temporary tables and at the end of the session for session-specific
temporary tables.

临时表的段分配
1. 临时表使用临时段 , 临时段是在表第一次插入数据(或者ctas)时才分配
2. 当没有会话与临时表绑定时 ,可对临时表使用ddl操作 .
插入数据时 , 会话将与临时表绑定 , 当会话结束 , 进行truncate , commit/rollback时将解除绑定
3. 在事务结束时 , 事务临时表的临时段将被回收 . 同理对会话临时表

[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10599713/viewspace-981375/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/10599713/viewspace-981375/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值