首页 > 应用开发 > IT综合 > Temporary Table Segment Allocation (168)

Temporary Table Segment Allocation (168)

原创 IT综合 作者:tsinglee 时间:2007-11-09 09:59:35 0 删除 编辑

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. 在事务结束时 , 事务临时表的临时段将被回收 . 同理对会话临时表


来自 “ ITPUB博客 ” ,链接:,如需转载,请注明出处,否则将追究法律责任。

上一篇: Temporary Tables (167)
请登录后发表评论 登录
  • 博文量
  • 访问量