select trandate, serseqno, acctno, voukind,vouno, memomsg, cdflag, amount, trancode, oppaccno, oppacctname, flag
from glsinacctlist a
where cancelflag='0'
and trancode not in ( '548300', 'T00000' ) and acctno='6217000088103047' and trandate='2017-04-17'
and ( ( (trancode = 'TC0001' or trancode = 'TP0001') and ( flag = '1' or flag = '2' ) ) or (trancode <> 'TC0001' and trancode <> 'TP0001' and flag not in ('B','C','D','E') ) )
and not exists ( select 1 from GLSINACCTLIST where acctno=a.acctno and trandate=a.trandate and cancelstan=a.serseqno and cancelflag='1') order by a.serseqno
這條陳述句在執行時,有的時候很快,有的時候很慢,一執行cpu就飚到100%
表glsinacctlist 中大概有8000萬條資料
求大神門給個優化建議,最好能解釋下為什么,在下小白啊,下周上線
急急急急!
uj5u.com熱心網友回復:
看一下執行計劃吧,估計計算量比較大uj5u.com熱心網友回復:
額。。。看不太懂執行計劃啊,怎么看啊大神
uj5u.com熱心網友回復:

這是執行計劃,請大家幫幫忙,謝謝大家了
uj5u.com熱心網友回復:
執行上看著,沒什么例外。收集一下兩張表的統計資訊吧。
uj5u.com熱心網友回復:
select trandate, serseqno, acctno, voukind,vouno, memomsg, cdflag, amount, trancode, oppaccno, oppacctname, flagfrom glsinacctlist a
not exists ( select 1 from GLSINACCTLIST where acctno=a.acctno and trandate=a.trandate and cancelstan=a.serseqno and cancelflag='1')
這個連接的意義是什么,不能直接換成cancelflag!='1'么
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/99323.html
標籤:高級技術
下一篇:求助一個存盤程序
