SQL调优

网上看到如下sql:
留一个线索在此
select /*+ cardinality(@a 20000) cardinality(@b 20000) */ ((v.yvalue * 300) / (u.xvalue * 50)), u.xtime
2 from (select x.index_value xvalue, substr(x.update_time, 1, 14) xtime
3 from tb_indexs x
4 where x.id in (select /*+ QB_NAME(a)*/ min(a.id)
5 from tb_indexs a
6 where a.code = 'HSI'
7 and a.update_time > 20110701000000
8 and a.update_time < 20110722000000
9 group by a.update_time)) u,
10 (select y.index_value yvalue, substr(y.update_time, 1, 14) ytime
11 from tb_indexs y
12 where y.id in (select /*+ QB_NAME(b) */ min(b.id)
13 from tb_indexs b
14 where b.code = '000300'
15 and b.update_time > 20110701000000
16 and b.update_time < 20110722000000
17 group by b.update_time)) v
18 where u.xtime = v.ytime
19 order by u.xtime;
cardinality:指定查询基数
This hint specifies the estimated cardinality returned by a query or portions of the query. Note if no table is specified, the cardinality is the total number of rows returned by the entire query.

QB_NAME hint query block name length limitation

http://feed.askmaclean.com/archives/qb_name-hint-query-block-name-length-limitation.html
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值