Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

what constitutes a read?

Posted on 2012-04-03
7
Medium Priority
?
227 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 800 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 800 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 69

Assisted Solution

by:Scott Pletcher
Scott Pletcher earned 800 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 400 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 800 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

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

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

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

730 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