- 最后登录
- 2016-6-27
- 在线时间
- 134 小时
- 威望
- 351
- 金钱
- 2586
- 注册时间
- 2012-3-16
- 阅读权限
- 60
- 帖子
- 188
- 精华
- 6
- 积分
- 351
- UID
- 309
|
1#
发表于 2012-5-13 09:55:09
|
查看: 2849 |
回复: 0
刘大帮忙看看这条语句怎么优化,awr报告里看到执行花费了1,314s,但是在v$sql里找不到这条语句了,可能被刷出去了,执行计划我贴在附件里了。
SELECT pacct.fid faccountid, pacct.faccounttypeid, pacct.fnumber fnumber,
pacct.flongname_l2 fname, pacct.fparentid
FROM (SELECT DISTINCT va.fid
FROM t_gl_assistbalance tb INNER JOIN t_bd_accountview va
ON va.fid = tb.faccountid
LEFT OUTER JOIN t_gl_voucherentry ve
ON va.fid = ve.faccountid
LEFT OUTER JOIN t_gl_voucherassistrecord tvar
ON tvar.fentryid = ve.fid
INNER JOIN t_bd_period tp ON tb.fperiodid = tp.fid
WHERE ( ( ( ( ( ( ( ( ( tp.ftypeid =
:1
AND ( (tp.fperiodyear <
:2
)
OR ( tp.fperiodyear =
:3
AND (tp.fperiodnumber <=
:4
)
)
)
)
AND tb.fcurrencyid =
:5
)
AND ( (tb.fdebitfor <>
0
)
OR (tb.fcreditfor <>
0
)
OR (tb.fendbalancefor <>
0
)
OR (tvar.foriginalamount <>
0
)
)
)
AND tb.fbaltype = :6
)
AND tb.forgunitid = :7
)
AND va.faccounttableid = :8
)
AND va.fcompanyid = :9
)
AND ( (va.fnumber IN ('1001', '5701'))
OR ( (va.fnumber > '1001')
AND (va.fnumber < '5701~~')
)
)
)
AND tb.fassistgrpid IN (
SELECT DISTINCT hg.fid
FROM t_bd_assistanthg hg INNER JOIN t_org_admin t_4
ON hg.fadminorgid = t_4.fid
WHERE ( (t_4.flongnumber >= :10
)
AND (t_4.flongnumber <= :11
)
))
)) t_av
INNER JOIN
t_bd_accountview acct ON t_av.fid = acct.fid
INNER JOIN t_bd_accountview pacct
ON ( ( pacct.fcompanyid = acct.fcompanyid
AND pacct.faccounttableid = acct.faccounttableid
)
AND INSTR ((acct.flongnumber || '!'),
(pacct.flongnumber || '!')
) = 1
)
WHERE ( ((pacct.flevel >= :12) AND (pacct.flevel <= :13))
AND pacct.fcompanyid = :14
)
ORDER BY pacct.fnumber ASC; |
|