Query taking too long time to execute. [Resolved]

Posted by Thiru under Sql Server on 8/27/2012 | Points: 10 | Views : 1974 | Status : [Member] | Replies : 2
Hi Friends,

the following query is taking very very long time. But i dont know where is the mistake
please help me.

SELECT C.WMC,C.BNo,C.RcptNo,C.RcptDt,C.Comper,C.ComAmt,C.comtyp,R.Amt,P.PrdGrp,P.PrdCde,P.PrdNm,
CST.Frequency,T.BDT,T.WMC as T_WMC,T.BDT, W.Wnm,W.Wrnk FROM tblComm C
INNER JOIN tbltransreceipts R ON C.RcptNo=R.RcptNo INNER JOIN tbltransaction T ON T.BNo=C.BNo INNER JOIN tblproduct P ON T.PrdCde=P.PrdCde
INNER JOIN tblcust_prd_wor CST ON T.cst_cde=CST.cst_cde INNER JOIN tblworker W ON T.WMC=W.WMC WHERE (T.BCDE LIKE 'SLKRI') AND
((C.RcptDt) Between ('2012-05-01') And ('2012-05-05')) AND (C.WMC LIKE 'SLKRI8000003');

Note all the required joining columns are indexed.

( i have also attached the query execution plan too)

please help me to solve this issue.


Posted by: Thiru on: 8/27/2012 [Member] Starter | Points: 25


hi friend,
Finally one of my friend who is working in IBM DB analized my DB and found that
sometime "LIKE" operator wont work on INDEXED COLUMN

as per his suggestion i used "=" instead of "LIKE"
now its working fine.

Thanks to my friend from IBM and funda friends here who took and spend their
valuable time here to read.

I like to Thank Mr.Vuyiswa who took a special care and spend his valuable time

Thiru, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sheonarayan on: 8/27/2012 [Administrator] HonoraryPlatinum | Points: 25

Thanks and good effort guys.

Sheo Narayan

Thiru, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response