Sorts of all Kinds? Efficiency Question

F

Fred Block

Hi All,

I have a DataView being created using data from a stored procedure. The SP
itself is sorting the data in the SELECT statement being used.

A SqlDataAdapter is used to fill a table and then the DataView is created
and there is a "Sort" parameter available. Should this "Sort" parameter be
used or is the data brought in sorted as was defined in the stored
procedure?

I really need this to be as fast as possible and being new to ADO.NET, do
not want any mistakes or inefficiencies.

Thanks in advance!

Kind regards - Fred
 
S

sloan

I have moved away from sorting in the db to sorting in my BAL.

Why? Based on stress testing, my applications bottleneck is the database.
I have 600-1000 users hitting it (POUNDING IT) during an 8 hour shift.

Its a judgment call. If you want to minimize the work the database does,
dont' sort it there.
If your webserver(s) are being taxed, then do the opposite.

Keep in mind its easy to scale more webservers than it is your database
server.




Here is some light reading. Opinions on the subject VARY alot.
http://www.codeproject.com/KB/architecture/DudeWheresMyBusinessLogic.aspx
 
K

Kenny

If you're using a sorted DataView ... I can't see any benefit to sorting the
record set on the server.

Here's what I do:

1. If I need to seek many times into the same table and the table is small
enough to load into memory ... I do that with a DataView. Let the DataView
worry about the order/sort.

2. If I'm simply doing reporting and do not plan on keeping the data around
I'd suggest using a DataReader and letting the server perform the ORDER BY.
 
W

William Vaughn \(MVP\)

On #2: Consider that the Report Processor can do the sorting for you (on the
client if you use the ReportViewer control).

--
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker’s Guide to Visual Studio and SQL Server (7th Edition)
http://betav.com/blog/billva
http://betav.com
____________________________________________________________________________________________
 
C

Cor Ligthert[MVP]

Fred,

As you do it, it is for sure in most situations inefficiency

However, there are situations where it is very efficient

Therefore as you only tell the technique you use but not the goal an answer
is hard to give.

Cor
 

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