2

I have a large table, about 750M rows.

I have an application using Entity Framework to load and parse data, a query that returns 2 million rows takes 4 seconds.

The same exact query takes 8 seconds using SQL Server Management Studio.

I noticed this happens with other queries (that all returns large data sets). Both of the connection are using TCP/IP.

When including client statistics, I see this line (no idea what it means):

Client processing time 2539 2539.0000

Why would a SSMS query be slower ?

2 Answers 2

11

Client processing time is the amount of time spent in milliseconds between the first received response packet and the last received response packet by the client.

When you run the query in SSMS it render the data row by row to the GUI. Your application doesn't do that.

Setting the SSMS option to Discard results after execution will eliminate the time spent rendering the results to the grid, which should give you a comparable execution time:

Query options dialogue

3

SSMS renders the data retrieved from your query into a grid and fetches some metadata about the query (rows affected, duration, etc.). Those features and the rendering of the datagrid may cause a query to end slower in SSMS than directly from the .Net code which doesn't have a rendering part and only retrieves a Datatable/Dataset.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.