higher reads when using ADO.NET thatn when using Query Analyzer

B

Buddy Ackerman

I was doing some testing and noticed that when I execute a stored procedure from
my ADO.NET (using the Command class of the System.Data.SQLClient namespace) the
number of reads on a relatively simple query were significantly higher. As a
matter of fact I have not found a case where the reads when executed from
ADO.NET are lower than the reads when executing in QA. Sometimes they may be
the same but QA is always has equal or fewer reads. Any reason why this is and
is there any thing I can do to get ADO.NET to perform like QA?


--Buddy
 
W

W.G. Ryan eMVP

You can't compare them. When you call while(dr.Read()){

}
you'll read through the whole buffer. When you look at it through QA, you
only get a subset.

Use a dataset, wait till all the data is all done being pulled over. Then
check the reads. It will be 0 with ADO.NET
 
P

Pablo Castro [MS]

QA and SqlClient have different defaults for the "SET" options for the
session. Some of them might be causing your query plans to be different.
SqlClient will not add any SET options at all - other data-access drivers
such as OLEDB and ODBC used do add some. In the case of SqlClient we chose
to do no magic, and sometimes this means that you may need to add a SET or
two manually.

--
Pablo Castro
Program Manager - ADO.NET Team
Microsoft Corp.

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top