SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

I/O vs Logical I/O

tl;dr; While the difference is very important 90% of the time you won’t care and should just add the two numbers together.

I/O and Logical I/O are two pieces of information you will see all over the place.

 
Just to name a few.

There is an important difference between the two. Physical reads/IO are page reads from the disk. Logical reads/IO are pages read from memory. So why do we care? Reading from the disk is massively slower than reading from memory.

Side note: Simplifying dramatically, data gets stored in memory when it is read from disk to satisfy a query. It remains in memory until it is pushed out as new data needs to be moved to memory. Data that gets referenced more often is less likely to get pushed out of memory.

Now, realistically, pages are always going to have to be read from disk, at least initially and if you have a reasonable amount of memory then once the data is loaded to memory it should stay there for a while. (See page life expectancy.) So I ask again, why do we care? Honestly, most of the time I don’t. I add the two numbers together and that tells me how many pages the query is having to read. Hopefully, the vast majority are from memory (logical) but that will change depending on a ton of factors, not the least of which is Is this the first time in the recent past that the query has been run; or the second; or the twenty-second? We have absolutely no control over factors like that, so when tuning, or whatever, pay attention to the total, not the individual numbers.

That said, there are times when you care about them separately, but honestly, I couldn’t tell you what they are off the top of my head.

SQLStudies

My name is Kenneth Fisher and I am Senior DBA for a large (multi-national) insurance company. I have been working with databases for over 20 years starting with Clarion and Foxpro. I’ve been working with SQL Server for 12 years but have only really started “studying” the subject for the last 3. I don’t have any real "specialities" but I enjoy trouble shooting and teaching. Thus far I’ve earned by MCITP Database Administrator 2008, MCTS Database Administrator 2005, and MCTS Database Developer 2008. I’m currently studying for my MCITP Database Developer 2008 and should start in on the 2012 exams next year. My blog is at www.sqlstudies.com.

Comments

Leave a comment on the original post [sqlstudies.com, opens in a new window]

Loading comments...