ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 消除行连接

消除行连接

原创 Linux操作系统 作者:cdbdp 时间:2013-05-14 22:00:00 0 删除 编辑

[oracle@rac1 oracle]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Apr 22 11:12:11 2013
Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> conn scott/tiger
Connected.
SQL> desc chained_rows
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 OWNER_NAME                                         VARCHAR2(30)
 TABLE_NAME                                         VARCHAR2(30)
 CLUSTER_NAME                                       VARCHAR2(30)
 PARTITION_NAME                                     VARCHAR2(30)
 SUBPARTITION_NAME                                  VARCHAR2(30)
 HEAD_ROWID                                         ROWID
 ANALYZE_TIMESTAMP                                  DATE
SQL> truncate table chained_rows;
Table truncated.
SQL> analyze table t1 list chained rows into chained_rows;
Table analyzed.
SQL> select count(1) from chained_rows;
  COUNT(1)
----------
      8284
SQL> create table t1_chained as select * from t1 where rowid in (select head_rowid from chained_rows where table_name='T1');
Table created.
SQL> select count(2) from t1_chained;
  COUNT(2)
----------
      8284
SQL> delete from t1 where rowid in (select head_rowid from chained_rows where table_name='T1');
8284 rows deleted.
SQL> commit;
Commit complete.
SQL> insert into t1 select * from t1_chained;
8284 rows created.
SQL> commit;
Commit complete.
SQL> truncate table chained_rows;
Table truncated.
SQL> analyze table t1 list chained rows into chained_rows;
Table analyzed.
SQL> select count(1) from chained_rows;
  COUNT(1)
----------
         0
SQL> drop table t1_chained purge;
Table dropped.
SQL>

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

上一篇: oracle死锁
下一篇: asm
请登录后发表评论 登录
全部评论

注册时间:2010-02-22

  • 博文量
    51
  • 访问量
    105409