Solved

what constitutes a read?

Posted on 2012-04-03
7
224 Views
Last Modified: 2012-04-06
is one select statement = one read
(referring to
sys.dm_io_virtual_file_stats.num_of_reads)
0
Comment
Question by:25112
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 23

Assisted Solution

by:wdosanjos
wdosanjos earned 200 total points
ID: 37801948
No, num_of_reads refers to the number of read operations on the DB data/log file.  A single SELECT statement can trigger multiple read operations and potentially hit multiple DB files.
0
 
LVL 5

Author Comment

by:25112
ID: 37802555
>>A single SELECT statement can trigger multiple
can you give an example of the above?

SELECT * FROM PROGRESS_CARD

will the above always be one read regardless of how many records are returned.?
0
 
LVL 23

Assisted Solution

by:wdosanjos
wdosanjos earned 200 total points
ID: 37802623
It depends how big PROGRESS_CARD is.  If it's a large table it will be spread across multiple blocks on disk, so it will require multiple reads.
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
LVL 69

Assisted Solution

by:Scott Pletcher
Scott Pletcher earned 200 total points
ID: 37803432
Books Online describes that column this way:

"Number of reads issued on the file."

According to blogs I've read by SQL folks, the counts of reads and writes are PHYSICAL actions, not logical ones.  That is, an actual request to the disk I/O subsystem to read a block(s).  [Reads are typically 64K, whereas writes are 12K.]

So, one SELECT would typically take multiple reads.  But it could take none, if the entire table were already in buffers.
0
 
LVL 5

Author Comment

by:25112
ID: 37804208
is there a way to test how many reads a select statement takes..

sys.dm_io_virtual_file_stats shows it for all the transactions going on.. how about just a single statement like...
SELECT * FROM PROGRESS_CARD
0
 
LVL 19

Accepted Solution

by:
Rimvis earned 100 total points
ID: 37804738
Hello 25112,

Try this:
SET STATISTICS IO ON
SELECT * FROM PROGRESS_CARD

Open in new window


Check Messages tab in SSMS after select completes
0
 
LVL 69

Assisted Solution

by:Scott Pletcher
Scott Pletcher earned 200 total points
ID: 37806469
Yep, that will do it.

If you can stop other activity, then of course you could capture sys.dm_io_virtual_file_stats before and after the SELECT statement and compare them too.

Note that earlier activity on the table CAN affect the results you get.  If the table was read earlier and is still in the buffers, you will see much less reads than you would if the table was not already in the buffers.  

That is, anything that was already read is "saved", so it won't count against you when you re-read it.  But later SQL might have "forgotten" what was read earlier from your table, and have to read the whole table again, thus showing more reads the second time.

On a test/qa system, you could flush the buffers and make sure you counted every read, but that can hurt performance, so it's best not to do it on a prod system.
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
converting integer data type to time data type in sql 4 60
Update one rows based on previous row 5 36
SQL- GROUP BY 4 53
Enabling flash installation using GPO 2 55
There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question