B*****g 发帖数: 34098 | 1 why CHOOSECost for (1) is more than (2)?
SELECT *
FROM c
WHERE EXISTS (SELECT 1
FROM a
WHERE a.key = c.key
AND ROWNUM = 1)
Plan
SELECT STATEMENT CHOOSECost: 670,429 Bytes: 87,120,580 Cardinality: 215,
645
4 FILTER
1 TABLE ACCESS FULL C Cost: 23,494 Bytes: 87,120,580 Cardinality:
215,645
3 COUNT STOPKEY
2 INDEX RANGE SCAN UNIQUE INDEX1(***table A***) Cost: 3 B |
c*****d 发帖数: 6045 | |
B*****g 发帖数: 34098 | 3 实际执行时间(total not cpu time),1 10秒, 2 2分钟。
【在 c*****d 的大作中提到】![](/moin_static193/solenoid/img/up.png) : 2用了hash join,应该比1快
|
c*****d 发帖数: 6045 | 4 这两条语句返回多少记录?
如果很少,应该1快;如果很多,应该2快
【在 B*****g 的大作中提到】![](/moin_static193/solenoid/img/up.png) : 实际执行时间(total not cpu time),1 10秒, 2 2分钟。
|
c*****d 发帖数: 6045 | 5 另外,不同语句的cost是没有可比性的
【在 B*****g 的大作中提到】![](/moin_static193/solenoid/img/up.png) : 实际执行时间(total not cpu time),1 10秒, 2 2分钟。
|
s******e 发帖数: 493 | 6 The optimizer uses a mix of cost and heuristics to find a best plan for fast
delivery of the first row. Note: Using heuristics sometimes leads the CBO
to generate a plan with a cost that is significantly larger than the cost of
a plan without applying the heuristic. |
I******e 发帖数: 101 | 7 Can you post the plan better readable? But, basically it is the statistics
issue. |