SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 Query Executing Slow
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

akumar.ana06
Starting Member

USA
4 Posts

Posted - 06/03/2010 :  11:58:52  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

South Africa
4507 Posts

Posted - 06/04/2010 :  07:08:44  Show Profile  Visit GilaMonster's Homepage  Reply with Quote
Please post table definitions, index definitions and execution plan.

Thanks

--
Gail Shaw
SQL Server MVP
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000