Introduction to SQL Server Memory Management, especially concepts related to Caching in SQL Server. Explained in really simple way, that even a layman can understand! Dedicated to the SQL Server DBA ! :)
For queries, comments and if you need slides on some specific topic in SQL Server, write to us at info@ikosmik.com ! Keep watching our space for more slides on SQL Server!
12. HOW DOES IT OPERATE?
BUFFER CACHE /
POOL
DISK
Page is read into pool when needed
?
www.sqlserverapp.com
13. HOW MUCH MEMORY IS
USED BY THE BUFFER
CACHE?
www.sqlserverapp.com
14. It makes sense to understand SQL
Server's memory usage first
www.sqlserverapp.com
15. HOW DOES SQL SERVER USE
SYSTEM MEMORY?
SQL Server
reserves some
memory from the
system for its
potential usage
TARGET MEMORY
SQL Server uses
only what it
actually needs at
that point in time
COMMITTED MEMORY
www.sqlserverapp.com
16. QUERYING FOR IT!
SELECT
counter_name AS "STATISTIC NAME",
(cntr_value/ (1024)) AS "MEMORY VALUE (MB)"
FROM
sys.dm_os_performance_counters
WHERE
counter_name
IN ('Total Server Memory (KB)', 'Target Server Memory (KB)')
www.sqlserverapp.com
17. or you could also try this
query!
SELECT
committed_kb / (1024),
committed_target_kb / (1024*1024)
FROM
sys.dm_os_sys_info
www.sqlserverapp.com
18. HOW DOES SQL SERVER USE
SYSTEM MEMORY?
TARGET
MEMORY
COMMITTED
MEMORY
Ramp Up
www.sqlserverapp.com
20. Information about the pages in the
Buffer Pool
sys.dm_os_buffer_descriptors
www.sqlserverapp.com
21. ALLOCATION UNIT
Some concepts related to
sys.dm_os_buffer_descriptors explained
Types/Categories of data stored in pages
3 TYPES
IN_ROW_DATA
ROW_OVERFLOW_DAT
A
LOB_DATA
Data in the row
When data exceeds
8060 bytes
To store LOB data
type
www.sqlserverapp.com
22. SELECT
COUNT(*) AS number_of_pages_cached,
((COUNT(*) * 8.0) / 1024) AS
cache_usage_in_mb,
CASE
database_id
WHEN 32767
THEN 'ResourceDb'
ELSE DB_NAME(database_id)
END AS Database_name
FROM sys.dm_os_buffer_descriptors
GROUP BY DB_NAME(database_id) , database_id
ORDER BY cached_pages_count DESC;
Keeping track of pages in the Buffer Pool
www.sqlserverapp.com
23. TORN PAGE
PROTECTION
Data Integrity Protection Mechanisms
CHECKSUM
PROTECTION
2 bits to validate data
integrity
If power failure during
disk write corrupts data,
this may not protect the
integrity always.
But this method is less
resource-intensive
Calculates checksum based
on whole data
Costlier, i.e. more resource
intensive
Is a more reliable way to
catch data integrity issues
www.sqlserverapp.com
24. Hope you enjoyed the slides!
Write your queries, suggestions or if you
need tutorial on any specific topic
to
info@ikosmik.com
www.sqlserverapp.com