locked
Classic ADO.NET SqlDataReader creation and starting read time RRS feed

  • Question

  • User-1350516731 posted

    Hello!

    Can you provide to me details about time of SqlDataReader creation and how to decrease it?

    Thank you.

    Thursday, March 17, 2016 2:41 PM

Answers

  • User753101303 posted

    Hi,

    First we would need details on what happens and what you are doing. I suspect you see a delay on a SqlCommand.ExecuteReader method which IMO would point to a SQL query that is slow to run causing a delay before returning the first row? Is this is what you see?

    If confirmed double check the query and in particular that proper indexes are used etc... If rather on readiing, make sure to retrieve only the rows/columns you need and not more (ie a blob column or thousands of rows to just show the first few dozens).

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 17, 2016 2:59 PM

All replies

  • User753101303 posted

    Hi,

    First we would need details on what happens and what you are doing. I suspect you see a delay on a SqlCommand.ExecuteReader method which IMO would point to a SQL query that is slow to run causing a delay before returning the first row? Is this is what you see?

    If confirmed double check the query and in particular that proper indexes are used etc... If rather on readiing, make sure to retrieve only the rows/columns you need and not more (ie a blob column or thousands of rows to just show the first few dozens).

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 17, 2016 2:59 PM
  • User-2057865890 posted

    Hi Alex9,

    Asp.net provides a simple way to reduce the over head by connecting to database at a minimum level by writing all the select queries in one string and connect to database through DataReader only once. This is possible by calling DataReader's NextResult() method. So instead of writing many Select statements and many DataReader inside a single page, we can write in the above ways.

    Few Tips to Increase the performance in Asp.net Applications

    Best Regards,

    Chris Zhao

    Friday, March 25, 2016 9:53 AM