If the SqlDataAdapter uses an internal data reader, why do people say that using SqlDataReader is faster?

I continue to read that SqlDataReaders are much faster than SqlDataAdapters due to their fast-forward, read-only, one-line time-by-line, and that they are faster than SqlDataAdapters when populating a DataTable (SqlDataAdapter.Fill (DataTable)).

However, in some places, someone will mention: "It probably will not affect what you use, because the SqlDataAdapter internally uses a data reader to populate its table." If so, how exactly can the adapter be so slow if it interacts with the database at all using an internal data reader?

I know that I could tune some tests and monitor the performance of each of them, but I would really like someone to shed light on the alleged performance mismatches, if we are basically dealing with the same process anyway.

I understand that you usually use a reader to create a list of strongly typed POCOs, as opposed to a data adapter that simply populates a table. However, my question is strictly about the details of the performance difference between the two, not O / RM issues ...

+7
source share
1 answer

If you use DataReader, you can react to some information while reading the first line and even ignore the rest of the reading.

If you are using the DataAdapter, you first need to load the entire table and then read the first row in order to respond to the same information.

+5
source

All Articles