Solved

what constitutes a read?

Posted on 2012-04-03
7
220 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
  • 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Query to return total 6 21
sql 2014,  lock limit 5 37
any adverse effect when modifying data type on a busy table. 4 16
Substring works but need to tweak it 12 6
Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

809 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