Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 Query Executing Slow

Author  Topic 

akumar.ana06
Starting Member

4 Posts

Posted - 2010-06-03 : 11:58:52
Hi. Hope everyone doing great.

When i run SELECT 'X' FROM PS_INSTALLATION this it's taking no time, and when i run the inner query it's taking 3 sec. But when i run the compete query it's taking 2 mins. This is system generated query i can't change the query. Execution plans for the query and inner query are different.

CODE:
SELECT 'X' FROM PS_INSTALLATION WHERE EXISTS
(SELECT 'X' FROM PS_KK_SOURCE_LN A, PS_KK_SOURCE_HDR B , PS_KK_ACTIVITY_LOG C
WHERE B.BUSINESS_UNIT = 'BUS' AND B.PO_ID = 'PO_NUM' AND A.LINE_NBR = '1' AND A.SCHED_NBR = '1'
AND A.DISTRIB_LINE_NUM = '1' AND A.KK_TRAN_ID = B.KK_TRAN_ID AND A.KK_TRAN_DT = B.KK_TRAN_DT
AND A.KK_TRAN_ID = C.KK_TRAN_ID AND A.KK_TRAN_DT = C.KK_TRAN_DT AND A.KK_TRAN_LN = C.KK_TRAN_LN
AND C.ENTRY_EVENT <> ' ' AND C.EE_PROC_STATUS IN ('N', ' '))
Any help would be greatly appreciated!

Thanks,
Best Regards,
Kumar.

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-06-04 : 07:08:44
Please post table definitions, index definitions and execution plan.

Thanks

--
Gail Shaw
SQL Server MVP
Go to Top of Page
   

- Advertisement -