I/O vs Logical I/O

Leave a comment

September 5, 2018 by Kenneth Fisher

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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 2,469 other followers

Follow me on Twitter

ToadWorld Pro of the Month November 2013
%d bloggers like this: