.NET Start reading with DataReader before completing the query?

I am currently working on a program that converts an old database to a newer style, and one of the tasks I have assigned is to remove the old binary columns and convert them to documents in our repository.

We have about 1.1 million rows in the table, and my process takes about 12 hours.

I'm looking for ways to make it all faster, and one thing I'm looking at is handling data faster. If there is a way to get the results of my query before it is completed? I noticed that when I run the “select *” statement in this table in Query Analyzer, I immediately return the results, but when I use ExecuteReader in .NET, the query seems to take about 30 minutes before I start reading the lines.

+3
source share
2 answers

It may help to use command.ExecuteReader(CommandBehavior.SequentialAccess). However, this requires that you read the columns in order and require that you read binary values ​​differently. I recommend reading the SequentialAccess documentation so that you know what other changes to your code might be required.

, Query Analyzer. , 30 , Query Analyzer. , . , EXCEPT , , ExecuteReader. , , SequentialAccess . , SequentialAccess.

+1

- select *, . , :

0

Source: https://habr.com/ru/post/1785089/


All Articles