SQL Server 2008 Query is Slow but Fast-Paced

I have a query that works after about 2-4 minutes on release, but runs after a couple of seconds on development. Both of these databases are on the same server. (there are no lectures on the developer and production, production is really still in development).

I mean, I can just open two query windows and get two different results in sequence. I launched RedGate SQLCompare and there is no difference in the schemes (indexes, etc.). I disabled the site that connects to the database, so there should be no connections except my Management Studio session.

What could be the reason for this? I create a development database by copying the production (in Studio Management, right-click the database and click "Copy Database")

This is really weird. I do not want to make any index changes, because it is strange that the copy is growing rapidly, but the production is very, very slow, but there must be essentially exact copies.

+3
source share
6 answers

I do not know the SQLServer specifications, but, as a rule, this is due to the fact that the two databases have different tables. Look at query plans to see if they are different. Run the SQLServer version of the "analyze table" or "analyze schema" commands.

, , . , , , , , ?

- , - , " " ?

+7

- SQL-, , , , .

+1

, . , . , Copy Database . DBCC DBREINDEX , . !

+1

, ( ), . . , , , . , , , , . , , , , , .

+1

SQL, , .

0
source

The red gate by default ignores statistics and things like fill factor.

0
source

Source: https://habr.com/ru/post/1706158/


All Articles