July 23, 2009 at 1:05 am
Hi All,
The below query takes only 0 seconds in mssql2000 but it takes 15 seconds in mssql 2005 which we restored the same database in mssql 2005.
Query:
SELECT COUNT(*) FROM ACCOUNT_SEGMENT
WHERE
(ACCT_NBR = 'HQ254047434' AND SEG_ID IN (-1, 2, 3, 4))
OR
(EXISTS(
SELECT A.ACCT_NBR FROM ACCOUNT A
WHERE
A.CREATED_BY = 'sysadmin' AND A.ACCT_NBR = 'HQ254047434'
AND
NOT EXISTS (SELECT V.ACCT_NBR FROM ACCOUNT_SEGMENT V WHERE V.ACCT_NBR = 'HQ254047434')
))
OR
(NOT EXISTS (SELECT seg_id from settings3_segment where setting_id = 100474))
In the above scenario
ACCOUNT_SEGMENT have an index on ACCT_NBR & SEG_ID
ACCOUNT have an primary key on ACCT_NBR.
Any help will be greatly helpful to me.
Regards,
Sunil Kumar
July 23, 2009 at 2:21 am
Please don't cross post. It just wastes peoples time and fragments replies.
No replies to this thread please. Direct replies to: http://www.sqlservercentral.com/Forums/Topic758000-360-1.aspx
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply