chris
chris

Reputation: 121

How does SQL Server cache data I understand it reads data into pages saved in memory but what does it do when data in the underlying tables change?

How does SQL Server cache data? I understand it reads data into pages saved in memory but what does it do when data in the underlying tables change? How does it know not to use the data in the pages saved in memory?

Upvotes: 0

Views: 61

Answers (1)

Dan Guzman
Dan Guzman

Reputation: 46203

SQL Server reads pages into the buffer cache only if the page is not already in memory. Consequently, the cache always has the latest version of data where it is shared by all users. The in-memory data is always changed first and never updated directly on disk. Modified data pages are written to disk asynchronously. It is the transaction log guarantees durability of committed data so the physical data writes can be deferred.

I suggest you think of SQL Server as an in-memory database, that uses disk to guarantee durability.

Upvotes: 2

Related Questions