Caching in SQL Server | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Caching in SQL Server

Will Sql Server Cache the results of formulas, sprocs, and udfs in a query so that if you reference the result in another column it does not need to re run a potentialy expensive operation. EX: Select
,myFunction()
,myFunction()*100 –is this rerun or taken from cache???
SQL Server cache contains recently used and optimized execution plans and data/index pages (pinned or unpinned). Your function will be executed as many times as required using the plan and any necessary data/index pages. Nathan H.O.
Moderator
SQL-Server-Performance.com
I agree with Nathan. SQL Server will not cache the resuts of query / caclulations. But it will cache the execution plans and the data pages. (Until they are flushed out of memory ) Gaurav
Moderator
Man thrives, oddly enough, only in the presence of a challenging environment- L. Ron Hubbard

]]>