Which is faster? Single Row Vs Output Parameters?

U

Utter Newbie

I was just wondering which would be faster. Retrieving a single row
using a stored procedure and a sqldatareader or sending back output
parameter values using executenonquery?
 
U

Utter Newbie

Thanks for the quick response!

I have not actually timed it, but it is generally accepted that the stored
procedure output parameters will use fewer resources on the client and
server, and will be faster.

Regards,

NeilM
 
W

William Ryan

I'm with Neil on this one. It's difficult (really
difficult) to determine which is faster b/c query speeds
are dependent on many factors like the load on the
client, the load on the server and bandwidth. So doing
apples to apples comparisons is hard to really accomplish
unless you can isolate all the extra factors.

However, Output parameters only return the value you are
interested in. You don't have to push back the whole
record. Either way the DB has to run the query, so as
fara s the DB is concerned, the difference is
inconsequential.

However, that's why output params are faster then full
rows b/c you don't have to push all that data back over
the network. Of course, it depends on your table
size....if you had a 2 column table with Int datatypes
for instance, that is indexed, the difference won't
probably be noticeable unless you have many users on the
network. On the other hand, one big BLOB field and you'd
probably notice the difference.

Good Luck,

Bill

W.G. Ryan
(e-mail address removed)
www.knowdotnet.com
 

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