alter session set _unnest_subquery=false;
不让它进行子查询改写
select count(*) from test o where object_id>(select avg(object_id) from test i where i.object_type=o.object_type);
SQL> set linesize 200
SQL> set pagesize 200
SQL> ALTER SESSION SET STATISTICS_LEVEL=ALL;
会话已更改。
SQL> select count(*) from test o where object_id>(select avg(object_id) from test i where i.object_type=o.object_type);
COUNT(*)
----------
43307
SQL> SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL,NULL,'ALLSTATS LAST'));
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID
alter session set _unnest_subquery=false;
最新推荐文章于 2021-04-18 21:34:53 发布