[ORACLE BUG]查询结果错误--临时表并行

Wrong Results From Query Using Parallel Execution And Global Temporary Table(s) [ID 457040.1]To BottomTo Bottom

Modified:23-Nov-2010Type:PROBLEMStatus:PUBLISHEDPriority:3
There are no commentsComments (0)Rate this documentEmail link to this documentOpen document in new windowPrintable Page

In this Document
  Symptoms
  Cause
  Solution


Applies to:

Oracle Server - Enterprise Edition - Version: 10.2.0.1 to 10.2.0.4 - Release: 10.2 to 10.2
Information in this document applies to any platform.

Symptoms

When executing a parallel query on a set of tables including one or more Global Temporary Tables (GTT) resulting in an execution plan that involves Nested Loop Joins against the GTTs, NULL values result in the column which are part of the GTTs.

Reproducing the issue is fairly simple:

drop table t1;  
drop table t2;  
drop table t3;  

create table t1(c1 varchar2(64 ));  
create table t2(c1 varchar2(64 ),c2 varchar2(1 )) parallel ;  
create global temporary table t3(c1 varchar2(64),c2 varchar2(1)) on  
commit preserve rows;  


insert into t1 values('2');  
insert into t2 values('2', '0');  
insert into t3 values('2', '0');  
commit;  

alter session disable parallel query;  
select t3.rowid t_3_rowid from t2  inner join t1  on t1.c1 = t2.c1  
  left outer join t3 on t2.c1 = t3.c1 and (t2.c2 = 2 or t3.c2 = t2.c2);  
   
T_3_ROWID   
------------------   
AAQAAJAABAAAAAKAAA  

alter session enable parallel query;  

select t3.rowid t_3_rowid from t2  inner join t1  on t1.c1 = t2.c1  
  left outer join t3 on t2.c1 = t3.c1 and (t2.c2 = 2 or t3.c2 = t2.c2);  

T_3_ROWID   
------------------   
                  

The resulting parallel execution plan shows that the GTT is scanned by a parallel slave in a NLJ:

--------------------------------------------------------------------------  
|   0 | SELECT STATEMENT         |          |        |      |            |  
|   1 |  PX COORDINATOR          |          |        |      |            |  
|   2 |   PX SEND QC (RANDOM)    | :TQ10002 |  Q1,02 | P->S | QC (RAND)  |  
|   3 |    NESTED LOOPS OUTER    |          |  Q1,02 | PCWP |            |  
|*  4 |     HASH JOIN            |          |  Q1,02 | PCWP |            |  
|   5 |      PX RECEIVE          |          |  Q1,02 | PCWP |            |  
|   6 |       PX SEND HASH       | :TQ10001 |  Q1,01 | P->P | HASH       |  
|   7 |        PX BLOCK ITERATOR |          |  Q1,01 | PCWC |            |  
|   8 |         TABLE ACCESS FULL| T2       |  Q1,01 | PCWP |            |  
|   9 |      BUFFER SORT         |          |  Q1,02 | PCWC |            |  
|  10 |       PX RECEIVE         |          |  Q1,02 | PCWP |            |  
|  11 |        PX SEND HASH      | :TQ10000 |        | S->P | HASH       |  
|  12 |         TABLE ACCESS FULL| T1       |        |      |            |  
|  13 |     VIEW                 |          |  Q1,02 | PCWP |            |  
|* 14 |      TABLE ACCESS FULL   | T3       |  Q1,02 | PCWP |            |  
--------------------------------------------------------------------------
注:在MOS 查询发现由于并行引起的查询结果非常多

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

转载于:http://blog.itpub.net/15747463/viewspace-754924/

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值