oracle 变量不起作用,为什么提示不起作用呢? /*+USE_NL()*/

Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL> create table test as select * from dba_objects;

表已创建。

SQL> insert into test select * from test;

已创建47981行。

SQL> /

已创建95962行。

SQL> /

已创建191924行。

SQL> /

已创建383848行。

SQL> commit;

提交完成。

SQL> create table test1 as select * from dba_objects where rownum < 1000;

表已创建。

SQL> analyze table test compute statistics;

表已分析。

SQL>

SQL> analyze table test1 compute statistics;

表已分析。

SQL> set autotrace on

SQL> select /*+USE_NL(TEST1)*/ count(1) from test,test1 where test.object_id=tes

t1.object_id;

15984

执行计划

----------------------------------------------------------

0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=2331 Card=1 Bytes=

7)

1    0   SORT (AGGREGATE)

2    1     HASH JOIN (Cost=2331 Card=15984 Bytes=111888)

3    2       TABLE ACCESS (FULL) OF 'TEST1' (TABLE) (Cost=4 Card=99

9 Bytes=2997)

4    2       TABLE ACCESS (FULL) OF 'TEST' (TABLE) (Cost=2319 Card=

767696 Bytes=3070784)

统计信息

----------------------------------------------------------

1  recursive calls

0  db block gets

10545  consistent gets

9828  physical reads

0  redo size

392  bytes sent via SQL*Net to client

512  bytes received via SQL*Net from client

2  SQL*Net roundtrips to/from client

0  sorts (memory)

0  sorts (disk)

1  rows processed

SQL> select /*+ use_nl(test,test1) */ count(1) from test,test1 where test.object

_id=test1.object_id;

15984

执行计划

----------------------------------------------------------

0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=2038396 Card=1 Byt

es=7)

1    0   SORT (AGGREGATE)

2    1     NESTED LOOPS (Cost=2038396 Card=15984 Bytes=111888)

3    2       TABLE ACCESS (FULL) OF 'TEST' (TABLE) (Cost=2319 Card=

767696 Bytes=3070784)

4    2       TABLE ACCESS (FULL) OF 'TEST1' (TABLE) (Cost=3 Card=1

Bytes=3)

统计信息

----------------------------------------------------------

1  recursive calls

0  db block gets

11525970  consistent gets

9833  physical reads

0  redo size

392  bytes sent via SQL*Net to client

512  bytes received via SQL*Net from client

2  SQL*Net roundtrips to/from client

0  sorts (memory)

0  sorts (disk)

1  rows processed

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值