Sunday, 13 October 2024

Logical read in SQL server

 Number of pages read from data cache (memory) rather than directly from disk. It occurs when SQL Server data that has already been loaded into memory (buffer pool). A Logical read is counted each time SQL Server retrieve 8kb pages from memory, regardless of whether it was read from disk or already present in buffer cache. Buffer cache is nothing but the memory area where SQL Server store data pages to minimize the disk I/O.


 


 To see the Logical read we need to SET STATISTICS IO ON command. This will return the information like number of Logical read, physical read and other I/O statistics for the query.

This help us to identify if SQL server is effectively using the buffer pool and how much of the data is already cached in memory.

SET STATISTICS  IO ON

select id,firstname,lastname,placeofbirth from employee

 

See the IO information.

It show number of logical read happen to provide the result of the select statement.

Popular Posts