avatar
Which one is better?# Database - 数据库
B*g
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
avatar
c*d
2
2用了hash join,应该比1快
avatar
B*g
3
实际执行时间(total not cpu time),1 10秒, 2 2分钟。

【在 c*****d 的大作中提到】
: 2用了hash join,应该比1快
avatar
c*d
4
这两条语句返回多少记录?
如果很少,应该1快;如果很多,应该2快

【在 B*****g 的大作中提到】
: 实际执行时间(total not cpu time),1 10秒, 2 2分钟。
avatar
c*d
5
另外,不同语句的cost是没有可比性的

【在 B*****g 的大作中提到】
: 实际执行时间(total not cpu time),1 10秒, 2 2分钟。
avatar
s*e
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.
avatar
I*e
7
Can you post the plan better readable? But, basically it is the statistics
issue.
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。