SQL Network DataReader Restriction

I have such an idea (I don’t know whether it’s good or bad). I have a utility that connects using reglament to a SQL server and extracts some data into the application. The data is simple (2 attributes of varchar text), but the amount of data is ~ 3 million rows. So, my application uses the network very intensively. Can I programmatically reduce (restriction, throttling, etc.) using SQL network bandwidth DataReader? Let it work more slowly, but not stress either from the server or from the client. Is that a good idea? If not, what should I do?

Here is the code for now:

using (SqlConnection con = new SqlConnection("My connection string here"))
{
    con.Open();
    using (SqlCommand command = new SqlCommand(query, con))
    {                        
        using (SqlDataReader reader = command.ExecuteReader())
        {
            while (reader.Read())
            {
                yield return new MyDBObject()
                {                               
                    Date = (DateTime)reader["close_date"],                                
                    JsonResult = (string)reader["json_result"]
                };
            }
        }
    }
}
+4
source share
1 answer

, , , - "" , , . - , 100k. OFFSET/FETCH SQL Server.

+4

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


All Articles