query-unesting

环境

BANNER               CON_ID
-------------------------------------------------------------------------------- ----------
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production    0
PL/SQL Release 12.2.0.1.0 - Production                                                               0
CORE 12.2.0.1.0 Production                                                                                  0
TNS for Linux: Version 12.2.0.1.0 - Production                                                      0
NLSRTL Version 12.2.0.1.0 - Production                                                               0

Red Hat Enterprise Linux Server release 7.0 (Maipo)

[oracle@localhost ~]$ uname -a
Linux localhost.localdomain 3.8.13-35.3.1.el7uek.x86_64 #2 SMP Wed Jun 25 15:27:43 PDT 2014 x86_64 x86_64 x86_64 GNU/Linux

sql:SELECT * FROM HR.EMPLOYEES WHERE DEPARTMENT_ID IN(SELECT DEPARTMENT_ID FROM HR.DEPARTMENTS);

生产10053trace

 以sys用户登录

SQL> oradebug setmypid
Statement processed.
SQL> oradebug tracefile_name
/u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_2035.trc
SQL> oradebug event 10053 trace name context forever ,level 1;
Statement processed.
SQL> alter system flush buffer_cache;

System altered.

SQL> alter system flush shared_pool;

System altered.

SQL> SELECT * FROM HR.EMPLOYEES WHERE DEPARTMENT_ID IN(SELECT DEPARTMENT_ID FROM HR.DEPARTMENTS);

SQL> oradebug event 10053 trace name context off;
Statement processed.

查看trace

783行

SELECT "EMPLOYEES"."EMPLOYEE_ID"    "EMPLOYEE_ID",
       "EMPLOYEES"."FIRST_NAME"     "FIRST_NAME",
       "EMPLOYEES"."LAST_NAME"      "LAST_NAME",
       "EMPLOYEES"."EMAIL"          "EMAIL",
       "EMPLOYEES"."PHONE_NUMBER"   "PHONE_NUMBER",
       "EMPLOYEES"."HIRE_DATE"      "HIRE_DATE",
       "EMPLOYEES"."JOB_ID"         "JOB_ID",
       "EMPLOYEES"."SALARY"         "SALARY",
       "EMPLOYEES"."COMMISSION_PCT" "COMMISSION_PCT",
       "EMPLOYEES"."MANAGER_ID"     "MANAGER_ID",
       "EMPLOYEES"."DEPARTMENT_ID"  "DEPARTMENT_ID"
  FROM "HR"."EMPLOYEES" "EMPLOYEES"
 WHERE "EMPLOYEES"."DEPARTMENT_ID" = ANY
 (SELECT "DEPARTMENTS"."DEPARTMENT_ID" "DEPARTMENT_ID"
          FROM "HR"."DEPARTMENTS" "DEPARTMENTS")

870行

SU: Unnesting query blocks in query block SEL$1 (#1) that are valid to unnest.


916行

SELECT "EMPLOYEES"."EMPLOYEE_ID"    "EMPLOYEE_ID",
       "EMPLOYEES"."FIRST_NAME"     "FIRST_NAME",
       "EMPLOYEES"."LAST_NAME"      "LAST_NAME",
       "EMPLOYEES"."EMAIL"          "EMAIL",
       "EMPLOYEES"."PHONE_NUMBER"   "PHONE_NUMBER",
       "EMPLOYEES"."HIRE_DATE"      "HIRE_DATE",
       "EMPLOYEES"."JOB_ID"         "JOB_ID",
       "EMPLOYEES"."SALARY"         "SALARY",
       "EMPLOYEES"."COMMISSION_PCT" "COMMISSION_PCT",
       "EMPLOYEES"."MANAGER_ID"     "MANAGER_ID",
       "EMPLOYEES"."DEPARTMENT_ID"  "DEPARTMENT_ID"
  FROM "HR"."DEPARTMENTS" "DEPARTMENTS", "HR"."EMPLOYEES" "EMPLOYEES"
 WHERE "EMPLOYEES"."DEPARTMENT_ID" = "DEPARTMENTS"."DEPARTMENT_ID"


trace文件


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值