Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Query runs very slowly only in particular database while its ok in other databases

$
0
0

Dear All,

I have this strange issue with one of the queries in one particular database. First to put some light on the background I will describe in short the configuration:

1. Microsoft SQL Server 2008 (SP3) - 10.0.5512.0 (X64)   Aug 22 2012 19:25:47   Copyright (c) 1988-2008 Microsoft Corporation  Standard Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) (VM)

2. couple customer databases with exact the same tables/views/sp's each

The problem: in one database the query completes to run within 1 minute while it takes only 1 second to complete the same query in all other databases.

I have detached the db and copied mdf and ldf files to my local developement machine with the same SQL Server version installed (Microsoft SQL Server 2008 (RTM) - 10.0.1600.22 (X64)   Jul  9 2008 14:17:44   Copyright (c) 1988-2008 Microsoft Corporation  Standard Edition (64-bit) on Windows NT 6.1 <X64> (Build 7600: )) and attached it to run some tests. When I attempt to run this query to see what is the dalay I found that it started to work normally i.e. completion takes 1 second. That's surprising to me what can be the reason of this?

When I copied back the db files to the source machine it takes 1 minute to complete the query again. Any ideas how to find out the root cause of this?

Thanks in advance for your help!


Dzordz



Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>