03-21-2005, 12:25 PM | #1 (permalink) |
Insane
Location: Michigan
|
[.NET] DataReader, DataAdapter.Fill() performance question
Ok, so I am trying to figure out if DataAdapter.Fill() is efficient.
SQL Server, itself, has no real paging ability. If you want to see the Nth set of 10 records, you have to do some funky sql to get the results you want. It's a bitch to do queries like this, because you have to exec(sqlstringhere). If you are trying to used stored procedures, it makes them 100% pointless as you are generating a new string each time the stored procedure is called. There are other methods, but they are complicated. The point in doing sql this way is to return ONLY the data you want to display and not the other 10,000 records that the query without paging returns. In the .NET framework, the DataAdapter.Fill() allows you to set a starting record, and how many records to return after the starting record. I know that the .Fill method uses a DataReader, but my question is this: Using .Fill(), will sql server return all 10,000 records, then doing its "limit" in the .NET framework. OR ONLY the count of recurds to return after the starting record? And if so, HOW is this done in sql server? What commands do you have to give sql server to do the paging (what does the DataReader do that is so special)? My problem with just using it and not knowing is, if you have your database server and web server seperate (any large project does), why transfer 10k records worth of data time after time when you are only going to display, say, 25 records?
__________________
Patterns have a habit of repeating themselves. |
03-21-2005, 04:00 PM | #2 (permalink) |
Psycho
Location: Floating amongst the ether
|
We've recently started a .Net project at work. Unless I'm mistaken, it only transfers your 10k records across the servers once, puts it into a DataSet, and manipulates it there. It's much more efficient than moving stuff all over the place multiple times. I'm no expert, but I think that's how it works.
__________________
We're here to steal your pornography, and sodomize our vast imaginations. - Inignot |
03-21-2005, 06:59 PM | #3 (permalink) | |
Insane
Location: Michigan
|
Quote:
If you are using asp.net, storing 10k records in a dataset (bound to a datagrid or something) is going to be a HUGE post back, thus making the end user wait for 10k records worth of viewstate back to the server. See why it doesn't make sense? There has to be something I am missing and in all my research I have not been able to find it . edit: It may be more efficient to hit the database once, but you take a huge hit on the client side. It needs to be balanced out. Thats my opinion anyways.
__________________
Patterns have a habit of repeating themselves. |
|
Tags |
dataadapterfill, datareader, net, performance, question |
|
|