Caching SQL Execution Plans

I know that SQL Server 2005 does some caching of the execution plan, but will that be enough to make the difference between the clocks between the same query that is executed twice? The first time it takes 3 hours the next time it takes 1 min? Is it possible?

+3
source share
4 answers

SQL Server will not just cache the execution plan as well as the data

if you do

SET STATISTICS IO ON

, , - , - . , ,

3 , - /, ..

+3

! !

!
, , ().

, ​​:

  • / /
  • ( SQL ..)

: 3 , 1 , , , .
, ...
, , (, update/insert/delete, , ), SELECT , ( /).

, :

  • () . , -, , 3 .
  • "" ( ) .

( SQL-Server):

dbcc freeproccache
go
dbcc dropcleanbuffers
go
0

, ( " " ) , , . , .

( "" ) , , , .

, 3 , , .

, (, - ).

0

. , , (, ), .

, : INSERT INTO Table (Field) VALUES (1). , , . 750 10%, 75 , SQL Server , 30 . .

The point here is not that during the execution you had or did not have a growth event. The fact is that if the request lasts 3 hours, you need to understand why. Activity Monitor is a great start. Reading white paper, such as "Waiting for Performance," would be even better.

0
source

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


All Articles