Does SQL Server CACHES Query Results? -
this question has answer here:
- sql server cache question 5 answers
when run query sql server caches results?
because: when run below query:
select id foo foo.name '%bar%'
the query runs 40 seconds on 1st time.
but on second run takes only few seconds.
is because execution plan somehow cached or data cached can retrieve faster on 2nd run?
sql server not cache query results, caches data pages reads in memory. data these pages used produce query result.
you can see if data read memory or disk setting
set statistics io on
which returns following information on execution of query
table 'productcosthistory'. scan count 1, logical reads 5, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
the difference between logical , physical reads data read memory.
sql server claim memory caching until maximum (configured, or physical maximum) reached , oldest pages flushed.
Comments
Post a Comment