3 ms·
I notice this is using data readers. I'm not an expert but I believe they keep the connection (and therefore any database locks) until you've finished processin
by d4nt 16y ago
I notice this is using data readers. I'm not an expert but I believe they keep the connection (and therefore any database locks) until you've finished processing and closed the reader. Given that it's for hydrating strongly typed collections into memory you aren't going to be ignoring any records. You might get even better throughput at the database (at the expense of memory usage in the app) by using datasets which will run the query, then close the connection, then return all the results to the app.
- mquander 16y agoI strongly disagree. If you use a DataAdapter to populate a dataset, all it's doing is iterating over a reader internally and loading the results into the dataset. There's no reason it would ever be as fast, let alone faster, than using a reader yourself to populate a data structure that you actually want.
- SigmundA 16y agoLocks really shouldn't be happening with a datareader on a modern database with MVCC isolation (SQL2005+ and Oracle, etc.) unless you have specifically lowered isolation.